]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fusion/include/boost/fusion/container/vector/detail/cpp03/vector_n.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / container / vector / detail / cpp03 / vector_n.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
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// No include guard. This file is meant to be included many times
8
9#if !defined(FUSION_MACRO_05042005)
10#define FUSION_MACRO_05042005
11
12#define FUSION_VECTOR_CTOR_DEFAULT_INIT(z, n, _) \
13 m##n()
14
15#define FUSION_VECTOR_CTOR_INIT(z, n, _) \
16 m##n(_##n)
17
18#define FUSION_VECTOR_MEMBER_CTOR_INIT(z, n, _) \
19 m##n(other.m##n)
20
21#define FUSION_VECTOR_CTOR_FORWARD(z, n, _) \
22 m##n(BOOST_FUSION_FWD_ELEM(T##n, other.m##n))
23
24#define FUSION_VECTOR_CTOR_ARG_FWD(z, n, _) \
25 m##n(BOOST_FUSION_FWD_ELEM(U##n, _##n))
26
27#define FUSION_VECTOR_MEMBER_DECL(z, n, _) \
28 T##n m##n;
29
30#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) \
31 BOOST_FUSION_FWD_ELEM(U##n, _##n)
32
33#define FUSION_VECTOR_MEMBER_ASSIGN(z, n, _) \
34 this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
35
36#define FUSION_VECTOR_MEMBER_DEREF_ASSIGN(z, n, _) \
37 this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
38
39#define FUSION_VECTOR_MEMBER_MOVE(z, n, _) \
40 this->BOOST_PP_CAT(m, n) = std::forward< \
41 BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
42
43#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _) \
44 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
45 typename add_reference<T##n>::type \
46 at_impl(mpl::int_<n>) { return this->m##n; } \
47 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
48 typename add_reference<typename add_const<T##n>::type>::type \
49 at_impl(mpl::int_<n>) const { return this->m##n; }
50
51#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
52 typedef typename result_of::next< \
53 BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \
54 BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \
55 = fusion::next(BOOST_PP_CAT(i, BOOST_PP_DEC(n)));
56
57#endif
58
59#define N BOOST_PP_ITERATION()
60
61 template <BOOST_PP_ENUM_PARAMS(N, typename T)>
62 struct BOOST_PP_CAT(vector_data, N)
63 {
64 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
65 BOOST_PP_CAT(vector_data, N)()
66 : BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_DEFAULT_INIT, _) {}
67
68#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
69FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
70#endif
71#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
72 (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
73 template <BOOST_PP_ENUM_PARAMS(N, typename U)>
74#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
75FUSION_HASH if !defined(BOOST_CLANG)
76 BOOST_CXX14_CONSTEXPR
77FUSION_HASH endif
78#else
79#if !defined(BOOST_CLANG)
80 BOOST_CXX14_CONSTEXPR
81#endif
82#endif
83 BOOST_FUSION_GPU_ENABLED
84 BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg)
85 , typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
86 )
87 : BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_ARG_FWD, arg) {}
88
89 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
90 BOOST_PP_CAT(vector_data, N)(
91 BOOST_PP_CAT(vector_data, N)&& other)
92 : BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_FORWARD, arg) {}
93#endif
94#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
95FUSION_HASH endif
96#endif
97
98#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
99FUSION_HASH if !defined(BOOST_CLANG)
100 BOOST_CONSTEXPR
101FUSION_HASH endif
102#else
103#if !defined(BOOST_CLANG)
104 BOOST_CONSTEXPR
105#endif
106#endif
107 BOOST_FUSION_GPU_ENABLED
108 BOOST_PP_CAT(vector_data, N)(
109 BOOST_PP_ENUM_BINARY_PARAMS(
110 N, typename detail::call_param<T, >::type arg))
111 : BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_INIT, arg) {}
112
113 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
114 BOOST_PP_CAT(vector_data, N)(
115 BOOST_PP_CAT(vector_data, N) const& other)
116 : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_CTOR_INIT, _) {}
117
118 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
119 BOOST_PP_CAT(vector_data, N)&
120 operator=(BOOST_PP_CAT(vector_data, N) const& vec)
121 {
122 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_ASSIGN, _)
123 return *this;
124 }
125
126 template <typename Sequence>
127#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
128FUSION_HASH if !defined(BOOST_CLANG)
129 BOOST_CXX14_CONSTEXPR
130FUSION_HASH endif
131#else
132#if !defined(BOOST_CLANG)
133 BOOST_CXX14_CONSTEXPR
134#endif
135#endif
136 BOOST_FUSION_GPU_ENABLED
137 static BOOST_PP_CAT(vector_data, N)
138 init_from_sequence(Sequence const& seq)
139 {
140 typedef typename result_of::begin<Sequence const>::type I0;
141 I0 i0 = fusion::begin(seq);
142 BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
143 return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
144 }
145
146 template <typename Sequence>
147#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
148FUSION_HASH if !defined(BOOST_CLANG)
149 BOOST_CXX14_CONSTEXPR
150FUSION_HASH endif
151#else
152#if !defined(BOOST_CLANG)
153 BOOST_CXX14_CONSTEXPR
154#endif
155#endif
156 BOOST_FUSION_GPU_ENABLED
157 static BOOST_PP_CAT(vector_data, N)
158 init_from_sequence(Sequence& seq)
159 {
160 typedef typename result_of::begin<Sequence>::type I0;
161 I0 i0 = fusion::begin(seq);
162 BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
163 return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
164 }
165
166 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DECL, _)
167 };
168
169 template <BOOST_PP_ENUM_PARAMS(N, typename T)>
170 struct BOOST_PP_CAT(vector, N)
171 : BOOST_PP_CAT(vector_data, N)<BOOST_PP_ENUM_PARAMS(N, T)>
172 , sequence_base<BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> >
173 {
174 typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> this_type;
175 typedef BOOST_PP_CAT(vector_data, N)<BOOST_PP_ENUM_PARAMS(N, T)> base_type;
176 typedef mpl::BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> types;
177 typedef vector_tag fusion_tag;
178 typedef fusion_sequence_tag tag; // this gets picked up by MPL
179 typedef mpl::false_ is_view;
180 typedef random_access_traversal_tag category;
181 typedef mpl::int_<N> size;
182
183 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
184 BOOST_PP_CAT(vector, N)() {}
185
186#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
187FUSION_HASH if !defined(BOOST_CLANG)
188 BOOST_CONSTEXPR
189FUSION_HASH endif
190#else
191#if !defined(BOOST_CLANG)
192 BOOST_CONSTEXPR
193#endif
194#endif
195 BOOST_FUSION_GPU_ENABLED
196#if (N == 1)
197 explicit
198#endif
199 BOOST_PP_CAT(vector, N)(
200 BOOST_PP_ENUM_BINARY_PARAMS(
201 N, typename detail::call_param<T, >::type arg))
202 : base_type(BOOST_PP_ENUM_PARAMS(N, arg)) {}
203
204#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
205FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
206#endif
207#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
208 (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
209 template <BOOST_PP_ENUM_PARAMS(N, typename U)>
210#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
211FUSION_HASH if !defined(BOOST_CLANG)
212 BOOST_CXX14_CONSTEXPR
213FUSION_HASH endif
214#else
215#if !defined(BOOST_CLANG)
216 BOOST_CXX14_CONSTEXPR
217#endif
218#endif
219 BOOST_FUSION_GPU_ENABLED
220#if (N == 1)
221 explicit
222 BOOST_PP_CAT(vector, N)(U0&& _0
223 , typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
224 )
225 : base_type(BOOST_FUSION_FWD_ELEM(U0, _0)) {}
226#else
227 BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg))
228 : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, arg)) {}
229#endif
230
231 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
232 BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
233 : base_type(std::forward<base_type>(rhs)) {}
234
235 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
236 BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) const& rhs)
237 : base_type(static_cast<base_type const&>(rhs)) {}
238
239 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
240 BOOST_PP_CAT(vector, N)&
241 operator=(BOOST_PP_CAT(vector, N) const& vec)
242 {
243 base_type::operator=(vec);
244 return *this;
245 }
246
247 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
248 BOOST_PP_CAT(vector, N)&
249 operator=(BOOST_PP_CAT(vector, N)&& vec)
250 {
251 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MOVE, _)
252 return *this;
253 }
254#endif
255#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
256FUSION_HASH endif
257#endif
258
259 template <BOOST_PP_ENUM_PARAMS(N, typename U)>
260#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
261FUSION_HASH if !defined(BOOST_CLANG)
262 BOOST_CXX14_CONSTEXPR
263FUSION_HASH endif
264#else
265#if !defined(BOOST_CLANG)
266 BOOST_CXX14_CONSTEXPR
267#endif
268#endif
269 BOOST_FUSION_GPU_ENABLED
270 BOOST_PP_CAT(vector, N)(
271 BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
272 : base_type(BOOST_PP_ENUM_PARAMS(N, vec.m)) {}
273
274 template <typename Sequence>
275#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
276FUSION_HASH if !defined(BOOST_CLANG)
277 BOOST_CXX14_CONSTEXPR
278FUSION_HASH endif
279#else
280#if !defined(BOOST_CLANG)
281 BOOST_CXX14_CONSTEXPR
282#endif
283#endif
284 BOOST_FUSION_GPU_ENABLED
285 BOOST_PP_CAT(vector, N)(
286 Sequence const& seq
287 , typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
288#if (N == 1)
289 , typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
290#endif
291 )
292 : base_type(base_type::init_from_sequence(seq)) {}
293
294 template <typename Sequence>
295#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
296FUSION_HASH if !defined(BOOST_CLANG)
297 BOOST_CXX14_CONSTEXPR
298FUSION_HASH endif
299#else
300#if !defined(BOOST_CLANG)
301 BOOST_CXX14_CONSTEXPR
302#endif
303#endif
304 BOOST_FUSION_GPU_ENABLED
305 BOOST_PP_CAT(vector, N)(
306 Sequence& seq
307 , typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
308#if (N == 1)
309 , typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
310#endif
311 )
312 : base_type(base_type::init_from_sequence(seq)) {}
313
314 template <BOOST_PP_ENUM_PARAMS(N, typename U)>
315 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
316 BOOST_PP_CAT(vector, N)&
317 operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
318 {
319 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_ASSIGN, _)
320 return *this;
321 }
322
323 template <typename Sequence>
324 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
325 typename boost::disable_if<is_convertible<Sequence, T0>, this_type&>::type
326 operator=(Sequence const& seq)
327 {
328 typedef typename result_of::begin<Sequence const>::type I0;
329 I0 i0 = fusion::begin(seq);
330 BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
331 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_ASSIGN, _)
332 return *this;
333 }
334
335 BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
336
337 template<typename I>
338 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
339 typename add_reference<typename mpl::at<types, I>::type>::type
340 at_impl(I)
341 {
342 return this->at_impl(mpl::int_<I::value>());
343 }
344
345 template<typename I>
346 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
347 typename add_reference<typename add_const<typename mpl::at<types, I>::type>::type>::type
348 at_impl(I) const
349 {
350 return this->at_impl(mpl::int_<I::value>());
351 }
352 };
353
354#undef N