iterator erase(iterator it);
iterator erase(iterator first, iterator last);
The first member function removes the element of the controlled sequence pointed to by it
. The second member
function removes the elements of the controlled sequence in the range [first, last)
. Both return an iterator that
designates the first element remaining beyond any elements removed, or end
()
if no such element exists.
Removing N
elements causes N
destructor calls and an assignment for each of the elements between the insertion point
and the nearer end of the sequence. Removing an element at either end invalidates only iterators and references that
designate the erased elements. Otherwise, erasing an element invalidates all iterators and references.
See the related sample program.