invalidation of iterators on deque

S

subramanian100in

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top