bsl::list::emplace

Insert a newly constructed value_type at the specified position.

Synopsis

Declared in <bslstl_list.h>

template<class... ARGS>
list<VALUE, ALLOCATOR>::iterator
emplace(
    const_iterator position,
    ARGS&&... arguments);

Description

The object is constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, and return an iterator providing modifiable access to the newly created and inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list and emplace-constructible from arguments (see {Requirements on VALUE}). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

Return Value

iterator to the newly emplaced element

Parameters

NameDescription
positionlocation before which the element is inserted
argumentsconstructor arguments forwarded to value_type