Created
March 3, 2025 22:13
-
-
Save Eczbek/cecec131d18cec89fbe0c9393546476f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
std::string vtable_inator(const auto& any) { | |
struct h { void** name; }; | |
return std::string(reinterpret_cast<char*>(reinterpret_cast<void**>(reinterpret_cast<const h*>(&any)->name[-1])[1])); | |
} | |
struct vtable_inator_able { virtual void nothing() final {}; }; | |
struct Hello_world : vtable_inator_able {}; | |
int main() { | |
std::print("{}\n", vtable_inator(Hello_world())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment