#include <iostream>
#include <utility>
#include <tuple>
template <class Type>
class HasStringOperator
{
template <typename T, T> struct TypeCheck;
typedef char Yes;
typedef long No;
template <typename T> struct operator_{
typedef char (T::*fptr)(int);
};
template <typename T> static Yes HasOperator(TypeCheck< typename operator_<T>::fptr, &T::operator[] >*);
template <typename T> static No HasOperator(...);
public:
static bool const value = (sizeof(HasOperator<Type>(0)) == sizeof(Yes));
};
struct A
{
char operator[](int){}
};
struct B
{};
int main()
{
std::cout<<HasStringOperator<A>::value;
std::cout<<HasStringOperator<B>::value;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPHR1cGxlPgoKdGVtcGxhdGUgPGNsYXNzIFR5cGU+CmNsYXNzIEhhc1N0cmluZ09wZXJhdG9yCnsKICAgIHRlbXBsYXRlIDx0eXBlbmFtZSBULCBUPiBzdHJ1Y3QgVHlwZUNoZWNrOwoKICAgIHR5cGVkZWYgY2hhciBZZXM7CiAgICB0eXBlZGVmIGxvbmcgTm87CiAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4gc3RydWN0IG9wZXJhdG9yX3sKICAgICAgICB0eXBlZGVmIGNoYXIgKFQ6OipmcHRyKShpbnQpOwogICAgfTsKCiAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4gc3RhdGljIFllcyBIYXNPcGVyYXRvcihUeXBlQ2hlY2s8IHR5cGVuYW1lIG9wZXJhdG9yXzxUPjo6ZnB0ciwgJlQ6Om9wZXJhdG9yW10gPiopOwogICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQ+IHN0YXRpYyBObyAgSGFzT3BlcmF0b3IoLi4uKTsKCnB1YmxpYzoKICAgIHN0YXRpYyBib29sIGNvbnN0IHZhbHVlID0gKHNpemVvZihIYXNPcGVyYXRvcjxUeXBlPigwKSkgPT0gc2l6ZW9mKFllcykpOwp9OwoKc3RydWN0IEEKewogICAgY2hhciBvcGVyYXRvcltdKGludCl7fQp9OwpzdHJ1Y3QgQgp7fTsKCmludCBtYWluKCkKewogICAgc3RkOjpjb3V0PDxIYXNTdHJpbmdPcGVyYXRvcjxBPjo6dmFsdWU7CiAgICBzdGQ6OmNvdXQ8PEhhc1N0cmluZ09wZXJhdG9yPEI+Ojp2YWx1ZTsKfQo=