Skip to content

Commit

Permalink
📝 address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Dec 9, 2024
1 parent b8297c3 commit bf1e029
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 17 deletions.
8 changes: 8 additions & 0 deletions docs/mkdocs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ install_venv: requirements.txt
# uninstall the virtual environment
uninstall_venv: clean
rm -fr venv

update_requirements:
rm -fr venv_small
python3 -mvenv venv_small
venv_small/bin/pip3 install pur
venv_small/bin/pur -r requirements.txt
rm -fr venv_small venv
make install_venv
4 changes: 2 additions & 2 deletions docs/mkdocs/docs/api/basic_json/emplace_back.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Creates a JSON value from the passed parameters `args` to the end of the JSON va
## Iterator invalidation
By adding an element to an array, a reallocation can happen, in which case all iterators (including
the [`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the
By adding an element to an array to the end of the array, a reallocation can happen, in which case all iterators
(including the [`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the
[`end()`](end.md) iterator is invalidated.
## Parameters
Expand Down
15 changes: 7 additions & 8 deletions docs/mkdocs/docs/api/basic_json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ class basic_json;

## Iterator invalidation

All operations that add values to arrays ([`push_back`](push_back.md) , [`operator+=`](operator+=.md),
[`emplace_back`](emplace_back.md), [`insert`](insert.md), and also assignment to the result of
[`operator[]`](operator%5B%5D.md) for non-existing indices) can yield a reallocation, in which case all iterators
(including the [`end()`](end.md) iterator) and all references to the elements are invalidated.
All operations that add values to an **array** ([`push_back`](push_back.md) , [`operator+=`](operator+=.md),
[`emplace_back`](emplace_back.md), [`insert`](insert.md), and [`operator[]`](operator%5B%5D.md) for a non-existing
index) can yield a reallocation, in which case all iterators (including the [`end()`](end.md) iterator) and all
references to the elements are invalidated.

For [`ordered_json`](../ordered_json.md), also all operations that add a value to an object
For [`ordered_json`](../ordered_json.md), also all operations that add a value to an **object**
([`push_back`](push_back.md), [`operator+=`](operator+=.md), [`emplace`](emplace.md), [`insert`](insert.md),
[`update`](update.md), and assignment to the result [`operator[]`](operator%5B%5D.md) for a non-existing key) can yield
a reallocation, in which case all iterators (including the [`end()`](end.md) iterator) and all references to the
elements are invalidated.
[`update`](update.md), and [`operator[]`](operator%5B%5D.md) for a non-existing key) can yield a reallocation, in
which case all iterators (including the [`end()`](end.md) iterator) and all references to the elements are invalidated.

## Requirements

Expand Down
6 changes: 4 additions & 2 deletions docs/mkdocs/docs/api/basic_json/insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ void insert(const_iterator first, const_iterator last);
For all cases where an element is added to an **array**, a reallocation can happen, in which case all iterators
(including the [`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the
[`end()`](end.md) iterator is invalidated.
[`end()`](end.md) iterator is invalidated. Also, any iterator or reference after the insertion point will point to the
same index which is now a different value.
For [`ordered_json`](../ordered_json.md), also adding an element to an **object** can yield a reallocation which again
invalidates all iterators and all references.
invalidates all iterators and all references. Also, any iterator or reference after the insertion point will point to
the same index which is now a different value.
## Parameters
Expand Down
3 changes: 2 additions & 1 deletion docs/mkdocs/docs/api/ordered_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This type preserves the insertion order of object keys.

The type is based on [`ordered_map`](ordered_map.md) which in turn uses a `std::vector` to store object elements.
Therefore, adding object elements can yield a reallocation in which case all iterators (including the
[`end()`](basic_json/end.md) iterator) and all references to the elements are invalidated.
[`end()`](basic_json/end.md) iterator) and all references to the elements are invalidated. Also, any iterator or
reference after the insertion point will point to the same index which is now a different value.

## Examples

Expand Down
7 changes: 4 additions & 3 deletions docs/mkdocs/docs/features/assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ behavior and yields a runtime assertion.

### Reading from a null `FILE` or `char` pointer

Reading from a null `#!cpp FILE` or `#!cpp char` pointer is undefined behavior.
Until version 3.11.4, a runtime assertion was triggered.
Since version 3.11.4, a [`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) is thrown instead.
Reading from a null `#!cpp FILE` or `#!cpp char` pointer in C++ is undefined behavior. Until version 3.11.4, this
library asserted that the pointer was not `nullptr` using a runtime assertion. If assertions were disabled, this would
result in undefined behavior. Since version 3.11.4, this library checks for `nullptr` and throws a
[`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) to prevent the undefined behavior.

??? example "Example 4: Reading from null pointer"

Expand Down
1 change: 1 addition & 0 deletions docs/mkdocs/docs/home/customers.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ the result of an internet search. If you know further customers of the library,
- [**Meta Yoga**](https://github.com/facebook/yoga), a layout engine that facilitates flexible and efficient user interface design across multiple platforms
- [**NVIDIA Nsight Compute**](https://docs.nvidia.com/nsight-compute/2022.2/pdf/CopyrightAndLicenses.pdf), a performance analysis tool for CUDA applications that provides detailed insights into GPU performance metrics
- [**Notepad++**](https://github.com/notepad-plus-plus/notepad-plus-plus), a free source code editor that supports various programming languages
- [**OpenRGB**](https://gitlab.com/CalcProgrammer1/OpenRGB), an open source RGB lighting control that doesn't depend on manufacturer software
- [**OpenTelemetry C++**](https://github.com/open-telemetry/opentelemetry-cpp): a library for collecting and exporting observability data in C++, enabling developers to implement distributed tracing and metrics in their application
- [**Qt Creator**](https://doc.qt.io/qtcreator/qtcreator-attribution-json-nlohmann.html), an IDE for developing applications using the Qt application framework
- [**Scanbot SDK**](https://docs.scanbot.io/barcode-scanner-sdk/web/third-party-libraries/): a software development kit (SDK) that provides tools for integrating advanced document scanning and barcode scanning capabilities into applications
Expand Down
Binary file modified docs/mkdocs/docs/images/customers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/mkdocs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdocs==1.6.1 # documentation framework
mkdocs-git-revision-date-localized-plugin==1.3.0 # plugin "git-revision-date-localized"
mkdocs-material==9.5.46 # theme for mkdocs
mkdocs-material==9.5.48 # theme for mkdocs
mkdocs-material-extensions==1.3.1 # extensions
mkdocs-minify-plugin==0.8.0 # plugin "minify"
mkdocs-redirects==1.2.2 # plugin "redirects"

0 comments on commit bf1e029

Please sign in to comment.