bsl::optional::optional

If the optional base class of the specified original holds a value, create an optional object whose contained value is initialized by moving from that.

Synopsis

Declared in <bslstl_optional.h>

template<class t_DERIVED>
optional(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslmf::MovableRef_Deduced<t_DERIVED> original);

Description

If the optional base class of the specified original holds a value, create an optional object whose contained value is initialized by moving from that val

If the optional base class of the specified original holds a value, create an optional object whose contained value is initialized by moving from that value; otherwise, create a disengaged optional object. Use the specified allocator to supply memory. original is left in a valid, but unspecified state. Note that this constructor does not participate in overload resolution unless optional is an accessible base class of t_DERIVED or t_DERIVED is optional itself (in which case the instantiation provides the allocator-extended move constructor).

Parameters

NameDescription
allocatorArgtag selecting the allocator-extended constructor
allocatorallocator used to supply memory
originalsource optional used to initialize this object