C++ Reflection: Back on Track
summary
Proposal P2996 adds compile-time reflection to C++ with a single opaque type meta::info, a prefix ^ operator for reflection and [::] splices to turn reflections back into code; language wording is design-approved and the library is under review aiming for C++26. Implementations exist on Compiler Explorer (EDG, clang experimental and NVIDIA NVC++). Concrete demos compile: a generic command-line parser, automatic struct->SoA conversion, allocator propagation via substitute/Define_class, and nearβautomatic serialization.
AI-written summary Β· about
chapters (15)
- 0:00Introduction to C++ reflection
- 1:33What is reflection?
- 7:30Reflection in other languages
- 15:20Past C++ reflection attempts
- 18:34P2996 reflection proposal
- 29:42Meta functions in P2996
- 39:19Compile-time loops for reflection
- 41:26Real-world example: parse options
- 42:50Code injection: substitute function
- 46:42Code injection: Define class
- 49:10Trying reflection today
- 51:17Serialization with reflection
- 53:22Token sequences and Q injection
- 59:50Future directions for reflection
- 1:02:24Summary and takeaways
related talks
01h 08mKeynote: Reflection in C++26 - Welcome to v0.1 of the meta::[[verse]]!
01h 04mWelcome to v1.0 of the meta::[[verse]]!
01h 37mReflection: Compile-Time Introspection of C++
01h 01mReflection
37mWelcome to v1.0 of the meta::[[verse]]!
55mC++14 Reflections Without Macros, Markup nor External Tooling..
53mC++ Horizons
46mBuilding a C++ Reflection System in One Weekend Using Clang and LLVM
