int main() { vector<int> test; //插入 test.push_back(0); test.insert(test.begin(),1);//在迭代器之前插入 test.insert(test.end(), 3, 2); //遍历 for (auto i : test) cout << i << " "; cout << endl; //删除 test.erase(test.end()-1, test.end()); //查找 if (find(test.begin(), test.end(), 1) != test.end()) cout << "find it" << endl; //排序 sort(test.begin(), test.end()); //去重 test.erase(unique(test.begin(), test.end()), test.end()); // test.reserve(10); test.resize(7); return 0; }