deque.hpp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*=============================================================================
  2. Copyright (c) 2005-2012 Joel de Guzman
  3. Copyright (c) 2005-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. #if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
  8. #define BOOST_PP_FUSION_DEQUE_26112006_1649
  9. #if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
  10. #error "C++03 only! This file should not have been included"
  11. #endif
  12. #include <boost/fusion/container/deque/detail/cpp03/limits.hpp>
  13. #include <boost/fusion/container/deque/front_extended_deque.hpp>
  14. #include <boost/fusion/container/deque/back_extended_deque.hpp>
  15. #include <boost/fusion/container/deque/detail/cpp03/deque_keyed_values.hpp>
  16. #include <boost/fusion/container/deque/detail/cpp03/deque_initial_size.hpp>
  17. #include <boost/fusion/support/sequence_base.hpp>
  18. #include <boost/fusion/support/detail/access.hpp>
  19. #include <boost/fusion/container/deque/detail/keyed_element.hpp>
  20. #include <boost/preprocessor/repetition/enum_params.hpp>
  21. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  22. #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
  23. #include <boost/type_traits/is_convertible.hpp>
  24. #include <boost/type_traits/is_same.hpp>
  25. #include <boost/type_traits/remove_reference.hpp>
  26. #include <boost/fusion/container/deque/deque_fwd.hpp>
  27. #include <boost/fusion/container/deque/detail/value_at_impl.hpp>
  28. #include <boost/fusion/container/deque/detail/at_impl.hpp>
  29. #include <boost/fusion/container/deque/detail/begin_impl.hpp>
  30. #include <boost/fusion/container/deque/detail/end_impl.hpp>
  31. #include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
  32. #include <boost/fusion/sequence/intrinsic/begin.hpp>
  33. #include <boost/mpl/bool.hpp>
  34. #include <boost/fusion/support/void.hpp>
  35. #include <boost/fusion/support/detail/enabler.hpp>
  36. #include <boost/utility/enable_if.hpp>
  37. #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
  38. #include <boost/fusion/container/deque/detail/cpp03/preprocessed/deque.hpp>
  39. #else
  40. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  41. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
  42. #endif
  43. /*=============================================================================
  44. Copyright (c) 2001-2011 Joel de Guzman
  45. Distributed under the Boost Software License, Version 1.0. (See accompanying
  46. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  47. This is an auto-generated file. Do not edit!
  48. ==============================================================================*/
  49. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  50. #pragma wave option(preserve: 1)
  51. #endif
  52. #define FUSION_HASH #
  53. namespace boost { namespace fusion {
  54. struct deque_tag;
  55. template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
  56. struct deque
  57. :
  58. detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type,
  59. sequence_base<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> >
  60. {
  61. typedef deque_tag fusion_tag;
  62. typedef bidirectional_traversal_tag category;
  63. typedef typename detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type base;
  64. typedef typename detail::deque_initial_size<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type size;
  65. typedef mpl::int_<size::value> next_up;
  66. typedef mpl::int_<-1> next_down;
  67. typedef mpl::false_ is_view;
  68. #include <boost/fusion/container/deque/detail/cpp03/deque_forward_ctor.hpp>
  69. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  70. deque()
  71. {}
  72. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  73. explicit deque(typename detail::call_param<T0>::type t0)
  74. : base(t0, detail::nil_keyed_element())
  75. {}
  76. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  77. explicit deque(deque const& rhs)
  78. : base(rhs)
  79. {}
  80. template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
  81. BOOST_FUSION_GPU_ENABLED
  82. deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
  83. : base(seq)
  84. {}
  85. template<typename Sequence>
  86. BOOST_FUSION_GPU_ENABLED
  87. deque(Sequence const& seq
  88. , typename disable_if<is_convertible<Sequence, T0>, detail::enabler_>::type = detail::enabler
  89. , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
  90. : base(base::from_iterator(fusion::begin(seq)))
  91. {}
  92. template <typename T>
  93. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  94. deque&
  95. operator=(T const& rhs)
  96. {
  97. base::operator=(rhs);
  98. return *this;
  99. }
  100. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  101. FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  102. #endif
  103. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
  104. (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
  105. template <typename T0_>
  106. BOOST_FUSION_GPU_ENABLED
  107. explicit deque(T0_&& t0
  108. , typename enable_if<is_convertible<T0_, T0>, detail::enabler_>::type = detail::enabler
  109. , typename disable_if_c<
  110. boost::is_same<deque const, typename boost::remove_reference<T0_>::type const>::value
  111. , detail::enabler_
  112. >::type = detail::enabler
  113. )
  114. : base(BOOST_FUSION_FWD_ELEM(T0_, t0), detail::nil_keyed_element())
  115. {}
  116. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  117. explicit deque(deque&& rhs)
  118. : base(std::forward<deque>(rhs))
  119. {}
  120. template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
  121. BOOST_FUSION_GPU_ENABLED
  122. deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& seq
  123. , typename disable_if<
  124. is_convertible<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>, T0>
  125. , detail::enabler_
  126. >::type = detail::enabler)
  127. : base(std::forward<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>>(seq))
  128. {}
  129. template <typename T>
  130. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  131. deque&
  132. operator=(T&& rhs)
  133. {
  134. base::operator=(BOOST_FUSION_FWD_ELEM(T, rhs));
  135. return *this;
  136. }
  137. // This copy op= is required because move ctor deletes copy op=.
  138. BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  139. deque&
  140. operator=(deque const& rhs)
  141. {
  142. base::operator=(static_cast<base const&>(rhs));
  143. return *this;
  144. }
  145. #endif
  146. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  147. FUSION_HASH endif
  148. #endif
  149. };
  150. template <>
  151. struct deque<> : detail::nil_keyed_element
  152. {
  153. typedef deque_tag fusion_tag;
  154. typedef bidirectional_traversal_tag category;
  155. typedef mpl::int_<0> size;
  156. typedef mpl::int_<0> next_up;
  157. typedef mpl::int_<-1> next_down;
  158. typedef mpl::false_ is_view;
  159. template <typename Sequence>
  160. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  161. deque(Sequence const&,
  162. typename enable_if<
  163. mpl::and_<
  164. traits::is_sequence<Sequence>
  165. , result_of::empty<Sequence> >, detail::enabler_>::type = detail::enabler) BOOST_NOEXCEPT
  166. {}
  167. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  168. deque() BOOST_NOEXCEPT {}
  169. };
  170. }}
  171. #undef FUSION_HASH
  172. #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
  173. #pragma wave option(output: null)
  174. #endif
  175. #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
  176. #endif