In c++ , what happens to the iterators when an element is added or deleted.
For example, vector is :{1,2,3,4,5,6} and suppose two iterators a and b point to element '2', and '5'. If I delete 3rd item i.e. delete '3', what will the iterators be pointing to ?
And if the iterator points to the last element, and that element gets deleted, will it cause error? I need to implement this code, where the elements are randomly deleted, i wanted to know the best /suitable data structure in which references doesn't change after the insertion ordeletion.