source: NonGTP/Boost/boost/mpl/arg.hpp @ 857

Revision 857, 3.3 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2#if !defined(BOOST_PP_IS_ITERATING)
3
4///// header body
5
6#ifndef BOOST_MPL_ARG_HPP_INCLUDED
7#define BOOST_MPL_ARG_HPP_INCLUDED
8
9// Copyright Peter Dimov 2001-2002
10// Copyright Aleksey Gurtovoy 2001-2004
11//
12// Distributed under the Boost Software License, Version 1.0.
13// (See accompanying file LICENSE_1_0.txt or copy at
14// http://www.boost.org/LICENSE_1_0.txt)
15//
16// See http://www.boost.org/libs/mpl for documentation.
17
18// $Source: /cvsroot/boost/boost/boost/mpl/arg.hpp,v $
19// $Date: 2004/09/21 13:48:07 $
20// $Revision: 1.12 $
21
22#if !defined(BOOST_MPL_PREPROCESSING_MODE)
23#   include <boost/mpl/arg_fwd.hpp>
24#   include <boost/mpl/aux_/na.hpp>
25#   include <boost/mpl/aux_/na_assert.hpp>
26#   include <boost/mpl/aux_/arity_spec.hpp>
27#   include <boost/mpl/aux_/arg_typedef.hpp>
28#endif
29
30#include <boost/mpl/aux_/config/static_constant.hpp>
31#include <boost/mpl/aux_/config/use_preprocessed.hpp>
32
33#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
34    && !defined(BOOST_MPL_PREPROCESSING_MODE)
35
36#   define BOOST_MPL_PREPROCESSED_HEADER arg.hpp
37#   include <boost/mpl/aux_/include_preprocessed.hpp>
38
39#else
40
41#   include <boost/mpl/limits/arity.hpp>
42#   include <boost/mpl/aux_/preprocessor/default_params.hpp>
43#   include <boost/mpl/aux_/preprocessor/params.hpp>
44#   include <boost/mpl/aux_/config/lambda.hpp>
45#   include <boost/mpl/aux_/config/dtp.hpp>
46#   include <boost/mpl/aux_/nttp_decl.hpp>
47
48#   include <boost/preprocessor/iterate.hpp>
49#   include <boost/preprocessor/inc.hpp>
50#   include <boost/preprocessor/cat.hpp>
51
52BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
53
54// local macro, #undef-ined at the end of the header
55#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
56#   define AUX778076_ARG_N_DEFAULT_PARAMS(param,value) \
57    BOOST_MPL_PP_DEFAULT_PARAMS( \
58          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
59        , param \
60        , value \
61        ) \
62    /**/
63#else
64#   define AUX778076_ARG_N_DEFAULT_PARAMS(param,value) \
65    BOOST_MPL_PP_PARAMS( \
66          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
67        , param \
68        ) \
69    /**/
70#endif
71
72#define BOOST_PP_ITERATION_PARAMS_1 \
73    (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/arg.hpp>))
74#include BOOST_PP_ITERATE()
75
76
77#   undef AUX778076_ARG_N_DEFAULT_PARAMS
78
79BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int,arg)
80
81BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
82
83#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
84#endif // BOOST_MPL_ARG_HPP_INCLUDED
85
86///// iteration
87
88#else
89#define i_ BOOST_PP_FRAME_ITERATION(1)
90
91#if i_ > 0
92
93template<> struct arg<i_>
94{
95    BOOST_STATIC_CONSTANT(int, value = i_);
96    typedef arg<BOOST_PP_INC(i_)> next;
97    BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
98    BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
99
100    template<
101          AUX778076_ARG_N_DEFAULT_PARAMS(typename U, na)
102        >
103    struct apply
104    {
105        typedef BOOST_PP_CAT(U,i_) type;
106        BOOST_MPL_AUX_ASSERT_NOT_NA(type);
107    };
108};
109
110#else
111
112template<> struct arg<-1>
113{
114    BOOST_STATIC_CONSTANT(int, value = -1);
115    BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
116    BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
117
118    template<
119          AUX778076_ARG_N_DEFAULT_PARAMS(typename U, na)
120        >
121    struct apply
122    {
123        typedef U1 type;
124        BOOST_MPL_AUX_ASSERT_NOT_NA(type);
125    };
126};
127
128#endif // i_ > 0
129
130#undef i_
131#endif // BOOST_PP_IS_ITERATING
Note: See TracBrowser for help on using the repository browser.