The following table shows the commonly used deque APIs:
|
API |
Description |
|
at ( int index ) |
This returns the value stored at the indexed position. It throws the std::out_of_range exception if the index is invalid. |
|
operator [ int index ] |
This returns the value stored at the indexed position. It is faster than at( int index ) since no bounds checking is performed by this function. |
|
front() |
This returns the first value stored in the deque. |
|
back() |
This returns the last value stored in the deque. |
|
empty() |
This returns true if the deque is empty and false, otherwise. |
|
size() |
This returns the number of values stored in the deque. |
|
capacity() |
This returns the total capacity of the deque, while size() returns the actual number of values stored in the deque. |
|
clear() |
This clears all the values. |
|
push_back<data_type>( value ) |
This adds a new value at the end of the deque. |