#include
#include
#include
int main ()
{
using namespace std;
deque dqIntegers;
dqIntegers.push_back (3);
dqIntegers.push_back (4);
dqIntegers.push_back (5);
dqIntegers.push_front (2);
dqIntegers.push_front (1);
dqIntegers.push_front (0);
for ( size_t nCount = 0; nCount < dqIntegers.size (); ++ nCount ){
cout << "Element [" << nCount << "] = ";
cout << dqIntegers [nCount] << endl;
}
// Erase an element at the top
dqIntegers.pop_front ();
// Erase an element at the bottom
dqIntegers.pop_back ();
deque ::iterator iElementLocator;
for ( iElementLocator = dqIntegers.begin (); iElementLocator != dqIntegers.end (); ++ iElementLocator )
{
size_t nOffset = distance (dqIntegers.begin (), iElementLocator);
cout<<"Element [" << nOffset << "] = " << *iElementLocator< }
return 0;
}