#include <iostream>

template<typename T>
class test
{
	template <void*>
    struct Nothing
    {
        typedef char type;
    };
 
    template <typename U>
    static typename Nothing<&U::operator()>::type check(int);
 
    template <typename>
    static int check(char);
 
public:
 
    static const bool is_functor = sizeof(check<T>(0)) == 1;
};

struct a{};
struct b
{
	void operator() (){}
};

int main()
{
	std::cout << test<a>::is_functor << '\n';
	std::cout << test<b>::is_functor << '\n';
}