poly_function_funop.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
  2. #include <boost/proto/detail/preprocessed/poly_function_funop.hpp>
  3. #elif !defined(BOOST_PP_IS_ITERATING)
  4. #define BOOST_PROTO_NORMALIZE_ARG(Z, N, DATA) \
  5. static_cast<typename normalize_arg<BOOST_PP_CAT(A, N) const &> \
  6. ::reference>(BOOST_PP_CAT(a, N)) \
  7. /**/
  8. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  9. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/poly_function_funop.hpp")
  10. #endif
  11. ///////////////////////////////////////////////////////////////////////////////
  12. // poly_function_funop.hpp
  13. // Contains overloads of poly_function\<\>::operator()
  14. //
  15. // Copyright 2008 Eric Niebler. Distributed under the Boost
  16. // Software License, Version 1.0. (See accompanying file
  17. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  18. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  19. #pragma wave option(preserve: 1)
  20. #endif
  21. #define BOOST_PP_ITERATION_PARAMS_1 \
  22. (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/poly_function_funop.hpp>))
  23. #include BOOST_PP_ITERATE()
  24. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  25. #pragma wave option(output: null)
  26. #endif
  27. #undef BOOST_PROTO_NORMALIZE_ARG
  28. #else
  29. #define N BOOST_PP_ITERATION()
  30. template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
  31. struct result<This(BOOST_PP_ENUM_PARAMS(N, A))>
  32. : Derived::template impl<
  33. BOOST_PP_ENUM_BINARY_PARAMS(
  34. N
  35. , typename normalize_arg<A
  36. , >::type BOOST_PP_INTERCEPT
  37. )
  38. >
  39. {
  40. typedef typename result::result_type type;
  41. };
  42. template<BOOST_PP_ENUM_PARAMS(N, typename A)>
  43. typename result<
  44. Derived const(
  45. BOOST_PP_ENUM_BINARY_PARAMS(N, A, const & BOOST_PP_INTERCEPT)
  46. )
  47. >::type
  48. operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const
  49. {
  50. result<
  51. Derived const(
  52. BOOST_PP_ENUM_BINARY_PARAMS(N, A, const & BOOST_PP_INTERCEPT)
  53. )
  54. > impl;
  55. return impl(BOOST_PP_ENUM(N, BOOST_PROTO_NORMALIZE_ARG, ~));
  56. }
  57. #undef N
  58. #endif // BOOST_PROTO_DONT_USE_PREPROCESSED_FILES