#include <iostream>
struct S{bool operator()(){return true;}};
template <class TFunctor>
class TIsCallable
{
typedef char TTwoChars[2];
template <class T>
static char Test(int[sizeof((*((T*)0))()) ? 1 : -1] = 0);
template <class>
static TTwoChars& Test(...);
public:
static const bool Value_ = sizeof(Test<TFunctor>(0)) == 1;
};
int main()
{
std::cout << TIsCallable<int>::Value_ << TIsCallable<int (*)()>::Value_
<< TIsCallable<S>::Value_ << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IFN7Ym9vbCBvcGVyYXRvcigpKCl7cmV0dXJuIHRydWU7fX07Cgp0ZW1wbGF0ZSA8Y2xhc3MgVEZ1bmN0b3I+CmNsYXNzIFRJc0NhbGxhYmxlCnsKICAgIHR5cGVkZWYgY2hhciBUVHdvQ2hhcnNbMl07CiAgICB0ZW1wbGF0ZSA8Y2xhc3MgVD4KICAgIHN0YXRpYyBjaGFyIFRlc3QoaW50W3NpemVvZigoKigoVCopMCkpKCkpID8gMSA6IC0xXSA9IDApOwoKICAgIHRlbXBsYXRlIDxjbGFzcz4KICAgIHN0YXRpYyBUVHdvQ2hhcnMmIFRlc3QoLi4uKTsKcHVibGljOgogICAgc3RhdGljIGNvbnN0IGJvb2wgVmFsdWVfID0gc2l6ZW9mKFRlc3Q8VEZ1bmN0b3I+KDApKSA9PSAxOwp9OwoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgVElzQ2FsbGFibGU8aW50Pjo6VmFsdWVfIDw8IFRJc0NhbGxhYmxlPGludCAoKikoKT46OlZhbHVlXwogICAgICAgIDw8IFRJc0NhbGxhYmxlPFM+OjpWYWx1ZV8gPDwgc3RkOjplbmRsOwp9Cg==