zserio
zserio copied to clipboard
Add support for compile time reflection
ZSerio currently supports runtime reflection. There is no compile time reflection. With compile time reflection one can:
- iterate over the members of a c++ struct
- iterate over the names of the c++ fields. If a structure has compile time reflection one can define template functions that can work on any such struct. For example a comparison operator, hash function, json or yaml generated for a struct.
Compared to runtime reflecting it has the following advantages:
- Errors in code are discovered at compile time instead of runtime.
- Better runtime performance
- templated function can be in a seperate header that you don't include if you do not need it. This prevents discussions on what functions a struct generated for a zserio struct must support and prevents code blot in the code emitted by the zserio compiler.