Connecting Tech Pros Worldwide Help | Site Map

invalidation of iterators on deque

  #1  
Old June 27th, 2008, 05:43 PM
subramanian100in@yahoo.com, India
Guest
 
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.

Thanks
V.Subramanian
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
invalidation of iterators on deque<T>:insert() subramanian100in@yahoo.com, India answers 2 September 30th, 2008 12:15 PM
will std::deque not reallocate? Gernot Frisch answers 8 December 8th, 2006 10:05 AM
should we prefer deque over vector yancheng.cheok@gmail.com answers 5 September 14th, 2006 02:15 PM
Implementing deque with a couple of vectors? chris answers 19 July 22nd, 2005 09:56 PM