public member function
<queue>
std::queue::backvalue_type& back();const value_type& back() const;
reference& back();const_reference& back() const;
Access last element
Returns a reference to the last element in the queue. This is the "newest" element in the queue (i.e. the last element pushed into the queue).This member function effectively calls member back of the underlying container object.
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 containers's types with the same name.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// queue::back
#include <iostream> // std::cout
#include <queue> // std::queue
int main ()
{
std::queue<int> myqueue;
myqueue.push(12);
myqueue.push(75); // this is now the back
myqueue.back() -= myqueue.front();
std::cout << "myqueue.back() is now " << myqueue.back() << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4