absl::optional_ref::as_optional

Represents the optional_ref as a std::optional.

Synopsis

Declared in <absl/types/optional_ref.h>

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.