Afficher un message
Vieux 06/02/2008, 09h42   #1
subramanian100in@yahoo.com, India
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut sequential container insert() function

Suppose I have a vector<T> or deque<T> for some type T.
Suppose vector<T>::iterator iter is an iterator.

Then consider the operation
vector<T>::iterator nit = container.insert(iter, T());

After the insertion, iter will be invalidated for both vector<T>,
deque<T>.

However for list<T>, the same operation under g++ 3.4.3, does not seem
to invalidate iter. From this, can it be concluded that list<T> does
not invalidate iterators after insert operation ? What does the
standard say regarding this ?

Kindly clarify.

Thanks
V.Subramanian
  Réponse avec citation
 
Page generated in 0,04347 seconds with 9 queries