mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
Document the node index of json_view on the architecture page
A new section describes the 16-byte node: its fields, how integers, floats, and object members are stored, how views navigate without pointers, and a worked example. The feature page and the pages of basic_json_document and node_count link to it where they mention the 16 bytes. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -7,9 +7,10 @@ template<typename BasicJsonType>
|
||||
class basic_json_document;
|
||||
```
|
||||
|
||||
A parsed JSON text, held as a flat index of its values (16 bytes per value) instead of a tree of `BasicJsonType`
|
||||
values. Strings and numbers stay in the source text; only strings that contain escapes are decoded, into one buffer
|
||||
owned by the document. [`basic_json_view`](../basic_json_view/index.md) is a read-only handle to one value of a
|
||||
A parsed JSON text, held as a flat index of its values
|
||||
([16 bytes per value](../../home/architecture.md#node-index-of-json-views)) instead of a tree of `BasicJsonType` values.
|
||||
Strings and numbers stay in the source text; only strings that contain escapes are decoded, into one buffer owned by
|
||||
the document. [`basic_json_view`](../basic_json_view/index.md) is a read-only handle to one value of a
|
||||
`basic_json_document`; [`materialize()`](../basic_json_view/materialize.md) turns a subtree back into the
|
||||
`BasicJsonType` value that [`BasicJsonType::parse()`](../basic_json/parse.md) would have produced for it.
|
||||
|
||||
|
||||
@@ -21,8 +21,9 @@ Constant.
|
||||
|
||||
## Notes
|
||||
|
||||
Each index entry is 16 bytes, so `#!cpp node_count() * 16` is the size of the index itself (part, but not all, of
|
||||
[`memory_usage()`](memory_usage.md), which also counts decoded strings and, for an owned document, the text).
|
||||
Each index entry is [16 bytes](../../home/architecture.md#node-index-of-json-views), so `#!cpp node_count() * 16` is
|
||||
the size of the index itself (part, but not all, of [`memory_usage()`](memory_usage.md), which also counts decoded
|
||||
strings and, for an owned document, the text).
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
Reference in New Issue
Block a user