mem_fun_ptr_gen.hpp 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #if !BOOST_PHOENIX_IS_ITERATING
  2. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  3. #include <boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen.hpp>
  4. #else
  5. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  6. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/mem_fun_ptr_gen_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  7. #endif
  8. /*==============================================================================
  9. Copyright (c) 2001-2010 Joel de Guzman
  10. Copyright (c) 2010 Thomas Heller
  11. Distributed under the Boost Software License, Version 1.0. (See accompanying
  12. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  13. ==============================================================================*/
  14. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  15. #pragma wave option(preserve: 1)
  16. #endif
  17. namespace detail {
  18. template <typename Object, typename MemPtr>
  19. struct mem_fun_ptr_gen
  20. {
  21. mem_fun_ptr_gen(Object const& obj_, MemPtr ptr_)
  22. : obj(obj_)
  23. , ptr(ptr_)
  24. {}
  25. typename phoenix::expression::mem_fun_ptr<Object, MemPtr>::type const
  26. operator()() const
  27. {
  28. return phoenix::expression::mem_fun_ptr<Object, MemPtr>::make(obj, ptr);
  29. }
  30. #define BOOST_PHOENIX_ITERATION_PARAMS \
  31. (3, (1, BOOST_PHOENIX_MEMBER_LIMIT, \
  32. <boost/phoenix/operator/detail/cpp03/mem_fun_ptr_gen.hpp>)) \
  33. #include BOOST_PHOENIX_ITERATE()
  34. Object const& obj;
  35. MemPtr ptr;
  36. };
  37. struct make_mem_fun_ptr_gen
  38. : proto::callable
  39. {
  40. template<typename Sig>
  41. struct result;
  42. template<typename This, typename Object, typename MemPtr>
  43. struct result<This(Object, MemPtr)>
  44. {
  45. typedef
  46. mem_fun_ptr_gen<
  47. typename remove_const<typename remove_reference<Object>::type>::type
  48. , typename remove_const<typename remove_reference<MemPtr>::type>::type
  49. >
  50. type;
  51. };
  52. template<typename Object, typename MemPtr>
  53. mem_fun_ptr_gen<Object, MemPtr> operator()(Object const & obj, MemPtr ptr) const
  54. {
  55. return mem_fun_ptr_gen<Object, MemPtr>(obj, ptr);
  56. }
  57. };
  58. }
  59. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  60. #pragma wave option(output: null)
  61. #endif
  62. #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
  63. #else
  64. template <BOOST_PHOENIX_typename_A>
  65. typename phoenix::expression::mem_fun_ptr<
  66. Object
  67. , MemPtr
  68. , BOOST_PHOENIX_A
  69. >::type const
  70. operator()(BOOST_PHOENIX_A_const_ref_a) const
  71. {
  72. return phoenix::expression::mem_fun_ptr<
  73. Object
  74. , MemPtr
  75. , BOOST_PHOENIX_A
  76. >::make(obj, ptr, BOOST_PHOENIX_a);
  77. }
  78. #endif