1 /*==============================================================================
2     Copyright (c) 2005-2010 Joel de Guzman
3     Copyright (c) 2010 Thomas Heller
4     Copyright (c) 2016 Kohei Takahashi
5 
6     Distributed under the Boost Software License, Version 1.0. (See accompanying
7     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 
10 #ifndef BOOST_PHOENIX_OPERATOR_MEMBER_HPP
11 #define BOOST_PHOENIX_OPERATOR_MEMBER_HPP
12 
13 #include <boost/phoenix/core/limits.hpp>
14 #include <boost/get_pointer.hpp>
15 #include <boost/phoenix/core/domain.hpp>
16 #include <boost/phoenix/core/meta_grammar.hpp>
17 #include <boost/phoenix/core/call.hpp>
18 #include <boost/phoenix/core/expression.hpp>
19 #include <boost/type_traits/remove_reference.hpp>
20 #include <boost/type_traits/is_member_function_pointer.hpp>
21 #include <boost/proto/operators.hpp>
22 #include <boost/phoenix/support/iterate.hpp>
23 
24 #ifdef BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
25 #   include <boost/phoenix/operator/detail/cpp03/mem_fun_ptr_expr.hpp>
26 #else
27 BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG(
28     (boost)(phoenix)(mem_fun_ptr)
29   , (meta_grammar)(meta_grammar)
30   , _
31 )
32 #endif
33 
34 #include <boost/phoenix/operator/detail/define_operator.hpp>
35 
36 namespace boost { namespace phoenix
37 {
38 #if defined(BOOST_PHOENIX_NO_VARIADIC_OPERATOR)
39     #include <boost/phoenix/operator/detail/cpp03/mem_fun_ptr_gen.hpp>
40 #else
41     // TODO
42 #endif
43 
44     BOOST_PHOENIX_BINARY_OPERATORS((mem_ptr))
45 
46     template<>
47     struct phoenix_generator::case_<proto::tag::mem_ptr>
48       : proto::or_<
49             proto::when<
50                 proto::and_<
51                     proto::mem_ptr<meta_grammar, proto::terminal<proto::_> >
52                   , proto::if_<is_member_function_pointer<boost::remove_reference<proto::call<proto::_value(proto::_right)> > >()>
53                 >
54               , proto::call<detail::make_mem_fun_ptr_gen(proto::_left, proto::call<proto::_value(proto::_right)>)>
55             >
56           , proto::otherwise<
57                 proto::call<proto::pod_generator<actor>(proto::_)>
58             >
59         >
60     {};
61 
62     namespace result_of
63     {
64         template <
65             typename Context
66           , BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_LIMIT)
67           , typename Dummy = void
68         >
69         struct mem_fun_ptr_eval;
70 
71 #if defined(BOOST_PHOENIX_NO_VARIADIC_OPERATOR)
72         #include <boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval_result_of.hpp>
73 #else
74     // TODO
75 #endif
76     }
77 
78     struct mem_fun_ptr_eval
79     {
80         template<typename Sig>
81         struct result;
82 
83 #if defined(BOOST_PHOENIX_NO_VARIADIC_OPERATOR)
84         #include <boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval.hpp>
85 #else
86     // TODO
87 #endif
88     };
89 
90     template <typename Dummy>
91     struct default_actions::when<rule::mem_fun_ptr, Dummy>
92         : call<mem_fun_ptr_eval>
93     {};
94 }}
95 
96 #include <boost/phoenix/operator/detail/undef_operator.hpp>
97 
98 #endif
99