C++相談室 part60
■ このスレッドは過去ログ倉庫に格納されています
0249245
2008/01/29(火) 13:41:34自分で書いてみても、やはり通らない。
こんな風にSFINAEを使ってやればできるはずなんだけど。
struct BjarneStroustrup
{ void hage() ; } ;
struct Others
{ void fusafusa() ; } ;
template < typename T >
struct has_hage
{
struct Yes { char a[1] ; } ;
struct No { char a[2] ; } ;
template < typename Y > static Yes test(typename Y::hage const *) ;
template < typename Y > static No test(...) ;
static bool const value = ( sizeof( test<T>(0) ) == 1 ) ;
} ;
BOOST_STATIC_ASSERT(( has_hage<BjarneStroustrup>::value )) ;
BOOST_STATIC_ASSERT(( has_hage<Others>::value )) ;
■ このスレッドは過去ログ倉庫に格納されています