]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fusion/include/boost/fusion/container/deque/deque.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / container / deque / deque.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2005-2012 Joel de Guzman
3 Copyright (c) 2005-2006 Dan Marsden
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7==============================================================================*/
8#if !defined(BOOST_FUSION_DEQUE_26112006_1649)
9#define BOOST_FUSION_DEQUE_26112006_1649
10
11# include <boost/fusion/container/deque/deque_fwd.hpp>
12
13///////////////////////////////////////////////////////////////////////////////
14// Without variadics, we will use the PP version
15///////////////////////////////////////////////////////////////////////////////
16#if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
17# include <boost/fusion/container/deque/detail/cpp03/deque.hpp>
18#else
19
20///////////////////////////////////////////////////////////////////////////////
21// C++11 interface
22///////////////////////////////////////////////////////////////////////////////
23#include <boost/fusion/support/sequence_base.hpp>
24#include <boost/fusion/support/void.hpp>
25#include <boost/fusion/support/detail/enabler.hpp>
26#include <boost/fusion/support/detail/access.hpp>
27#include <boost/fusion/support/is_sequence.hpp>
28#include <boost/fusion/container/deque/detail/keyed_element.hpp>
29#include <boost/fusion/container/deque/detail/deque_keyed_values.hpp>
30#include <boost/fusion/container/deque/deque_fwd.hpp>
31#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
32#include <boost/fusion/container/deque/detail/at_impl.hpp>
33#include <boost/fusion/container/deque/detail/begin_impl.hpp>
34#include <boost/fusion/container/deque/detail/end_impl.hpp>
35#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
36#include <boost/fusion/sequence/intrinsic/begin.hpp>
37#include <boost/fusion/sequence/intrinsic/empty.hpp>
38
39#include <boost/mpl/int.hpp>
40#include <boost/mpl/and.hpp>
41#include <boost/utility/enable_if.hpp>
42#include <boost/type_traits/is_convertible.hpp>
43
44namespace boost { namespace fusion
45{
46 struct deque_tag;
47
48 template <typename ...Elements>
49 struct deque : detail::nil_keyed_element
50 {
51 typedef deque_tag fusion_tag;
52 typedef bidirectional_traversal_tag category;
53 typedef mpl::int_<0> size;
54 typedef mpl::int_<0> next_up;
55 typedef mpl::int_<-1> next_down;
56 typedef mpl::false_ is_view;
57
58 template <typename Sequence>
59 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
60 deque(Sequence const&,
61 typename enable_if<
62 mpl::and_<
63 traits::is_sequence<Sequence>
64 , result_of::empty<Sequence>>, detail::enabler_>::type = detail::enabler) BOOST_NOEXCEPT
65 {}
66
67 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
68 deque() BOOST_NOEXCEPT {}
69 };
70
71 template <typename Head, typename ...Tail>
72 struct deque<Head, Tail...>
73 : detail::deque_keyed_values<Head, Tail...>::type
74 , sequence_base<deque<Head, Tail...>>
75 {
76 typedef deque_tag fusion_tag;
77 typedef bidirectional_traversal_tag category;
78 typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
79 typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
80 typedef mpl::int_<size::value> next_up;
81 typedef mpl::int_<-1> next_down;
82 typedef mpl::false_ is_view;
83
84 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
85 deque()
86 {}
87
88 template <typename Head_, typename ...Tail_, typename =
89 typename enable_if<is_convertible<Head_, Head> >::type
90 >
91 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
92 deque(deque<Head_, Tail_...> const& seq)
93 : base(seq)
94 {}
95
96 template <typename Head_, typename ...Tail_, typename =
97 typename enable_if<is_convertible<Head_, Head> >::type
98 >
99 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
100 deque(deque<Head_, Tail_...>& seq)
101 : base(seq)
102 {}
103
104#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
105 template <typename Head_, typename ...Tail_, typename =
106 typename enable_if<is_convertible<Head_, Head> >::type
107 >
108 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
109 deque(deque<Head_, Tail_...>&& seq)
110 : base(std::forward<deque<Head_, Tail_...>>(seq))
111 {}
112#endif
113
114 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
115 deque(deque const& seq)
116 : base(seq)
117 {}
118
119#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
120 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
121 deque(deque&& seq)
122 : base(std::forward<deque>(seq))
123 {}
124#endif
125
126 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
127 explicit deque(typename detail::call_param<Head>::type head
128 , typename detail::call_param<Tail>::type... tail)
129 : base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...))
130 {}
131
132#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
133 template <typename Head_, typename ...Tail_, typename =
134 typename enable_if<is_convertible<Head_, Head> >::type
135 >
136 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
137 explicit deque(Head_&& head, Tail_&&... tail)
138 : base(detail::deque_keyed_values<Head, Tail...>
139 ::forward_(BOOST_FUSION_FWD_ELEM(Head_, head), BOOST_FUSION_FWD_ELEM(Tail_, tail)...))
140 {}
141#else
142 template <typename Head_, typename ...Tail_, typename =
143 typename enable_if<is_convertible<Head_, Head> >::type
144 >
145 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
146 explicit deque(Head_ const& head, Tail_ const&... tail)
147 : base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...))
148 {}
149#endif
150
151 template <typename Sequence>
152 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
153 explicit deque(Sequence const& seq
154 , typename disable_if<is_convertible<Sequence, Head>, detail::enabler_>::type = detail::enabler
155 , typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
156 : base(base::from_iterator(fusion::begin(seq)))
157 {}
158
159 template <typename ...Elements>
160 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
161 deque& operator=(deque<Elements...> const& rhs)
162 {
163 base::operator=(rhs);
164 return *this;
165 }
166
167 template <typename T>
168 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
169 deque& operator=(T const& rhs)
170 {
171 base::operator=(rhs);
172 return *this;
173 }
174
175#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
176 template <typename T>
177 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
178 deque& operator=(T&& rhs)
179 {
180 base::operator=(BOOST_FUSION_FWD_ELEM(T, rhs));
181 return *this;
182 }
183#endif
184
185 };
186}}
187
188#endif
189#endif