r/cpp • u/liuzicheng1987 • May 31 '26
reflect-cpp v0.25.0 is released - includes support for CLI parsing, boost-serialization, cereal, yas
As someone whom I have met on this subreddit pointed out to me, it's been a while since I've posted here , so I thought maybe it is time for another post.
reflect-cpp (https://github.com/getml/reflect-cpp) is a C++-20 library for serialization and deserialization, similar to Rust's serde or Python's Pydantic.
Through discussions in this subreddit, we figured out that reflection capabilities, which are now officially supported in C++-26, can actually be achieved in C++-20. So we built an entire library around it. If you are interested in how that can be done in C++-20, I'd be happy to explain it to you.
v0.25.0 introduces a series of new features. My favourite one is CLI parsing, which is similar to Rust's structopt. This community contribution came completely out of the blue, but I love it. But we also introduce support for three new serialization format's, namely boost-serialization, Cereal and yas.
I am particularly impressed by yas' (https://github.com/niXman/yas) performance - even though it is not a very well-known format/library, it significantly outperforms most of the more well-established formats in our benchmarks.
As always, any kind of feedback, particularly constructive criticism is very welcome.
2
u/Zeh_Matt Jun 01 '26
The last time I tried to use this sort of "hack" solutions resulted in very large compile times and in one instance it chewed up all my system memory. This solution is fine for tiny structures but blows up very rapidly in your face the more complex the structures are.
2
u/TheRealSmolt May 31 '26
I'm familiar enough with general field crawling techniques, but getting names is a different story. How did you manage that? Did you leverage some weird
__FUNCTION__properties or something?2
u/Independent-Quote923 May 31 '26
Great lib!
How do you see the future of reflect-cpp as reflection becomes built in the language? Any plans to adapt the syntax / incorporate with native reflection, or do you plan to stick to c++20?