[#bsl-vector-00d-emplace] = xref:bsl.adoc[bsl]::xref:bsl/vector-00d.adoc[vector]::emplace :relfileprefix: ../../ :mrdocs: Emplace a newly constructed element at the specified position. == Synopsis Declared in `<bslstl_vector.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> xref:bsl/vector-00d/iterator.adoc[iterator] emplace( xref:bsl/vector-00d/const_iterator.adoc[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 [cols="1,4"] |=== | Name| Description | *position* | element position or insertion point | *arguments* | constructor arguments forwarded to the new element |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#