1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00

Consolidate documentation (#3071)

* 🔥 consolidate documentation
* ♻️ overwork std specializations
* 🚚 move images files to mkdocs
* ♻️ fix URLs
* 🔧 tweak MkDocs configuration
* 🔧 add namespaces
* 📝 document deprecations
* 📝 document documentation generation
* 🚸 improve search
* 🚸 add examples
* 🚧 start adding documentation for macros
* 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139
* 📝 overwork example handling
* 📝 fix Markdown tables
This commit is contained in:
Niels Lohmann
2021-12-29 13:41:01 +01:00
committed by GitHub
parent 6d3115924c
commit 29cd970b94
392 changed files with 4827 additions and 12560 deletions

View File

@ -66,7 +66,7 @@ The JSON iterators have two member functions, `key()` and `value()` to access th
### Range-based for loops
C++11 allows to use range-based for loops to iterate over a container.
C++11 allows using range-based for loops to iterate over a container.
```cpp
for (auto it : j_object)
@ -76,7 +76,7 @@ for (auto it : j_object)
}
```
For this reason, the `items()` function allows to access `iterator::key()` and `iterator::value()` during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.
For this reason, the `items()` function allows accessing `iterator::key()` and `iterator::value()` during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.
```cpp
for (auto& el : j_object.items())
@ -85,7 +85,7 @@ for (auto& el : j_object.items())
}
```
The items() function also allows to use structured bindings (C++17):
The items() function also allows using structured bindings (C++17):
```cpp
for (auto& [key, val] : j_object.items())
@ -151,5 +151,5 @@ Note that "value" means a JSON value in this setting, not values stored in the u
## Iterator invalidation
| Operations | invalidated iterators |
| ---------- | --------------------- |
|------------|-----------------------|
| `clear` | all |