Skip to content

Instantly share code, notes, and snippets.

@aixxe aixxe/virtuals.h
Created Feb 7, 2017

Embed
What would you like to do?
Various virtual method table helper functions.
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
You can’t perform that action at this time.