namespace std { class type_info; } #include #include #include #include template< typename T > struct eq1 { T a; T b; template< typename TX > static char check ( TX a, TX b, char(*)[sizeof (std::is_convertible) ]); template< typename TX > static long check ( ... ); static const bool value = sizeof(char) == sizeof check(a, b, 0); }; template< typename T > struct eq2 { T a; T b; template< typename TX > static char check ( TX a, TX b, char(*)[sizeof bool{a == b} ]); template< typename TX > static long check ( ... ); static const bool value = sizeof(char) == sizeof check(a, b, 0); }; struct x { x(char*); }; int main ( void ) { std::cout << eq1::value << std::endl; std::cout << eq1::value << std::endl; std::cout << eq1::value << std::endl; std::cout << std::endl; std::cout << eq2::value << std::endl; std::cout << eq2::value << std::endl; std::cout << eq2::value << std::endl; return 0; }