absl::optional_ref::optional_ref

Constructors

Synopses

Declared in <absl/types/optional_ref.h>

Constructs an empty optional_ref.

constexpr
optional_ref();
» more...

Copies an optional_ref.

optional_ref(optional_ref<T> const& other) = default;
» more...

Constructs an empty optional_ref from std::nullopt.

constexpr
optional_ref(std::nullopt_t input);
» more...

Deleted to forbid a naked nullptr; use std::nullopt instead.

constexpr
optional_ref(std::nullptr_t input) = delete;
» more...

Constructs an optional_ref referring to a concrete value.

constexpr
optional_ref(T& input);
» more...

Constructs an optional_ref from a pointer, where null means absent.

constexpr
optional_ref(T* input);
» more...

Converts from an optional_ref<U> when U* converts to T*.

template<
    typename U,
    typename = EnableIfConvertibleFrom<U>>
constexpr
optional_ref(optional_ref<U> input);
» more...

Constructs an optional_ref from a mutable std::optional.

template<
    typename U,
    typename = EnableIfConvertibleFrom<U>>
constexpr
optional_ref(std::optional<U>& input);
» more...

Constructs an optional_ref from a const std::optional.

template<
    typename U,
    typename = EnableIfConvertibleFrom<U const>>
constexpr
optional_ref(std::optional<U> const& input);
» more...

Parameters

NameDescription
otherThe reference to copy.
inputThe std::nullopt tag.