How can I deduce statically if an argument is a C++ function object (functor)?
template
void test(F f) {}
I tried
template
struct is_functor
{
typedef char yes[1];
typedef char no [2];
template struct type_check;
template static yes &chk(type_check*);
template static no &chk(...);
static bool const value = sizeof(chk(nullptr)) == sizeof(yes);
};
Altered from this answer.
It could be used like...
template
typename std::enable_if::value>::type func()
{
}