The <deque> header file defines the deque class, which is a sequence container such that entries can be added or removed from the front or back efficiently. Unlike built-in arrays, deques grow or shrink to approximately the size of the number of elements in the deque. Additionally, the file defines six relational operators and a swap function that are friend functions of the deque class. In comparison to a vector, a deque is favored when entries must frequently be added and removed from both the front and back to the sequence. An array is favored over a deque for frequent random accesses. As the name suggests, a deque is primarily for creating queues.
The deque class is a template class that can be instantiated to create sequential containers. A deque is primarily used for creating a queue, which requires entries to be added and removed from the start and end of the sequence frequently. The parameter X specifies the type that the container holds. The parameter A specifies the allocator that is used to perform allocation in the deque and is typically left as the default value, allocator<X>.
Members© 20072024 XoaX.net LLC. All rights reserved.