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());
1v.erase(std::remove_if(
2 v.begin(), v.end(),
3 [](const int& x) {
4 return x > 10; // put your condition here
5 }), v.end());
6// therefore elements > 10 are removed, leaving only elements<= 10