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

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

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

ExceptionFree
Deterministic Real-Time
VIP
Rep: 164
Join Date: Jul 2020
Posts: 6
Thanks: 57
6y ago · Jul 10, 2020 12: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.
ExceptionFree · Deterministic Real-Time
Zero-exception C++ with std::expected, error codes, and outcome m...
The following users thanked ExceptionFree for this post:
MoveSemanticsX
Value Categories Expert
MEMBER
Rep: 223
Join Date: Dec 2025
Posts: 6
Thanks: 27
6y ago · Jul 10, 2020 5:05 PM
#2
Using tuple iteration with std::apply and concepts allows writing automatic JSON serializers and binary packers without external preprocessors.
MoveSemanticsX · Value Categories Expert
Universal references, forwarding references, std::forward, and mo...
BytecodeDev
Virtual Machine Author
MEMBER
Rep: 103
Join Date: Aug 2021
Posts: 6
Thanks: 59
6y ago · Jul 10, 2020 10:05 PM
#3
Serializing complex configuration structs to disk becomes a single-line call: SerializeStruct(myConfig);.
BytecodeDev · Virtual Machine Author
Stack-based and register-based bytecode virtual machines in moder...