This member function effectively calls the member function front of the underlying container object.
Parameters
noneReturn value
A reference to the top element in the priority_queue.Member type value_type is defined to the type of value contained by the underlying container, which shall be the same as the first template parameter (T).
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Output:
mypq.top() is now 20 |
Complexity
Constant.See also
| priority_queue::pop | Remove top element (public member function) |
| priority_queue::push | Insert element (public member function) |
