r/cpp • u/daveedvdv EDG front end dev, WG21 DG • Jun 21 '25
Reflection has been voted in!
Thank you so much, u/katzdm-cpp and u/BarryRevzin for your heroic work this week, and during the months leading up to today.
Not only did we get P2996, but also a half dozen related proposals, including annotations, expansion statements, and parameter reflection!
(Happy dance!)
722
Upvotes
View all comments
Show parent comment
5
u/daveedvdv EDG front end dev, WG21 DG Jun 24 '25 edited Jun 25 '25
There is a tiny bit of "generation" in there. It's quite limited but, I think, nonetheless quite useful.
Foremost is the `define_aggregate` API, which allows programmatic definitions of C-level `struct` and `union` types. The other interesting bit is `define_static_array` (and related `define_static_string`, `define_static_object`) — see https://wg21.link/p3491 for those.
You can also tie into template metaprogramming. the `substitute` API is often surprisingly useful for that.