A deque is somewhat recursively defined: internally it maintains a double-ended queue of chunks of fixed size. Each chunk is a vector, and the queue (“map” in the graphic below) of chunks itself is also a vector.
There’s a great analysis of the performance characteristics and how it compares to the vector
over at CodeProject.
The GCC standard library implementation internally uses a T**
to represent the map. Each data block is a T*
which is allocated with some fixed size __deque_buf_size
(which depends on sizeof(T)
).