Better C++14 reflections
summary
Claims a working C++14 reflection solution that needs no macros or external tooling and ships as Boost.PPR (GitHub). Implements auto ostream, comparisons, hashing and serializers by deriving field count via aggregate initialization, using an ubic conversion trick and a compile-time binary search to get logarithmic instantiation depth. Also shows a recursive approach and a loophole friend-function trick (MSVC/GCC/Clang support) and notes a much simpler C++17 structured-binding solution but with better compile-time performance tradeoffs.
AI-written summary · about
chapters (9)
- 0:00Start
- 0:48Some structure
- 1:54What's in the header?
- 2:19We need to go deeper
- 4:37Basic idea for counting fields
- 8:09Putting all together. Simplified version :-
- 16:16Naive solution
- 26:49Getting the field type recursively
- 30:36Type Loophole
related talks
01h 03mC++ Reflection: Back on Track
40mReflection in C++ Next
01h 05mC++ Reflection Based Libraries to Look Forward To
01h 21mGazing Beyond Reflection for C++26
01h 06mMigration of C++ Libraries to C++14
05mUsing type_traits and constexpr to make code more readable/debuggable
01h 05mC++11 in the Wild: Techniques from a Real Codebase
39mReflection without Reflection TS
