# include<iostream>
# include<list>
using namespace std;
void printList(const list<int>& L)
{
for (list<int>::const_iterator it = L.begin(); it != L.end(); it++)
{
cout << *it << " ";
}
cout << endl;
}
void test01()
{
list<int>L1; //默认构造
L1.push_back(10);
L1.push_back(20);
L1.push_back(30);
L1.push_front(40);
L1.push_front(50);
cout << "第一个元素:" << L1.front() << endl;
cout << "最后一个元素:" << L1.back() << endl;
//验证迭代器是不支持随机访问的
list<int>::iterator it = L1.begin();
it++;
it--;
//it = it+1; 不支持
}
int main()
{
test01();
system("pause");
return 0;
}