1// Deletes the second element (vec[1])
2vec.erase(vec.begin() + 1);
3
4// Deletes the second through third elements (vec[1], vec[2])
5vec.erase(vec.begin() + 1, vec.begin() + 3);
1#include <algorithm>
2#include <vector>
3
4// using the erase-remove idiom
5
6std::vector<int> vec {2, 4, 6, 8};
7int value = 8 // value to be removed
8vec.erase(std::remove(vec.begin(), vec.end(), value), vec.end());
1vector.erase(position) // remove certain position
2// or
3vector.erase(left,right) // remove positions within range
4