Reflection with RTTR

For those who liked the (very) old and "deprecated" C++ reflection articles of mine, check out the RTTR library by Axel Menzel.

RTTR's general approach, structure, and features are almost identical to what my reflection libraries look like today. RTTR is thus pretty much what I would use for a new native C++ reflection article series, were I to have the time. It's also quite similar to the reflection/serialization engine we use where I work (which has been used in multiple shipped game titles).

I do believe that there is an even superior approach to reflection in C++ that uses code generation. Such an approach is used by the Unreal engine, for instance, though there are significant improvements that can be made compared to Epic's implementation. A freely available example tool of this nature is clReflect by Don Williamson.

However, as code generation requires additional tools, build system integration, and is difficult to implement independently, I do still feel that pure C++ solutions like RTTR continue to have great value for many projects.

Sean Middleditch

Read more posts by this author.