[#beman-optional-optional-03-value_or-03] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]::value_or :relfileprefix: ../../../ :mrdocs: Returns the contained value if there is one, otherwise returns `u`. == Synopses Declared in `<beman/optional/optional.hpp>` Returns the contained value if there is one, otherwise returns `u`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr std::remove_cv_t<T> xref:beman/optional/optional-03/value_or-05.adoc[value_or](U&& u) const &; ---- [.small]#xref:beman/optional/optional-03/value_or-05.adoc[_» more..._]# Returns the contained value if there is one, otherwise returns `u`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U = std::remove_cv_t<T>> constexpr std::remove_cv_t<T> xref:beman/optional/optional-03/value_or-0b.adoc[value_or](U&& u) &&; ---- [.small]#xref:beman/optional/optional-03/value_or-0b.adoc[_» more..._]# == Return Value T == Template Parameters [cols="1,4"] |=== |Name|Description | *U* | The type of the alternate value |=== == Parameters [cols="1,4"] |=== |Name|Description | *u* | The value to return in the empty case |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#