Reflection without Reflection TS
summary
A catalogue of concrete techniques and limits appears: template specialization and SFINAE check pointer/array/polymorphic properties; dynamic_cast to void for a polymorphism test works but relies on standard corner cases; enum names come from __PRETTY_FUNCTION__/SourceLocation so it is implementation‑defined and MagicEnum wraps it; member counting and types use aggregate‑init recursion to count members and an implicit‑conversion any to deduce types* and it works but is fragile; clang trunk exposes dump_struct for names at compile time.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 3:59Template/function specialization
- 5:45template argument deduction
- 8:13Reflection technique #1: SFINAE
- 19:45std::source_location::function_name
- 22:34Struct reflection: counting the number of members
- 26:58structured bindings
- 28:46Struct reflection: std::tuple for struct's members
- 34:15clang's __builtin_dump_struct
- 35:11Checking if you are using tabs or spaces
related talks
40mReflection in C++ Next
01h 03mC++ Reflection: Back on Track
01h 21mGazing Beyond Reflection for C++26
57mBuilding a C++ Reflection System
01h 05mC++ Reflection Based Libraries to Look Forward To
45mBetter C++14 reflections
58mWriting a reflection engine from scratch
02h 02mPeering forward: C++'s next decade
