Exemple #1
0
#include <boost/preprocessor/arithmetic/dec.hpp>

#include <boost/mpl/void.hpp>

#include <boost/type_traits/function_traits.hpp>

#include <boost/get_pointer.hpp>

#include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_return.hpp>

namespace boost { namespace phoenix {

    struct mem_fun_ptr_eval
    {
        template<typename Env, typename PtrActor, typename MemFunPtrActor,
                 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_SUB(PHOENIX_MEMBER_LIMIT, 2), typename Arg, mpl::void_)>

        struct result
            : detail::mem_fun_ptr_return<typename eval_result<MemFunPtrActor, Env>::type> { };

        template<typename Rt, typename Env, typename PtrActor, typename MemFunPtrActor>
        static typename result<Env,PtrActor,MemFunPtrActor>::type
        eval(const Env& env, PtrActor& ptrActor, MemFunPtrActor& memFunPtrActor)
        {
            return (get_pointer(ptrActor.eval(env))->*memFunPtrActor.eval(env))();
        }

#define BOOST_PP_ITERATION_PARAMS_1                                                                                 \
        (3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp"))

#include BOOST_PP_ITERATE()
Exemple #2
0
        struct zip_iterator_category<
            tuple<T, U>
          , typename boost::enable_if_c<
                tuple_size<tuple<T, U> >::value == 2
            >::type
        > : zip_iterator_category_impl<
                typename std::iterator_traits<T>::iterator_category
              , typename std::iterator_traits<U>::iterator_category
            >
        {};

#       define HPX_PARALLEL_UTIL_ZIP_ITERATOR_CATEGORY(Z, N, D)               \
            typename zip_iterator_reference_impl<BOOST_PP_CAT(T, N)>::type    \
        /**/
        template <typename T, typename U,
            BOOST_PP_ENUM_PARAMS(BOOST_PP_SUB(N, 2), typename T)>
        struct zip_iterator_category<
            tuple<T, U, BOOST_PP_ENUM_PARAMS(BOOST_PP_SUB(N, 2), T)>
          , typename boost::enable_if_c<
                (tuple_size<tuple<
                    T, U, BOOST_PP_ENUM_PARAMS(BOOST_PP_SUB(N, 2), T)
                > >::value > 2)
            >::type
        > : zip_iterator_category_impl<
                typename zip_iterator_category_impl<
                    typename std::iterator_traits<T>::iterator_category
                  , typename std::iterator_traits<U>::iterator_category
                >::type
              , typename zip_iterator_category<tuple<
                    BOOST_PP_ENUM_PARAMS(BOOST_PP_SUB(N, 2), T)
                > >::type
Exemple #3
0
#else // BOOST_PP_IS_ITERATING

    #define N BOOST_PP_ITERATION()

    // Assymetry here between the handling of and_N and or_N because
    // and_N is used by lambda_matches up to BOOST_PROTO_MAX_ARITY,
    // regardless of how low BOOST_PROTO_MAX_LOGICAL_ARITY is.
    template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
    struct BOOST_PP_CAT(and_, N)
    #if 2 == N
      : mpl::bool_<P0::value>
    {};
    #else
      : BOOST_PP_CAT(and_, BOOST_PP_DEC(N))<
            P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
            BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
        >
    {};
    #endif

    template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
    struct BOOST_PP_CAT(and_, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
      : mpl::false_
    {};

    #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY

        template<BOOST_PP_ENUM_PARAMS(N, typename G), typename Expr, typename State, typename Data>
        struct _and_impl<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, Data>
          : proto::transform_impl<Expr, State, Data>
Exemple #4
0
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/tuple/eat.hpp>

#define _MAX_ARGS 64

/* Python code for generating The TF_ARG_N() macros:
for i in range(1, 32+1):
    line = '#define TF_ARG_%d(' % i
    for j in range(1, i):
        line += '_%d,' % j
    line += '_%d,...) _%d' % (i, i)
    print(line)
*/

// Make sure TF_ARG_N() supports at least BOOST_PP_LIMIT_TUPLE arguments.

#define _TF_ARG_ERROR(a, b, c)
#define _TF_ARG_TUPLE_OVERFLOW(a, b, c)

BOOST_PP_IIF(BOOST_PP_EQUAL(1,                                          \
    BOOST_PP_EXPAND(BOOST_PP_CAT(TF_ARG_, _MAX_ARGS) BOOST_PP_LPAREN()  \
    _TF                                                                 \
    BOOST_PP_REPEAT(BOOST_PP_SUB(_MAX_ARGS, 2), _TF_NUM_ARGS_REP, _TF)  \
    BOOST_PP_COMMA() 1 BOOST_PP_RPAREN())),                             \
    BOOST_PP_TUPLE_EAT(1), _TF_ARG_ERROR)(...)

BOOST_PP_IIF(BOOST_PP_GREATER_EQUAL(_MAX_ARGS, BOOST_PP_LIMIT_TUPLE), \
             BOOST_PP_TUPLE_EAT(1), _TF_ARG_TUPLE_OVERFLOW)(...)
 
#endif