]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / spirit / home / phoenix / operator / detail / mem_fun_ptr_gen.hpp
1 /*=============================================================================
2     Copyright (c) 2005-2007 Dan Marsden
3     Copyright (c) 2005-2007 Joel de Guzman
4
5     Distributed under the Boost Software License, Version 1.0. (See accompanying 
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PP_IS_ITERATING
9 #ifndef PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP
10 #define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_GEN_HPP
11
12 #include <boost/spirit/home/phoenix/core/composite.hpp>
13 #include <boost/spirit/home/phoenix/core/compose.hpp>
14 #include <boost/spirit/home/phoenix/core/as_actor.hpp>
15 #include <boost/spirit/home/phoenix/core/limits.hpp>
16 #include <boost/spirit/home/phoenix/core/actor.hpp>
17
18 #include <boost/preprocessor/repetition/enum_params.hpp>
19 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
20 #include <boost/preprocessor/iteration/iterate.hpp>
21 #include <boost/preprocessor/arithmetic/dec.hpp>
22
23 #include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp>
24
25 namespace boost { namespace phoenix {
26     template<typename Actor, typename MemFunPtr>
27     struct mem_fun_ptr_gen
28     {
29         mem_fun_ptr_gen(
30             const Actor& actor, MemFunPtr memFunPtr)
31             : mActor(actor), mMemFunPtr(memFunPtr) { }
32
33         actor<typename as_composite<mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type>::type>
34         operator()() const
35         {
36             return compose<mem_fun_ptr_eval>(
37                 mActor, as_actor<MemFunPtr>::convert(mMemFunPtr));
38         }
39
40 #define BOOST_PP_ITERATION_PARAMS_1                                                        \
41         (3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp"))
42
43 #include BOOST_PP_ITERATE()
44
45         Actor mActor;
46         MemFunPtr mMemFunPtr;
47     };
48 }}
49
50 #endif
51 #else
52
53 #define PHOENIX_ITERATION BOOST_PP_ITERATION()
54
55         template<BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Arg)>
56         actor<typename as_composite<
57             mem_fun_ptr_eval, Actor, typename as_actor<MemFunPtr>::type,
58             BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, Arg)>::type>
59         operator()(
60             BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, const Arg, &arg)) const
61         {
62             return compose<mem_fun_ptr_eval>(
63                 mActor, as_actor<MemFunPtr>::convert(mMemFunPtr),
64                 BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, arg));
65         }
66
67 #undef PHOENIX_ITERATION
68
69 #endif