FastDynamicCast
FastDynamicCast copied to clipboard
Cache also failed casts.
Hi, thanks for your PR!
I am currently in vacation, and will look at it when I am back.
Hi Tobias, please remove both my pull requests, I just re-implemented your idea, you can have a look in my repository. My improvements are: 1) quickly return ptr or nullptr when we are casting from derived to base or from some_class to some_unrelated_class it is detectable through few templates, 2) cache also failed lookups, 3) enlarge the case to more elements (4 in my case). You have special case for casting from T to T but it doesn't work in all cases - I have the derived -> base cast as a superset of this idea. I have also simplified the reference cast. https://github.com/MarekKnapek/stuff/tree/master/C%2B%2B/fast_dynamic_cast