Creates an optional<T> constructing the value in‐place from the given arguments.

Synopsis

Declared in <beman/optional/optional.hpp>

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

Exception specification

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

Return Value

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

Parameters

Name

Description

args

The arguments forwarded to the constructor of T.

Created with MrDocs