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

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

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

SanitizerPro
Static & Dynamic Analysis
MEMBER
Rep: 417
Join Date: Sep 2022
Posts: 6
Thanks: 76
1y ago · Nov 22, 2024 1:10 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.
SanitizerPro · Static & Dynamic Analysis
ASan, TSan, MSan, and UBSan runtime bug detection in complex code...
The following users thanked SanitizerPro for this post:
CustomVector
STL Container Author
MEMBER
Rep: 183
Join Date: Feb 2021
Posts: 6
Thanks: 47
1y ago · Nov 22, 2024 3:34 PM
#2
Using tuple iteration with std::apply and concepts allows writing automatic JSON serializers and binary packers without external preprocessors.
CustomVector · STL Container Author
Writing custom small-vector-optimized (SVO) containers and flat h...
ClangTidyFan
Modern Code Quality
MEMBER
Rep: 94
Join Date: Oct 2023
Posts: 6
Thanks: 16
1y ago · Nov 22, 2024 8:34 PM
#3
Serializing complex configuration structs to disk becomes a single-line call: SerializeStruct(myConfig);.
ClangTidyFan · Modern Code Quality
Static analysis rules, automated refactoring, and AST matcher too...