annotate DEPENDENCIES/generic/include/boost/proto/detail/and_n.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
Chris@16 2
Chris@16 3 #include <boost/proto/detail/preprocessed/and_n.hpp>
Chris@16 4
Chris@16 5 #elif !defined(BOOST_PP_IS_ITERATING)
Chris@16 6
Chris@16 7 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
Chris@16 8 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/and_n.hpp")
Chris@16 9 #endif
Chris@16 10
Chris@16 11 ///////////////////////////////////////////////////////////////////////////////
Chris@16 12 /// \file and_n.hpp
Chris@16 13 /// Definitions of and_N, and_impl
Chris@16 14 //
Chris@16 15 // Copyright 2008 Eric Niebler. Distributed under the Boost
Chris@16 16 // Software License, Version 1.0. (See accompanying file
Chris@16 17 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 18
Chris@16 19 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
Chris@16 20 #pragma wave option(preserve: 1)
Chris@16 21 #endif
Chris@16 22
Chris@16 23 #define BOOST_PP_ITERATION_PARAMS_1 \
Chris@16 24 (3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/and_n.hpp>))
Chris@16 25 #include BOOST_PP_ITERATE()
Chris@16 26
Chris@16 27 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
Chris@16 28 #pragma wave option(output: null)
Chris@16 29 #endif
Chris@16 30
Chris@16 31 #else // BOOST_PP_IS_ITERATING
Chris@16 32
Chris@16 33 #define N BOOST_PP_ITERATION()
Chris@16 34
Chris@16 35 // Assymetry here between the handling of and_N and or_N because
Chris@16 36 // and_N is used by lambda_matches up to BOOST_PROTO_MAX_ARITY,
Chris@16 37 // regardless of how low BOOST_PROTO_MAX_LOGICAL_ARITY is.
Chris@16 38 template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
Chris@16 39 struct BOOST_PP_CAT(and_, N)
Chris@16 40 #if 2 == N
Chris@16 41 : mpl::bool_<P0::value>
Chris@16 42 {};
Chris@16 43 #else
Chris@16 44 : BOOST_PP_CAT(and_, BOOST_PP_DEC(N))<
Chris@16 45 P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
Chris@16 46 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
Chris@16 47 >
Chris@16 48 {};
Chris@16 49 #endif
Chris@16 50
Chris@16 51 template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
Chris@16 52 struct BOOST_PP_CAT(and_, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
Chris@16 53 : mpl::false_
Chris@16 54 {};
Chris@16 55
Chris@16 56 #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
Chris@16 57
Chris@16 58 template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
Chris@16 59 struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
Chris@16 60 : proto::transform_impl<Expr, State, Data>
Chris@16 61 {
Chris@16 62 #define M0(Z, N, DATA) \
Chris@16 63 typedef \
Chris@16 64 typename proto::when<proto::_, BOOST_PP_CAT(G, N)> \
Chris@16 65 ::template impl<Expr, State, Data> \
Chris@16 66 BOOST_PP_CAT(Gimpl, N); \
Chris@16 67 /**/
Chris@16 68 BOOST_PP_REPEAT(N, M0, ~)
Chris@16 69 #undef M0
Chris@16 70
Chris@16 71 typedef typename BOOST_PP_CAT(Gimpl, BOOST_PP_DEC(N))::result_type result_type;
Chris@16 72
Chris@16 73 result_type operator()(
Chris@16 74 typename _and_impl::expr_param e
Chris@16 75 , typename _and_impl::state_param s
Chris@16 76 , typename _and_impl::data_param d
Chris@16 77 ) const
Chris@16 78 {
Chris@16 79 // Fix: jfalcou - 12/29/2010
Chris@16 80 // Avoid the use of comma operator here so as not to find Proto's
Chris@16 81 // by accident.
Chris@16 82 // expands to G0()(e,s,d); G1()(e,s,d); ... G{N-1}()(e,s,d);
Chris@16 83 #define M0(Z,N,DATA) BOOST_PP_CAT(Gimpl,N)()(e,s,d);
Chris@16 84 BOOST_PP_REPEAT(BOOST_PP_DEC(N),M0,~)
Chris@16 85 return BOOST_PP_CAT(Gimpl,BOOST_PP_DEC(N))()(e,s,d);
Chris@16 86 #undef M0
Chris@16 87 }
Chris@16 88 };
Chris@16 89
Chris@16 90 #endif
Chris@16 91
Chris@16 92 #undef N
Chris@16 93
Chris@16 94 #endif