Reflection
summary
Static compile-time reflection for C++ aims to turn declarations into usable values for metaprogramming and to project those values back into syntax; two concrete implementations appear: reflexpr as types (P0194/P0385) which creates a compiler-generated class per reflection and forces template metaprogramming, and a Clang prototype using a dollar operator returning values that encodes AST pointers and uses intrinsics like __reflect_name and projection operators (typename, idexpr) to generate code. It builds tuple-like member views, a compile-time unrolling for-loop, works but exposes issues: memory blowup from per-reflection types and surprising behavior around incomplete-type instantiation.
AI-written summary · about
chapters (37)
- 0:00Intro
- 0:45University of Akron
- 1:12What to know about Akron
- 1:45Background
- 2:59Overview
- 3:29What is reflection?
- 4:13Concepts and operators
- 6:57Metaprogramming strategy
- 7:27Example
- 9:46Why dynamic reflection?
- 11:33Meanwhile, in C++...
- 12:51Why reflection?
- 13:53Static reflection
- 14:28Reflection, abstractly
- 15:20Projection, abstractly
- 17:25Committee work and papers
- 18:18Encoding reflections
- 19:12Type-based reflection (P0194)
- 26:27Reflection operator
- 27:48Reflection type
- 28:09Encoded reflections
- 28:57Meta templates
- 29:43Projection intrinsics
- 31:30Value projection
- 32:44Reflecting lists
- 35:53Loop expansion
- 37:52Projection operators
- 38:30Type projection
- 39:06Namespace projection
- 39:51Name projection
- 41:03Declaration names
- 41:31Implementing stringification
- 42:41Analysis
- 44:46Moving forward...
- 45:41Future work
- 47:14Questions
- 47:33Type-encoded reflection (P0590)
related talks
01h 37mReflection: Compile-Time Introspection of C++
01h 08mReflections: Compile-time Introspection of Source Code
01h 10mReflection Is Good for C++ Code Health
01h 27mC++ Reflection - Back on Track
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
55mC++14 Reflections Without Macros, Markup nor External Tooling..
