File indexing completed on 2025-01-18 09:41:37
0001
0002
0003
0004 #if !defined(BOOST_PP_IS_ITERATING)
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 # include <boost/mpl/limits/unrolling.hpp>
0019 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
0020 # include <boost/mpl/aux_/config/workaround.hpp>
0021 # include <boost/mpl/aux_/config/ctps.hpp>
0022 # include <boost/mpl/aux_/nttp_decl.hpp>
0023 # include <boost/mpl/aux_/config/eti.hpp>
0024
0025 # include <boost/preprocessor/iterate.hpp>
0026 # include <boost/preprocessor/dec.hpp>
0027 # include <boost/preprocessor/cat.hpp>
0028
0029
0030
0031 # define AUX778076_ITER_FOLD_STEP(unused, i, unused2) \
0032 typedef typename apply2< \
0033 ForwardOp \
0034 , BOOST_PP_CAT(state,i) \
0035 , AUX778076_FOLD_IMPL_OP(BOOST_PP_CAT(iter,i)) \
0036 >::type BOOST_PP_CAT(state,BOOST_PP_INC(i)); \
0037 typedef typename mpl::next<BOOST_PP_CAT(iter,i)>::type \
0038 BOOST_PP_CAT(iter,BOOST_PP_INC(i)); \
0039
0040
0041 # define AUX778076_FOLD_IMPL_NAME \
0042 BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_impl) \
0043
0044
0045 # define AUX778076_FOLD_CHUNK_NAME \
0046 BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_chunk) \
0047
0048
0049 namespace boost { namespace mpl { namespace aux {
0050
0051
0052 template<
0053 BOOST_MPL_AUX_NTTP_DECL(int, N)
0054 , typename First
0055 , typename Last
0056 , typename State
0057 , typename ForwardOp
0058 >
0059 struct AUX778076_FOLD_IMPL_NAME;
0060
0061 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0062
0063 # if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)
0064
0065 # define BOOST_PP_ITERATION_PARAMS_1 \
0066 (3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
0067 # include BOOST_PP_ITERATE()
0068
0069
0070 template<
0071 BOOST_MPL_AUX_NTTP_DECL(int, N)
0072 , typename First
0073 , typename Last
0074 , typename State
0075 , typename ForwardOp
0076 >
0077 struct AUX778076_FOLD_IMPL_NAME
0078 {
0079 typedef AUX778076_FOLD_IMPL_NAME<
0080 BOOST_MPL_LIMIT_UNROLLING
0081 , First
0082 , Last
0083 , State
0084 , ForwardOp
0085 > chunk_;
0086
0087 typedef AUX778076_FOLD_IMPL_NAME<
0088 ( (N - BOOST_MPL_LIMIT_UNROLLING) < 0 ? 0 : N - BOOST_MPL_LIMIT_UNROLLING )
0089 , typename chunk_::iterator
0090 , Last
0091 , typename chunk_::state
0092 , ForwardOp
0093 > res_;
0094
0095 typedef typename res_::state state;
0096 typedef typename res_::iterator iterator;
0097 };
0098
0099
0100 template<
0101 typename First
0102 , typename Last
0103 , typename State
0104 , typename ForwardOp
0105 >
0106 struct AUX778076_FOLD_IMPL_NAME<-1,First,Last,State,ForwardOp>
0107 : AUX778076_FOLD_IMPL_NAME<
0108 -1
0109 , typename mpl::next<First>::type
0110 , Last
0111 , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
0112 , ForwardOp
0113 >
0114 {
0115 };
0116
0117 template<
0118 typename Last
0119 , typename State
0120 , typename ForwardOp
0121 >
0122 struct AUX778076_FOLD_IMPL_NAME<-1,Last,Last,State,ForwardOp>
0123 {
0124 typedef State state;
0125 typedef Last iterator;
0126 };
0127
0128 # else
0129
0130
0131
0132 template<
0133 BOOST_MPL_AUX_NTTP_DECL(int, N)
0134 , typename First
0135 , typename Last
0136 , typename State
0137 , typename ForwardOp
0138 >
0139 struct AUX778076_FOLD_IMPL_NAME
0140 {
0141 typedef AUX778076_FOLD_IMPL_NAME<
0142 -1
0143 , typename mpl::next<First>::type
0144 , Last
0145 , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
0146 , ForwardOp
0147 > res_;
0148
0149 typedef typename res_::state state;
0150 typedef typename res_::iterator iterator;
0151 typedef state type;
0152 };
0153
0154 template<
0155 BOOST_MPL_AUX_NTTP_DECL(int, N)
0156 , typename Last
0157 , typename State
0158 , typename ForwardOp
0159 >
0160 struct AUX778076_FOLD_IMPL_NAME<N,Last,Last,State,ForwardOp >
0161 {
0162 typedef State state;
0163 typedef Last iterator;
0164 typedef state type;
0165 };
0166
0167 # endif
0168
0169 #else
0170
0171 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
0172 struct AUX778076_FOLD_CHUNK_NAME;
0173
0174 # define BOOST_PP_ITERATION_PARAMS_1 \
0175 (3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
0176 # include BOOST_PP_ITERATE()
0177
0178
0179 template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
0180 struct AUX778076_FOLD_CHUNK_NAME
0181 {
0182 template<
0183 typename First
0184 , typename Last
0185 , typename State
0186 , typename ForwardOp
0187 >
0188 struct result_
0189 {
0190 typedef AUX778076_FOLD_IMPL_NAME<
0191 BOOST_MPL_LIMIT_UNROLLING
0192 , First
0193 , Last
0194 , State
0195 , ForwardOp
0196 > chunk_;
0197
0198 typedef AUX778076_FOLD_IMPL_NAME<
0199 ( (N - BOOST_MPL_LIMIT_UNROLLING) < 0 ? 0 : N - BOOST_MPL_LIMIT_UNROLLING )
0200 , typename chunk_::iterator
0201 , Last
0202 , typename chunk_::state
0203 , ForwardOp
0204 > res_;
0205
0206 typedef typename res_::state state;
0207 typedef typename res_::iterator iterator;
0208 };
0209 };
0210
0211
0212 template<
0213 typename First
0214 , typename Last
0215 , typename State
0216 , typename ForwardOp
0217 >
0218 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step);
0219
0220 template<
0221 typename Last
0222 , typename State
0223 >
0224 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)
0225 {
0226 typedef Last iterator;
0227 typedef State state;
0228 };
0229
0230 template<>
0231 struct AUX778076_FOLD_CHUNK_NAME<-1>
0232 {
0233 template<
0234 typename First
0235 , typename Last
0236 , typename State
0237 , typename ForwardOp
0238 >
0239 struct result_
0240 {
0241 typedef typename if_<
0242 typename is_same<First,Last>::type
0243 , BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)<Last,State>
0244 , BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)<First,Last,State,ForwardOp>
0245 >::type res_;
0246
0247 typedef typename res_::state state;
0248 typedef typename res_::iterator iterator;
0249 };
0250
0251 #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
0252
0253 template<> struct result_<int,int,int,int>
0254 {
0255 typedef int state;
0256 typedef int iterator;
0257 };
0258 #endif
0259 };
0260
0261 template<
0262 typename First
0263 , typename Last
0264 , typename State
0265 , typename ForwardOp
0266 >
0267 struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)
0268 {
0269
0270 typedef AUX778076_FOLD_CHUNK_NAME<-1>::template result_<
0271 typename mpl::next<First>::type
0272 , Last
0273 , typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
0274 , ForwardOp
0275 > chunk_;
0276
0277 typedef typename chunk_::state state;
0278 typedef typename chunk_::iterator iterator;
0279 };
0280
0281 template<
0282 BOOST_MPL_AUX_NTTP_DECL(int, N)
0283 , typename First
0284 , typename Last
0285 , typename State
0286 , typename ForwardOp
0287 >
0288 struct AUX778076_FOLD_IMPL_NAME
0289 : AUX778076_FOLD_CHUNK_NAME<N>
0290 ::template result_<First,Last,State,ForwardOp>
0291 {
0292 };
0293
0294 #endif
0295
0296 }}}
0297
0298 # undef AUX778076_FOLD_IMPL_NAME
0299 # undef AUX778076_FOLD_CHUNK_NAME
0300 # undef AUX778076_ITER_FOLD_STEP
0301
0302 #undef AUX778076_FOLD_IMPL_OP
0303 #undef AUX778076_FOLD_IMPL_NAME_PREFIX
0304
0305
0306
0307 #else
0308
0309 # define n_ BOOST_PP_FRAME_ITERATION(1)
0310
0311 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0312
0313 template<
0314 typename First
0315 , typename Last
0316 , typename State
0317 , typename ForwardOp
0318 >
0319 struct AUX778076_FOLD_IMPL_NAME<n_,First,Last,State,ForwardOp>
0320 {
0321 typedef First iter0;
0322 typedef State state0;
0323
0324 BOOST_MPL_PP_REPEAT(n_, AUX778076_ITER_FOLD_STEP, unused)
0325
0326 typedef BOOST_PP_CAT(state,n_) state;
0327 typedef BOOST_PP_CAT(iter,n_) iterator;
0328 };
0329
0330 #else
0331
0332 template<> struct AUX778076_FOLD_CHUNK_NAME<n_>
0333 {
0334 template<
0335 typename First
0336 , typename Last
0337 , typename State
0338 , typename ForwardOp
0339 >
0340 struct result_
0341 {
0342 typedef First iter0;
0343 typedef State state0;
0344
0345 BOOST_MPL_PP_REPEAT(n_, AUX778076_ITER_FOLD_STEP, unused)
0346
0347 typedef BOOST_PP_CAT(state,n_) state;
0348 typedef BOOST_PP_CAT(iter,n_) iterator;
0349 };
0350
0351 #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
0352
0353 template<> struct result_<int,int,int,int>
0354 {
0355 typedef int state;
0356 typedef int iterator;
0357 };
0358 #endif
0359 };
0360
0361 #endif
0362
0363 # undef n_
0364
0365 #endif