Reflection: Compile-Time Introspection of C++
summary
Static reflection for C++ claims compile-time introspection and limited code generation (aiming for C++23/C++26) and ships as a working clang branch on GitHub (log3/meta, branch paper/p2320) and on Compiler Explorer (cppx.godbolt.com). Examples include p2320 syntax using a ^ reflection operator and splice operator to reinsert generated types, an enum-to-string example, JSON-like serialization/deserialization, hashing, and a make_indirect reduces instantiations demo that cuts 43 template specializations to one. Implementation runs but the repo is rough and some examples fail or crash.
AI-written summary · about
chapters (27)
- 0:00Introduction
- 2:53Examples
- 12:07Reflection and metaprogramming: final
- 12:37Motivation for metaprogramming
- 15:23Where static reflection helps
- 18:27Generating indirection
- 20:22Reflection operator (P2320) Is an expression Produces a comple-time (as in constexpr) value that describes its operand
- 21:26Reflection type (P1240)
- 23:14Testing our indirection generator
- 24:14Reflection library (P1240)
- 27:29Making pointers iteratively
- 30:30Splice operator
- 32:24Splice equation
- 33:48A reflective indirection generator
- 35:57Expansion statements
- 37:17A trivial implementation
- 38:50Equivalent specialization
- 43:29Serialization algorithm
- 44:31Sketch of algorithm
- 45:38Serialization as a facility
- 46:25The main structure
- 47:23Serialization interface
- 48:02Serializing base cases
- 49:19Serializing composites
- 54:02Generic and extensible
- 57:55Deserialization
- 58:56Deserializing classes
related talks
01h 01mReflection
01h 03mC++ Reflection: Back on Track
01h 08mKeynote: Reflection in C++26 - Welcome to v0.1 of the meta::[[verse]]!
46mBuilding a C++ Reflection System in One Weekend Using Clang and LLVM
01h 04mWelcome to v1.0 of the meta::[[verse]]!
55mC++14 Reflections Without Macros, Markup nor External Tooling..
05mLightning Talk: Static Reflection on the Budget in C++23
37mWelcome to v1.0 of the meta::[[verse]]!
