]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/include/boost/fusion/container/vector/detail/cpp03/vector.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / container / vector / detail / cpp03 / vector.hpp
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 #if !defined(FUSION_VECTOR_07072005_1244)
8 #define FUSION_VECTOR_07072005_1244
9
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/fusion/support/config.hpp>
14 #include <boost/fusion/support/void.hpp>
15 #include <boost/fusion/support/detail/enabler.hpp>
16 #include <boost/fusion/support/is_sequence.hpp>
17 #include <boost/fusion/container/vector/vector_fwd.hpp>
18 #include <boost/fusion/container/vector/detail/cpp03/vector_n_chooser.hpp>
19 #include <boost/fusion/sequence/intrinsic/begin.hpp>
20 #include <boost/mpl/at.hpp>
21 #include <boost/mpl/bool.hpp>
22 #include <boost/type_traits/add_reference.hpp>
23 #include <boost/type_traits/add_const.hpp>
24 #include <boost/type_traits/is_base_of.hpp>
25 #include <boost/detail/workaround.hpp>
26 #include <boost/core/enable_if.hpp>
27
28 #define FUSION_HASH #
29
30 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
31
32 #define BOOST_FUSION_VECTOR_COPY_INIT() \
33 ctor_helper(rhs, is_base_of<vector, Sequence>()) \
34
35 #define BOOST_FUSION_VECTOR_CTOR_HELPER() \
36 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
37 static vector_n const& \
38 ctor_helper(vector const& rhs, mpl::true_) \
39 { \
40 return rhs.vec; \
41 } \
42 \
43 template <typename T> \
44 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
45 static T const& \
46 ctor_helper(T const& rhs, mpl::false_) \
47 { \
48 return rhs; \
49 }
50
51 #else
52
53 #define BOOST_FUSION_VECTOR_COPY_INIT() \
54 rhs \
55
56 #define BOOST_FUSION_VECTOR_CTOR_HELPER()
57
58 #endif
59
60 #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
61 #include <boost/fusion/container/vector/detail/cpp03/preprocessed/vector.hpp>
62 #else
63 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
64 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/vvector" FUSION_MAX_VECTOR_SIZE_STR ".hpp")
65 #endif
66
67 /*=============================================================================
68 Copyright (c) 2001-2011 Joel de Guzman
69
70 Distributed under the Boost Software License, Version 1.0. (See accompanying
71 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
72
73 This is an auto-generated file. Do not edit!
74 ==============================================================================*/
75
76 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
77 #pragma wave option(preserve: 1)
78 #endif
79
80 namespace boost { namespace fusion
81 {
82 struct void_;
83 struct fusion_sequence_tag;
84
85 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
86 struct vector
87 : sequence_base<vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> >
88 {
89 private:
90
91 typedef typename detail::vector_n_chooser<
92 BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
93 vector_n;
94
95 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
96 friend struct vector;
97
98 public:
99
100 typedef typename vector_n::types types;
101 typedef typename vector_n::fusion_tag fusion_tag;
102 typedef typename vector_n::tag tag;
103 typedef typename vector_n::size size;
104 typedef typename vector_n::category category;
105 typedef typename vector_n::is_view is_view;
106
107 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
108 vector()
109 : vec() {}
110
111 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
112 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
113 vector(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
114 : vec(rhs.vec) {}
115
116 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
117 vector(vector const& rhs)
118 : vec(rhs.vec) {}
119
120 template <typename Sequence>
121 BOOST_FUSION_GPU_ENABLED
122 vector(Sequence const& rhs,
123 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
124 : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
125
126 // Expand a couple of forwarding constructors for arguments
127 // of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
128 //
129 // vector(
130 // typename detail::call_param<T0>::type arg0
131 // , typename detail::call_param<T1>::type arg1)
132 // : vec(arg0, arg1) {}
133 #include <boost/fusion/container/vector/detail/cpp03/vector_forward_ctor.hpp>
134
135 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
136 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
137 vector&
138 operator=(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
139 {
140 vec = rhs.vec;
141 return *this;
142 }
143
144 template <typename T>
145 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
146 vector&
147 operator=(T const& rhs)
148 {
149 vec = rhs;
150 return *this;
151 }
152
153 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
154 vector&
155 operator=(vector const& rhs)
156 {
157 vec = rhs.vec;
158 return *this;
159 }
160
161 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
162 FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
163 #endif
164 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
165 (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
166 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
167 vector(vector&& rhs)
168 : vec(std::forward<vector_n>(rhs.vec)) {}
169
170 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
171 vector&
172 operator=(vector&& rhs)
173 {
174 vec = std::forward<vector_n>(rhs.vec);
175 return *this;
176 }
177
178 template <typename T>
179 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
180 vector&
181 operator=(T&& rhs)
182 {
183 vec = BOOST_FUSION_FWD_ELEM(T, rhs);
184 return *this;
185 }
186 #endif
187 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
188 FUSION_HASH endif
189 #endif
190
191 template <int N>
192 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
193 typename add_reference<
194 typename mpl::at_c<types, N>::type
195 >::type
196 at_impl(mpl::int_<N> index)
197 {
198 return vec.at_impl(index);
199 }
200
201 template <int N>
202 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
203 typename add_reference<
204 typename add_const<
205 typename mpl::at_c<types, N>::type
206 >::type
207 >::type
208 at_impl(mpl::int_<N> index) const
209 {
210 return vec.at_impl(index);
211 }
212
213 template <typename I>
214 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
215 typename add_reference<
216 typename mpl::at<types, I>::type
217 >::type
218 at_impl(I /*index*/)
219 {
220 return vec.at_impl(mpl::int_<I::value>());
221 }
222
223 template<typename I>
224 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
225 typename add_reference<
226 typename add_const<
227 typename mpl::at<types, I>::type
228 >::type
229 >::type
230 at_impl(I /*index*/) const
231 {
232 return vec.at_impl(mpl::int_<I::value>());
233 }
234
235 private:
236
237 BOOST_FUSION_VECTOR_CTOR_HELPER()
238 vector_n vec;
239 };
240 }}
241
242 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
243 #pragma wave option(output: null)
244 #endif
245
246 #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
247
248 #undef FUSION_HASH
249 #endif