Talk:cpp/container/deque/pop front
"All iterators and references are invalidated."
This is not true according to §23.3.3.4/4 in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf:
An erase operation that erases the last element of a deque invalidates only the past-the-end iterator and all iterators and references to the erased elements. An erase operation that erases the first element of a deque but not the last element invalidates only the erased elements. An erase operation that erases neither the first element nor the last element of a deque invalidates the past-the-end iterator and all iterators and references to all the elements of the deque.
In std::deque, removal of single elements at either end leaves references to all elements except the removed one valid.
Unfortunately, I weren't able to find the right place in this wiki template mess to change the description of iterator invalidations, that's why I couldn't change it directly. If you know where to change it, please do it. It would be nice if you notified me, so that I know how to perform such a modification in the future.
TheNexus 02:18, 24 December 2012 (PST)
In the example the increment should happen within the for loop and not on the first usage of the loop variable, sure this is valid syntax but not necessarily the easiest to digest, in particular as it is an example. But I'm afraid that I don't know how to do it as the page itself consists only of two macros instead of 'regular wiki markup'. Rob42 (talk) 07:55, 16 March 2022 (PDT)