Destroy any contained value and construct a new one in place.

Synopsis

Declared in <bslstl_optional.h>

template<
    class t_INIT_LIST_TYPE,
    class... t_ARGS>
t_TYPE&
emplace(
    bslma::Allocator* allocator,
    std::initializer_list<t_INIT_LIST_TYPE> initializer_list,
    t_ARGS&&... args);

Description

Create an object of StoredType in d_buffer using the specified allocator, initializer_list, and args, and return a reference providing modifiable access to the underlying t_TYPE object.

Return Value

reference providing modifiable access to the contained value

Parameters

Name

Description

allocator

allocator used to supply memory

initializer_list

initializer list forwarded to construct the contained value

args

arguments forwarded to construct the contained value

Created with MrDocs