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