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