#include<iostream>
namespace CHECK
{
class No { bool b[2]; };
template<typename T, typename Arg> No operator== (const T&, const Arg&);
bool Check (...);
No& Check (const No&);
template <typename T, typename Arg = T>
struct EqualExists
{
enum { value = (sizeof(Check(*(T*)(0) == *(Arg*)(0))) != sizeof(No)) };
};
}
struct A
{
bool operator == (A const &);
};
struct B
{
short operator == (B const &);
};
struct C {};
struct D
{
short operator == (short);
};
int main()
{
std::cout<< "A::operator== () exists: " << CHECK::EqualExists<A>::value << std::endl;
std::cout<< "B::operator== () exists: " << CHECK::EqualExists<B>::value << std::endl;
std::cout<< "C::operator== () exists: " << CHECK::EqualExists<C>::value << std::endl;
std::cout<< "C::operator== (short) exists: " << CHECK::EqualExists<D, short>::value << std::endl;
}
I2luY2x1ZGU8aW9zdHJlYW0+CgpuYW1lc3BhY2UgQ0hFQ0sKewogIGNsYXNzIE5vIHsgYm9vbCBiWzJdOyB9OwogIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHR5cGVuYW1lIEFyZz4gTm8gb3BlcmF0b3I9PSAoY29uc3QgVCYsIGNvbnN0IEFyZyYpOwoKICBib29sIENoZWNrICguLi4pOwogIE5vJiBDaGVjayAoY29uc3QgTm8mKTsKCiAgdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHR5cGVuYW1lIEFyZyA9IFQ+CiAgc3RydWN0IEVxdWFsRXhpc3RzCiAgewogICAgZW51bSB7IHZhbHVlID0gKHNpemVvZihDaGVjaygqKFQqKSgwKSA9PSAqKEFyZyopKDApKSkgIT0gc2l6ZW9mKE5vKSkgfTsKICB9OyAgCn0KCgpzdHJ1Y3QgQSAKeyAKICBib29sIG9wZXJhdG9yID09IChBIGNvbnN0ICYpOwp9OwoKc3RydWN0IEIgCnsKICBzaG9ydCBvcGVyYXRvciA9PSAoQiBjb25zdCAmKTsgCn07CgpzdHJ1Y3QgQyB7fTsKCnN0cnVjdCBECnsKICBzaG9ydCBvcGVyYXRvciA9PSAoc2hvcnQpOwp9OwoKaW50IG1haW4o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