From 9eb621c516de42f453af61a9614902c183ca2bcb Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 20 Sep 2003 21:27:04 +0000 Subject: [PATCH] Handle ETI in BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC, since we need to invoke that anyway. Make is_even work with vc6/7. [SVN r20122] --- include/boost/mpl/aux_/begin_end_impl.hpp | 5 ----- include/boost/mpl/aux_/traits_lambda_spec.hpp | 20 ++++++++++++++++++- include/boost/mpl/math/is_even.hpp | 18 ++++++++++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/include/boost/mpl/aux_/begin_end_impl.hpp b/include/boost/mpl/aux_/begin_end_impl.hpp index f620011..539e894 100644 --- a/include/boost/mpl/aux_/begin_end_impl.hpp +++ b/include/boost/mpl/aux_/begin_end_impl.hpp @@ -71,11 +71,6 @@ AUX_AGLORITM_TRAIT_SPEC(end, nested_begin_end_tag, typename Sequence::end) AUX_AGLORITM_TRAIT_SPEC(begin, non_sequence_tag, void_) AUX_AGLORITM_TRAIT_SPEC(end, non_sequence_tag, void_) -#if defined(BOOST_MPL_MSVC_ETI_BUG) -AUX_AGLORITM_TRAIT_SPEC(begin, int, int) -AUX_AGLORITM_TRAIT_SPEC(end, int, int) -#endif - # undef AUX_AGLORITM_TRAIT_SPEC diff --git a/include/boost/mpl/aux_/traits_lambda_spec.hpp b/include/boost/mpl/aux_/traits_lambda_spec.hpp index e65bb88..40525bd 100644 --- a/include/boost/mpl/aux_/traits_lambda_spec.hpp +++ b/include/boost/mpl/aux_/traits_lambda_spec.hpp @@ -25,7 +25,7 @@ # define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) /**/ -#else +#elif !defined(BOOST_MPL_MSVC_ETI_BUG) # define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \ template<> struct trait \ @@ -36,6 +36,24 @@ template<> struct trait \ }; \ /**/ +#else + +# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \ +template<> struct trait \ +{ \ + template< BOOST_MPL_PP_PARAMS(i, typename T) > struct algorithm \ + { \ + }; \ +}; \ +template<> struct trait \ +{ \ + template< BOOST_MPL_PP_PARAMS(i, typename T) > struct algorithm \ + { \ + typedef int type; \ + }; \ +}; \ +/**/ + #endif // BOOST_MPL_NO_FULL_LAMBDA_SUPPORT #endif // BOOST_MPL_AUX_TRAITS_LAMBDA_SPEC_HPP_INCLUDED diff --git a/include/boost/mpl/math/is_even.hpp b/include/boost/mpl/math/is_even.hpp index 215c711..1c25797 100644 --- a/include/boost/mpl/math/is_even.hpp +++ b/include/boost/mpl/math/is_even.hpp @@ -21,16 +21,32 @@ #include "boost/mpl/aux_/void_spec.hpp" #include "boost/mpl/aux_/lambda_support.hpp" #include "boost/mpl/aux_/config/eti.hpp" +#include "boost/detail/workaround.hpp" namespace boost { namespace mpl { namespace math { +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +namespace aux +{ + template + struct is_even_base + { + enum { value = (N::value % 2) == 0 }; + typedef bool_ type; + }; +} +#endif template< typename BOOST_MPL_AUX_VOID_SPEC_PARAM(N) > struct is_even - : bool_<((N::value % 2) == 0)> +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + : aux::is_even_base::type +#else + : bool_<((N::value % 2) == 0)> +#endif { BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_even,(N)) };