#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> l;
l.push_back(10);
l.push_back(20);
l.push_back(30);
l.push_back(40);
l.push_front(1);
l.push_front(2);
l.push_front(3);
l.push_front(4);
printList(l);
l.pop_back();
printList(l);
l.pop_front();
printList(l);
list<int>::iterator it = l.begin();
l.insert(++it, 1000);
printList(l);
it = l.begin();
l.erase(it);
printList(l);
l.push_back(10000);
printList(l);
l.remove(10000);
printList(l);
}
int main ()
{
test01();
return 0;
}