mirror of
https://github.com/nlohmann/json.git
synced 2026-08-22 00:53:18 +00:00
Overwork documentation (#4516)
This commit is contained in:
@@ -27,6 +27,15 @@ void push_back(initializer_list_t init);
|
||||
`init` is converted into an object element and added using `push_back(const typename object_t::value_type&)`.
|
||||
Otherwise, `init` is converted to a JSON value and added using `push_back(basic_json&&)`.
|
||||
|
||||
## Iterator invalidation
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## Parameters
|
||||
|
||||
`val` (in)
|
||||
@@ -99,6 +108,11 @@ All functions can throw the following exception:
|
||||
--8<-- "examples/push_back__initializer_list.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [emplace_back](emplace_back.md) add a value to an array
|
||||
- [operator+=](operator+=.md) add a value to an array/object
|
||||
|
||||
## Version history
|
||||
|
||||
1. Since version 1.0.0.
|
||||
|
||||
Reference in New Issue
Block a user