bind_member_variable.hpp 1.6 KB

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