Created
October 18, 2014 06:37
-
-
Save wackoisgod/058b92ed9c03bf52765d to your computer and use it in GitHub Desktop.
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
class PrivateClass{ | |
private: | |
void SomeFunction() { printf("Hello World"); }; | |
}; | |
template <class Tag> | |
struct touch | |
{ | |
static typename Tag::type value; | |
}; | |
template <class Tag> | |
typename Tag::type touch<Tag>::value; | |
template <class Tag, typename Tag::type x> | |
struct touch_private | |
{ | |
touch_private() { touch<Tag>::value = x; } | |
static touch_private instance; | |
}; | |
template <class Tag, typename Tag::type x> | |
touch_private<Tag, x> touch_private<Tag, x>::instance; | |
//// OH MAN WTF!!!! HACKS!!!! | |
struct AS { typedef void(PrivateClass::*type)(); }; | |
template struct touch_private < AS, &PrivateClass::SomeFunction >; | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
PrivateClass c; | |
(c.*touch<AS>::value)(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment