/Src/Dependencies/Boost/boost/proto/transform/detail/make_gcc_workaround.hpp

http://hadesmem.googlecode.com/ · C++ Header · 98 lines · 69 code · 19 blank · 10 comment · 15 complexity · 46cb8c591a0c1c3f1ad4967a9b2e4327 MD5 · raw file

  1. #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
  2. #if BOOST_WORKAROUND(__GNUC__, == 3) || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
  3. #include <boost/proto/transform/detail/preprocessed/make_gcc_workaround.hpp>
  4. #endif
  5. #elif !defined(BOOST_PP_IS_ITERATING)
  6. #define BOOST_PROTO_EXPR_MAKE_ARG(Z, M, DATA) \
  7. detail::as_lvalue( \
  8. typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d) \
  9. ) \
  10. /**/
  11. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  12. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_gcc_workaround.hpp")
  13. #endif
  14. ///////////////////////////////////////////////////////////////////////////////
  15. /// \file make_gcc_workaround.hpp
  16. /// Special workaround code to make the make\<\> transform work on certain
  17. /// versions of gcc.
  18. //
  19. // Copyright 2008 Eric Niebler. Distributed under the Boost
  20. // Software License, Version 1.0. (See accompanying file
  21. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  22. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  23. #pragma wave option(preserve: 1)
  24. #endif
  25. #if BOOST_WORKAROUND(__GNUC__, == 3) || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) || \
  26. (defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES))
  27. #define BOOST_PP_ITERATION_PARAMS_1 \
  28. (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make_gcc_workaround.hpp>))
  29. #include BOOST_PP_ITERATE()
  30. #endif
  31. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  32. #pragma wave option(output: null)
  33. #endif
  34. #undef BOOST_PROTO_EXPR_MAKE_ARG
  35. #else
  36. #define N BOOST_PP_ITERATION()
  37. // work around GCC bug
  38. template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
  39. struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
  40. : transform<make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
  41. {
  42. template<typename Expr, typename State, typename Data>
  43. struct impl : transform_impl<Expr, State, Data>
  44. {
  45. typedef proto::expr<Tag, Args, Arity> result_type;
  46. result_type operator ()(
  47. typename impl::expr_param e
  48. , typename impl::state_param s
  49. , typename impl::data_param d
  50. ) const
  51. {
  52. return proto::expr<Tag, Args, Arity>::make(
  53. BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
  54. );
  55. }
  56. };
  57. };
  58. template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
  59. struct make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
  60. : transform<make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
  61. {
  62. template<typename Expr, typename State, typename Data>
  63. struct impl : transform_impl<Expr, State, Data>
  64. {
  65. typedef proto::basic_expr<Tag, Args, Arity> result_type;
  66. result_type operator ()(
  67. typename impl::expr_param e
  68. , typename impl::state_param s
  69. , typename impl::data_param d
  70. ) const
  71. {
  72. return proto::basic_expr<Tag, Args, Arity>::make(
  73. BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
  74. );
  75. }
  76. };
  77. };
  78. #undef N
  79. #endif