Skip to content

Commit 37bb4d9

Browse files
committed
📝 address review comments
Signed-off-by: Niels Lohmann <[email protected]>
1 parent 7bf9a06 commit 37bb4d9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

docs/mkdocs/docs/api/basic_json/end_pos.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ constexpr std::size_t end_pos() const noexcept;
66
#endif
77
```
88

9-
Returns the position after the last character of the JSON string the value was parsed from.
9+
Returns the position immediately following the last character of the JSON string from which the value was parsed,
10+
provided the value originated from a string. If the value was constructed by other means, the function returns
11+
`std::string::npos`.
1012

1113
| JSON type | return value |
1214
|-----------|-----------------------------------|

docs/mkdocs/docs/api/basic_json/start_pos.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ constexpr std::size_t start_pos() const noexcept;
66
#endif
77
```
88

9-
Returns the position of the first character of the JSON string the value was parsed from.
9+
Returns the position of the first character in the JSON string from which the value was parsed, provided the value
10+
originated from a string. If the value was constructed by other means, the function returns `std::string::npos`.
1011

1112
| JSON type | return value |
1213
|-----------|------------------------------------------------|

docs/mkdocs/docs/api/macros/json_diagnostic_positions.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ When enabled, two new member functions [`start_pos()`](../basic_json/start_pos.m
1010
[`end_pos()`](../basic_json/end_pos.md) are added to [`basic_json`](../basic_json/index.md) values.
1111
[`start_pos()`](../basic_json/start_pos.md) returns the start position of that JSON value in the original JSON string
1212
the object was parsed from. Likewise, [`end_pos()`](../basic_json/end_pos.md) returns the end position of that JSON
13-
value in the original string the object was parsed from.
13+
value in the original string the object was parsed from. If the value was not parsed, but constructed by other means,
14+
the functions returns `std::string::npos`.
1415
1516
[`start_pos()`](../basic_json/start_pos.md) returns the first character of a given value in the original JSON string,
1617
while [`end_pos()`](../basic_json/end_pos.md) returns the character _following_ the last character. For objects and
@@ -31,11 +32,9 @@ Given the above, [`end_pos()`](../basic_json/end_pos.md)` - `[`start_pos()`](../
3132
value provides the length of the parsed JSON string for that value, including the opening or closing braces, brackets,
3233
or quotes.
3334
34-
[`start_pos()`](../basic_json/start_pos.md) and [`end_pos()`](../basic_json/end_pos.md) are only set if the JSON value
35-
was parsed using [`parse()`](../basic_json/parse.md). For all other cases,`std::string::npos` will be returned.
36-
3735
Note that enabling this macro increases the size of every JSON value by two `std::size_t` fields and adds slight runtime
38-
overhead.
36+
overhead to parsing, copying JSON value objects, and the generation of error messages for exceptions. It also causes
37+
these values to be reported in those error messages.
3938
4039
## Default definition
4140

0 commit comments

Comments
 (0)