PageRenderTime 13ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp

http://hadesmem.googlecode.com/
C++ Header | 76 lines | 49 code | 20 blank | 7 comment | 0 complexity | c54fa9698e42da7756fc57b99698a6ba MD5 | raw file
 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_EVAL_HPP
10#define PHOENIX_OPERATOR_DETAIL_MEM_FUN_PTR_EVAL_HPP
11
12#include <boost/spirit/home/phoenix/core/limits.hpp>
13#include <boost/spirit/home/phoenix/core/actor.hpp>
14
15#include <boost/preprocessor/repetition/enum_params.hpp>
16#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
17#include <boost/preprocessor/repetition/enum_binary_params.hpp>
18#include <boost/preprocessor/iteration/iterate.hpp>
19#include <boost/preprocessor/arithmetic/sub.hpp>
20#include <boost/preprocessor/arithmetic/dec.hpp>
21
22#include <boost/mpl/void.hpp>
23
24#include <boost/type_traits/function_traits.hpp>
25
26#include <boost/get_pointer.hpp>
27
28#include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_return.hpp>
29
30namespace boost { namespace phoenix {
31
32    struct mem_fun_ptr_eval
33    {
34        template<typename Env, typename PtrActor, typename MemFunPtrActor,
35                 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_SUB(PHOENIX_MEMBER_LIMIT, 2), typename Arg, mpl::void_)>
36
37        struct result
38            : detail::mem_fun_ptr_return<typename eval_result<MemFunPtrActor, Env>::type> { };
39
40        template<typename Rt, typename Env, typename PtrActor, typename MemFunPtrActor>
41        static typename result<Env,PtrActor,MemFunPtrActor>::type
42        eval(const Env& env, PtrActor& ptrActor, MemFunPtrActor& memFunPtrActor)
43        {
44            return (get_pointer(ptrActor.eval(env))->*memFunPtrActor.eval(env))();
45        }
46
47#define BOOST_PP_ITERATION_PARAMS_1                                                                                 \
48        (3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp"))
49
50#include BOOST_PP_ITERATE()
51
52    };
53}}
54
55#endif
56
57#else
58
59#define PHOENIX_ITERATION BOOST_PP_ITERATION()
60
61#define PHOENIX_EVAL_ARG(z,n,_) arg ## n.eval(env)        
62
63        template<typename Rt, typename Env, typename PtrActor, typename MemFunPtrActor,
64                 BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Arg)> 
65        static typename result<Env,PtrActor,MemFunPtrActor, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION,Arg)>::type
66        eval(const Env& env, PtrActor& ptrActor, MemFunPtrActor& memFunPtrActor,
67             BOOST_PP_ENUM_BINARY_PARAMS(PHOENIX_ITERATION, Arg, & arg))
68        {
69            return (get_pointer(ptrActor.eval(env))->*memFunPtrActor.eval(env))(
70                BOOST_PP_ENUM(PHOENIX_ITERATION,PHOENIX_EVAL_ARG,_));
71        }
72
73#undef PHOENIX_EVAL_ARG
74#undef PHOENIX_ITERATION
75
76#endif