📜  C++ STL-Deque队列

📅  最后修改于: 2020-10-17 06:46:11             🧑  作者: Mango

C++双端队列

双端队列代表双端队列。它概括了队列数据结构,即可以从前端或后端的两端进行插入和删除。

创建双端队列对象的语法:

deque deque_name;

C++双端队列函数

Method Description
assign() It assigns new content and replacing the old one.
emplace() It adds a new element at a specified position.
emplace_back() It adds a new element at the end.
emplace_front() It adds a new element in the beginning of a deque.
insert() It adds a new element just 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 deletes the last element from the deque.
pop_front() It deletes the first element from the deque.
swap() It exchanges the contents of two deques.
clear() It removes all the contents of the deque.
empty() It checks whether the container is empty or not.
erase() It removes the 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 access the element at position pos.
operator[]() It access the element at position pos.
operator=() It assigns new contents to the container.
back() It access 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 access the last element.