[#BloombergLP-bdljsn-JsonArray-insert-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::xref:BloombergLP/bdljsn/JsonArray.adoc[JsonArray]::insert
:relfileprefix: ../../../
:mrdocs:

Insert the range `&lsqb;first, last)&rsqb;` at the specified `index`&period;

== Synopsis

Declared in `&lt;bdljsn&lowbar;json&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;INDEX,
    class t&lowbar;INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator]
insert(
    t&lowbar;INDEX index,
    t&lowbar;INPUT&lowbar;ITERATOR first,
    t&lowbar;INPUT&lowbar;ITERATOR last)
requires bsl&colon;&colon;is&lowbar;integral&lt;t&lowbar;INDEX&gt;&colon;&colon;value
                        &amp;&amp; !bsl&colon;&colon;is&lowbar;same&lt;t&lowbar;INDEX, bool&gt;&colon;&colon;value;
----

== Description

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&period; Return an iterator referring to the first newly inserted element&period; If an exception is thrown, `&ast;this` is unaffected&period; Throw `bsl&colon;&colon;length&lowbar;error` if `size() &plus; distance(first, last) &gt; maxSize()`&period; The (template parameter) type `t&lowbar;INDEX` must be a non&hyphen;`bool` integral type&period; The (template parameter) type `t&lowbar;INPUT&lowbar;ITERATOR` shall meet the requirements of an input iterator defined in the C&plus;&plus;11 standard &lsqb;24&period;2&period;3&rsqb;providing access to values of a type convertible to `Json`, and `Json` must be `emplace&hyphen;constructible` from `&ast;i` into this `JsonArray`, where `i` is a dereferenceable iterator in the range `&lsqb;first &period;&period; last)&rsqb;`&period; The behavior is undefined unless `index` is in the range `&lsqb;0 &period;&period; size()&rsqb;` (both endpoints included), and `first` and `last` refer to a range of valid values where `first` is at a position at or before `last`&period;

== Return Value

an iterator referring to the newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *index*
| insertion position
| *first*
| beginning of the source range
| *last*
| end of the source range
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
