make_optional overloads

Synopses

Declared in <absl/types/optional.h>

Creates an optional holding a copy of the given value.

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

Creates an optional<T> by constructing T in place.

template<
    typename T,
    typename... Args>
constexpr
decltype(std::make_optional<T>(
    std::declval<Args>()...))
make_optional(Args&&... args);

Creates an optional<T> from an initializer list and extra arguments.

template<
    typename T,
    typename U,
    typename... Args>
constexpr
decltype(std::make_optional<T>(
    std::declval<std::initializer_list<U>>(),
    std::declval<Args>()...))
make_optional(
    std::initializer_list<U> il,
    Args&&... args);

Return Value

  • An optional holding the forwarded value.

  • An optional holding the constructed value.

Parameters

Name

Description

value

The value to store in the returned optional.

args

Arguments forwarded to the constructor of T.

il

Initializer list forwarded to the constructor of T.

Created with MrDocs