Return an optional containing a value constructed from the arguments.

Synopsis

Declared in <bslstl_optional.h>

template<
    class t_TYPE,
    class t_INIT_LIST_TYPE,
    class... t_ARGS>
bsl::optional<t_TYPE>
make_optional(
    std::allocator_arg_t allocatorArg,
    bsl::optional<t_TYPE>::allocator_type const& alloc,
    std::initializer_list<t_INIT_LIST_TYPE> il,
    t_ARGS&&... args);

Description

Return an optional object containing a t_TYPE object created by invoking a bsl::optional allocator‐extended in_place_t constructor with the specified alloc as the allocator argument, and specified il and args as the constructor arguments. Note that this function will fail to compile if t_TYPE doesn't use allocators.

Return Value

optional containing a t_TYPE constructed from il and args

Parameters

Name

Description

allocatorArg

tag selecting the allocator‐extended constructor

alloc

allocator used to supply memory for the optional

il

initializer list forwarded to construct the contained value

args

arguments forwarded to construct the contained value

Created with MrDocs