[#absl-optional_ref-0c-as_optional] = xref:absl.adoc[absl]::xref:absl/optional_ref-0c.adoc[optional_ref]::as_optional :relfileprefix: ../../ :mrdocs: Represents the `optional_ref` as a `std::optional`. == Synopsis Declared in `<absl/types/optional_ref.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U = std::decay_t<T>> constexpr std::optional<U> as_optional() const; ---- == Description Incurs a copy when the `optional_ref` is non‐empty. == Return Value A `std::optional<U>` holding a copy of the value, or `nullopt`. [.small]#Created with https://www.mrdocs.com[MrDocs]#