]> git.lyx.org Git - lyx.git/blob - boost/boost/mpl/arg.hpp
Boost 1.31.0
[lyx.git] / boost / boost / mpl / arg.hpp
1 //-----------------------------------------------------------------------------
2 // boost mpl/arg.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
5 //
6 // Copyright (c) 2001-02
7 // Peter Dimov, 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_ARG_HPP_INCLUDED
22 #define BOOST_MPL_ARG_HPP_INCLUDED
23
24 #include "boost/mpl/aux_/config/static_constant.hpp"
25
26 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
27 #   include "boost/mpl/arg_fwd.hpp"
28 #   include "boost/mpl/void.hpp"
29 #   include "boost/mpl/aux_/arity_spec.hpp"
30 #   include "boost/mpl/aux_/arg_typedef.hpp"
31 #   include "boost/static_assert.hpp"
32 #endif
33
34 #include "boost/mpl/aux_/config/use_preprocessed.hpp"
35
36 #if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) \
37  && !defined(BOOST_MPL_PREPROCESSING_MODE)
38
39 #   define BOOST_MPL_PREPROCESSED_HEADER arg.hpp
40 #   include "boost/mpl/aux_/include_preprocessed.hpp"
41
42 #else
43 #   include "boost/mpl/limits/arity.hpp"
44 #   include "boost/mpl/aux_/preprocessor/default_params.hpp"
45 #   include "boost/mpl/aux_/preprocessor/params.hpp"
46 #   include "boost/mpl/aux_/config/lambda.hpp"
47 #   include "boost/mpl/aux_/config/dtp.hpp"
48 #   include "boost/mpl/aux_/config/nttp.hpp"
49
50 #   include "boost/preprocessor/iterate.hpp"
51 #   include "boost/preprocessor/inc.hpp"
52 #   include "boost/preprocessor/cat.hpp"
53
54 namespace boost {
55 namespace mpl {
56
57 // local macro, #undef-ined at the end of the header
58 #if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES)
59 #   define AUX_ARG_N_DEFAULT_PARAMS(param,value) \
60     BOOST_MPL_PP_DEFAULT_PARAMS( \
61           BOOST_MPL_METAFUNCTION_MAX_ARITY \
62         , param \
63         , value \
64         ) \
65     /**/
66 #else
67 #   define AUX_ARG_N_DEFAULT_PARAMS(param,value) \
68     BOOST_MPL_PP_PARAMS( \
69           BOOST_MPL_METAFUNCTION_MAX_ARITY \
70         , param \
71         ) \
72     /**/
73 #endif
74
75 #define BOOST_PP_ITERATION_PARAMS_1 \
76     (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/arg.hpp"))
77 #include BOOST_PP_ITERATE()
78
79
80 #   undef AUX_ARG_N_DEFAULT_PARAMS
81
82 BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int,arg)
83
84 } // namespace mpl
85 } // namespace boost
86
87 #endif // BOOST_MPL_USE_PREPROCESSED_HEADERS
88 #endif // BOOST_MPL_ARG_HPP_INCLUDED
89
90 ///// iteration
91
92 #else
93 #define i BOOST_PP_FRAME_ITERATION(1)
94
95 #if i > 0
96
97 template<> struct arg<i>
98 {
99     BOOST_STATIC_CONSTANT(int, value = i);
100     typedef arg<BOOST_PP_INC(i)> next;
101     BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag)
102
103     template<
104           AUX_ARG_N_DEFAULT_PARAMS(typename U, void_)
105         >
106     struct apply
107     {
108         typedef BOOST_PP_CAT(U,i) type;
109 #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG))
110      private:
111         BOOST_STATIC_CONSTANT(bool, nv = !is_void_<type>::value);
112         BOOST_STATIC_ASSERT(nv);
113 #endif
114     };
115 };
116
117 #else
118
119 template<> struct arg<-1>
120 {
121     BOOST_STATIC_CONSTANT(int, value = -1);
122     BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag)
123
124     template<
125           AUX_ARG_N_DEFAULT_PARAMS(typename U, void_)
126         >
127     struct apply
128     {
129         typedef U1 type;
130 #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG))
131      private:
132         BOOST_STATIC_CONSTANT(bool, nv = !is_void_<type>::value);
133         BOOST_STATIC_ASSERT(nv);
134 #endif
135     };
136 };
137
138 #endif // i > 0
139
140 #undef i
141 #endif // BOOST_PP_IS_ITERATING