【C++】template 統合スレ -- Part6
at TECH
189:181
05/01/08 00:55:07
これでどうだろう。>>184 と組み合わせてみた。
template<class T> struct wrap{ typedef T type; };
template<class T> struct wrap<void (T)>{ typedef T type; };
#define TYPE(x) wrap<void x>::type
template< bool >struct ExistsBool{};
template<>struct ExistsBool< true >{ enum { _true }; };
#defineTYPEDEF( type, alias ) \
__if_exists( __template__::_true ){ typedef typename TYPE((typename type)) alias; } \
__if_not_exists( __template__::_true ){ typedef TYPE((type)) alias; } \
#defineCLASS( __Class ) \
typedef __Classself; \
typedef ExistsBool< false >__template__; \
#defineTEMPLATE( __Class ) \
typedef __Classself; \
typedef ExistsBool< true >__template__; \
#define$,
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5373日前に更新/262 KB
担当:undef