[#bsl-list-054-insert-0a5] = xref:bsl.adoc[bsl]::xref:bsl/list-054.adoc[list]::insert :relfileprefix: ../../ :mrdocs: `insert` overloads == Synopses Declared in `<bslstl_list.h>` Insert at the specified `dstPosition` in this list the specified move‐insertable `value`, and return an iterator providing modifiable access 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 method has no effect. This method requires that the (template parameter) `VALUE` be `move‐insertable` into this list (see {Requirements on `VALUE`}). The behavior is undefined unless `dstPosition` is an iterator in the range `[cbegin() .. cend()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/iterator.adoc[list<VALUE, ALLOCATOR>::iterator] xref:bsl/list-054/insert-0c.adoc[insert]( xref:bsl/list-054/const_iterator.adoc[const_iterator] dstPosition, xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<value_type>] value); ---- [.small]#xref:bsl/list-054/insert-0c.adoc[_» more..._]# Insert at the specified `dstPosition` in this list the value of each `value_type` object in the specified `values` initializer list, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. This method requires that the (template parameter) `VALUE` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). The behavior is undefined unless `dstPosition` is an iterator in the range `[cbegin() .. cend()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/iterator.adoc[list<VALUE, ALLOCATOR>::iterator] xref:bsl/list-054/insert-00.adoc[insert]( xref:bsl/list-054/const_iterator.adoc[const_iterator] dstPosition, std::initializer_list<value_type> values); ---- [.small]#xref:bsl/list-054/insert-00.adoc[_» more..._]# Insert at the specified `dstPosition` in this list a copy of the specified `value`, and return an iterator providing modifiable access to the newly inserted element. This method offers full guarantee of rollback in case an exception is thrown other than by the `VALUE` copy constructor or assignment operator. This method requires that the (template parameter) `VALUE` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). The behavior is undefined unless `dstPosition` is an iterator in the range `[cbegin() .. cend()]endpoints included)`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/iterator.adoc[list<VALUE, ALLOCATOR>::iterator] xref:bsl/list-054/insert-06.adoc[insert]( xref:bsl/list-054/const_iterator.adoc[const_iterator] dstPosition, xref:bsl/list-054/value_type.adoc[value_type] const& value); ---- [.small]#xref:bsl/list-054/insert-06.adoc[_» more..._]# Insert at the specified `dstPosition` in this list the specified `numElements` copies of the specified `value`, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. This method requires that the (template parameter) `VALUE` be `copy‐insertable` into this list (see {Requirements on `VALUE`}). The behavior is undefined unless `dstPosition` is an iterator in the range `[cbegin() .. cend()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/list-054/iterator.adoc[list<VALUE, ALLOCATOR>::iterator] xref:bsl/list-054/insert-0ab.adoc[insert]( xref:bsl/list-054/const_iterator.adoc[const_iterator] dstPosition, xref:bsl/list-054/size_type.adoc[size_type] numElements, xref:bsl/list-054/value_type.adoc[value_type] const& value); ---- [.small]#xref:bsl/list-054/insert-0ab.adoc[_» more..._]# Insert at the specified `dstPosition` in this list the values in the range starting at the specified `first` and ending immediately before the specified `last` iterators of the (template parameter) type `INPUT_ITERATOR`, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. The (template parameter) type `INPUT_ITERATOR` shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators]providing access to values of a type convertible to `value_type`, and `value_type` must be `emplace‐constructible` from `*i` into this list, where `i` is a dereferenceable iterator in the range `[first .. last)]` (see {Requirements on `VALUE`}). The behavior is undefined unless `dstPosition` is an iterator in the range `[cbegin() .. cend()]` (both endpoints included), and `first` and `last` refer to a sequence of valid values where `first` is at a position at or before `last`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/list-054/iterator.adoc[iterator] xref:bsl/list-054/insert-0e.adoc[insert]( xref:bsl/list-054/const_iterator.adoc[const_iterator] dstPosition, INPUT_ITERATOR first, INPUT_ITERATOR last) requires !is_arithmetic<INPUT_ITERATOR>::value && !is_enum<INPUT_ITERATOR>::value; ---- [.small]#xref:bsl/list-054/insert-0e.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#