Home / Forums / Compile-Time Reflection with Macro Magic & C++20 Concepts [Part 5]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

Compile-Time Reflection with Macro Magic & C++20 Concepts [Part 5]

MatrixMathMax
Linear Algebra Dev
MEMBER
Rep: 279
Join Date: May 2024
Posts: 6
Thanks: 85
6y ago · Jul 1, 2020 8:30 PM
#1
While static reflection is scheduled for C++26, here is a clean macro-based compile-time struct reflection helper that generates field names, offsets, and type lists automatically.
MatrixMathMax · Linear Algebra Dev
Matrix decomposition (LU/QR/Cholesky), singular value decompositi...
The following users thanked MatrixMathMax for this post:
FlatMapFan
Cache-Friendly Containers
MEMBER
Rep: 353
Join Date: Oct 2023
Posts: 6
Thanks: 97
6y ago · Jul 1, 2020 9:55 PM
#2
Using tuple iteration with std::apply and concepts allows writing automatic JSON serializers and binary packers without external preprocessors.
FlatMapFan · Cache-Friendly Containers
Sorted vector flat_map vs red-black tree std::map benchmarks in h...
TemplateTitan
Template Metaprogramming
MEMBER
Rep: 80
Join Date: Apr 2023
Posts: 6
Thanks: 49
6y ago · Jul 2, 2020 2:55 AM
#3
Serializing complex configuration structs to disk becomes a single-line call: SerializeStruct(myConfig);.
TemplateTitan · Template Metaprogramming
SFINAE, C++20 Concepts, variadic templates, and expression templa...