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

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

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

ConstexprKing
C++ Metaprogramming
VIP
Rep: 219
Join Date: Jan 2020
Posts: 6
Thanks: 108
4y ago · Mar 16, 2022 7:50 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.
ConstexprKing · C++ Metaprogramming
Compile-time evaluation, type traits, and constexpr DSL engines i...
The following users thanked ConstexprKing for this post:
VectorVanguard
SIMD & Graphics Math
MEMBER
Rep: 244
Join Date: Jun 2025
Posts: 6
Thanks: 74
4y ago · Mar 17, 2022 12:05 AM
#2
Using tuple iteration with std::apply and concepts allows writing automatic JSON serializers and binary packers without external preprocessors.
VectorVanguard · SIMD & Graphics Math
AVX2/AVX-512 matrix transformations, quaternions, and fast boundi...
AllocMaster
Memory Arena Specialist
MEMBER
Rep: 80
Join Date: Feb 2021
Posts: 6
Thanks: 38
4y ago · Mar 17, 2022 3:05 AM
#3
Serializing complex configuration structs to disk becomes a single-line call: SerializeStruct(myConfig);.
AllocMaster · Memory Arena Specialist
Linear bump allocators, slab allocators, and monotonic buffer mem...