]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2007 Joel de Guzman | |
3 | Copyright (c) 2014 John Fletcher | |
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 | ||
9 | #ifndef PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP | |
10 | #define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP | |
11 | ||
12 | #include <boost/utility/enable_if.hpp> | |
13 | #include <boost/type_traits/is_member_function_pointer.hpp> | |
14 | #include <boost/phoenix/core/expression.hpp> | |
15 | #include <boost/phoenix/core/detail/function_eval.hpp> | |
16 | #include <boost/phoenix/bind/detail/member_variable.hpp> | |
17 | ||
18 | namespace boost { namespace phoenix | |
19 | { | |
20 | template <typename RT, typename ClassT, typename ClassA> | |
21 | inline | |
22 | typename boost::lazy_disable_if< | |
23 | boost::is_member_function_pointer<RT (ClassT::*)>, | |
24 | typename detail::expression::function_eval< | |
25 | detail::member_variable<RT, RT ClassT::*> | |
26 | , ClassA >//::type | |
27 | >::type const | |
28 | bind(RT ClassT::*mp, ClassA const& obj) | |
29 | { | |
30 | typedef detail::member_variable<RT, RT ClassT::*> mp_type; | |
31 | return | |
32 | detail::expression::function_eval<mp_type, ClassA> | |
33 | ::make(mp_type(mp), obj); | |
34 | } | |
35 | ||
36 | template <typename RT, typename ClassT> | |
37 | inline | |
38 | typename boost::lazy_disable_if< | |
39 | boost::is_member_function_pointer<RT (ClassT::*)>, | |
40 | typename detail::expression::function_eval< | |
41 | detail::member_variable<RT, RT ClassT::*> | |
42 | , ClassT >//::type | |
43 | >::type const | |
44 | bind(RT ClassT::*mp, ClassT& obj) | |
45 | { | |
46 | typedef detail::member_variable<RT, RT ClassT::*> mp_type; | |
47 | return | |
48 | detail::expression::function_eval< | |
49 | mp_type | |
50 | , ClassT | |
51 | >::make(mp_type(mp), obj); | |
52 | } | |
53 | ||
54 | }} | |
55 | ||
56 | #endif |