Double ended queue or Deque in CPP is used for insertion and deletion of data from both the front end and the back end of a queue.
Syntax:
deque <object_type> deque_name;
CPP Deque Functions
| FUNCTION | USES |
| at() | To access the element at position pos. |
| assign() | To assign new content to the deque, replacing the old one. |
| begin() | To return an iterator to the beginning of the deque. |
| back() | To access the last element. |
| cend() | To return a constant iterator to the end. |
| cbegin() | To return a constant iterator to the beginning of the deque. |
| clear() | To remove all the contents of the deque. |
| crbegin() | To return a const reverse iterator to the beginning. |
| crend() | To return a const reverse iterator to the end. |
| empty() | To determine whether the container is empty or not. |
| emplace_back() | To insert a new element at the end. |
| emplace_front() | To insert a new element at the beginning. |
| erase() | To delete the specified element. |
| end() | To return an iterator to the end. |
| emplace() | To insert a new element at a specified position. |
| front() | To access the first element. |
| insert() | To insert a new element just before the specified position. |
| max_size() | To determine the maximum size of the deque. |
| operator=() | To assign new values to the container. |
| operator[]() | To access a specified element. |
| push_back() | To add a new element at the end of the container. |
| push_front() | To add a new element at the start of the container. |
| pop_back() | To remove the last element from the deque. |
| pop_front() | To remove the first element from the deque. |
| rend() | To return a reverse iterator to the end. |
| rbegin() | To return a reverse iterator to the beginning. |
| resize() | To modify the size of the deque. |
| size() | To determine the number of elements in the deque. |
| shrink_to_fit() | To reduce the memory to fit the size of the deque. |
| swap() | To exchange the the contents of two deques. |