📝 address review comments
This commit is contained in:
parent
a1755a0b2b
commit
d6b65aad48
@ -4,8 +4,7 @@
|
||||
#define JSON_ASSERT(x) /* value */
|
||||
```
|
||||
|
||||
This macro controls which code is executed for [runtime assertions](../../features/assertions.md) of the libraries. It
|
||||
is set by the library, but can be overridden by defining it before including the library.
|
||||
This macro controls which code is executed for [runtime assertions](../../features/assertions.md) of the library.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ detected incorrectly.
|
||||
|
||||
## Default definition
|
||||
|
||||
The default value is detected based on the preprocessor macros `#!cpp __cplusplus`, `#!cpp _HAS_CXX17`, or
|
||||
The default value is detected based on preprocessor macros such as `#!cpp __cplusplus`, `#!cpp _HAS_CXX17`, or
|
||||
`#!cpp _MSVC_LANG`.
|
||||
|
||||
## Notes
|
||||
|
||||
@ -37,7 +37,7 @@ By default, the macros map to their respective C++ keywords:
|
||||
|
||||
When exceptions are switched off, the `#!cpp try` block is executed unconditionally, and throwing exceptions is
|
||||
replaced by calling [`std::abort`](https://en.cppreference.com/w/cpp/utility/program/abort) to make reaching the
|
||||
`cpp throw` branch abort the process.
|
||||
`#!cpp throw` branch abort the process.
|
||||
|
||||
```cpp
|
||||
#define JSON_THROW_USER(exception) std::abort()
|
||||
|
||||
@ -11,7 +11,7 @@ sets `JSON_USE_IMPLICIT_CONVERSIONS` accordingly.
|
||||
|
||||
## Default definition
|
||||
|
||||
By default, implicit conversions are enabled
|
||||
By default, implicit conversions are enabled.
|
||||
|
||||
```cpp
|
||||
#define JSON_USE_IMPLICIT_CONVERSIONS 1
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
```
|
||||
|
||||
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
||||
serialization and want to user the member variable names as object keys in that object. The macro is to be defined
|
||||
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
||||
**inside** the class/struct to create code for.
|
||||
Unlike [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](nlohmann_define_type_non_intrusive.md), it can access private members.
|
||||
The first parameter is the name of the class/struct, and all remaining parameters name the members.
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
```
|
||||
|
||||
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
||||
serialization and want to user the member variable names as object keys in that object. The macro is to be defined
|
||||
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
||||
**outside** the class/struct to create code for, but **inside** its namespace.
|
||||
Unlike [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](nlohmann_define_type_intrusive.md), it **cannot** access private members.
|
||||
The first parameter is the name of the class/struct, and all remaining parameters name the members.
|
||||
@ -45,7 +45,7 @@ See examples below for the concrete generated code.
|
||||
2. The macro must be used outside the type (class/struct).
|
||||
3. The passed members must be public.
|
||||
|
||||
!!! warning "Implementation limit"
|
||||
!!! warning "Implementation limits"
|
||||
|
||||
- The current implementation is limited to at most 64 member variables. If you want to serialize/deserialize types
|
||||
with more than 64 member variables, you need to define the `to_json`/`from_json` functions manually.
|
||||
|
||||
@ -94,9 +94,12 @@ There are four macros to make your life easier as long as you (1) want to use a
|
||||
|
||||
In all macros, the first parameter is the name of the class/struct, and all remaining parameters name the members. You can read more docs about them starting from [here](macros.md#nlohmann_define_type_intrusivetype-member).
|
||||
|
||||
!!! info "Implementation limit"
|
||||
!!! info "Implementation limits"
|
||||
|
||||
At most 64 member variables can be passed to these macros.
|
||||
- The current macro implementations are limited to at most 64 member variables. If you want to serialize/deserialize
|
||||
types with more than 64 member variables, you need to define the `to_json`/`from_json` functions manually.
|
||||
- The macros only work for the [`nlohmann::json`](../api/json.md) type; other specializations such as
|
||||
[`nlohmann::ordered_json`](../api/ordered_json.md) are currently unsupported.
|
||||
|
||||
??? example
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user