#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;
}
