Reflection is commonplace in other contemporary programming languages, but support for it in C++ is virtually non-existent. In this article we’re going to summarize what reflection is and how existing C++ techniques to implement it could potentially be improved in the upcoming C++26 Standard.
Reflection is the ability of a running program to inspect, analyze and modify its own structure at runtime. In C++ we would prefer to focus on compile-time reflection, which would not be expected to incur runtime costs. Existing features which do incur runtime costs already in C++ include RTTI (Run-Time Type Information) and virtual function dispatch, while those which do not include TMP (Template Metaprogramming) and compile-time function invocation.
Continue reading “How could Reflection be applied to Modern C++?”