Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. void eraseEvenVectorElements (std::vector<int>* v)
  2. {
  3. for(std::vector<int>::iterator it = v->begin(); it != v->end(); it++) {
  4. // be careful, at erasing "it" element, the vector is squeezed and "it" = (it+1),
  5. // so it should be incremented only once again
  6. v->erase(it);
  7. }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement