#include <iostream>
#include <deque>
#include <iterator>
#include <algorithm>
using namespace std;
int main ()
{
deque<int> d(10);
deque<int>::iterator It;
for ( int i=0; i<10; i++ )
d[i] = i+1;
copy(d.begin(),d.end(),
ostream_iterator<int>(cout," "));
cout << endl;
It = d.begin()+2;
cout<<*It<<endl;
// remove third element
d.erase(It);
copy(d.begin(),d.end(),
ostream_iterator<int>(cout," "));
cout << endl;
It = d.begin();
// remove 2 elements from beginning fo d
d.erase(It,It+2);
copy(d.begin(),d.end(),
ostream_iterator<int>(cout," "));
cout << endl;
getchar();
return 0;
}