[#beman-optional-optional-03-or_else-01]
= xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]::or&lowbar;else
:relfileprefix: ../../../
:mrdocs:

Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not&period;

== Synopses

Declared in `&lt;beman&sol;optional&sol;optional&period;hpp&gt;`

Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class F&gt;
constexpr
xref:beman/optional/optional-03.adoc[optional&lt;T&gt;]
xref:beman/optional/optional-03/or_else-05.adoc[or&lowbar;else](F&& f) const &amp;;
----

[.small]#xref:beman/optional/optional-03/or_else-05.adoc[_» more&period;&period;&period;_]#

Returns an optional containing the stored value if it has one, or the result of applying `f` to the optional if it does not&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class F&gt;
constexpr
xref:beman/optional/optional-03.adoc[optional&lt;T&gt;]
xref:beman/optional/optional-03/or_else-04.adoc[or&lowbar;else](F&& f) &amp;&amp;;
----

[.small]#xref:beman/optional/optional-03/or_else-04.adoc[_» more&period;&period;&period;_]#

== Return Value

* optional
* optional&lt;T&gt;
* auto


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