(The link above shows ImGui generation, but the same exact logic can be applied for serialiation to JSON/YAML/whatever.)
> The magic sauce? Boost.PFR! An incredibly clever library that enables reflections on aggregates, even in C++17.
That's not vanilla C++!
A guiding principle of C++ is that if something can be implemented cleanly and efficiently in a library, the language should not be extended to support the use case.
Now boost.pfr is exceedingly clever, but relying on speculative pack expansions or using stateful metaprogramming hacks is not something I would call clean and efficient, so proper reflection is warranted.
I do worry about the compile time impact though.
PFR has given us reflection since C++14.
I also don't think the Standard Library is particularly well-defined nor well-implemented, as demonstrated by the atrocious compilation times.
That is if you are worried about doing this by hand reflection is not the answer, something like protobuf where your data structures are generated is the answer.