개요
예제
- 코드
#include <iostream>
#include <string>
#include <type_traits>
using namespace std;
class A {
public:
string func(int i) { return "a"; }
};
auto func(int i) { return "a"; };
int main() {
cout << is_invocable<decltype(func), int>::value << endl;
cout << is_invocable<decltype(func), string>::value << endl;
cout << is_invocable_r<string, decltype(func), int>::value << endl;
cout << is_invocable_r<string, decltype(func), string>::value << endl;
cout << "------" << endl;
cout << is_invocable<decltype(&A::func), A, int>::value << endl;
cout << is_invocable<decltype(&A::func), A, string>::value << endl;
cout << is_invocable_r<string, decltype(&A::func), A, int>::value << endl;
cout << is_invocable_r<string, decltype(&A::func), A, string>::value
<< endl;
return 0;
}
- 실행 결과