vector.hpp 5.5 KB

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