queues are a type of container adaptor, specifically designed to operate in a FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other.
queues are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container class as its underlying container, providing a specific set of member functions to access it elements. Elements are pushed into the "back" of the specific container and popped from its "front".
The underlying container may be one of the standard container class template or some other specifically designed container class. The only requirement is that it supports the following operations:
Therefore, the standard container class templates deque and list can be used. By default, if no container class is specified for a particular queue class, the standard container class template deque is used.
In their implementation in the C++ Standard Template Library, queues take two template parameters:
template < class T, class Container = deque<T> > class queue;
Where the template parameters have the following meanings:
In the reference for the queue member functions, these same names are assumed for the template parameters.
- T: Type of the elements.
- Container: Type of the underlying container object used to store and access the elements.
|empty|| Test whether container is empty (public member function)|
|size|| Return size (public member function)|
|front|| Access next element (public member function)|
|back|| Access last element (public member function)|
|push|| Insert element (public member function)|
|pop|| Delete next element (public member function)|