deploy: 54f6b3ef06
This commit is contained in:
1 parent
11a863958e
commit
40c9f42917
38 files changed
+564
-458
No files matched your search
@@ -15,7 +15,7 @@
|
||||
<span class=c1>// (4)</span>
|
||||
<span class=n>reference</span><span class=w> </span><span class=k>operator</span><span class=p>[](</span><span class=k>const</span><span class=w> </span><span class=n>json_pointer</span><span class=o>&</span><span class=w> </span><span class=n>ptr</span><span class=p>);</span>
|
||||
<span class=n>const_reference</span><span class=w> </span><span class=k>operator</span><span class=p>[](</span><span class=k>const</span><span class=w> </span><span class=n>json_pointer</span><span class=o>&</span><span class=w> </span><span class=n>ptr</span><span class=p>)</span><span class=w> </span><span class=k>const</span><span class=p>;</span>
|
||||
</code></pre></div> <ol> <li>Returns a reference to the array element at specified location <code>idx</code>.</li> <li>Returns a reference to the object element with specified key <code>key</code>. The non-const qualified overload takes the key by value.</li> <li>See 2. This overload is only available if <code>KeyType</code> is comparable with <code class=highlight><span class=k>typename</span><span class=w> </span><span class=nc>object_t</span><span class=o>::</span><span class=n>key_type</span></code> and <code class=highlight><span class=k>typename</span><span class=w> </span><span class=nc>object_comparator_t</span><span class=o>::</span><span class=n>is_transparent</span></code> denotes a type.</li> <li>Returns a reference to the element with specified <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code>.</li> </ol> <h2 id=template-parameters>Template parameters<a class=headerlink href=#template-parameters title="Permanent link">¶</a></h2> <dl> <dt><code>KeyType</code></dt> <dd>A type for an object key other than <a href=../../json_pointer/ ><code>json_pointer</code></a> that is comparable with <a href=../string_t/ ><code>string_t</code></a> using <a href=../object_comparator_t/ ><code>object_comparator_t</code></a>. This can also be a string view (C++17).</dd> </dl> <h2 id=iterator-invalidation>Iterator invalidation<a class=headerlink href=#iterator-invalidation title="Permanent link">¶</a></h2> <p>For the non-const versions 1. and 4., when passing an <strong>array</strong> index that does not exist, it is created and filled with a <code class=highlight><span class=kc>null</span></code> value before a reference to it is returned. For this, a reallocation can happen, in which case all iterators (including the <a href=../end/ ><code>end()</code></a> iterator) and all references to the elements are invalidated.</p> <p>For <a href=../../ordered_json/ ><code>ordered_json</code></a>, also passing an <strong>object key</strong> to the non-const versions 2., 3., and 4., a reallocation can happen which again invalidates all iterators and all references.</p> <h2 id=parameters>Parameters<a class=headerlink href=#parameters title="Permanent link">¶</a></h2> <dl> <dt><code>idx</code> (in)</dt> <dd>index of the element to access</dd> <dt><code>key</code> (in)</dt> <dd>object key of the element to access</dd> <dt><code>ptr</code> (in)</dt> <dd><abbr title="JavaScript Object Notation">JSON</abbr> pointer to the desired element</dd> </dl> <h2 id=return-value>Return value<a class=headerlink href=#return-value title="Permanent link">¶</a></h2> <ol> <li>(const) reference to the element at index <code>idx</code></li> <li>(const) reference to the element at key <code>key</code></li> <li>(const) reference to the element at key <code>key</code></li> <li>(const) reference to the element pointed to by <code>ptr</code></li> </ol> <h2 id=exception-safety>Exception safety<a class=headerlink href=#exception-safety title="Permanent link">¶</a></h2> <p>Strong exception safety: if an exception occurs, the original value stays intact.</p> <h2 id=exceptions>Exceptions<a class=headerlink href=#exceptions title="Permanent link">¶</a></h2> <ol> <li>The function can throw the following exceptions:<ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptiontype_error305><code>type_error.305</code></a> if the <abbr title="JavaScript Object Notation">JSON</abbr> value is not an array or null; in that case, using the <code>[]</code> operator with an index makes no sense.</li> <li>Throws <code class=highlight><span class=n>std</span><span class=o>::</span><span class=n>length_error</span></code> if <code>idx</code> equals the maximum value of <code>size_type</code>; the array is left unchanged. (This is the one index for which growing the array to hold it cannot be expressed as a <code>size_type</code> size, the same way an oversized <a href="https://en.cppreference.com/w/cpp/container/vector/resize"><code>resize</code></a> throws.)</li> </ul> </li> <li>The function can throw the following exceptions:<ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptiontype_error305><code>type_error.305</code></a> if the <abbr title="JavaScript Object Notation">JSON</abbr> value is not an object or null; in that case, using the <code>[]</code> operator with a key makes no sense.</li> </ul> </li> <li>See 2.</li> <li> <p>The function can throw the following exceptions:</p> <ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptionparse_error106><code>parse_error.106</code></a> if an array index in the passed <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code> begins with '0'.</li> <li>Throws <a href=../../../home/exceptions/#jsonexceptionparse_error109><code>parse_error.109</code></a> if an array index in the passed <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code> is not a number.</li> <li>Throws <a href=../../../home/exceptions/#jsonexLine truncated
|
||||
</code></pre></div> <ol> <li>Returns a reference to the array element at specified location <code>idx</code>.</li> <li>Returns a reference to the object element with specified key <code>key</code>. The non-const qualified overload takes the key by value.</li> <li>See 2. This overload is only available if <code>KeyType</code> is comparable with <code class=highlight><span class=k>typename</span><span class=w> </span><span class=nc>object_t</span><span class=o>::</span><span class=n>key_type</span></code> and <code class=highlight><span class=k>typename</span><span class=w> </span><span class=nc>object_comparator_t</span><span class=o>::</span><span class=n>is_transparent</span></code> denotes a type.</li> <li>Returns a reference to the element with specified <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code>.</li> </ol> <h2 id=template-parameters>Template parameters<a class=headerlink href=#template-parameters title="Permanent link">¶</a></h2> <dl> <dt><code>KeyType</code></dt> <dd>A type for an object key other than <a href=../../json_pointer/ ><code>json_pointer</code></a> that is comparable with <a href=../string_t/ ><code>string_t</code></a> using <a href=../object_comparator_t/ ><code>object_comparator_t</code></a>. This can also be a string view (C++17).</dd> </dl> <h2 id=iterator-invalidation>Iterator invalidation<a class=headerlink href=#iterator-invalidation title="Permanent link">¶</a></h2> <p>For the non-const versions 1. and 4., when passing an <strong>array</strong> index that does not exist, it is created and filled with a <code class=highlight><span class=kc>null</span></code> value before a reference to it is returned. For this, a reallocation can happen, in which case all iterators (including the <a href=../end/ ><code>end()</code></a> iterator) and all references to the elements are invalidated.</p> <p>For <a href=../../ordered_json/ ><code>ordered_json</code></a>, also passing an <strong>object key</strong> to the non-const versions 2., 3., and 4., a reallocation can happen which again invalidates all iterators and all references.</p> <h2 id=parameters>Parameters<a class=headerlink href=#parameters title="Permanent link">¶</a></h2> <dl> <dt><code>idx</code> (in)</dt> <dd>index of the element to access</dd> <dt><code>key</code> (in)</dt> <dd>object key of the element to access</dd> <dt><code>ptr</code> (in)</dt> <dd><abbr title="JavaScript Object Notation">JSON</abbr> pointer to the desired element</dd> </dl> <h2 id=return-value>Return value<a class=headerlink href=#return-value title="Permanent link">¶</a></h2> <ol> <li>(const) reference to the element at index <code>idx</code></li> <li>(const) reference to the element at key <code>key</code></li> <li>(const) reference to the element at key <code>key</code></li> <li>(const) reference to the element pointed to by <code>ptr</code></li> </ol> <h2 id=exception-safety>Exception safety<a class=headerlink href=#exception-safety title="Permanent link">¶</a></h2> <p>Strong exception safety: if an exception occurs, the original value stays intact.</p> <h2 id=exceptions>Exceptions<a class=headerlink href=#exceptions title="Permanent link">¶</a></h2> <ol> <li>The function can throw the following exceptions:<ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptiontype_error305><code>type_error.305</code></a> if the <abbr title="JavaScript Object Notation">JSON</abbr> value is not an array or null; in that case, using the <code>[]</code> operator with an index makes no sense.</li> <li>Throws <code class=highlight><span class=n>std</span><span class=o>::</span><span class=n>length_error</span></code> if <code>idx</code> equals the maximum value of <code>size_type</code>; the array is left unchanged. (This is the one index for which growing the array to hold it cannot be expressed as a <code>size_type</code> size, the same way an oversized <a href="https://en.cppreference.com/w/cpp/container/vector/resize"><code>resize</code></a> throws.)</li> </ul> </li> <li>The function can throw the following exceptions:<ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptiontype_error305><code>type_error.305</code></a> if the <abbr title="JavaScript Object Notation">JSON</abbr> value is not an object or null; in that case, using the <code>[]</code> operator with a key makes no sense.</li> </ul> </li> <li>See 2.</li> <li> <p>The function can throw the following exceptions:</p> <ul> <li>Throws <a href=../../../home/exceptions/#jsonexceptionparse_error106><code>parse_error.106</code></a> if an array index in the passed <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code> begins with '0'.</li> <li>Throws <a href=../../../home/exceptions/#jsonexceptionparse_error109><code>parse_error.109</code></a> if an array index in the passed <abbr title="JavaScript Object Notation">JSON</abbr> pointer <code>ptr</code> is not a number.</li> <li>Throws <a href=../../../home/exceptions/#jsonexLine truncated
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><nlohmann/json.hpp></span>
|
||||
|
||||
<span class=k>using</span><span class=w> </span><span class=n>nlohmann</span><span class=o>::</span><span class=n>json</span><span class=p>;</span>
|
||||
@@ -283,4 +283,4 @@
|
||||
<span class=s2>"foo"</span>
|
||||
<span class=p>[</span><span class=mi>1</span><span class=p>,</span><span class=mi>2</span><span class=p>]</span>
|
||||
<span class=mi>2</span>
|
||||
</code></pre></div> </details> <h2 id=see-also>See also<a class=headerlink href=#see-also title="Permanent link">¶</a></h2> <ul> <li><a href=../../../features/element_access/unchecked_access/ >Unchecked access</a> - element access without range checking</li> <li><a href=../../../features/assertions/ >Runtime assertions</a> - assertions guarding against undefined behavior</li> <li><a href=../at/ ><code>at</code></a> - access by reference with range checking</li> <li><a href=../value/ ><code>value</code></a> - access with default value</li> <li><a href=../../basic_json_view/operator%5B%5D/ ><code>basic_json_view::operator[]</code></a> - the same access on a zero-copy view (a duplicate key resolves to the first member, whereas <code>parse()</code> keeps the last; a missing key gives a discarded view instead of undefined behavior)</li> <li><a href=../../../features/element_access/ >Element Access</a> - overview of all ways to access elements</li> <li><a href=../../../features/json_pointer/ ><abbr title="JavaScript Object Notation">JSON</abbr> Pointer</a> - access nested values with a pointer</li> </ul> <h2 id=version-history>Version history<a class=headerlink href=#version-history title="Permanent link">¶</a></h2> <ol> <li>Added in version 1.0.0. Fixed in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span> to throw <code class=highlight><span class=n>std</span><span class=o>::</span><span class=n>length_error</span></code> instead of emptying the array and accessing it out of bounds when <code>idx</code> equals the maximum value of <code>size_type</code>. A missing index in the const version is guarded by a runtime assertion since version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>.</li> <li>Added in version 1.0.0. Added overloads for <code>T* key</code> in version 1.1.0. The <code>T* key</code> overloads forward to overload 3 since version 3.11.0.</li> <li>Added in version 3.11.0. Support for keys convertible to <code>std::string_view</code> added in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>, consistently across the lookup functions.</li> <li>Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>. Throws <a href=../../../home/exceptions/#jsonexceptionparse_error109><code>parse_error.109</code></a> instead of <a href=../../../home/exceptions/#jsonexceptionout_of_range404><code>out_of_range.404</code></a> for a one-character array index that is not a digit (e.g., <code>/x</code>) in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>, as it already did for longer ones.</li> </ol> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="October 27, 2026 06:41:42 UTC">October 27, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <nav class="md-footer__inner md-grid" aria-label=Footer> <a href=../operator_value_t/ class="md-footer__link md-footer__link--prev" aria-label="Previous: operator value_t"> <div class="md-footer__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg> </div> <div class=md-footer__title> <span class=md-footer__dLine truncated
|
||||
</code></pre></div> </details> <h2 id=see-also>See also<a class=headerlink href=#see-also title="Permanent link">¶</a></h2> <ul> <li><a href=../../../features/element_access/unchecked_access/ >Unchecked access</a> - element access without range checking</li> <li><a href=../../../features/assertions/ >Runtime assertions</a> - assertions guarding against undefined behavior</li> <li><a href=../at/ ><code>at</code></a> - access by reference with range checking</li> <li><a href=../value/ ><code>value</code></a> - access with default value</li> <li><a href=../../basic_json_view/operator%5B%5D/ ><code>basic_json_view::operator[]</code></a> - the same access on a zero-copy view (a duplicate key resolves to the first member, whereas <code>parse()</code> keeps the last; a missing key gives a discarded view instead of undefined behavior)</li> <li><a href=../../../features/element_access/ >Element Access</a> - overview of all ways to access elements</li> <li><a href=../../../features/json_pointer/ ><abbr title="JavaScript Object Notation">JSON</abbr> Pointer</a> - access nested values with a pointer</li> </ul> <h2 id=version-history>Version history<a class=headerlink href=#version-history title="Permanent link">¶</a></h2> <ol> <li>Added in version 1.0.0. Fixed in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span> to throw <code class=highlight><span class=n>std</span><span class=o>::</span><span class=n>length_error</span></code> instead of emptying the array and accessing it out of bounds when <code>idx</code> equals the maximum value of <code>size_type</code>. A missing index in the const version is guarded by a runtime assertion since version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>.</li> <li>Added in version 1.0.0. Added overloads for <code>T* key</code> in version 1.1.0. The <code>T* key</code> overloads forward to overload 3 since version 3.11.0.</li> <li>Added in version 3.11.0. Support for keys convertible to <code>std::string_view</code> added in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>, consistently across the lookup functions.</li> <li>Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>. Throws <a href=../../../home/exceptions/#jsonexceptionparse_error109><code>parse_error.109</code></a> instead of <a href=../../../home/exceptions/#jsonexceptionout_of_range404><code>out_of_range.404</code></a> for a one-character array index that is not a digit (e.g., <code>/x</code>) in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span>, as it already did for longer ones. Fixed in version 3.13.0 <span class=unreleased-version title="Not part of a release yet; the latest release is 3.12.0.">unreleased</span> to leave the value unchanged if the non-const version throws (strong exception safety, as documented); before, values created for earlier reference tokens of <code>ptr</code> were kept.</li> </ol> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="October 27, 2026 16:15:55 UTC">October 27, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <nav class="md-footer__inner md-grid" aria-label=Footer> <a href=../operator_value_t/ cLine truncated
|
||||
@@ -77,12 +77,14 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
||||
|
||||
For the **const** version, an object key or array index in `ptr` that does not exist is not reported by an exception, but is undefined behavior (see the notes below). Use [`at`](https://json.nlohmann.me/api/basic_json/at/index.md) for checked access.
|
||||
|
||||
If the **non-const** version throws, the value is left unchanged: values it created for earlier reference tokens of `ptr` are removed again. This also holds for exceptions such as `std::bad_alloc` or `std::length_error` thrown while padding an array up to a very large index. With custom [template parameters](https://json.nlohmann.me/features/types/template_parameters/index.md), this requires that `erase()` of the object and array types and the move operations of the custom base class do not throw.
|
||||
|
||||
## Complexity
|
||||
|
||||
1. Constant if `idx` is in the range of the array. Otherwise, linear in `idx - size()`.
|
||||
1. Logarithmic in the size of the container.
|
||||
1. Logarithmic in the size of the container.
|
||||
1. Logarithmic in the size of the container.
|
||||
1. Linear in the number of reference tokens of `ptr`; for each of them, logarithmic in the size of the object, or constant for an array. When the non-const version pads an array with `null` values, it is additionally linear in `idx - size()` for that array.
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -114,6 +116,10 @@ The following cases apply to the **const** overloads; the non-const overloads in
|
||||
|
||||
When the JSON pointer traverses intermediate levels that don't exist at all yet (not just a missing leaf), each missing level is created as an array or an object depending on whether the corresponding pointer token is a valid array index: the token `0`, a sequence of digits that does not begin with `0`, or the token `-` creates an array, and every other token creates an object. For example, on an initially `null` value, `/foo/0/0/0` creates nested arrays, while `/foo/one/one/one` creates nested objects. Tokens such as `01` or the empty token cannot be array indices (cf. RFC 6901, Sect. 4) and therefore create objects, just as they would if the level already existed as an object. This is not specified by the JSON Pointer RFC; it is this library's own, intentional disambiguation rule. See also [JSON Pointer](https://json.nlohmann.me/features/json_pointer/index.md).
|
||||
|
||||
Large array indices
|
||||
|
||||
As the array is filled up with `null` values to the given index, the memory used grows with the index and not with the size of the pointer: on a 64-bit platform, the index `10000000` allocates about 160 MB. The library does not limit the index, so check the array indices of a JSON pointer from untrusted input before using it with the non-const version. See [Parsing untrusted input](https://json.nlohmann.me/features/parsing/untrusted_input/#json-pointers-and-flattened-keys).
|
||||
|
||||
Deprecation
|
||||
|
||||
Overload (4) also accepts a [`json_pointer`](https://json.nlohmann.me/api/json_pointer/index.md) whose template argument is a `basic_json` specialization (e.g., `nlohmann::json_pointer<nlohmann::json>`) instead of a string type. This is deprecated since version 3.11.0 and will be removed in a future major version; use `basic_json::json_pointer` (for `json`, `nlohmann::json_pointer<std::string>`) instead.
|
||||
@@ -503,4 +509,4 @@ Output:
|
||||
1. Added in version 1.0.0. Fixed in version 3.13.0 unreleased to throw `std::length_error` instead of emptying the array and accessing it out of bounds when `idx` equals the maximum value of `size_type`. A missing index in the const version is guarded by a runtime assertion since version 3.13.0 unreleased.
|
||||
1. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. The `T* key` overloads forward to overload 3 since version 3.11.0.
|
||||
1. Added in version 3.11.0. Support for keys convertible to `std::string_view` added in version 3.13.0 unreleased, consistently across the lookup functions.
|
||||
1. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since version 3.13.0 unreleased. Throws [`parse_error.109`](https://json.nlohmann.me/home/exceptions/#jsonexceptionparse_error109) instead of [`out_of_range.404`](https://json.nlohmann.me/home/exceptions/#jsonexceptionout_of_range404) for a one-character array index that is not a digit (e.g., `/x`) in version 3.13.0 unreleased, as it already did for longer ones.
|
||||
1. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since version 3.13.0 unreleased. Throws [`parse_error.109`](https://json.nlohmann.me/home/exceptions/#jsonexceptionparse_error109) instead of [`out_of_range.404`](https://json.nlohmann.me/home/exceptions/#jsonexceptionout_of_range404) for a one-character array index that is not a digit (e.g., `/x`) in version 3.13.0 unreleased, as it already did for longer ones. Fixed in version 3.13.0 unreleased to leave the value unchanged if the non-const version throws (strong exception safety, as documented); before, values created for earlier reference tokens of `ptr` were kept.
|
||||
Reference in new issue
Block a user