[#bsl-vector-00d-insert-01] = xref:bsl.adoc[bsl]::xref:bsl/vector-00d.adoc[vector]::insert :relfileprefix: ../../ :mrdocs: Insert elements into this vector. == Synopsis Declared in `<bslstl_vector.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/vector-00d/iterator.adoc[vector<VALUE_TYPE, ALLOCATOR>::iterator] insert( xref:bsl/vector-00d/const_iterator.adoc[const_iterator] position, xref:bsl/vector-00d/size_type.adoc[size_type] numElements, VALUE_TYPE const& value); ---- == Description Insert at the specified `position` in this vector the specified `numElements` copies of the specified `value`, and return an iterator referring to the first newly 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() + numElements > 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 `copy‐insertable` into this vector (see {Requirements on `VALUE_TYPE`}). == Return Value iterator referring to the first newly inserted element, or `position` if none == Parameters [cols="1,4"] |=== | Name| Description | *position* | element position or insertion point | *numElements* | number of elements to insert or assign | *value* | element value |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#