Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 2 | #if !defined(NDNBOOST_PP_IS_ITERATING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 3 | |
| 4 | ///// header body |
| 5 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 6 | #ifndef NDNBOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED |
| 7 | #define NDNBOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 8 | |
| 9 | // Copyright Aleksey Gurtovoy 2000-2004 |
| 10 | // |
| 11 | // Distributed under the Boost Software License, Version 1.0. |
| 12 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 13 | // http://www.boost.org/LICENSE_1_0.txt) |
| 14 | // |
| 15 | // See http://www.boost.org/libs/mpl for documentation. |
| 16 | |
| 17 | // $Id: advance_backward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ |
| 18 | // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ |
| 19 | // $Revision: 49267 $ |
| 20 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 21 | #if !defined(NDNBOOST_MPL_PREPROCESSING_MODE) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 22 | # include <ndnboost/mpl/prior.hpp> |
| 23 | # include <ndnboost/mpl/apply_wrap.hpp> |
| 24 | #endif |
| 25 | |
| 26 | #include <ndnboost/mpl/aux_/config/use_preprocessed.hpp> |
| 27 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 28 | #if !defined(NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ |
| 29 | && !defined(NDNBOOST_MPL_PREPROCESSING_MODE) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 31 | # define NDNBOOST_MPL_PREPROCESSED_HEADER advance_backward.hpp |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 32 | # include <ndnboost/mpl/aux_/include_preprocessed.hpp> |
| 33 | |
| 34 | #else |
| 35 | |
| 36 | # include <ndnboost/mpl/limits/unrolling.hpp> |
| 37 | # include <ndnboost/mpl/aux_/nttp_decl.hpp> |
| 38 | # include <ndnboost/mpl/aux_/config/eti.hpp> |
| 39 | |
| 40 | # include <ndnboost/preprocessor/iterate.hpp> |
| 41 | # include <ndnboost/preprocessor/cat.hpp> |
| 42 | # include <ndnboost/preprocessor/inc.hpp> |
| 43 | |
| 44 | namespace ndnboost { namespace mpl { namespace aux { |
| 45 | |
| 46 | // forward declaration |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 47 | template< NDNBOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_backward; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 48 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 49 | # define NDNBOOST_PP_ITERATION_PARAMS_1 \ |
| 50 | (3,(0, NDNBOOST_MPL_LIMIT_UNROLLING, <ndnboost/mpl/aux_/advance_backward.hpp>)) |
| 51 | # include NDNBOOST_PP_ITERATE() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 52 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 53 | // implementation for N that exceeds NDNBOOST_MPL_LIMIT_UNROLLING |
| 54 | template< NDNBOOST_MPL_AUX_NTTP_DECL(long, N) > |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 55 | struct advance_backward |
| 56 | { |
| 57 | template< typename Iterator > struct apply |
| 58 | { |
| 59 | typedef typename apply_wrap1< |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 60 | advance_backward<NDNBOOST_MPL_LIMIT_UNROLLING> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 61 | , Iterator |
| 62 | >::type chunk_result_; |
| 63 | |
| 64 | typedef typename apply_wrap1< |
| 65 | advance_backward<( |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 66 | (N - NDNBOOST_MPL_LIMIT_UNROLLING) < 0 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 67 | ? 0 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 68 | : N - NDNBOOST_MPL_LIMIT_UNROLLING |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 69 | )> |
| 70 | , chunk_result_ |
| 71 | >::type type; |
| 72 | }; |
| 73 | }; |
| 74 | |
| 75 | }}} |
| 76 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 77 | #endif // NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS |
| 78 | #endif // NDNBOOST_MPL_AUX778076_ADVANCE_BACKWARD_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 79 | |
| 80 | ///// iteration, depth == 1 |
| 81 | |
| 82 | // For gcc 4.4 compatability, we must include the |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 83 | // NDNBOOST_PP_ITERATION_DEPTH test inside an #else clause. |
| 84 | #else // NDNBOOST_PP_IS_ITERATING |
| 85 | #if NDNBOOST_PP_ITERATION_DEPTH() == 1 |
| 86 | #define i_ NDNBOOST_PP_FRAME_ITERATION(1) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 87 | |
| 88 | template<> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 89 | struct advance_backward< NDNBOOST_PP_FRAME_ITERATION(1) > |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 90 | { |
| 91 | template< typename Iterator > struct apply |
| 92 | { |
| 93 | typedef Iterator iter0; |
| 94 | |
| 95 | #if i_ > 0 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 96 | # define NDNBOOST_PP_ITERATION_PARAMS_2 \ |
| 97 | (3,(1, NDNBOOST_PP_FRAME_ITERATION(1), <ndnboost/mpl/aux_/advance_backward.hpp>)) |
| 98 | # include NDNBOOST_PP_ITERATE() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 99 | #endif |
| 100 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 101 | typedef NDNBOOST_PP_CAT(iter,NDNBOOST_PP_FRAME_ITERATION(1)) type; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 102 | }; |
| 103 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 104 | #if defined(NDNBOOST_MPL_CFG_MSVC_60_ETI_BUG) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 105 | /// ETI workaround |
| 106 | template<> struct apply<int> |
| 107 | { |
| 108 | typedef int type; |
| 109 | }; |
| 110 | #endif |
| 111 | }; |
| 112 | |
| 113 | #undef i_ |
| 114 | |
| 115 | ///// iteration, depth == 2 |
| 116 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 117 | #elif NDNBOOST_PP_ITERATION_DEPTH() == 2 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 118 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 119 | # define AUX778076_ITER_0 NDNBOOST_PP_CAT(iter,NDNBOOST_PP_DEC(NDNBOOST_PP_FRAME_ITERATION(2))) |
| 120 | # define AUX778076_ITER_1 NDNBOOST_PP_CAT(iter,NDNBOOST_PP_FRAME_ITERATION(2)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 121 | |
| 122 | typedef typename prior<AUX778076_ITER_0>::type AUX778076_ITER_1; |
| 123 | |
| 124 | # undef AUX778076_ITER_1 |
| 125 | # undef AUX778076_ITER_0 |
| 126 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 127 | #endif // NDNBOOST_PP_ITERATION_DEPTH() |
| 128 | #endif // NDNBOOST_PP_IS_ITERATING |