1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
3 #include <boost/proto/detail/preprocessed/and_n.hpp>
5 #elif !defined(BOOST_PP_IS_ITERATING)
7 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
8 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/and_n.hpp")
11 ///////////////////////////////////////////////////////////////////////////////
13 /// Definitions of and_N, and_impl
15 // Copyright 2008 Eric Niebler. Distributed under the Boost
16 // Software License, Version 1.0. (See accompanying file
17 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
19 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
20 #pragma wave option(preserve: 1)
23 #define BOOST_PP_ITERATION_PARAMS_1 \
24 (3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/and_n.hpp>))
25 #include BOOST_PP_ITERATE()
27 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
28 #pragma wave option(output: null)
31 #else // BOOST_PP_IS_ITERATING
33 #define N BOOST_PP_ITERATION()
35 // Assymetry here between the handling of and_N and or_N because
36 // and_N is used by lambda_matches up to BOOST_PROTO_MAX_ARITY,
37 // regardless of how low BOOST_PROTO_MAX_LOGICAL_ARITY is.
38 template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
39 struct BOOST_PP_CAT(and_, N)
41 : mpl::bool_<P0::value>
44 : BOOST_PP_CAT(and_, BOOST_PP_DEC(N))<
45 P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
46 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
51 template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
52 struct BOOST_PP_CAT(and_, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
56 #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
58 template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
59 struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
60 : proto::transform_impl<Expr, State, Data>
62 #define M0(Z, N, DATA) \
64 typename proto::when<proto::_, BOOST_PP_CAT(G, N)> \
65 ::template impl<Expr, State, Data> \
66 BOOST_PP_CAT(Gimpl, N); \
68 BOOST_PP_REPEAT(N, M0, ~)
71 typedef typename BOOST_PP_CAT(Gimpl, BOOST_PP_DEC(N))::result_type result_type;
73 result_type operator()(
74 typename _and_impl::expr_param e
75 , typename _and_impl::state_param s
76 , typename _and_impl::data_param d
79 // Fix: jfalcou - 12/29/2010
80 // Avoid the use of comma operator here so as not to find Proto's
82 // expands to G0()(e,s,d); G1()(e,s,d); ... G{N-1}()(e,s,d);
83 #define M0(Z,N,DATA) BOOST_PP_CAT(Gimpl,N)()(e,s,d);
84 BOOST_PP_REPEAT(BOOST_PP_DEC(N),M0,~)
85 return BOOST_PP_CAT(Gimpl,BOOST_PP_DEC(N))()(e,s,d);