This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
[OffTopic] Why does that doestn't works
- From: Javier Mena <javimena at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 29 Nov 2005 19:51:07 -0500
- Subject: [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