[#beman-optional-optional-06-value_or]
= xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-06.adoc[optional&lt;T&&gt;]::value&lowbar;or
:relfileprefix: ../../../
:mrdocs:

Returns the contained value if there is one, otherwise returns `u`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class U = std::remove&lowbar;cv&lowbar;t&lt;T&gt;&gt;
requires (std&colon;&colon;is&lowbar;object&lowbar;v&lt;T&gt; &amp;&amp; !std&colon;&colon;is&lowbar;array&lowbar;v&lt;T&gt;)
constexpr
std::decay&lowbar;t&lt;T&gt;
value&lowbar;or(U&& u) const;
----

== Return Value

std&colon;&colon;remove&lowbar;cv&lowbar;t&lt;T&gt;

== 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]#
