mirror of
https://github.com/nlohmann/json.git
synced 2026-10-05 22:20:30 +00:00
Fix with_t nav entry and document chaining of the with_*_t aliases
Indent the with_t entry in mkdocs.yml so it is listed under basic_json, explain that the aliases can be chained and work on ordered_json, and test both, including json::with_object_t<ordered_map> == ordered_json. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -96,6 +96,18 @@ with_base_class_t<CustomBaseClass2>
|
||||
All other template parameters are kept unchanged, so the resulting type still uses, for instance, the same
|
||||
`ObjectType` unless `with_object_t` itself is used.
|
||||
|
||||
The aliases are members of every `basic_json` specialization, including [`ordered_json`](../ordered_json.md), and the
|
||||
type they produce is again a `basic_json` specialization. They can therefore be chained to replace several template
|
||||
parameters at once:
|
||||
|
||||
```cpp
|
||||
using my_json = nlohmann::json::with_integers_t<int, unsigned int>::with_float_t<float>;
|
||||
using my_ordered_json = nlohmann::ordered_json::with_string_t<std::wstring>;
|
||||
```
|
||||
|
||||
The result is the same type as spelling out all template parameters, so the order of the chained aliases does not
|
||||
matter. For instance, `nlohmann::json::with_object_t<nlohmann::ordered_map>` is `nlohmann::ordered_json`.
|
||||
|
||||
## Examples
|
||||
|
||||
??? example
|
||||
|
||||
@@ -232,7 +232,7 @@ nav:
|
||||
- 'update': api/basic_json/update.md
|
||||
- 'value': api/basic_json/value.md
|
||||
- 'value_t': api/basic_json/value_t.md
|
||||
- 'with_t': api/basic_json/with_t.md
|
||||
- 'with_t': api/basic_json/with_t.md
|
||||
- byte_container_with_subtype:
|
||||
- 'Overview': api/byte_container_with_subtype/index.md
|
||||
- '(constructor)': api/byte_container_with_subtype/byte_container_with_subtype.md
|
||||
|
||||
Reference in New Issue
Block a user