[#absl-optional_ref-0c-2constructor-093]
= xref:absl.adoc[absl]::xref:absl/optional_ref-0c.adoc[optional&lowbar;ref]::optional&lowbar;ref
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

Declared in `&lt;absl&sol;types&sol;optional&lowbar;ref&period;h&gt;`

Constructs an empty `optional&lowbar;ref`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/optional_ref-0c/2constructor-0e1.adoc[optional&lowbar;ref]();
----

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

Copies an `optional&lowbar;ref`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/optional_ref-0c/2constructor-0d.adoc[optional&lowbar;ref](xref:absl/optional_ref-0c.adoc[optional&lowbar;ref&lt;T&gt;] const& other) = default;
----

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

Constructs an empty `optional&lowbar;ref` from `std&colon;&colon;nullopt`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/optional_ref-0c/2constructor-0c.adoc[optional&lowbar;ref](std::nullopt&lowbar;t input);
----

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

Deleted to forbid a naked `nullptr`&semi; use `std&colon;&colon;nullopt` instead&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/optional_ref-0c/2constructor-0b.adoc[optional&lowbar;ref](std::nullptr&lowbar;t input) = delete;
----

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

Constructs an `optional&lowbar;ref` referring to a concrete value&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/optional_ref-0c/2constructor-0f.adoc[optional&lowbar;ref](T& input);
----

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

Constructs an `optional&lowbar;ref` from a pointer, where null means absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/optional_ref-0c/2constructor-04.adoc[optional&lowbar;ref](T* input);
----

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

Converts from an `optional&lowbar;ref&lt;U&gt;` when `U&ast;` converts to `T&ast;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename U,
    typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom&lt;U&gt;]&gt;
constexpr
xref:absl/optional_ref-0c/2constructor-0e0.adoc[optional&lowbar;ref](xref:absl/optional_ref-0c.adoc[optional&lowbar;ref&lt;U&gt;] input);
----

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

Constructs an `optional&lowbar;ref` from a mutable `std&colon;&colon;optional`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename U,
    typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom&lt;U&gt;]&gt;
constexpr
xref:absl/optional_ref-0c/2constructor-099.adoc[optional&lowbar;ref](std::optional&lt;U&gt;& input);
----

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

Constructs an `optional&lowbar;ref` from a const `std&colon;&colon;optional`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename U,
    typename = xref:absl/optional_ref-0c.adoc[EnableIfConvertibleFrom&lt;U const&gt;]&gt;
constexpr
xref:absl/optional_ref-0c/2constructor-06.adoc[optional&lowbar;ref](std::optional&lt;U&gt; const& input);
----

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *other*
| The reference to copy&period;
| *input*
| The `std&colon;&colon;nullopt` tag&period;
|===


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