Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / phoenix / operator / detail / mem_fun_ptr_gen.hpp
1
2 #if !BOOST_PHOENIX_IS_ITERATING
3
4 #ifndef BOOST_PHOENIX_OPERATOR_MEMBER_DETAIL_MEM_FUN_PTR_GEN_HPP
5 #define BOOST_PHOENIX_OPERATOR_MEMBER_DETAIL_MEM_FUN_PTR_GEN_HPP
6
7 #include <boost/phoenix/core/limits.hpp>
8 #include <boost/phoenix/support/iterate.hpp>
9 #include <boost/phoenix/core/expression.hpp>
10
11 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
12
13 #include <boost/phoenix/operator/detail/preprocessed/mem_fun_ptr_gen.hpp>
14
15 #else
16
17 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
18 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/mem_fun_ptr_gen_" BOOST_PHOENIX_LIMIT_STR ".hpp")
19 #endif
20
21 /*==============================================================================
22     Copyright (c) 2001-2010 Joel de Guzman
23     Copyright (c) 2010 Thomas Heller
24
25     Distributed under the Boost Software License, Version 1.0. (See accompanying
26     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
27 ==============================================================================*/
28
29 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
30 #pragma wave option(preserve: 1)
31 #endif
32
33 BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG(
34     (boost)(phoenix)(mem_fun_ptr)
35   , (meta_grammar)
36     (meta_grammar)
37   , BOOST_PHOENIX_LIMIT
38 )
39
40 namespace boost { namespace phoenix
41 {
42     namespace detail {
43         template <typename Object, typename MemPtr>
44         struct mem_fun_ptr_gen
45         {
46             mem_fun_ptr_gen(Object const& obj_, MemPtr ptr_)
47               : obj(obj_)
48               , ptr(ptr_)
49             {}
50
51             typename phoenix::expression::mem_fun_ptr<Object, MemPtr>::type const
52             operator()() const
53             {
54                 return phoenix::expression::mem_fun_ptr<Object, MemPtr>::make(obj, ptr);
55             }
56
57 #define BOOST_PHOENIX_ITERATION_PARAMS                                          \
58         (3, (1, BOOST_PHOENIX_MEMBER_LIMIT,                                     \
59         <boost/phoenix/operator/detail/mem_fun_ptr_gen.hpp>))                   \
60
61 #include BOOST_PHOENIX_ITERATE()
62
63             Object const& obj;
64             MemPtr ptr;
65
66         };
67
68         struct make_mem_fun_ptr_gen
69             : proto::callable
70         {
71             template<typename Sig>
72             struct result;
73
74             template<typename This, typename Object, typename MemPtr>
75             struct result<This(Object, MemPtr)>
76             {
77                 typedef
78                     mem_fun_ptr_gen<
79                         typename remove_const<typename remove_reference<Object>::type>::type
80                       , typename remove_const<typename remove_reference<MemPtr>::type>::type
81                     >
82                 type;
83             };
84
85             template<typename Object, typename MemPtr>
86             mem_fun_ptr_gen<Object, MemPtr> operator()(Object const & obj, MemPtr ptr) const
87             {
88                 return mem_fun_ptr_gen<Object, MemPtr>(obj, ptr);
89             }
90         };
91     }
92 }}
93
94 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
95 #pragma wave option(output: null)
96 #endif
97
98 #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
99
100 #endif
101
102 #else
103             template <BOOST_PHOENIX_typename_A>
104             typename phoenix::expression::mem_fun_ptr<
105                 Object
106               , MemPtr
107               , BOOST_PHOENIX_A
108             >::type const
109             operator()(BOOST_PHOENIX_A_const_ref_a) const
110             {
111                 return phoenix::expression::mem_fun_ptr<
112                     Object
113                   , MemPtr
114                   , BOOST_PHOENIX_A
115                 >::make(obj, ptr, BOOST_PHOENIX_a);
116             }
117 #endif