gcc 3.1 question

Ilan Finci ifinci@myrealbox.com
Tue Jun 4 04:12:00 GMT 2002


Hi,
I've got the following code, which used to compile with gcc 2.95.x and 
now fails with 3.1.

vector<OverlapHelper> overlapVector;

vector<OverlapHelper>::iterator ohiter = &overlapVector[n];

this line fails with the following error:

  conversion from `OverlapHelper*' to
    non-scalar type `__gnu_cxx::__normal_iterator<OverlapHelper*,
    std::vector<OverlapHelper, std::allocator<OverlapHelper> > >' requested

For some reason, the container iterator is no longer a pointer to the 
type stored in the container, but something more complicated. This 
prevent the above assignment and mixing types of container.

(for example, I have a vector of T, and a list of T*, I cannot push_back 
into the list an iterator of the vector).

Please reply to my address.

Thanks,
Ilan



More information about the Gcc mailing list