The deque bidirectional queue is a bidirectional open continuous linear space that can efficiently insert and delete elements at both ends of the head and tail. The deque interface is very similar to the vector. The deque implementation is complicated and a map is maintained internally (note! It is not a map container in STL, that is, a small contiguous space. Each element in the space is a pointer pointing to another (larger) area, which is called a buffer zone, the buffer is used to save data in deque. Therefore, deque is slower than vector in random access and data traversal.
The operations of deque are only different from those of vector in the following two ways:
1. deques does not provide capacity operations (capacity () and reserve ())
2. deque directly provides functions for inserting and deleting header elements (push_front () and pop_back ())
[STL Study Notes] deques