set(target, scalar) on an array/object that spans more than one node first switches the container that target is in to links, since that container steps over target's parsed subtree by its node count. The container was looked up from root(); for a target that is no longer part of the document (an edit erased or replaced it, or a value that contains it) the lookup found nothing and the scalar was written anyway. The dropped container then read past its nodes when walked, and a later edit of it made block_of() write more links than the block it allocated holds. When the lookup from root() fails, look for the container whose contiguous layout still steps over the slot: the nearest container before it in its allocation whose extent covers it (edits never enlarge an extent, so this is the original parent). If that container still uses its layout, it switches to links as a live parent does. Every other edit through a view of a dropped value already worked and changed only the detached value; the scalar set now does the same, as documented. Also stop block_of() when its block is full, so that it never writes past the capacity it allocated. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Documentation
Generate documentation
Note on documentation: The source files contain links to the online documentation at https://json.nlohmann.me.
This URL provides the most recent documentation and also applies to previous versions. Documentation for deprecated
functions is not removed; instead, it is marked as deprecated.
If you want to view the documentation for a specific tag or commit hash, you can generate it locally as follows (example
using tag v3.12.0):
git clone https://github.com/nlohmann/json.git
cd json
git checkout v3.12.0
make install_venv serve -C docs/mkdocs
Open http://127.0.0.1:8000/ in your browser. Replace any URL in the source code that points to
https://json.nlohmann.me with http://127.0.0.1:8000 to view the documentation for the selected tag or commit hash.