Skip to content

Commit

Permalink
📝 add comment on iterator invalidation #4279 #4289
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Dec 7, 2024
1 parent 01b956d commit ec90e63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/mkdocs/docs/api/basic_json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ class basic_json;

## Iterator invalidation

Todo
All operations that add values to arrays (`push_back`, `operator+=`, `emplace_back`, `insert`, and also assignment to
the result of `operator[]` for non-existing indices) can yield a reallocation, in which case all iterators (including
the `end()` iterator) and all references to the elements are invalidated.

For `ordered_json`, also all operations that add a value to an object (`push_back`, `operator+=`, `clear`, `emplace`,
`erase`, `insert`, `update`, and assignment to the result `operator[]` for a non-existing key) can yield a reallocation,
in which case all iterators (including the `end()` iterator) and all references to the elements are invalidated.

## Requirements

Expand Down

0 comments on commit ec90e63

Please sign in to comment.