[#bsl-stack-05-top-06]
= xref:bsl.adoc[bsl]::xref:bsl/stack-05.adoc[stack]::top
:relfileprefix: ../../
:mrdocs:

`top` overloads

== Synopses

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

Return a reference to the element at the top of this stack&period; The behavior is undefined if this stack is empty&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
CONTAINER::reference
xref:bsl/stack-05/top-034.adoc[top]();
----

[.small]#xref:bsl/stack-05/top-034.adoc[_» more&period;&period;&period;_]#

Return a reference providing non&hyphen;modifiable access to the element at the top of this stack&period; The behavior is undefined if the stack is empty&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
CONTAINER::const&lowbar;reference
xref:bsl/stack-05/top-035.adoc[top]() const;
----

[.small]#xref:bsl/stack-05/top-035.adoc[_» more&period;&period;&period;_]#

== Return Value

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


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