as_deque.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*=============================================================================
  2. Copyright (c) 2005-2012 Joel de Guzman
  3. Copyright (c) 2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #ifndef BOOST_PP_IS_ITERATING
  8. #if !defined(FUSION_AS_DEQUE_20061213_2210)
  9. #define FUSION_AS_DEQUE_20061213_2210
  10. #include <boost/preprocessor/iterate.hpp>
  11. #include <boost/preprocessor/repetition/enum_params.hpp>
  12. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  13. #include <boost/preprocessor/repetition/repeat.hpp>
  14. #include <boost/preprocessor/cat.hpp>
  15. #include <boost/preprocessor/inc.hpp>
  16. #include <boost/preprocessor/dec.hpp>
  17. #include <boost/fusion/container/deque/deque.hpp>
  18. #include <boost/fusion/iterator/value_of.hpp>
  19. #include <boost/fusion/iterator/deref.hpp>
  20. #include <boost/fusion/iterator/next.hpp>
  21. namespace boost { namespace fusion { namespace detail
  22. {
  23. BOOST_FUSION_BARRIER_BEGIN
  24. template <int size>
  25. struct as_deque
  26. {
  27. BOOST_STATIC_ASSERT_MSG(
  28. size <= FUSION_MAX_DEQUE_SIZE
  29. , "FUSION_MAX_DEQUE_SIZE limit is too low"
  30. );
  31. };
  32. template <>
  33. struct as_deque<0>
  34. {
  35. template <typename Iterator>
  36. struct apply
  37. {
  38. typedef deque<> type;
  39. };
  40. template <typename Iterator>
  41. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  42. static typename apply<Iterator>::type
  43. call(Iterator)
  44. {
  45. return deque<>();
  46. }
  47. };
  48. BOOST_FUSION_BARRIER_END
  49. }}}
  50. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  51. #include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque.hpp>
  52. #else
  53. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  54. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/as_deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
  55. #endif
  56. /*=============================================================================
  57. Copyright (c) 2001-2011 Joel de Guzman
  58. Distributed under the Boost Software License, Version 1.0. (See accompanying
  59. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  60. This is an auto-generated file. Do not edit!
  61. ==============================================================================*/
  62. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  63. #pragma wave option(preserve: 1)
  64. #endif
  65. namespace boost { namespace fusion { namespace detail
  66. {
  67. BOOST_FUSION_BARRIER_BEGIN
  68. #define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
  69. typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
  70. BOOST_PP_CAT(I, BOOST_PP_INC(n));
  71. #define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
  72. typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
  73. BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
  74. #define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
  75. typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
  76. BOOST_PP_CAT(T, n);
  77. #define BOOST_PP_FILENAME_1 <boost/fusion/container/deque/detail/cpp03/as_deque.hpp>
  78. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
  79. #include BOOST_PP_ITERATE()
  80. #undef BOOST_FUSION_NEXT_ITERATOR
  81. #undef BOOST_FUSION_NEXT_CALL_ITERATOR
  82. #undef BOOST_FUSION_VALUE_OF_ITERATOR
  83. BOOST_FUSION_BARRIER_END
  84. }}}
  85. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  86. #pragma wave option(output: null)
  87. #endif
  88. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  89. #endif
  90. #else // defined(BOOST_PP_IS_ITERATING)
  91. ///////////////////////////////////////////////////////////////////////////////
  92. //
  93. // Preprocessor vertical repetition code
  94. //
  95. ///////////////////////////////////////////////////////////////////////////////
  96. #define N BOOST_PP_ITERATION()
  97. template <>
  98. struct as_deque<N>
  99. {
  100. template <typename I0>
  101. struct apply
  102. {
  103. BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
  104. BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
  105. typedef deque<BOOST_PP_ENUM_PARAMS(N, T)> type;
  106. };
  107. template <typename Iterator>
  108. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  109. static typename apply<Iterator>::type
  110. call(Iterator const& i0)
  111. {
  112. typedef apply<Iterator> gen;
  113. typedef typename gen::type result;
  114. BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
  115. return result(BOOST_PP_ENUM_PARAMS(N, *i));
  116. }
  117. };
  118. #undef N
  119. #endif // defined(BOOST_PP_IS_ITERATING)