Created
February 7, 2017 11:43
-
-
Save aixxe/68afce6655ff5acb524eb7963f093d07 to your computer and use it in GitHub Desktop.
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