Created
February 7, 2017 11:43
Star
You must be signed in to star a gist
Various virtual method table helper functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void**& GetVirtualTable(void* baseclass) { | |
return *reinterpret_cast<void***>(baseclass); | |
} | |
inline void* GetVirtualFunction(void* vftable, size_t index) { | |
return reinterpret_cast<void*>(GetVirtualTable(vftable)[index]); | |
} | |
template <typename Fn> inline Fn GetVirtualFunction(void* vftable, size_t index) { | |
return reinterpret_cast<Fn>(GetVirtualTable(vftable)[index]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment