auto(cfoo::* _cfoo_foo_int_ptr)(int) = &cfoo::foo; using result_type = invoke_result<decltype(_cfoo_foo_int_ptr), cfoo, int>::type;
#include <iostream> #include <type_traits> using namespace std; struct cfoo { int foo(int) { cout << __FUNCSIG__ << endl; return 0; } int foo(int, int) { cout << __FUNCSIG__ << endl; return 0;} }; int main() { auto(cfoo::* _cfoo_foo_int_ptr)(int) = &cfoo::foo; cfoo _cfoo; (_cfoo.*_cfoo_foo_int_ptr)(0); // callable ! using result_type = invoke_result<decltype(_cfoo_foo_int_ptr), int>::type; return 0; } #ifdef _COMPILE_ERRORS_BELOW_ 1>bugyCode.cpp(16, 71) : error C2039 : 'type' : is not a member of 'std::invoke_result<void (__cdecl cfoo::* )(int),int>' 1>bugyCode.cpp(16, 22) : message: see declaration of 'std::invoke_result<void (__cdecl cfoo::* )(int),int>' 1>bugyCode.cpp(16, 71) : error C2061 : syntax error : identifier 'type'#endif #endif
_cfoo_foo_int_ptr
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)