absl::make_optional

Creates an optional holding a copy of the given value.

Synopsis

Declared in <absl/types/optional.h>

template<typename T>
constexpr
decltype(std::make_optional(
    std::declval<T>()))
make_optional(T&& value);

Return Value

An optional holding the forwarded value.

Parameters

NameDescription
valueThe value to store in the returned optional.