[#absl-StatusOr-2constructor-07]
= xref:absl.adoc[absl]::xref:absl/StatusOr.adoc[StatusOr]::StatusOr
:relfileprefix: ../../
:mrdocs:

Constructs the inner value `T` by direct&hyphen;initialization from `u`&period;

== Synopsis

Declared in `&lt;absl&sol;status&sol;statusor&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = T&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionValid&lt;
                                 false, T, U, false&gt;&colon;&colon;value
StatusOr(U&& u);
----

== Description

Constructs the inner value `T` in&hyphen;place using the provided args, using the `T(U)` (direct&hyphen;initialization) constructor&period; This constructor is only valid if `T` can be constructed from a `U`&period; Can accept move or copy constructors&period;

This constructor is explicit if `U` is not convertible to `T`&period; To avoid ambiguity, this constructor is disabled if `U` is a `StatusOr&lt;J&gt;`, where `J` is convertible to `T`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *u*
| The value used to direct&hyphen;initialize the held object&period;
|===


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