This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[OffTopic] Why does that doestn't works


Hi,

I have this code. It doesn't compiles with the "const", but without
the "const" it compiles.
Why?

Thanks.

#include <map>
using namespace std;

template<class Type>
void myOwnMap(map<int,int>& result, const map<int,Type>& desc ) {
   typename map<int,Type>::iterator p;
   p = desc.begin();
   for (int i=0; p!=desc.end(); i++, p++) {
      result[p->first] = i;
   }
}

struct t1 {};

int main() {
  map<int,int> result;
  map<int,t1> mystruct1;
  myOwnMap(result,mystruct1);
}

--
Javier Andrés Mena Zapata
University of  Valle
Cali - Colombia


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]