Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / phoenix / bind / bind_member_variable.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2007 Joel de Guzman
3
4     Distributed under the Boost Software License, Version 1.0. (See accompanying 
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7
8 #ifndef PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
9 #define PHOENIX_BIND_BIND_MEMBER_VARIABLE_HPP
10
11 #include <boost/phoenix/core/expression.hpp>
12 #include <boost/phoenix/core/detail/function_eval.hpp>
13 #include <boost/phoenix/bind/detail/member_variable.hpp>
14
15 namespace boost { namespace phoenix
16 {
17     template <typename RT, typename ClassT, typename ClassA>
18     inline
19     typename
20         detail::expression::function_eval<
21             detail::member_variable<RT, RT ClassT::*>
22           , ClassA
23         >::type const
24     bind(RT ClassT::*mp, ClassA const& obj)
25     {
26         typedef detail::member_variable<RT, RT ClassT::*> mp_type;
27         return
28             detail::expression::function_eval<mp_type, ClassA>
29                 ::make(mp_type(mp), obj);
30     }
31
32     template <typename RT, typename ClassT>
33     inline
34     typename
35         detail::expression::function_eval<
36             detail::member_variable<RT, RT ClassT::*>
37           , ClassT
38         >::type const
39     bind(RT ClassT::*mp, ClassT& obj)
40     {
41         typedef detail::member_variable<RT, RT ClassT::*> mp_type;
42         return
43             detail::expression::function_eval<
44                 mp_type
45               , ClassT
46             >::make(mp_type(mp), obj);
47     }
48
49 }}
50
51 #endif