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

Constructors

== Synopses

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

Constructs a new `StatusOr` with an unknown status&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:absl/StatusOr/2constructor-0a.adoc[StatusOr]();
----

[.small]#xref:absl/StatusOr/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Copy constructor&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/StatusOr/2constructor-00f.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr] const& other) = default;
----

[.small]#xref:absl/StatusOr/2constructor-00f.adoc[_» more&period;&period;&period;_]#

Constructs a `StatusOr&lt;T&gt;` from an `absl&colon;&colon;StatusOr&lt;U&gt;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                false, T, U, false, const U&amp;&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-0c5.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;] const& other);
----

[.small]#xref:absl/StatusOr/2constructor-0c5.adoc[_» more&period;&period;&period;_]#

Converting constructor from a `StatusOr&lt;U&gt;` (lifetime&hyphen;bound overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                false, T, U, true, const U&amp;&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-0f.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;] const& other);
----

[.small]#xref:absl/StatusOr/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Converting constructor from a `StatusOr&lt;U&gt;` (explicit overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                true, T, U, false, const U&amp;&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-03.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;] const& other);
----

[.small]#xref:absl/StatusOr/2constructor-03.adoc[_» more&period;&period;&period;_]#

Converting constructor from a `StatusOr&lt;U&gt;` (explicit, lifetime&hyphen;bound)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                true, T, U, true, const U&amp;&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-0c1.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;] const& other);
----

[.small]#xref:absl/StatusOr/2constructor-0c1.adoc[_» more&period;&period;&period;_]#

Move constructor&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/StatusOr/2constructor-05.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr]&& other) = default;
----

[.small]#xref:absl/StatusOr/2constructor-05.adoc[_» more&period;&period;&period;_]#

Converting move constructor from a `StatusOr&lt;U&gt;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                false, T, U, false, U&amp;&amp;&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-0bc3.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;]&& other);
----

[.small]#xref:absl/StatusOr/2constructor-0bc3.adoc[_» more&period;&period;&period;_]#

Converting move constructor from a `StatusOr&lt;U&gt;` (lifetime&hyphen;bound overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                false, T, U, true, U&amp;&amp;&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-0bc7.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;]&& other);
----

[.small]#xref:absl/StatusOr/2constructor-0bc7.adoc[_» more&period;&period;&period;_]#

Converting move constructor from a `StatusOr&lt;U&gt;` (explicit overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                true, T, U, false, U&amp;&amp;&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-09.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;]&& other);
----

[.small]#xref:absl/StatusOr/2constructor-09.adoc[_» more&period;&period;&period;_]#

Converting move constructor from a `StatusOr&lt;U&gt;` (explicit, lifetime&hyphen;bound)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusOrValid&lt;
                                true, T, U, true, U&amp;&amp;&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-06.adoc[StatusOr](xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;]&& other);
----

[.small]#xref:absl/StatusOr/2constructor-06.adoc[_» more&period;&period;&period;_]#

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


[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
xref:absl/StatusOr/2constructor-07.adoc[StatusOr](U&& u);
----

[.small]#xref:absl/StatusOr/2constructor-07.adoc[_» more&period;&period;&period;_]#

Direct&hyphen;initializes the held value from `u` (lifetime&hyphen;bound overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = T&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionValid&lt;
                                 false, T, U, true&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-02.adoc[StatusOr](U&& u);
----

[.small]#xref:absl/StatusOr/2constructor-02.adoc[_» more&period;&period;&period;_]#

Direct&hyphen;initializes the held value from `u` (explicit overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = T&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionValid&lt;
                                 true, T, U, false&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-04.adoc[StatusOr](U&& u);
----

[.small]#xref:absl/StatusOr/2constructor-04.adoc[_» more&period;&period;&period;_]#

Direct&hyphen;initializes the held value from `u` (explicit, lifetime&hyphen;bound)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = T&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionValid&lt;true, T, U, true&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-01.adoc[StatusOr](U&& u);
----

[.small]#xref:absl/StatusOr/2constructor-01.adoc[_» more&period;&period;&period;_]#

Constructs a new `StatusOr&lt;T&gt;` from a value convertible to `Status`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = xref:absl/Status.adoc[absl::Status]&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusValid&lt;
                                 false, T, U&gt;&colon;&colon;value
xref:absl/StatusOr/2constructor-00d.adoc[StatusOr](U&& v);
----

[.small]#xref:absl/StatusOr/2constructor-00d.adoc[_» more&period;&period;&period;_]#

Constructs a new `StatusOr&lt;T&gt;` from a value convertible to `Status` (explicit overload)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = xref:absl/Status.adoc[absl::Status]&gt;
requires internal&lowbar;statusor&colon;&colon;IsConstructionFromStatusValid&lt;
                                  true, T, U&gt;&colon;&colon;value
explicit
xref:absl/StatusOr/2constructor-0d.adoc[StatusOr](U&& v);
----

[.small]#xref:absl/StatusOr/2constructor-0d.adoc[_» more&period;&period;&period;_]#

Constructs the inner value `T` in&hyphen;place from the given arguments&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename&period;&period;&period; Args&gt;
explicit
xref:absl/StatusOr/2constructor-089.adoc[StatusOr](
    std::in&lowbar;place&lowbar;t tag,
    Args&&&period;&period;&period; args);
----

[.small]#xref:absl/StatusOr/2constructor-089.adoc[_» more&period;&period;&period;_]#

Constructs the inner value `T` in&hyphen;place from an initializer list and args&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename U,
    typename&period;&period;&period; Args&gt;
explicit
xref:absl/StatusOr/2constructor-0e.adoc[StatusOr](
    std::in&lowbar;place&lowbar;t tag,
    std::initializer&lowbar;list&lt;U&gt; ilist,
    Args&&&period;&period;&period; args);
----

[.small]#xref:absl/StatusOr/2constructor-0e.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *other*
| The source object&period;
| *u*
| The value used to direct&hyphen;initialize the held object&period;
| *v*
| The status (or value convertible to a status) to store&period;
| *args*
| The arguments forwarded to the `T` constructor&period;
| *tag*
| A tag that selects this overload&period;
| *ilist*
| The initializer list forwarded to the `T` constructor&period;
|===


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