vector iterators

If I have a vector
 
vector<int> incoming;

and I create an iterator
 
vector<int>::iterator in_it;

and set
1
2
 
in_it = incoming.begin();

and then erase the first member of the vector
 
incoming.erase(incoming.begin());

will the iterator now be automatically adjusted to the next member of the vector?
no. Your iterator would become invalid.
However, this would do the job:

in_it=incoming.erase(incoming.begin());

See why here -> http://cplusplus.com/reference/stl/vector/erase/ (see 'Return value')

Topic archived. No new replies allowed.