std::priority_queue::top - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::priority_queue::top

From cppreference.com
< cpp‎ | container‎ | priority queue

const_reference top() const; |  |

Returns reference to the top element in the priority queue. This element will be removed on a call to pop(). If default comparison function is used, the returned element is also the greatest among the elements in the queue.

### [edit] Parameters

(none)

### [edit] Return value

Reference to the top element as if obtained by a call to c.front()

### [edit] Complexity

Constant.

### [edit] See also

pop | removes the top element (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/container/priority_queue/top&oldid=60936"