Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Straight Forward c++ RTTI

$
0
0

Hi, i have been trying to implement RTTI for a while but haven't found a good solution. Ideally the interface should revolve to asking via a static call:

T::GetTypeID();

I have tried using CRTP but as you know this doesn't give the Base class access too the TypeID so you cant do:

T::GetTypeID() == BaseClass::GetTypeID();

I also tried the macro approach where you pass a class name in and generate some functions for it, at runtime i compute the hash when the TypeID is requested and store it, yeah it costs an extra 4 Bytes per …


Viewing all articles
Browse latest Browse all 17063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>