TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24724 16
C++26 Reflection: Autocereal - Use the Cereal Serialization Library With Just A #include (No Class Instrumentation Required)

I ran this up to show and tell a couple days ago, but the proof of concept is much further along now. My goal for this project was to allow anyone to use Cereal to serialize their classes without having to write serialization functions for them. This project does that with the one exception that private members are not being returned by the reflection API (I'm pretty sure they should be,) so my private member test is currently failing. You will need to friend class cereal::access in order to serialize private members once that's working, as I do in the unit test.


Other than that, it's very non-intrusive. Just include the header and serialize stuff (See the Serialization Unit Test Nothing up my sleeve.


If you've looked at Cereal and didn't like it because you had to retype all your class member names, that will soon not be a concern. Writing libraries is going to be fun for the next few years!

https://redd.it/1qq2npd
@r_cpp
GitHub FlyingRhenquest - Overview FlyingRhenquest has 39 repositories available. Follow their code on GitHub.
More from @r_cpp
  1. Oct 7, 2026Escaping `CreateProcess()` arguments on Windows https://holyblackcat.github.io/blog/2026/0…
  2. Oct 7, 2026flat_map internals https://quantdev.blog/posts/flat-map-internals/index.html https://redd.…
  3. Oct 7, 2026New C++ Conference Videos Released This Month - September 2026 C++Now 2026-08-31 - 2026-09…
  4. Oct 7, 2026Jean Frantz René: C++ Memory safety for safety-critical and non-safety critical applicatio…
  5. Oct 7, 2026Full Meeting C++ 2026 program released https://meetingcpp.com/mcpp/schedule/#2026 https://…
  6. Oct 7, 2026Qt moc now can handle basic C++ modules (Qt 6.12) https://codereview.qt-project.org/c/qt/q…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →