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

Synopsis

Declared in <bdlb_nullableallocatedvalue.h>

template<
    class INIT_LIST_TYPE,
    class... ARGS>
TYPE&
emplace(
    std::initializer_list<INIT_LIST_TYPE> il,
    ARGS&&... args);

Description

Assign to this object the value of the (template parameter) TYPE created in place using the specified il and specified args and return a reference providing modifiable access to the underlying TYPE object. If this object already contains an object (`true == hasValue()`), that object is destroyed before the new object is created. Note that if the constructor of TYPE throws an exception this object is left in a disengaged state.

Return Value

modifiable reference to the created value

Parameters

Name

Description

il

initializer list forwarded to construct the contained value

args

arguments forwarded to construct the contained value

Created with MrDocs