summaryrefslogtreecommitdiffstats
blob: 31d5413035c402d365065cf78372e9fbc4583724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*=============================================================================
    Copyright (c) 2005-2007 Dan Marsden
    Copyright (c) 2005-2007 Joel de Guzman

    Distributed under the Boost Software License, Version 1.0. (See accompanying 
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#ifndef PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP
#define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP

#include <boost/spirit/home/phoenix/core/composite.hpp>
#include <boost/spirit/home/phoenix/core/compose.hpp>
#include <boost/spirit/home/phoenix/core/as_actor.hpp>
#include <boost/spirit/home/phoenix/core/limits.hpp>
#include <boost/spirit/home/phoenix/core/actor.hpp>

#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>

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

namespace boost { namespace phoenix {
    template<typename Actor, typename MemFunPtr>
    struct mem_fun_ptr_gen
    {
        mem_fun_ptr_gen(
            const Actor& actor, MemFunPtr memFunPtr)
            : mActor(actor), mMemFunPtr(memFunPtr) { }

        actor<typename as_composite<mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type>::type>
        operator()() const
        {
            return compose<mem_fun_ptr_eval>(
                mActor, as_actor<MemFunPtr>::convert(mMemFunPtr));
        }

#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_gen.hpp"))

#include BOOST_PP_ITERATE()

        Actor mActor;
        MemFunPtr mMemFunPtr;
    };
}}

#endif
#else

#define PHOENIX_ITERATION BOOST_PP_ITERATION()

        template<BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Arg)>
        actor<typename as_composite<
            mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type,
            BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, Arg)>::type>
        operator()(
            BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, const Arg, &arg)) const
        {
            return compose<mem_fun_ptr_eval>(
                mActor, as_actor<MemFunPtr>::convert(mMemFunPtr),
                BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, arg));
        }

#undef PHOENIX_ITERATION

#endif