不知道他这句话是C++标准如此,还是仅仅只是他自己写的VC STL库如此?我猜应该是后者。
不放心,还是去查一下吧,ISO/IEC 14882:2003(E) 第 480 页,关于 deque::erase 就只有如下这么多:
iterator erase(iterator position);
iterator erase(iterator first, iterator last);
4 Effects: An erase in the middle of the deque invalidates all the iterators and references to elements of the deque. An erase at either end of the deque invalidates only the iterators and the references to the erased elements.
5 Complexity: The number of calls to the destructor is the same as the number of elements erased, but the number of the calls to the assignment operator is at most equal to the minimum of the number of elements before the erased elements and the number of elements after the erased elements.
6 Throws: Nothing unless an exception is thrown by the copy constructor or assignment operator of T.