On Sun, Mar 23, 2003 at 11:30:26PM +0100, Alfredo Braunstein wrote:
> Actually, Lars, I have a (general) question related to this. What
> assumptions can be done for old iterators after modifications on the
> container? Does this depend on the particular container (and/or
> implementation)

Yes. 

std::vector<> eg. invalidates almost everytime, whereas std::list<> rarely
does.

> For instance, I think that a list iterator is pretty 'stable', i.e. it will
> remain valid and pointing to the same element if I add or remove other
> elements on the list.
> OTOH, on a vector, this is not true (an iterator point to different
> --posible invalid-- elements after insert/removal of other elements)
> Is the stl explicit about this?

The stl is not the one to tell. It's the C++ Standard (ISO 14882/1998) and
it is very explicit about this kind of stuff.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to