From a9c64bba20eb3d5ca9ac5cc2dcc4088e456ec176 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Mon, 9 Dec 2002 08:08:30 +0000 Subject: [PATCH] ISO-friendly lambda [SVN r16572] --- .../type_traits/detail/bool_trait_def.hpp | 156 +++--------------- .../type_traits/detail/size_t_trait_def.hpp | 2 +- .../type_traits/detail/type_trait_def.hpp | 2 +- 3 files changed, 25 insertions(+), 135 deletions(-) diff --git a/include/boost/type_traits/detail/bool_trait_def.hpp b/include/boost/type_traits/detail/bool_trait_def.hpp index 16dd261..7278dd6 100644 --- a/include/boost/type_traits/detail/bool_trait_def.hpp +++ b/include/boost/type_traits/detail/bool_trait_def.hpp @@ -45,146 +45,36 @@ # define BOOST_TT_AUX_BOOL_C_BASE(C) : mpl::bool_c< C > #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 \ - BOOST_TT_AUX_BOOL_C_BASE(C) \ - { \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - struct rebind; \ - }; \ - \ - template < typename T > \ - struct trait< T >::rebind \ - { \ - enum { arity = 1 }; \ - typedef typename trait::arg1 arg1; \ - template< typename U1 > \ - struct apply : trait< U1 > \ - { \ - }; \ - }; \ - /**/ - -# 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) \ - { \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - struct rebind; \ - }; \ - \ - template < typename T1, typename T2 > \ - struct trait< T1,T2 >::rebind \ - { \ - enum { arity = 2 }; \ - 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) \ - template< typename T > struct trait \ - BOOST_TT_AUX_BOOL_C_BASE(C) \ - { \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ - }; \ - \ - BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ - /**/ +#define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \ +template< typename T > struct trait \ + BOOST_TT_AUX_BOOL_C_BASE(C) \ +{ \ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ +}; \ +\ +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ +/**/ -# 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) \ - { \ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \ - }; \ - \ - BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \ - /**/ - -#endif +#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) \ +{ \ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \ +}; \ +\ +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \ +/**/ #define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \ template<> struct trait< sp > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(sp)) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \ }; \ /**/ @@ -193,7 +83,7 @@ template<> struct trait< sp1,sp2 > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(sp1,sp2)) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ /**/ @@ -218,7 +108,7 @@ template< param > struct trait< sp1,sp2 > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(sp1,sp2)) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ /**/ diff --git a/include/boost/type_traits/detail/size_t_trait_def.hpp b/include/boost/type_traits/detail/size_t_trait_def.hpp index 1683685..36d18a2 100644 --- a/include/boost/type_traits/detail/size_t_trait_def.hpp +++ b/include/boost/type_traits/detail/size_t_trait_def.hpp @@ -48,7 +48,7 @@ template<> struct trait \ : mpl::size_t_c< C > \ { \ BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(spec)) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ }; \ /**/ diff --git a/include/boost/type_traits/detail/type_trait_def.hpp b/include/boost/type_traits/detail/type_trait_def.hpp index bdcc478..c64cd19 100644 --- a/include/boost/type_traits/detail/type_trait_def.hpp +++ b/include/boost/type_traits/detail/type_trait_def.hpp @@ -33,7 +33,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ template<> struct trait \ { \ typedef result type; \ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(spec)) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ }; \ /**/