Create an optional object whose contained value is initialized by forwarding from the specified value.

Synopsis

Declared in <bslstl_optional.h>

template<class t_ANY_TYPE = t_TYPE>
optional(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    t_ANY_TYPE&& value);

Description

Create an optional object whose contained value is initialized by forwarding from the specified value. Use the specified allocator to supply memory. Note that this constructor participates in overload resolution only when t_TYPE is constructible from t_ANY_TYPE, and is implicit only when t_ANY_TYPE is implicitly convertible to t_TYPE.

Parameters

Name

Description

allocatorArg

tag selecting the allocator‐extended constructor

allocator

allocator used to supply memory

value

value compared with or used to initialize the optional

Created with MrDocs