// this overload is added to the set of overloads if // C is a reference-to-class type and F is a pointer to member function of C template <class C, class F> auto test(C c, F f) -> decltype((void)(c.*f)(), void()) { std::cout << "Reference overload called\n"; }   // this overload is added to the set of overloads if // C is a pointer-to-class type and F is a pointer to member function of C template <class C, class F> auto test(C c, F f) -> decltype((void)((c->*f)()), void()) { std::cout << "Pointer overload called\n"; }


struct X { void f() {} };   int main(){ X x; test( x, &X::f); test(&x, &X::f); }


컴파일 타임에 decltype 들여다보고 resolution 안되는 템플릿 무시하고 머 그런..