Erase without invalidating iterator

However, as iterators are based on counting, they are all invalidated by addition. Only the iterators and references to the erased element is invalidated Reason: As per addition.

Only iterators and references to the erased elements are invalidated.

This is an experiment to test the difference between C iterator of STL vector and list affected by erase operation and list performs like real linked list.

It is inappropriate to cite this document as other than work in progress.The working group maintains a list of all bug reports that the editors have not yet tried to address; there are also open bugs in the previous bug tracker.The container is extended by inserting new elements before the element at the specified position.The arguments determine how many elements are inserted and to which values they are initialized: are inserted at position (in the same order).Notice that the range includes all the elements between first and last, including the element pointed by first but not the one pointed by last.If you need to worry about iterator invalidation it may be that you should be using an existing algorithm so that you do not need to modify the container’s contents directly.

You must have an account to comment. Please register or login here!