ISO-friendly lambda

[SVN r16572]
This commit is contained in:
Aleksey Gurtovoy
2002-12-09 08:08:30 +00:00
parent e8b42afe69
commit a9c64bba20
3 changed files with 25 additions and 135 deletions

View File

@ -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<T>::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)) \
}; \
/**/

View File

@ -48,7 +48,7 @@ template<> struct trait<spec> \
: 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)) \
}; \
/**/

View File

@ -33,7 +33,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
template<> struct trait<spec> \
{ \
typedef result type; \
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(spec)) \
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \
}; \
/**/