[#BloombergLP-bdljsn-JsonArray-insert-0e4] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/JsonArray.adoc[JsonArray]::insert :relfileprefix: ../../../ :mrdocs: `insert` overloads == Synopses Declared in `<bdljsn_json.h>` Insert at the specified `position` in this `JsonArray` the specified move‐insertable `json`, and return an iterator referring to the newly inserted element. `json` is left in a valid but unspecified state. If an exception is thrown, `this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The behavior is undefined unless `position` is an iterator in the range `[begin() .. end()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-0e2.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[ConstIterator] position, xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Json>] json); ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0e2.adoc[_» more..._]# Insert at the specified `position` in this `JsonArray` a copy of the specified `json`, and return an iterator referring to the newly inserted element. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The behavior is undefined unless `position` is an iterator in the range `[begin() .. end()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-0c.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[ConstIterator] position, xref:BloombergLP/bdljsn/Json.adoc[Json] const& json); ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0c.adoc[_» more..._]# Insert at the specified `index` in this JsonArray the specified move‐insertable `json`, and return an iterator referring to the newly inserted element. `json` is left in a valid but unspecified state. If an exception is thrown, `this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The behavior is undefined unless `index` is in the range `[0 .. size()]` (both endpoints included). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INDEX> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-01.adoc[insert]( t_INDEX index, xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Json>] json) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-01.adoc[_» more..._]# Insert at the specified `index` in this JsonArray a copy of the specified `json`, and return an iterator referring to the newly inserted element. If an exception is thrown, `*this` is unaffected. Throw `bsl::length_error` if `size() == maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The behavior is undefined unless `index` is in the range `[0 .. size()]`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_INDEX> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-0a.adoc[insert]( t_INDEX index, xref:BloombergLP/bdljsn/Json.adoc[Json] const& json) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0a.adoc[_» more..._]# Insert at the specified `position` in this `JsonArray` 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, `*this` is unaffected. Throw `bsl::length_error` if `size() + distance(first, last) > maxSize()`. The (template parameter) type `t_INPUT_ITERATOR` 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 JsonArray, where `i` is a dereferenceable iterator in the range `[first .. last)]`. 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 t_INPUT_ITERATOR> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-0f.adoc[insert]( xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[ConstIterator] position, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last); ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0f.adoc[_» more..._]# Insert at the specified `index` in this JsonArray 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, `*this` is unaffected. Throw `bsl::length_error` if `size() + distance(first, last) > maxSize()`. The (template parameter) type `t_INDEX` must be a non‐`bool` integral type. The (template parameter) type `t_INPUT_ITERATOR` 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 `Json`, and `Json` must be `emplace‐constructible` from `*i` into this `JsonArray`, where `i` is a dereferenceable iterator in the range `[first .. last)]`. The behavior is undefined unless `index` is in the range `[0 .. size()]` (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 t_INDEX, class t_INPUT_ITERATOR> xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator] xref:BloombergLP/bdljsn/JsonArray/insert-09.adoc[insert]( t_INDEX index, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last) requires bsl::is_integral<t_INDEX>::value && !bsl::is_same<t_INDEX, bool>::value; ---- [.small]#xref:BloombergLP/bdljsn/JsonArray/insert-09.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#