[OffTopic] Why does that doestn't works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux