C语言STL标准模板库(list)
程序员文章站
2022-07-12 17:59:42
...
#include <list>
#include <iostream>
using namespace std;
int main()
{
list<int> mylist (8,1); //8个100
mylist.push_back (2); //表尾插入
list<int> :: iterator it = mylist.begin();
//删除元素
mylist.erase(it);
//遍历输出
for (it=mylist.begin(); it!=mylist.end(); ++it)
cout << " " << *it;
cout << endl;
return 0;
}