I\'m bit confused regarding iterator invalidation in deque. (In the context of this question)
Following is the excerpts from -- The C++ Standard Library: A Tutorial
The SGI implementation probably uses a growable array, so if an insert causes the array to grow, the iterators pointing to the old array are invalid.
EDIT:
Looking in section 17.2.3 of The C++ Programming Language Third Edition, I don't see anything in the description of deque that indicates what operations preserve or invalidate iterators. I may be looking in the wrong spot or the behavior may be undefined.