#include<vector> #include<iostream> #include<algorithm> int main(int argc, char** argv) { using namespace std; int ret = 0; vector<int> theVector; theVector.push_back(2); theVector.push_back(1); vector<int>::iterator theEnd = remove(theVector.begin(), theVector.end(), 1); theVector.erase(theEnd, theVector.end()); for(int i = 0; i < theVector.size(); i++) { cout << theVector[i] << endl; } return ret; }