diff --git a/docs/README.md b/docs/README.md index 1c12ac6d..a00eb16d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,7 +10,7 @@ 1.3) [Struct flattening](https://github.com/getml/reflect-cpp/blob/main/docs/flatten_structs.md) - For making struct A "inherit" the fields of struct B. -1.4) [Anonymous fields](https://github.com/getml/reflect-cpp/blob/main/docs/anonymous_fields.md) - For structs without field names or `rfl::Field`. +1.4) [The rfl::Field-syntax](https://github.com/getml/reflect-cpp/blob/main/docs/field_syntax.md) - Describes an alternative syntax which requires slightly more effort, but allows for some powerful functionalities. 1.5) [String literals](https://github.com/getml/reflect-cpp/blob/main/docs/literals.md) - For representing strings that can only assume a limited number of enumerated values. diff --git a/docs/field_syntax.md b/docs/field_syntax.md index 08e023b0..a3a5c286 100644 --- a/docs/field_syntax.md +++ b/docs/field_syntax.md @@ -19,6 +19,11 @@ should be negligible in most cases, this allows for compile-time checks which are otherwise impossible. It also allows for functionalities like `rfl::replace`, `rfl::as` or interactions with `rfl::NamedTuple` which we will see later in the documentation. +There are a two things you have to keep in mind: + +1) If you annotate *some* of the fields using either `rfl::Field`, then you must annotate *all* of them using one of these two. +2) If you are combining structs using `rfl::Flatten`, then they structs combined like this must either be annotated or not. + You can initilize your struct like this: ```cpp