Using type_traits and constexpr to make code more readable/debuggable
summary
Macro-based reflection for serialization gets replaced by real type traits and constexpr so generated code disappears and debugging becomes possible. The code uses enable_if and is_trivially_copyable to choose implementations, then simplifies to one overload with if constexpr so trivial-copy paths compile away. Compile-time string hashing moves from recursive constexpr to loop-based constexpr, and a user-defined literal removes remaining macros; the resource system accepts std::vector and the approach actually works.
AI-written summary · about
chapters (6)
- 0:00Start
- 1:13The Macro Version
- 2:34Yay no macros
- 3:47Constexpr loops
- 4:32Can we get rid of more macros?
- 4:46User-defined literals to the rescue
related talks
45mBetter C++14 reflections
01h 05mC++11 in the Wild: Techniques from a Real Codebase
59mCombining C++17 Features
24mMacros for a More Productive Rust
57mBuilding a C++ Reflection System
01h 00mKilling C++ Serialization Overhead & Complexity
01h 03mC++ Reflection: Back on Track
01h 02mEmbedded Friendly C++: Features That Make a Difference
