This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Strange error with list iterator
- To: libstdc++ at gcc dot gnu dot org
- Subject: Strange error with list iterator
- From: Giuseppe Martino <rdmartin at infinito dot it>
- Date: Sun, 4 Nov 2001 22:43:14 -0500
- Reply-To: rdmartin at infinito dot it
Compiling this sources:
#include <list>
#include <string>
#include <iostream>
using namespace std;
int main()
{
list<string> l;
l.push_back("ciao");
typedef std::list <string>::iterator it;
for(it i=l.begin(); i<l.end(); i++)
cout<<*i;
}
i have tried to compile it with gcc-3.0.0 and gcc-3.0.2 but it's the same
Compiling with the command:
g++ -ansi -pedantic -Wall -c show.cpp
show.cpp: In function `int main()':
show.cpp:12: no match for `int main()::it& < std::_List_iterator<std::string,
std::string&, std::string*>' operator
make: *** [show.o] Error 1
it's seem that l.begin() return a reference. what is the problem?
thank you