English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C++ Deque (Double-Ended Queue)

Deque represents a deque. It generalizes the queue data structure, which allows insertion and deletion from both ends.

Syntax for creating a deque object:

deque<object_type> deque_name;

C ++Deque Functions

MethodDescription
assign()It allocates new content and replaces the old content.
emplace()It adds a new element at the specified position.
emplace_back()It adds a new element at the end.
emplace_front()It adds a new element at the beginning of the deque.
insert()It adds a new element before the specified position.
push_back()It adds a new element at the end of the container.
push_front()It adds a new element at the beginning of the container.
pop_back()It removes the last element from the deque.
pop_front()It removes the first element from the deque.
swap()It swaps the contents of two deques.
clear()It removes all content from the deque.
empty()It checks if the container is empty.
erase()It deletes elements.
max_size()It determines the maximum size of the deque.
resize()It changes the size of the deque.
shrink_to_fit()It reduces the memory to fit the size of the deque.
size()It returns the number of elements.
at()It accesses the element at position pos.
operator[]()It accesses the element at position pos.
operator=()It assigns new content to the container.
back()It accesses the last element.
begin()It returns an iterator to the beginning of the deque.
cbegin()It returns a constant iterator to the beginning of the deque.
end()It returns an iterator to the end.
cend()It returns a constant iterator to the end.
rbegin()It returns a reverse iterator to the beginning.
crbegin()It returns a constant reverse iterator to the beginning.
rend()It returns a reverse iterator to the end.
crend()It returns a constant reverse iterator to the end.
front()It accesses the last element.