fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. vector<int> v{1,2,3,4,5,6};
  9. v.erase(remove_if(v.begin(), v.end(), [] (const int n){return n % 2 == 0;}), v.end());
  10. for (int i = 0 ; i != v.size() ; i++) {
  11. cout << v[i] << endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
1
3
5