Added rfl::NoOptionals; resolved #100 (#105)

This commit is contained in:
liuzicheng1987
2024-05-26 21:32:00 +02:00
committed by GitHub
parent 43ebb0bb24
commit 1eed713fff
11 changed files with 166 additions and 21 deletions
+2 -1
View File
@@ -13,7 +13,8 @@ But Bart doesn't have any children. After all, he's only 10 years old. To indica
we can use either `std::optional`, `std::shared_ptr` or `std::unique_ptr`.
If `std::optional` is `std::nullopt` or any of the smart pointers is a `nullptr`,
then the field will not be written to the JSON string. Likewise, when you read the JSON string, the fields will not be required.
then the field will not be written to the JSON string. Likewise, when you read the JSON string, the fields will not be required. If you
want the fields to be required, you can use the `rfl::NoOptionals` processor, please refer to the section on processors.
So this is how we could rewrite the previous example: