blob: a91a26aae2d1bc71f946e60e98608f41d226f073 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001
Jeff Thompson3d613fd2013-10-15 15:39:04 -07002#if !defined(NDNBOOST_PP_IS_ITERATING)
Jeff Thompsona28eed82013-08-22 16:21:10 -07003
4///// header body
5
Jeff Thompson3d613fd2013-10-15 15:39:04 -07006#ifndef NDNBOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
7#define NDNBOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -07008
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_forward.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 Thompson3d613fd2013-10-15 15:39:04 -070021#if !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070022# include <ndnboost/mpl/next.hpp>
23# include <ndnboost/mpl/apply_wrap.hpp>
24#endif
25
26#include <ndnboost/mpl/aux_/config/use_preprocessed.hpp>
27
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028#if !defined(NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
29 && !defined(NDNBOOST_MPL_PREPROCESSING_MODE)
Jeff Thompsona28eed82013-08-22 16:21:10 -070030
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031# define NDNBOOST_MPL_PREPROCESSED_HEADER advance_forward.hpp
Jeff Thompsona28eed82013-08-22 16:21:10 -070032# 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
44namespace ndnboost { namespace mpl { namespace aux {
45
46// forward declaration
Jeff Thompson3d613fd2013-10-15 15:39:04 -070047template< NDNBOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_forward;
Jeff Thompsona28eed82013-08-22 16:21:10 -070048
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049# define NDNBOOST_PP_ITERATION_PARAMS_1 \
50 (3,(0, NDNBOOST_MPL_LIMIT_UNROLLING, <ndnboost/mpl/aux_/advance_forward.hpp>))
51# include NDNBOOST_PP_ITERATE()
Jeff Thompsona28eed82013-08-22 16:21:10 -070052
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053// implementation for N that exceeds NDNBOOST_MPL_LIMIT_UNROLLING
54template< NDNBOOST_MPL_AUX_NTTP_DECL(long, N) >
Jeff Thompsona28eed82013-08-22 16:21:10 -070055struct advance_forward
56{
57 template< typename Iterator > struct apply
58 {
59 typedef typename apply_wrap1<
Jeff Thompson3d613fd2013-10-15 15:39:04 -070060 advance_forward<NDNBOOST_MPL_LIMIT_UNROLLING>
Jeff Thompsona28eed82013-08-22 16:21:10 -070061 , Iterator
62 >::type chunk_result_;
63
64 typedef typename apply_wrap1<
65 advance_forward<(
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066 (N - NDNBOOST_MPL_LIMIT_UNROLLING) < 0
Jeff Thompsona28eed82013-08-22 16:21:10 -070067 ? 0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070068 : N - NDNBOOST_MPL_LIMIT_UNROLLING
Jeff Thompsona28eed82013-08-22 16:21:10 -070069 )>
70 , chunk_result_
71 >::type type;
72 };
73};
74
75}}}
76
Jeff Thompson3d613fd2013-10-15 15:39:04 -070077#endif // NDNBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
78#endif // NDNBOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070079
80///// iteration, depth == 1
81
82// For gcc 4.4 compatability, we must include the
Jeff Thompson3d613fd2013-10-15 15:39:04 -070083// 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 Thompsona28eed82013-08-22 16:21:10 -070087
88template<>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070089struct advance_forward< NDNBOOST_PP_FRAME_ITERATION(1) >
Jeff Thompsona28eed82013-08-22 16:21:10 -070090{
91 template< typename Iterator > struct apply
92 {
93 typedef Iterator iter0;
94
95#if i_ > 0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070096# define NDNBOOST_PP_ITERATION_PARAMS_2 \
Jeff Thompsona28eed82013-08-22 16:21:10 -070097 (3,(1, i_, <ndnboost/mpl/aux_/advance_forward.hpp>))
Jeff Thompson3d613fd2013-10-15 15:39:04 -070098# include NDNBOOST_PP_ITERATE()
Jeff Thompsona28eed82013-08-22 16:21:10 -070099#endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700100 typedef NDNBOOST_PP_CAT(iter,i_) type;
Jeff Thompsona28eed82013-08-22 16:21:10 -0700101 };
102
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700103#if defined(NDNBOOST_MPL_CFG_MSVC_60_ETI_BUG)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700104 /// ETI workaround
105 template<> struct apply<int>
106 {
107 typedef int type;
108 };
109#endif
110};
111
112#undef i_
113
114///// iteration, depth == 2
115
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700116#elif NDNBOOST_PP_ITERATION_DEPTH() == 2
Jeff Thompsona28eed82013-08-22 16:21:10 -0700117
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700118# define AUX778076_ITER_0 NDNBOOST_PP_CAT(iter,NDNBOOST_PP_DEC(NDNBOOST_PP_FRAME_ITERATION(2)))
119# define AUX778076_ITER_1 NDNBOOST_PP_CAT(iter,NDNBOOST_PP_FRAME_ITERATION(2))
Jeff Thompsona28eed82013-08-22 16:21:10 -0700120
121 typedef typename next<AUX778076_ITER_0>::type AUX778076_ITER_1;
122
123# undef AUX778076_ITER_1
124# undef AUX778076_ITER_0
125
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700126#endif // NDNBOOST_PP_ITERATION_DEPTH()
127#endif // NDNBOOST_PP_IS_ITERATING