fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. vector<float> X{1.f, 2.f, 3.f, 4.f, 5.f};
  7. cout << "before: "; for(auto f : X) { cout << f << " "; } cout << endl;
  8. X.erase(X.end()-3, X.end());
  9. cout << "after: "; for(auto f : X) { cout << f << " "; } cout << endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 4204KB
stdin
Standard input is empty
stdout
before: 1 2 3 4 5 
after: 1 2