void push_back(const T&) | Back Insertion Sequence | Inserts a new element at the end. |
void pop_front() | Front Insertion Sequence | Removes the first element. |
void pop_back() | Back Insertion Sequence | Removes the last element. |
void swap(deque&) | Container | Swaps the contents of two deques. |
iterator insert(iterator pos, const T& x) | Sequence | Inserts x before pos. |
template <class InputIterator> void insert(iterator pos, InputIterator f, InputIterator l) [4] | Sequence | Inserts the range [f, l) before pos. |
void insert(iterator pos, size_type n, const T& x) | Sequence | Inserts n copies of x before pos. |
iterator erase(iterator pos) | Sequence | Erases the element at position pos. |
iterator erase(iterator first, iterator last) | Sequence | Erases the range [first, last) |
void clear() | Sequence | Erases all of the elements. |
void resize(n, t = T()) | Sequence | Inserts or erases elements at the end such that the size becomes n. |
bool operator==(const deque&, const deque&) | Forward Container | Tests two deques for equality. This is a global function, not a member function. |
bool operator<(const deque&, const deque&) | Forward Container | Lexicographical comparison. This is a global function, not a member function. |
New members All of deque's members are defined in the Random access container, Front insertion sequence, and Back insertion sequence requirements. Deque does not introduce any new members.
Notes [1] The name deque is pronounced 'deck', and stands for 'double-ended queue.' Knuth (section 2.6) reports that the name was coined by E. J. Schweppe. See section 2.2.1 of Knuth for more information about deques. (D. E. Knuth, The Art of Computer Programming. Volume 1: Fundamental Algorithms, second edition. Addison-Wesley, 1973.)
[2] Inserting an element at the beginning or end of a deque takes amortized constant time. Inserting an element in the middle is linear in n, where n is the smaller of the number of elements from the insertion point to the beginning, and the number of elements from the insertion point to the end.
[3] The semantics of iterator invalidation for deque is as follows. Insert (including push_front and push_back) invalidates all iterators that refer to a deque. Erase in the middle of a deque invalidates all iterators that refer to the deque. Erase at the beginning or end of a deque (including pop_front and pop_back) invalidates an iterator only if it points to the erased element.
[4] This member function relies on member template functions, which at present (early 1998) are not supported by all compilers. If your compiler supports member templates, you can call this function with any type of input iterator. If your compiler does not yet support member templates, though, then the arguments must either be of type const value_type* or of type deque::const_iterator.
See also vector, list, slist