vector.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  2. #ifndef BOOST_PHOENIX_SUPPORT_VECTOR_HPP
  3. #define BOOST_PHOENIX_SUPPORT_VECTOR_HPP
  4. #include <boost/phoenix/core/limits.hpp>
  5. #include <boost/phoenix/support/iterate.hpp>
  6. #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
  7. #include <boost/fusion/adapted/struct/adapt_struct.hpp>
  8. #define BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL BOOST_FUSION_ADAPT_TPL_STRUCT
  9. #include <boost/phoenix/support/preprocessed/vector.hpp>
  10. #endif
  11. #else
  12. #if !BOOST_PHOENIX_IS_ITERATING
  13. #ifndef BOOST_PHOENIX_SUPPORT_VECTOR_HPP
  14. #define BOOST_PHOENIX_SUPPORT_VECTOR_HPP
  15. #include <boost/phoenix/core/limits.hpp>
  16. #include <boost/phoenix/support/iterate.hpp>
  17. #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
  18. #include <boost/fusion/adapted/struct/adapt_struct.hpp>
  19. #define BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL BOOST_FUSION_ADAPT_TPL_STRUCT
  20. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  21. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/vector_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  22. #endif
  23. /*==============================================================================
  24. Copyright (c) 2005-2010 Joel de Guzman
  25. Copyright (c) 2010 Thomas Heller
  26. Distributed under the Boost Software License, Version 1.0. (See accompanying
  27. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  28. ==============================================================================*/
  29. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  30. #pragma wave option(preserve: 1)
  31. #endif
  32. #define M0(Z, N, D) \
  33. typedef BOOST_PP_CAT(A, N) BOOST_PP_CAT(member_type, N); \
  34. BOOST_PP_CAT(A, N) BOOST_PP_CAT(a, N); \
  35. /**/
  36. #define M1(Z, N, D) \
  37. (BOOST_PP_CAT(A, N)) \
  38. /**/
  39. #define M2(Z, N, D) \
  40. (BOOST_PP_CAT(T, N)) \
  41. /**/
  42. #define M3(Z, N, D) \
  43. (BOOST_PP_CAT(A, N), BOOST_PP_CAT(a, N)) \
  44. /**/
  45. namespace boost { namespace phoenix
  46. {
  47. template <typename Dummy = void>
  48. struct vector0
  49. {
  50. typedef mpl::int_<0> size_type;
  51. static const int size_value = 0;
  52. };
  53. }}
  54. #define BOOST_PHOENIX_ITERATION_PARAMS \
  55. (3, (1, BOOST_PP_INC(BOOST_PHOENIX_LIMIT), \
  56. <boost/phoenix/support/vector.hpp>))
  57. #include BOOST_PHOENIX_ITERATE()
  58. #undef M0
  59. #undef M1
  60. #undef M2
  61. #undef M3
  62. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  63. #pragma wave option(output: null)
  64. #endif
  65. #endif
  66. #else
  67. namespace boost { namespace phoenix
  68. {
  69. template <BOOST_PHOENIX_typename_A>
  70. struct BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)
  71. {
  72. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M0, _)
  73. typedef mpl::int_<BOOST_PHOENIX_ITERATION> size_type;
  74. static const int size_value = BOOST_PHOENIX_ITERATION;
  75. typedef
  76. BOOST_PP_CAT(vector, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION))<BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PHOENIX_ITERATION, A)>
  77. args_type;
  78. args_type args() const
  79. {
  80. args_type r = {BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PHOENIX_ITERATION, a)};
  81. return r;
  82. }
  83. };
  84. }}
  85. #define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM0 \
  86. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _) \
  87. /**/
  88. #define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM1 \
  89. ( \
  90. BOOST_PP_CAT( \
  91. boost::phoenix::vector \
  92. , BOOST_PHOENIX_ITERATION \
  93. ) \
  94. ) \
  95. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _) \
  96. /**/
  97. #define BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM2 \
  98. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M3, _) \
  99. /**/
  100. BOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL(
  101. BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM0
  102. , BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM1
  103. , BOOST_PHOENIX_SUPPORT_VECTOR_ADAT_PARAM2
  104. )
  105. #endif
  106. #endif