zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Add support for compile time reflection

Open reinco opened this issue 10 months ago • 0 comments

ZSerio currently supports runtime reflection. There is no compile time reflection. With compile time reflection one can:

  1. iterate over the members of a c++ struct
  2. 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:

  1. Errors in code are discovered at compile time instead of runtime.
  2. Better runtime performance
  3. 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.

reinco avatar Apr 26 '24 13:04 reinco