[#bsl-optional-072-or_else-09]
= xref:bsl.adoc[bsl]::xref:bsl/optional-072.adoc[optional]::or&lowbar;else
:relfileprefix: ../../
:mrdocs:

Return this optional if engaged&semi; otherwise invoke `func`&period;

== Synopses

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

Return this optional if engaged&semi; otherwise invoke `func`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]
xref:bsl/optional-072/or_else-0b.adoc[or&lowbar;else](t&lowbar;FUNC&& func) const &amp;
requires conjunction&lowbar;v&lt;std&colon;&colon;is&lowbar;invocable&lt;t&lowbar;FUNC&gt;,
                              std&colon;&colon;is&lowbar;copy&lowbar;constructible&lt;t&lowbar;TYPE&gt;&gt;;
----

[.small]#xref:bsl/optional-072/or_else-0b.adoc[_» more&period;&period;&period;_]#

Return this optional if engaged&semi; otherwise invoke `func`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]
xref:bsl/optional-072/or_else-03.adoc[or&lowbar;else](t&lowbar;FUNC&& func) &amp;&amp;
requires conjunction&lowbar;v&lt;std&colon;&colon;is&lowbar;invocable&lt;t&lowbar;FUNC&gt;,
                              std&colon;&colon;is&lowbar;move&lowbar;constructible&lt;t&lowbar;TYPE&gt;&gt;;
----

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

== Return Value

this optional if engaged, otherwise the result of `func`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *func*
| callable invoked with the contained value or when empty
|===


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