diff --git a/docs/processors.md b/docs/processors.md index 14b43d8a..12a7a6d2 100644 --- a/docs/processors.md +++ b/docs/processors.md @@ -62,9 +62,9 @@ The resulting JSON string looks like this: {"type":"Person","first_name":"Homer","last_name":"Simpson","age":45} ``` -### `rfl::AddStructsToVariants` +### `rfl::AddTagsToVariants` -This processor automatically adds structs to variants. Consider the following example: +This processor automatically adds tags to variants. Consider the following example: ```cpp struct button_pressed_t {}; @@ -79,8 +79,8 @@ using my_event_type_t = std::variant; ``` -The problem here is that `button_pressed_t` and `butten_released_t` virtually look -indistinguishable. The will both be serialized to `{}`. +The problem here is that `button_pressed_t` and `button_released_t` virtually look +indistinguishable when they are serialized. The will both be serialized to `{}`. But you can add this processor to automatically add tags and avoid the problem: @@ -114,6 +114,9 @@ struct key_pressed_t { {"your_custom_tag":{"key":99}} ``` +Note that there are other ways to address problems like this, for instance `rfl::TaggedUnion`. +Please refer to the relevant sections of the documentation. + ### `rfl::AllowRawPtrs` By default, reflect-cpp does not allow *reading into* raw pointers. (*Writing from* raw pointers is never a problem.) This is because reading into raw pointers means that the library will allocate memory that the user then has to manually delete. This can lead to misunderstandings and memory leaks.