Deque

The name deque means double-ended queue, which means that it can grow from both ends, and, although you can insert items in the middle, it is more expensive. As a queue, it means that the items are ordered, but, because the items can be put into the queue from either end, the order is not necessarily the same order in which you put items into the container.

The interface of deque is similar to a vector, so you have iterator access as well as random access using the at function and the [] operator. As with a vector, you can access items from the end of a deque container using the push_back, pop_back, and back methods, but, unlike a vector, you can also access the front of a deque container using the push_front, pop_front, and front

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.