Fast C++ dynamic cast