STL iterators in gcc 3.2

John Love-Jensen eljay@adobe.com
Fri Oct 25 08:42:00 GMT 2002


Hi Alberto,

> 1.- Whereas I didn't need it before, now I have to use the "using
> namespace std" directive if I want to use cout, cin,... and all this
> stuff. Why the change?

Compliance with ISO 14882 specification standard for C++.

> 2.- This is more serious. In my programs I use a lot of STL vectors, and
> so, iterators too. When I had a method with a pointer argument, I passed a
> random iterator to it. It worked fine with previous versions of gcc, but
> not with 3.2. Is there any way to get it work or do I have to come back to
> an older version?

An iterator is not, necessarily, a pointer.  It could be -- and often is --
a UDT.

Can you use template methods?  (Would that be Generic Programming, of a
sort?)

Do you have a toy example?

This...
void Foo(int* begin, int* end);
...is different from this...
void Foo(vector<int>::iterator begin, vector<int>::iterator end);

--Eljay



More information about the Gcc-help mailing list