The deque, or double-ended queue, is an array that’s constructed in the same way as a vector and uses many of its same functions and operators. The deque can determine the array’s size, resize it, and empty it. In addition, deque defines functions to obtain an indexed value—deque::at( int nIndex)—and offers the same front and back operators as a vector.
You can add to the deque at the front or back, as the name suggests. You can also remove from the front or back of the deque. Assume that have defined a deque as follows:
deque<char> my_string ( 10, '.' ) ; // a string of 10 x '.'
Given this new string definition, you can then use the push operations as follows:
my_string.push_front ( 'a' ); // add an 'a' to the front my_string.push_back ...