[#bsl-priority_queue-034-top]
= xref:bsl.adoc[bsl]::xref:bsl/priority_queue-034.adoc[priority&lowbar;queue]::top
:relfileprefix: ../../
:mrdocs:

Return a reference to the highest&hyphen;priority element&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;priorityqueue&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/priority_queue-034/const_reference.adoc[priority&lowbar;queue&lt;VALUE, CONTAINER, COMPARATOR&gt;::const&lowbar;reference]
top() const;
----

== Description

Return a reference providing non&hyphen;modifiable access to the element having the highest priority in this `priority&lowbar;queue` object&period; In effect, performs `return c&period;front()`&period; The behavior is undefined if the priority queue is empty&period;

== Return Value

reference providing non&hyphen;modifiable access to the top element


[.small]#Created with https://www.mrdocs.com[MrDocs]#
