Constructors

Synopses

Declared in <absl/types/optional_ref.h>

Constructs an empty optional_ref.

constexpr
optional_ref();

Copies an optional_ref.

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

Constructs an empty optional_ref from std::nullopt.

constexpr
optional_ref(std::nullopt_t input);

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

constexpr
optional_ref(std::nullptr_t input) = delete;

Constructs an optional_ref referring to a concrete value.

constexpr
optional_ref(T& input);

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

constexpr
optional_ref(T* input);

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

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

Constructs an optional_ref from a mutable std::optional.

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

Constructs an optional_ref from a const std::optional.

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

Parameters

Name

Description

other

The reference to copy.

input

The std::nullopt tag.

Created with MrDocs