diff --git a/include/boost/type_traits/detail/bool_trait_def.hpp b/include/boost/type_traits/detail/bool_trait_def.hpp index 2e955db..16dd261 100644 --- a/include/boost/type_traits/detail/bool_trait_def.hpp +++ b/include/boost/type_traits/detail/bool_trait_def.hpp @@ -46,6 +46,68 @@ #endif #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 +// Various hacks to reduce the occurrence of "internal structure overflow" messages + +# if 1 + +# define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \ + template < typename T > struct trait; \ + \ + namespace mpl_rebind \ + { \ + template < typename T > \ + struct rebind_##trait \ + { \ + enum { arity = 1 }; \ + typedef T arg1; \ + \ + template< typename U1 > \ + struct apply : trait< U1 > \ + { \ + }; \ + }; \ + } \ + \ + template< typename T > struct trait \ + BOOST_TT_AUX_BOOL_C_BASE(C) \ + { \ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ + typedef mpl_rebind::rebind_##trait< T > rebind; \ + }; \ + /**/ + +# define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \ + template < typename T1, typename T2 > struct trait; \ + \ + namespace mpl_rebind \ + { \ + template < typename T1, typename T2 > \ + struct rebind_##trait \ + { \ + enum { arity = 2 }; \ + typedef T1 arg1; \ + typedef T2 arg2; \ + \ + template< typename U1, typename U2 > \ + struct apply : trait< U1,U2 > \ + { \ + }; \ + }; \ + } \ + \ + template< typename T1, typename T2 > struct trait \ + BOOST_TT_AUX_BOOL_C_BASE(C) \ + { \ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ + typedef mpl_rebind::rebind_##trait< T1,T2 > rebind; \ + }; + /**/ + +# else + +// this approach doesn't seem to work. For binary traits we often get +// the error message that 'rebind' is an undefined type. For either +// case we sometimes get the message that 'T' (or 'T1') is unknown. # define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \ template< typename T > struct trait \ @@ -55,11 +117,11 @@ struct rebind; \ }; \ \ - template < typename X > \ - struct trait< X >::rebind \ + template < typename T > \ + struct trait< T >::rebind \ { \ enum { arity = 1 }; \ - typedef X arg1; \ + typedef typename trait::arg1 arg1; \ template< typename U1 > \ struct apply : trait< U1 > \ { \ @@ -67,7 +129,6 @@ }; \ /**/ - # define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \ template< typename T1, typename T2 > struct trait \ BOOST_TT_AUX_BOOL_C_BASE(C) \ @@ -76,19 +137,21 @@ struct rebind; \ }; \ \ - template < typename X1, typename X2 > \ - struct trait< X1,X2 >::rebind \ + template < typename T1, typename T2 > \ + struct trait< T1,T2 >::rebind \ { \ enum { arity = 2 }; \ - typedef X1 arg1; \ - typedef X2 arg2; \ - template< typename U1, typename U2 > \ - struct apply : trait< U1,U2 > \ + typedef T1 arg1; \ + typedef T2 arg2; \ + template< typename X1, typename X2 > \ + struct apply : trait< X1,X2 > \ { \ }; \ }; \ /**/ +# endif + #else # define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \