member.hpp 2.9 KB

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