PkmnLib/src/ScriptResolving/AngelScript/TypeRegistry/RefCast.hpp

12 lines
265 B
C++

#ifndef PKMNLIB_REFCAST_HPP
#define PKMNLIB_REFCAST_HPP
#include <CreatureLib/Defines.hpp>
template <class A, class B> B* nullable refCast(A* nullable a) {
if (!a)
return 0;
B* b = dynamic_cast<B*>(a);
return b;
}
#endif // PKMNLIB_REFCAST_HPP