Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > invalidation of iterators on deque

Thread Tools

invalidation of iterators on deque, India
Posts: n/a
I am copying the following paragraph, as it is, from Stanley Lippman's
C++ Primer 4th edition, page 334.

It says:

"Inserting elements at the front or back of a deque does not
invalidate any iterators. Erasing the front or back element
invalidates only iterators referring to the elements(s) erased.
Inserting or erasing anywhere else in the deque invalidates all
iterators referring to elements of the deque".

I thought insertion or erasure of elements in a deque can potentially
invalidate all iterators into the deque irrespective of position(this
is what happens to vector I think). But the above paragraph says
something different.

Kindly clarify which is correct.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vector modifiers and invalidation of iterators, India C++ 8 07-27-2010 04:37 PM
invalidation of iterators on deque<T>:insert(), India C++ 2 09-30-2008 11:13 AM
question on invalidation of iterators on vector<T>, India C++ 1 08-19-2008 09:35 AM
std::list<>::splice invalidation of iterators Ben Pfaff C++ 2 02-01-2008 03:03 AM
Popping from the middle of a deque + deque rotation speed Russell Warren Python 5 05-02-2006 06:23 AM