The STL queue is a container adapter that represents a first-in, first-out (FIFO) queue. Only the oldest inserted element in the queue can be accessed.
queue is a container adapter, not a true STL container, and is implemented in terms of another linear container class like list or deque. To explicitly specify which container to use in the queue, parametrize the queue as queue<T, ContainerType<T> >. Note that you cannot build a queue around a vector, since vector does not have a pop_front member function.
Enqueues a new element into the queue.
Dequeues the first element of the queue. The behavior is undefined if the queue has no elements, so be sure not to pop off of an empty queue. Note that pop does not return a value; use front to get the value before popping.
Returns the first element of the queue (the one that will be removed by pop). The behavior is undefined if the queue has no elements, so be sure not to access the front element of an empty queue. The front function returns a reference to the front element of the queue, and you can modify the element if you so choose.
Returns the number of elements stored in the queue.
Returns whether the queue is empty. It's considered good practice to call empty to determine whether the queue is empty rather than checking whether size() returns zero.
queue around an existing container.Constructs a new queue whose contents are equal to those of the specified container. This constructor is rarely used, but is useful if you already have the data you want to use in the queue.
Returns the last element of the queue (the one most recently added). The behavior is undefined if the queue has no elements, so be sure not to access the back element of an empty queue. The back function returns a reference to the back element of the queue, and you can modify the element if you so choose.