Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:26

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/detail/preprocessed/and_n.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0008         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/and_n.hpp")
0009     #endif
0010 
0011     ///////////////////////////////////////////////////////////////////////////////
0012     /// \file and_n.hpp
0013     /// Definitions of and_N, and_impl
0014     //
0015     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0016     //  Software License, Version 1.0. (See accompanying file
0017     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0018 
0019     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0020         #pragma wave option(preserve: 1)
0021     #endif
0022 
0023     #define BOOST_PP_ITERATION_PARAMS_1                                                             \
0024         (3, (2, BOOST_PP_MAX(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_MAX_LOGICAL_ARITY), <boost/proto/detail/and_n.hpp>))
0025     #include BOOST_PP_ITERATE()
0026 
0027     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0028         #pragma wave option(output: null)
0029     #endif
0030 
0031 #else // BOOST_PP_IS_ITERATING
0032 
0033     #define N BOOST_PP_ITERATION()
0034 
0035     // Assymetry here between the handling of and_N and or_N because
0036     // and_N is used by lambda_matches up to BOOST_PROTO_MAX_ARITY,
0037     // regardless of how low BOOST_PROTO_MAX_LOGICAL_ARITY is.
0038     template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
0039     struct BOOST_PP_CAT(and_, N)
0040     #if 2 == N
0041       : mpl::bool_<P0::value>
0042     {};
0043     #else
0044       : BOOST_PP_CAT(and_, BOOST_PP_DEC(N))<
0045             P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
0046             BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
0047         >
0048     {};
0049     #endif
0050 
0051     template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
0052     struct BOOST_PP_CAT(and_, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
0053       : mpl::false_
0054     {};
0055 
0056     #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
0057 
0058         template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
0059         struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
0060           : proto::transform_impl<Expr, State, Data>
0061         {
0062             #define M0(Z, N, DATA)                                                            \
0063             typedef                                                                           \
0064                 typename proto::when<proto::_, BOOST_PP_CAT(G, N)>                            \
0065                     ::template impl<Expr, State, Data>                                        \
0066             BOOST_PP_CAT(Gimpl, N);                                                           \
0067             /**/
0068             BOOST_PP_REPEAT(N, M0, ~)
0069             #undef M0
0070 
0071             typedef typename BOOST_PP_CAT(Gimpl, BOOST_PP_DEC(N))::result_type result_type;
0072 
0073             result_type operator()(
0074                 typename _and_impl::expr_param e
0075               , typename _and_impl::state_param s
0076               , typename _and_impl::data_param d
0077             ) const
0078             {
0079                 // Fix: jfalcou - 12/29/2010
0080                 // Avoid the use of comma operator here so as not to find Proto's
0081                 // by accident.
0082                 // expands to G0()(e,s,d); G1()(e,s,d); ... G{N-1}()(e,s,d);
0083                 #define M0(Z,N,DATA) BOOST_PP_CAT(Gimpl,N)()(e,s,d);
0084                 BOOST_PP_REPEAT(BOOST_PP_DEC(N),M0,~)
0085                 return BOOST_PP_CAT(Gimpl,BOOST_PP_DEC(N))()(e,s,d);
0086                 #undef M0
0087             }
0088         };
0089 
0090     #endif
0091 
0092     #undef N
0093 
0094 #endif