Member type value_type is the type of the elements in the container (defined as an alias of the first class template parameter, T).
Member types reference and const_reference are aliases of the underlying container's types with the same name.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// queue::front
#include <iostream> // std::cout
#include <queue> // std::queue
int main ()
{
std::queue<int> myqueue;
myqueue.push(77);
myqueue.push(16);
myqueue.front() -= myqueue.back(); // 77-16=61
std::cout << "myqueue.front() is now " << myqueue.front() << '\n';
return 0;
}
Output:
myqueue.front() is now 61
Complexity
Constant (calling front on the underlying container).
Data races
The container is accessed (neither the const nor the non-const versions modify the container).
The reference returned can be used to access or modify the next element.
Exception safety
Provides the same level of guarantees as the operation performed on the container (no-throw guarantee for standard non-empty containers).