~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/mpl/aux_/advance_forward.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
// boost mpl/aux_/advance_forward.hpp header file
 
3
// See http://www.boost.org for updates, documentation, and revision history.
 
4
//-----------------------------------------------------------------------------
 
5
//
 
6
// Copyright (c) 2000-02
 
7
// Aleksey Gurtovoy
 
8
//
 
9
// Permission to use, copy, modify, distribute and sell this software
 
10
// and its documentation for any purpose is hereby granted without fee, 
 
11
// provided that the above copyright notice appears in all copies and 
 
12
// that both the copyright notice and this permission notice appear in 
 
13
// supporting documentation. No representations are made about the 
 
14
// suitability of this software for any purpose. It is provided "as is" 
 
15
// without express or implied warranty.
 
16
 
 
17
#if !defined(BOOST_PP_IS_ITERATING)
 
18
 
 
19
///// header body
 
20
 
 
21
#ifndef BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
 
22
#define BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
 
23
 
 
24
#include "boost/mpl/aux_/apply.hpp"
 
25
#include "boost/mpl/aux_/next.hpp"
 
26
#include "boost/mpl/aux_/config/eti.hpp"
 
27
 
 
28
#include "boost/mpl/aux_/config/use_preprocessed.hpp"
 
29
 
 
30
#if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) && \
 
31
    !defined(BOOST_MPL_PREPROCESSING_MODE)
 
32
 
 
33
#   define BOOST_MPL_PREPROCESSED_HEADER advance_forward.hpp
 
34
#   include "boost/mpl/aux_/include_preprocessed.hpp"
 
35
 
 
36
#else
 
37
 
 
38
#   include "boost/mpl/limits/unrolling.hpp"
 
39
#   include "boost/mpl/aux_/config/nttp.hpp"
 
40
 
 
41
#   include "boost/preprocessor/iterate.hpp"
 
42
#   include "boost/preprocessor/cat.hpp"
 
43
#   include "boost/preprocessor/inc.hpp"
 
44
 
 
45
namespace boost {
 
46
namespace mpl {
 
47
namespace aux {
 
48
 
 
49
// forward declaration
 
50
template< BOOST_MPL_AUX_NTTP_DECL(long, N) > struct advance_forward;
 
51
 
 
52
#   define BOOST_PP_ITERATION_PARAMS_1 \
 
53
    (3,(0, BOOST_MPL_UNROLLING_LIMIT, "boost/mpl/aux_/advance_forward.hpp"))
 
54
#   include BOOST_PP_ITERATE()
 
55
 
 
56
// implementation for N that exceeds BOOST_MPL_UNROLLING_LIMIT
 
57
template< BOOST_MPL_AUX_NTTP_DECL(long, N) > 
 
58
struct advance_forward
 
59
{
 
60
    template< typename Iterator > struct apply
 
61
    {
 
62
        typedef typename BOOST_MPL_AUX_APPLY1(
 
63
              advance_forward<BOOST_MPL_UNROLLING_LIMIT>
 
64
            , Iterator
 
65
            )::type chunk_result_;
 
66
 
 
67
        typedef typename BOOST_MPL_AUX_APPLY1(
 
68
              advance_forward<(
 
69
                (N - BOOST_MPL_UNROLLING_LIMIT) < 0
 
70
                    ? 0
 
71
                    : N - BOOST_MPL_UNROLLING_LIMIT
 
72
                    )>
 
73
            , chunk_result_
 
74
            )::type type;
 
75
    };
 
76
};
 
77
 
 
78
} // namespace aux
 
79
} // namespace mpl
 
80
} // namespace boost
 
81
 
 
82
#endif // BOOST_MPL_USE_PREPROCESSED_HEADERS
 
83
#endif // BOOST_MPL_AUX_ADVANCE_FORWARD_HPP_INCLUDED
 
84
 
 
85
///// iteration, depth == 1
 
86
 
 
87
#elif BOOST_PP_ITERATION_DEPTH() == 1
 
88
#define i BOOST_PP_FRAME_ITERATION(1)
 
89
 
 
90
template<>
 
91
struct advance_forward< BOOST_PP_FRAME_ITERATION(1) >
 
92
{
 
93
    template< typename Iterator > struct apply
 
94
    {
 
95
        typedef Iterator iter0;
 
96
 
 
97
#if i > 0
 
98
#   define BOOST_PP_ITERATION_PARAMS_2 \
 
99
    (3,(1, i, "boost/mpl/aux_/advance_forward.hpp"))
 
100
#   include BOOST_PP_ITERATE()
 
101
#endif
 
102
        typedef BOOST_PP_CAT(iter,i) type;
 
103
    };
 
104
 
 
105
#if defined(BOOST_MPL_MSVC_60_ETI_BUG)
 
106
    //: ETI workaround
 
107
    template<> struct apply<int>
 
108
    {
 
109
        typedef int type;
 
110
    };
 
111
#endif
 
112
};
 
113
 
 
114
#undef i
 
115
 
 
116
///// iteration, depth == 2
 
117
 
 
118
#elif BOOST_PP_ITERATION_DEPTH() == 2
 
119
 
 
120
#   define AUX_ITER_0 BOOST_PP_CAT(iter,BOOST_PP_DEC(BOOST_PP_FRAME_ITERATION(2)))
 
121
#   define AUX_ITER_1 BOOST_PP_CAT(iter,BOOST_PP_FRAME_ITERATION(2))
 
122
 
 
123
        typedef typename BOOST_MPL_AUX_NEXT(AUX_ITER_0) AUX_ITER_1;
 
124
        
 
125
#   undef AUX_ITER_1
 
126
#   undef AUX_ITER_0
 
127
 
 
128
#endif // BOOST_PP_IS_ITERATING