Can I get the Owning Object of a Member Function Template Parameter?
问题 Given a object: struct foo { void func(); }; Now given the templatized function declaration: template<typename T, T F> void bar(); So bar will be taking in a member function like so: bar<decltype(&foo::func), &foo::func>() In the body of bar I want to recover the type foo from T . Can I do that? I want to be able to do something like this: get_obj<T> myfoo; (myfoo.*F)(); I know that get_obj isn't a thing, but would there be a way to write it? 回答1: template<class T> struct get_memfun_class;