call.hpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  2. #ifndef BOOST_PHOENIX_CORE_DETAIL_CALL_HPP
  3. #define BOOST_PHOENIX_CORE_DETAIL_CALL_HPP
  4. #include <boost/phoenix/core/detail/cpp03/preprocessed/call.hpp>
  5. #endif
  6. #else
  7. #if !BOOST_PHOENIX_IS_ITERATING
  8. #ifndef BOOST_PHOENIX_CORE_DETAIL_CALL_HPP
  9. #define BOOST_PHOENIX_CORE_DETAIL_CALL_HPP
  10. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  11. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/call_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  12. #endif
  13. /*==============================================================================
  14. Copyright (c) 2005-2010 Joel de Guzman
  15. Copyright (c) 2010 Thomas Heller
  16. Distributed under the Boost Software License, Version 1.0. (See accompanying
  17. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  18. ==============================================================================*/
  19. #include <boost/phoenix/support/iterate.hpp>
  20. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  21. #pragma wave option(preserve: 1)
  22. #endif
  23. #define M0(Z, N ,D) \
  24. typedef \
  25. typename proto::result_of::child_c<Expr, N>::type \
  26. BOOST_PP_CAT(A, N); \
  27. /**/
  28. #define M1(Z, N ,D) \
  29. BOOST_PP_COMMA_IF(N) proto::child_c<N>(e)
  30. /**/
  31. #define BOOST_PHOENIX_ITERATION_PARAMS \
  32. (3, (1, BOOST_PHOENIX_LIMIT, \
  33. <boost/phoenix/core/detail/cpp03/call.hpp>))
  34. #include BOOST_PHOENIX_ITERATE()
  35. #undef M0
  36. #undef M1
  37. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  38. #pragma wave option(output: null)
  39. #endif
  40. #endif
  41. #else
  42. template <typename Fun, typename Expr, typename State, typename Data>
  43. struct call_impl<Fun, Expr, State, Data, BOOST_PHOENIX_ITERATION>
  44. : proto::transform_impl<Expr, State, Data>
  45. {
  46. typedef
  47. typename boost::phoenix::result_of::context<State, Data>::type
  48. context_type;
  49. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M0, _)
  50. typedef
  51. typename boost::result_of<
  52. Fun(BOOST_PHOENIX_A, context_type)
  53. >::type
  54. result_type;
  55. result_type operator()(
  56. typename call_impl::expr_param e
  57. , typename call_impl::state_param s
  58. , typename call_impl::data_param d
  59. ) const
  60. {
  61. return
  62. Fun()(
  63. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _)
  64. , boost::phoenix::context(s, d)
  65. );
  66. }
  67. };
  68. #endif
  69. #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES