S
subramanian100in
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
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