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]
This commit is contained in:
Dave Abrahams
2003-09-20 21:27:04 +00:00
parent d4cedca95e
commit 9eb621c516
3 changed files with 36 additions and 7 deletions

View File

@@ -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

View File

@@ -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<void_> \
@@ -36,6 +36,24 @@ template<> struct trait<void_> \
}; \
/**/
#else
# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \
template<> struct trait<void_> \
{ \
template< BOOST_MPL_PP_PARAMS(i, typename T) > struct algorithm \
{ \
}; \
}; \
template<> struct trait<int> \
{ \
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

View File

@@ -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 <class N>
struct is_even_base
{
enum { value = (N::value % 2) == 0 };
typedef bool_<value> type;
};
}
#endif
template<
typename BOOST_MPL_AUX_VOID_SPEC_PARAM(N)
>
struct is_even
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
: aux::is_even_base<N>::type
#else
: bool_<((N::value % 2) == 0)>
#endif
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_even,(N))
};