#include <iostream> #include <vector> using namespace std; int main() { vector <int> v; vector <int> ::iterator it = v.begin(); for(int i = 0; i < 10; i++) { v.push_back(i); } for(it=v.begin(); it != v.end();it++) { cout << *it << endl; } /* v.erase(v.begin(),v.begin()+2); v.erase(v.begin());//删除元素 v.insert(v.begin(),11); v.insert(it,11); v.clear(); for(int i = 0; i < 10; i++) { cout << v[i] << endl; } */ return 0; }
来源:https://www.cnblogs.com/jxust-jiege666/p/6534682.html