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

Represents the `optional&lowbar;ref` as a `std&colon;&colon;optional`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U = std::decay&lowbar;t&lt;T&gt;&gt;
constexpr
std::optional&lt;U&gt;
as&lowbar;optional() const;
----

== Description

Incurs a copy when the `optional&lowbar;ref` is non&hyphen;empty&period;

== Return Value

A `std&colon;&colon;optional&lt;U&gt;` holding a copy of the value, or `nullopt`&period;


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