Creates an optional<T> constructing the value in‐place from an initializer list and arguments.

Synopsis

Declared in <beman/optional/optional.hpp>

template<
    typename T,
    typename U,
    typename... Args>
constexpr
optional<T>
make_optional(
    std::initializer_list<U> il,
    Args&&... args) noexcept(/* see-below */)
requires std::is_constructible_v<T, std::initializer_list<U>&, Args...>;

Exception specification

This function is potentially-throwing unless std::is_nothrow_constructible_v<T, std::initializer_list<U> &, Args...>.

Return Value

An engaged optional<T> holding the in‐place constructed value.

Parameters

Name

Description

il

The initializer list forwarded to the constructor of T.

args

The additional arguments forwarded to the constructor of T.

Created with MrDocs