template <typename T>
void CallFn(T *p, void (T::*pfn)(void))
{
(p->*pfn)();
}
class Foo
{
public:
void Bar(void){}
};
int main(int argc, char** argv)
{
Foo *p = new Foo();
CallFn(p, &Foo::Bar);
}
dGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnZvaWQgQ2FsbEZuKFQgKnAsIHZvaWQgKFQ6OipwZm4pKHZvaWQpKQp7CiAgICAocC0+KnBmbikoKTsKfQpjbGFzcyBGb28KewpwdWJsaWM6CiAgICB2b2lkIEJhcih2b2lkKXt9Cn07CgoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqKiBhcmd2KQp7CiAgICBGb28gKnAgPSBuZXcgRm9vKCk7CiAgICBDYWxsRm4ocCwgJkZvbzo6QmFyKTsKfQ==