r/cpp • u/Xadartt • Jun 05 '26
More C++26 reflection at compile-time
https://andreasfertig.com/blog/2026/06/more-cpp26-reflection-at-compile-time/
74
Upvotes
r/cpp • u/Xadartt • Jun 05 '26
5
u/friedkeenan Jun 05 '26 edited Jun 05 '26
Yep, this is neat. I actually wrote a similar thing some time ago, which can be called like
to_bytes<std::endian::big>(...). It's cool to see how the logic came out to be extremely extremely similar.Though it's possible to extend this post's logic by calling
subobjects_ofinstead ofnonstatic_data_members_of, and that would let you serialize base subobjects too. But that's probably not super relevant to sending packets over a network.-42
u/[deleted] Jun 05 '26
[removed] — view removed comment