#include <iostream>
#include <utility>
template<typename T, typename U = typename T::type> //デフォルト引数あり
std::true_type test(int);
template<typename T>
std::false_type test(long);
template<typename T>
struct Test : decltype(test<T>(0)) {};
struct have { typedef char type; };
struct nhave { typedef char tYPe; };
int main() {
std::cout << "Test<have>::value = " << Test<have>::value << std::endl;
std::cout << "Test<nhave>::value = " << Test<nhave>::value << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KCnRlbXBsYXRlPHR5cGVuYW1lIFQsIHR5cGVuYW1lIFUgPSB0eXBlbmFtZSBUOjp0eXBlPiAgICAvL+ODh+ODleOCqeODq+ODiOW8leaVsOOBguOCigogICAgc3RkOjp0cnVlX3R5cGUgICAgIHRlc3QoaW50KTsKICAgIAp0ZW1wbGF0ZTx0eXBlbmFtZSBUPgogICAgc3RkOjpmYWxzZV90eXBlICAgIHRlc3QobG9uZyk7Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBUPgogICAgc3RydWN0IFRlc3QgOiBkZWNsdHlwZSh0ZXN0PFQ+KDApKSAge307CgpzdHJ1Y3QgaGF2ZSAgeyB0eXBlZGVmIGNoYXIgdHlwZTsgfTsKc3RydWN0IG5oYXZlIHsgdHlwZWRlZiBjaGFyIHRZUGU7IH07CgppbnQgbWFpbigpIHsKCXN0ZDo6Y291dCA8PCAiVGVzdDxoYXZlPjo6dmFsdWUgPSAiICA8PCBUZXN0PGhhdmU+Ojp2YWx1ZSA8PCBzdGQ6OmVuZGw7CglzdGQ6OmNvdXQgPDwgIlRlc3Q8bmhhdmU+Ojp2YWx1ZSA9ICIgIDw8IFRlc3Q8bmhhdmU+Ojp2YWx1ZSA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gMDsKfQ==