[#BloombergLP-bslstl-Optional_Base-05-value-07a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Optional_Base-05.adoc[Optional&lowbar;Base]::value
:relfileprefix: ../../../
:mrdocs:

`value` overloads

== Synopses

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

Return a reference providing modifiable access to the underlying `t&lowbar;TYPE` object if `true &equals;&equals; has&lowbar;value()` and throw `bsl&colon;&colon;bad&lowbar;optional&lowbar;access` otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
t&lowbar;TYPE&
xref:BloombergLP/bslstl/Optional_Base-05/value-0f.adoc[value]() &amp;;
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/value-0f.adoc[_» more&period;&period;&period;_]#

Return an rvalue reference to the contained value&semi; throws if disengaged&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
t&lowbar;TYPE&&
xref:BloombergLP/bslstl/Optional_Base-05/value-073.adoc[value]() &amp;&amp;;
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/value-073.adoc[_» more&period;&period;&period;_]#

Return a reference providing non&hyphen;modifiable access to the underlying `t&lowbar;TYPE` object if `true &equals;&equals; has&lowbar;value()` and throw `bsl&colon;&colon;bad&lowbar;optional&lowbar;access` otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
t&lowbar;TYPE const&
xref:BloombergLP/bslstl/Optional_Base-05/value-0d.adoc[value]() const &amp;;
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/value-0d.adoc[_» more&period;&period;&period;_]#

Return an rvalue reference to the underlying `t&lowbar;TYPE` object if &grave;true &equals;&equals; has&lowbar;value()` and throw `bsl&colon;&colon;bad&lowbar;optional&lowbar;access&grave; otherwise&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
t&lowbar;TYPE const&&
xref:BloombergLP/bslstl/Optional_Base-05/value-0c.adoc[value]() const &amp;&amp;;
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/value-0c.adoc[_» more&period;&period;&period;_]#

== Return Value

* reference providing modifiable access to the contained value
* rvalue reference providing modifiable access to the contained value
* reference providing non&hyphen;modifiable access to the contained value
* rvalue reference providing non&hyphen;modifiable access to the contained value


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