Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library User's Guide

7.1 The deque Data Abstraction

The name deque is short for double-ended queue, and is pronounced like deck. Traditionally, the term is used to describe any data structure that permits both insertions and removals from either the front or the back of a collection. The deque container class permits this and much more. In fact, the capabilities of the deque data structure are almost a union of those provided by the vector and list classes.

Like a vector, the deque is an indexed collection. Values can be accessed by subscript, using the position within the collection as a key. This capability is not provided by the list class.

Like a list, however, values can be efficiently added either to the front or to the back of a deque. This capability is provided only in part by the vector class.

As with both the list and vector classes, insertions can be made into the middle of the sequence held by a deque. Such insertion operations are not as efficient as with a list, but slightly more efficient that they are in a vector.

In short, a deque can often be used in situations that require a vector and in situations that require a list. Often, using a deque in place of either a vector or a list results in faster programs. To determine which data structure should be used, you can refer to the set of questions described in Section 4.2

7.1.1 Include Files

The deque header file must appear in all programs that use the deque datatype:

Previous fileTop of DocumentContentsIndex pageNext file