Closed NickStrupat closed 2 years ago
Thanks. I have explored these options quite heavily. However, they are simply not powerful enough. Boost.PFR provides "very basic reflection" (from their website description) because that's the most that can be accomplished without macros IMO.
@NickStrupat just to chime in what @veselink1 already hinted at.
We also looked heavily into macro-free reflection but believe that these are necessary at least until the compile-time reflection proposal is merged with the C++ standard (present estimate/hope is C++26).
IMHO there are at least two reasons that justify the macros:
Other non-macro-based reflection engines implicitly require that all fields are deflectable and always in the same order as their definition. This can be an issue w.r.t. nested types and if there are types that need to be mandatorily skipped.
All in all, I like the present refl-cpp functionality as it's close to what is being proposed to become part of the C++ standard. There are some aspects regarding member-function parameter type deduction that @veselink1 commented that this can be easily also implemented in the user-code.
Thanks folks for the informative replies :)
Hi, thank you for providing this great library.
The API of this project is very good, but the requirement of using macros is not ideal. There are some abilities to do reflection without macros, and they are used by Boost.PFR and magic_enum.
Have you looked into using these approaches to remove the need for calling macros in your library?
Thanks!