Talk type: Talk

Almost Full-Featured RTTI with Scaled Overhead

  • Talk in Russian
Presentation pdf

This work might be interesting for all those who needs RTTI or type erasure in C++. Why community keeps writing RTTI of their own? Isn't it enough to use standard C++ RTTI? The reason is that standard RTTI is too much global, once enabled it is injected into all translation unit classes. And sometimes it is slow. And you can't get access to classes hierarchy (which might be useful).

Same time when we write RTTI of our own, we have to:

  1. Write a lot of boilerplate code.
  2. Difficult to implement access to classes hierarchy.
  3. Sometimes we're about to use code generators (e.g. for visitor pattern, see clang AST visitor).

Using C++17 a some little tricks, we managed to get rid of most of all problems from above.

  1. We still need some boilerplate, but very small one. Really.
  2. Once you get a pointer to a base class, you're able to request a real type and… you can get whole classes hierarchy!
  3. Let's see whether we're able to write visitor without code generators ;-)
  • #c++17


Invited experts