args.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
  2. #include <boost/proto/detail/preprocessed/args.hpp>
  3. #elif !defined(BOOST_PP_IS_ITERATING)
  4. /// INTERNAL ONLY
  5. ///
  6. #define BOOST_PROTO_DEFINE_CHILD_N(Z, N, DATA) \
  7. typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(child, N); \
  8. /**< INTERNAL ONLY */
  9. /// INTERNAL ONLY
  10. ///
  11. #define BOOST_PROTO_DEFINE_VOID_N(z, n, data) \
  12. typedef mpl::void_ BOOST_PP_CAT(child, n); \
  13. /**< INTERNAL ONLY */
  14. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  15. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/args.hpp")
  16. #endif
  17. ///////////////////////////////////////////////////////////////////////////////
  18. /// \file args.hpp
  19. /// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
  20. /// class templates.
  21. //
  22. // Copyright 2008 Eric Niebler. Distributed under the Boost
  23. // Software License, Version 1.0. (See accompanying file
  24. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  25. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  26. #pragma wave option(preserve: 1)
  27. #endif
  28. /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
  29. ///
  30. /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
  31. /// The types in the sequence correspond to the children of a node in an expression tree.
  32. template< typename Arg0 >
  33. struct term
  34. {
  35. static const long arity = 0;
  36. typedef Arg0 child0;
  37. BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
  38. /// INTERNAL ONLY
  39. ///
  40. typedef Arg0 back_;
  41. };
  42. #define BOOST_PP_ITERATION_PARAMS_1 \
  43. (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/args.hpp>))
  44. #include BOOST_PP_ITERATE()
  45. #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
  46. #pragma wave option(output: null)
  47. #endif
  48. #undef BOOST_PROTO_DEFINE_VOID_N
  49. #undef BOOST_PROTO_DEFINE_CHILD_N
  50. #else
  51. #define N BOOST_PP_ITERATION()
  52. /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
  53. ///
  54. /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
  55. /// The types in the sequence correspond to the children of a node in an expression tree.
  56. template< BOOST_PP_ENUM_PARAMS(N, typename Arg) >
  57. struct BOOST_PP_CAT(list, N)
  58. {
  59. static const long arity = N;
  60. BOOST_PP_REPEAT(N, BOOST_PROTO_DEFINE_CHILD_N, ~)
  61. BOOST_PP_REPEAT_FROM_TO(N, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
  62. /// INTERNAL ONLY
  63. ///
  64. typedef BOOST_PP_CAT(Arg, BOOST_PP_DEC(N)) back_;
  65. };
  66. #undef N
  67. #endif