fold_impl_body.hpp
Go to the documentation of this file.
1 
2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
3 
4 #if !defined(BOOST_PP_IS_ITERATING)
5 
6 // Copyright Aleksey Gurtovoy 2000-2004
7 //
8 // Distributed under the Boost Software License, Version 1.0.
9 // (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11 //
12 // See http://www.boost.org/libs/mpl for documentation.
13 
14 // $Id: fold_impl_body.hpp 13472 2017-08-22 07:53:44Z richean $
15 // $Date: 2017-08-22 09:53:44 +0200 (Di, 22 Aug 2017) $
16 // $Revision: 13472 $
17 
24 
28 
29 // local macros, #undef-ined at the end of the header
30 
31 # define AUX778076_ITER_FOLD_STEP(unused, i, unused2) \
32  typedef typename apply2< \
33  ForwardOp \
34  , BOOST_PP_CAT(state,i) \
35  , AUX778076_FOLD_IMPL_OP(BOOST_PP_CAT(iter,i)) \
36  >::type BOOST_PP_CAT(state,BOOST_PP_INC(i)); \
37  typedef typename mpl::next<BOOST_PP_CAT(iter,i)>::type \
38  BOOST_PP_CAT(iter,BOOST_PP_INC(i)); \
39 
40 
41 # define AUX778076_FOLD_IMPL_NAME \
42  BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_impl) \
43 
44 
45 # define AUX778076_FOLD_CHUNK_NAME \
46  BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_chunk) \
47 
48 
49 namespace boost { namespace mpl { namespace aux {
50 
52 template<
54  , typename First
55  , typename Last
56  , typename State
57  , typename ForwardOp
58  >
60 
61 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
62 
63 # if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
64 
65 # define BOOST_PP_ITERATION_PARAMS_1 \
66  (3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
67 # include BOOST_PP_ITERATE()
68 
69 // implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING
70 template<
72  , typename First
73  , typename Last
74  , typename State
75  , typename ForwardOp
76  >
78 {
81  , First
82  , Last
83  , State
84  , ForwardOp
85  > chunk_;
86 
89  , typename chunk_::iterator
90  , Last
91  , typename chunk_::state
92  , ForwardOp
93  > res_;
94 
95  typedef typename res_::state state;
96  typedef typename res_::iterator iterator;
97 };
98 
99 // fallback implementation for sequences of unknown size
100 template<
101  typename First
102  , typename Last
103  , typename State
104  , typename ForwardOp
105  >
106 struct AUX778076_FOLD_IMPL_NAME<-1,First,Last,State,ForwardOp>
108  -1
109  , typename mpl::next<First>::type
110  , Last
111  , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
112  , ForwardOp
113  >
114 {
115 };
116 
117 template<
118  typename Last
119  , typename State
120  , typename ForwardOp
121  >
122 struct AUX778076_FOLD_IMPL_NAME<-1,Last,Last,State,ForwardOp>
123 {
124  typedef State state;
125  typedef Last iterator;
126 };
127 
128 # else // BOOST_WORKAROUND(__BORLANDC__, < 0x600)
129 
130 // Borland have some serious problems with the unrolled version, so
131 // we always use a basic implementation
132 template<
134  , typename First
135  , typename Last
136  , typename State
137  , typename ForwardOp
138  >
140 {
141  typedef AUX778076_FOLD_IMPL_NAME<
142  -1
143  , typename mpl::next<First>::type
144  , Last
145  , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
146  , ForwardOp
147  > res_;
148 
149  typedef typename res_::state state;
150  typedef typename res_::iterator iterator;
151  typedef state type;
152 };
153 
154 template<
156  , typename Last
157  , typename State
158  , typename ForwardOp
159  >
160 struct AUX778076_FOLD_IMPL_NAME<N,Last,Last,State,ForwardOp >
161 {
162  typedef State state;
163  typedef Last iterator;
164  typedef state type;
165 };
166 
167 # endif // BOOST_WORKAROUND(__BORLANDC__, < 0x600)
168 
169 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
170 
171 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
173 
174 # define BOOST_PP_ITERATION_PARAMS_1 \
175  (3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
176 # include BOOST_PP_ITERATE()
177 
178 // implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING
179 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
181 {
182  template<
183  typename First
184  , typename Last
185  , typename State
186  , typename ForwardOp
187  >
188  struct result_
189  {
190  typedef AUX778076_FOLD_IMPL_NAME<
192  , First
193  , Last
194  , State
195  , ForwardOp
196  > chunk_;
197 
198  typedef AUX778076_FOLD_IMPL_NAME<
200  , typename chunk_::iterator
201  , Last
202  , typename chunk_::state
203  , ForwardOp
204  > res_;
205 
206  typedef typename res_::state state;
207  typedef typename res_::iterator iterator;
208  };
209 };
210 
211 // fallback implementation for sequences of unknown size
212 template<
213  typename First
214  , typename Last
215  , typename State
216  , typename ForwardOp
217  >
218 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step);
219 
220 template<
221  typename Last
222  , typename State
223  >
224 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)
225 {
226  typedef Last iterator;
227  typedef State state;
228 };
229 
230 template<>
231 struct AUX778076_FOLD_CHUNK_NAME<-1>
232 {
233  template<
234  typename First
235  , typename Last
236  , typename State
237  , typename ForwardOp
238  >
239  struct result_
240  {
241  typedef typename if_<
243  , BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)<Last,State>
244  , BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)<First,Last,State,ForwardOp>
245  >::type res_;
246 
247  typedef typename res_::state state;
248  typedef typename res_::iterator iterator;
249  };
250 
251 #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
252  template<> struct result_<int,int,int,int>
254  {
255  typedef int state;
256  typedef int iterator;
257  };
258 #endif
259 };
260 
261 template<
262  typename First
263  , typename Last
264  , typename State
265  , typename ForwardOp
266  >
267 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)
268 {
269  // can't inherit here - it breaks MSVC 7.0
270  typedef AUX778076_FOLD_CHUNK_NAME<-1>::template result_<
271  typename mpl::next<First>::type
272  , Last
273  , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
274  , ForwardOp
275  > chunk_;
276 
277  typedef typename chunk_::state state;
278  typedef typename chunk_::iterator iterator;
279 };
280 
281 template<
283  , typename First
284  , typename Last
285  , typename State
286  , typename ForwardOp
287  >
290  ::template result_<First,Last,State,ForwardOp>
291 {
292 };
293 
294 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
295 
296 }}}
297 
298 # undef AUX778076_FOLD_IMPL_NAME
299 # undef AUX778076_FOLD_CHUNK_NAME
300 # undef AUX778076_ITER_FOLD_STEP
301 
302 #undef AUX778076_FOLD_IMPL_OP
303 #undef AUX778076_FOLD_IMPL_NAME_PREFIX
304 
306 
307 #else
308 
309 # define n_ BOOST_PP_FRAME_ITERATION(1)
310 
311 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
312 
313 template<
314  typename First
315  , typename Last
316  , typename State
317  , typename ForwardOp
318  >
319 struct AUX778076_FOLD_IMPL_NAME<n_,First,Last,State,ForwardOp>
320 {
321  typedef First iter0;
322  typedef State state0;
323 
325 
326  typedef BOOST_PP_CAT(state,n_) state;
327  typedef BOOST_PP_CAT(iter,n_) iterator;
328 };
329 
330 #else
331 
332 template<> struct AUX778076_FOLD_CHUNK_NAME<n_>
333 {
334  template<
335  typename First
336  , typename Last
337  , typename State
338  , typename ForwardOp
339  >
340  struct result_
341  {
342  typedef First iter0;
343  typedef State state0;
344 
346 
347  typedef BOOST_PP_CAT(state,n_) state;
348  typedef BOOST_PP_CAT(iter,n_) iterator;
349  };
350 
351 #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
352  template<> struct result_<int,int,int,int>
354  {
355  typedef int state;
356  typedef int iterator;
357  };
358 #endif
359 };
360 
361 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
362 
363 # undef n_
364 
365 #endif // BOOST_PP_IS_ITERATING
BOOST_PP_CAT
struct BOOST_PP_CAT(AUX778076_COUNT_ARGS_PREFIX, _count_args)
Definition: count_args.hpp:86
boost::mpl::aux::BOOST_PP_CAT
struct BOOST_PP_CAT(AUX778076_OP_NAME, impl)
Definition: logical_op.hpp:64
BOOST_MPL_PP_REPEAT
#define BOOST_MPL_PP_REPEAT(n, f, param)
Definition: mpl/aux_/preprocessor/repeat.hpp:23
ctps.hpp
BOOST_MPL_AUX_NTTP_DECL
#define BOOST_MPL_AUX_NTTP_DECL(T, x)
Definition: nttp_decl.hpp:31
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME<-1, Last, Last, State, ForwardOp >::state
State state
Definition: fold_impl_body.hpp:124
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME::state
res_::state state
Definition: fold_impl_body.hpp:95
boost::type
Definition: type.hpp:14
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
cat.hpp
BOOST_MPL_LIMIT_UNROLLING
#define BOOST_MPL_LIMIT_UNROLLING
Definition: unrolling.hpp:18
boost::integral_constant::type
integral_constant< T, val > type
Definition: integral_constant.hpp:56
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME
forward declaration
Definition: fold_impl_body.hpp:59
workaround.hpp
nttp_decl.hpp
eti.hpp
boost::mpl::apply2
Definition: aux_/preprocessed/bcc/apply.hpp:67
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME<-1, Last, Last, State, ForwardOp >::iterator
Last iterator
Definition: fold_impl_body.hpp:125
repeat.hpp
AUX778076_FOLD_IMPL_NAME
#define AUX778076_FOLD_IMPL_NAME
Definition: fold_impl_body.hpp:41
boost::mpl::next::type
T::next type
Definition: mpl/next_prior.hpp:31
AUX778076_ITER_FOLD_STEP
#define AUX778076_ITER_FOLD_STEP(unused, i, unused2)
Definition: fold_impl_body.hpp:31
AUX778076_FOLD_CHUNK_NAME
#define AUX778076_FOLD_CHUNK_NAME
Definition: fold_impl_body.hpp:45
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME::res_
AUX778076_FOLD_IMPL_NAME<((N - BOOST_MPL_LIMIT_UNROLLING)< 0 ? 0 :N - BOOST_MPL_LIMIT_UNROLLING), typename chunk_::iterator, Last, typename chunk_::state, ForwardOp > res_
Definition: fold_impl_body.hpp:93
unrolling.hpp
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME::iterator
res_::iterator iterator
Definition: fold_impl_body.hpp:96
dec.hpp
boost::mpl::aux::AUX778076_FOLD_IMPL_NAME::chunk_
AUX778076_FOLD_IMPL_NAME< BOOST_MPL_LIMIT_UNROLLING, First, Last, State, ForwardOp > chunk_
Definition: fold_impl_body.hpp:85
iterate.hpp


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:39:23