Address the second review round of json_view element access

From gregmarr's review of #5622:

- begin()/end(): "a null value or a discarded view iterates as an empty
  range", singular like the primitive case before it.
- The class page's list of function groups has no trailing commas.
- document_data::key_equals() compares a key node with a string, for the
  key comparisons that were spelled out in each lookup.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-18 22:20:57 +02:00
1 parent 8abbc36d7d
commit 0660e6d482
5 files changed
+17 -12

No files matched your search

@@ -6,7 +6,7 @@ iterator begin() const noexcept;
Returns an iterator to the first element of an array, or the first member value of an object, in **document order**
-- the order the values appear in the source text, not sorted by key. A primitive value iterates as a range of one
element (itself); `#!json null` and a [discarded](is_discarded.md) view iterate as an empty range.
element (itself), and a `#!json null` value or a [discarded](is_discarded.md) view iterates as an empty range.
## Return value
+2 -3
View File
@@ -5,9 +5,8 @@ iterator end() const noexcept;
```
Returns an iterator to one past the last element of an array, one past the last member value of an object, in
**document order** -- see [`begin()`](begin.md). A primitive value iterates as a range of one element (itself);
`#!json null` and a [discarded](is_discarded.md) view iterate as an empty range, so `#!cpp begin() == end()` for
them.
**document order** -- see [`begin()`](begin.md). A primitive value iterates as a range of one element (itself), and a
`#!json null` value or a [discarded](is_discarded.md) view iterates as an empty range (`#!cpp begin() == end()`).
## Return value
@@ -22,12 +22,12 @@ Moving the document itself does not invalidate its views: the index is heap-allo
`basic_json_view` provides the read-only part of the `BasicJsonType` interface:
- the type-inspection functions,
- element access,
- lookup,
- iteration, and
- the type-inspection functions
- element access
- lookup
- iteration
- conversion: [`get<T>()`](get.md), [`get_string()`](get_string.md), [`number_token()`](number_token.md), and
[`materialize()`](materialize.md) to build the `BasicJsonType` value of a subtree on demand.
[`materialize()`](materialize.md) to build the `BasicJsonType` value of a subtree on demand
[`operator[]`](operator%5B%5D.md), [`at`](at.md), [`contains`](contains.md), and [`value`](value.md) also accept a
[`json_pointer`](../json_pointer/index.md). It does not (yet) provide `dump()` or comparison. Unlike `basic_json`,