make_expr.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
  2. #include <boost/proto/detail/preprocessed/make_expr.hpp>
  3. #elif !defined(BOOST_PP_IS_ITERATING)
  4. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  5. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_expr.hpp")
  6. #endif
  7. ///////////////////////////////////////////////////////////////////////////////
  8. /// \file make_expr.hpp
  9. /// Contains overloads of make_expr() free function.
  10. //
  11. // Copyright 2008 Eric Niebler. Distributed under the Boost
  12. // Software License, Version 1.0. (See accompanying file
  13. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  14. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  15. #pragma wave option(preserve: 1)
  16. #endif
  17. #define BOOST_PP_ITERATION_PARAMS_1 \
  18. (3, (2, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/make_expr.hpp>))
  19. #include BOOST_PP_ITERATE()
  20. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  21. #pragma wave option(output: null)
  22. #endif
  23. #else // BOOST_PP_IS_ITERATING
  24. #define N BOOST_PP_ITERATION()
  25. /// \overload
  26. ///
  27. template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
  28. BOOST_FORCEINLINE
  29. typename lazy_disable_if<
  30. is_domain<A0>
  31. , result_of::make_expr<
  32. Tag
  33. BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
  34. >
  35. >::type const
  36. make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a))
  37. {
  38. return proto::detail::make_expr_<
  39. Tag
  40. , deduce_domain
  41. BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
  42. >()(BOOST_PP_ENUM_PARAMS(N, a));
  43. }
  44. /// \overload
  45. ///
  46. template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename C)>
  47. BOOST_FORCEINLINE
  48. typename result_of::make_expr<
  49. Tag
  50. , Domain
  51. BOOST_PP_ENUM_TRAILING_PARAMS(N, const C)
  52. >::type const
  53. make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const C, &c))
  54. {
  55. return proto::detail::make_expr_<
  56. Tag
  57. , Domain
  58. BOOST_PP_ENUM_TRAILING_PARAMS(N, const C)
  59. >()(BOOST_PP_ENUM_PARAMS(N, c));
  60. }
  61. #undef N
  62. #endif