[#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 `&lt;bdljsn&lowbar;json&period;h&gt;`

Insert at the specified `position` in this `JsonArray` the specified move&hyphen;insertable `json`, and return an iterator referring to the newly inserted element&period; `json` is left in a valid but unspecified state&period; If an exception is thrown, `this` is unaffected&period; Throw `bsl&colon;&colon;length&lowbar;error` if `size() &equals;&equals; maxSize()`&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period;


[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&lt;Json&gt;] json);
----

[.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0e2.adoc[_» more&period;&period;&period;_]#

Insert at the specified `position` in this `JsonArray` a copy of the specified `json`, and return an iterator referring to the newly inserted element&period; If an exception is thrown, `&ast;this` is unaffected&period; Throw `bsl&colon;&colon;length&lowbar;error` if `size() &equals;&equals; maxSize()`&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period;


[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&period;&period;&period;_]#

Insert at the specified `index` in this JsonArray the specified move&hyphen;insertable `json`, and return an iterator referring to the newly inserted element&period; `json` is left in a valid but unspecified state&period; If an exception is thrown, `this` is unaffected&period; Throw `bsl&colon;&colon;length&lowbar;error` if `size() &equals;&equals; maxSize()`&period; The (template parameter) type `t&lowbar;INDEX` must be a non&hyphen;`bool` integral type&period; The behavior is undefined unless `index` is in the range `&lsqb;0 &period;&period; size()&rsqb;` (both endpoints included)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;INDEX&gt;
xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator]
xref:BloombergLP/bdljsn/JsonArray/insert-01.adoc[insert](
    t&lowbar;INDEX index,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;Json&gt;] json)
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;
----

[.small]#xref:BloombergLP/bdljsn/JsonArray/insert-01.adoc[_» more&period;&period;&period;_]#

Insert at the specified `index` in this JsonArray a copy of the specified `json`, and return an iterator referring to the newly inserted element&period; If an exception is thrown, `&ast;this` is unaffected&period; Throw `bsl&colon;&colon;length&lowbar;error` if `size() &equals;&equals; maxSize()`&period; The (template parameter) type `t&lowbar;INDEX` must be a non&hyphen;`bool` integral type&period; The behavior is undefined unless `index` is in the range `&lsqb;0 &period;&period; size()&rsqb;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;INDEX&gt;
xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[JsonArray::Iterator]
xref:BloombergLP/bdljsn/JsonArray/insert-0a.adoc[insert](
    t&lowbar;INDEX index,
    xref:BloombergLP/bdljsn/Json.adoc[Json] const& json)
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;
----

[.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0a.adoc[_» more&period;&period;&period;_]#

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&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;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 `value&lowbar;type`, and `value&lowbar;type` 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 `position` is an iterator in the range `&lsqb;begin() &period;&period; end()&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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;INPUT&lowbar;ITERATOR&gt;
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&lowbar;INPUT&lowbar;ITERATOR first,
    t&lowbar;INPUT&lowbar;ITERATOR last);
----

[.small]#xref:BloombergLP/bdljsn/JsonArray/insert-0f.adoc[_» more&period;&period;&period;_]#

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;


[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]
xref:BloombergLP/bdljsn/JsonArray/insert-09.adoc[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;
----

[.small]#xref:BloombergLP/bdljsn/JsonArray/insert-09.adoc[_» more&period;&period;&period;_]#


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