[#beman-optional-optional-03-or_else-01] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]::or_else :relfileprefix: ../../../ :mrdocs: `or_else` overloads == Synopses Declared in `<beman/optional/optional.hpp>` Returns an optional containing the contained value if it has one, or the result of applying `f` to the optional if it does not. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr xref:beman/optional/optional-03.adoc[optional<T>] xref:beman/optional/optional-03/or_else-05.adoc[or_else](F&& f) const & requires (std::invocable<F> && std::copy_constructible<T>); ---- [.small]#xref:beman/optional/optional-03/or_else-05.adoc[_» more..._]# Returns an optional containing the contained value if it has one, or the result of calling `f` if it does not. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr xref:beman/optional/optional-03.adoc[optional<T>] xref:beman/optional/optional-03/or_else-04.adoc[or_else](F&& f) && requires (std::invocable<F> && std::move_constructible<T>); ---- [.small]#xref:beman/optional/optional-03/or_else-04.adoc[_» more..._]# == Return Value * optional * optional<T> * auto == Template Parameters [cols="1,4"] |=== |Name|Description | *F* | An invocable type returning an optional. |=== == Parameters [cols="1,4"] |=== |Name|Description | *f* | The invocable to call if the optional is disengaged. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#