#include <iostream>
#include <functional>
template<class T>
struct is_function {
constexpr static bool value = false;
};
template<class T>
struct is_function<std::function<T>> {
constexpr static bool value = true;
};
template<class T>
constexpr static bool is_function_v = is_function<T>::value;
template<class T>
void check(T t) {
if constexpr (is_function_v<T>) {
std::cout << "is std::function" << std::endl;
}
else {
std::cout << "is not std::function" << std::endl;
}
}
void f2() {}
int main() {
std::function f1 = [](){};
std::function f3 = f2;
check(f1); // is std::function
check(f2); // is not std::function
check(f3); // is std::function
return 0;
}