bsl::vector::emplace

Emplace a newly constructed element at the specified position.

Synopsis

Declared in <bslstl_vector.h>

template<class... Args>
iterator
emplace(
    const_iterator position,
    Args&&... arguments);

Description

Insert at the specified position in this vector a newly created value_type object, 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 referring 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 is unaffected. Throw std::length_error if `size() == max_size(). The behavior is undefined unless position` is an iterator in the range [begin() .. end()] (both endpoints included). This method requires that the (template parameter) type VALUE_TYPE be move-insertable into this vector and emplace-constructible from arguments (see {Requirements on VALUE_TYPE}).

NOTE: This function has been implemented inline due to an issue with the Sun compiler.

Return Value

iterator referring to the newly emplaced element

Parameters

NameDescription
positionelement position or insertion point
argumentsconstructor arguments forwarded to the new element