[#bsl-vector-095-insert-016] = xref:bsl.adoc[bsl]::xref:bsl/vector-095.adoc[vector<char>]::insert :relfileprefix: ../../ :mrdocs: `insert` overloads == Synopses Declared in `<bslstl_vector.h>` Insert at the specified `position` in this vector the specified move‐insertable `value`, and return an iterator referring to the newly inserted element. `value` is left in a valid but unspecified state. 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 (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/vector-095/iterator.adoc[iterator] xref:bsl/vector-095/insert-017.adoc[insert]( xref:bsl/vector-095/const_iterator.adoc[const_iterator] position, xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<char>] value); ---- [.small]#xref:bsl/vector-095/insert-017.adoc[_» more..._]# Insert at the specified `position` in this vector each `VALUE_TYPE` object in the specified `values` initializer list, 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, and move assignment operator of `VALUE_TYPE`), `*this` is unaffected. Throw `std::length_error` if `size() + values.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 `copy‐insertable` into this vector (see {Requirements on `VALUE_TYPE`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/vector-095/iterator.adoc[iterator] xref:bsl/vector-095/insert-001.adoc[insert]( xref:bsl/vector-095/const_iterator.adoc[const_iterator] position, std::initializer_list<char> values); ---- [.small]#xref:bsl/vector-095/insert-001.adoc[_» more..._]# Insert at the specified `position` in this vector a copy of the specified `value`, and return an iterator referring to the 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() == 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`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/vector-095/iterator.adoc[iterator] xref:bsl/vector-095/insert-003.adoc[insert]( xref:bsl/vector-095/const_iterator.adoc[const_iterator] position, char const& value); ---- [.small]#xref:bsl/vector-095/insert-003.adoc[_» more..._]# 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`}). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/vector-095/iterator.adoc[iterator] xref:bsl/vector-095/insert-0e.adoc[insert]( xref:bsl/vector-095/const_iterator.adoc[const_iterator] position, xref:bsl/vector-095/size_type.adoc[size_type] numElements, char const& value); ---- [.small]#xref:bsl/vector-095/insert-0e.adoc[_» more..._]# Insert at the specified `position` in this vector the values in the range starting at the specified `first` element, and ending immediately before the specified `last` element. 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() + distance(first, last) > max_size()`. The (template parameter) type `INPUT_ITER` shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3]providing access to values of a type convertible to `value_type`, and `value_type` must be `emplace‐constructible` from `*i` into this vector, where `i` is a dereferenceable iterator in the range `[first .. last)]` (see {Requirements on `VALUE_TYPE`}). The behavior is undefined unless `position` is an iterator in the range `[begin() .. end()]` (both endpoints included), and `first` and `last` refer to a range of valid values where `first` is at a position at or before `last`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITER> xref:bsl/vector-095/iterator.adoc[iterator] xref:bsl/vector-095/insert-0c.adoc[insert]( xref:bsl/vector-095/const_iterator.adoc[const_iterator] position, INPUT_ITER first, INPUT_ITER last); ---- [.small]#xref:bsl/vector-095/insert-0c.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#