sl@0
|
1 |
|
sl@0
|
2 |
#if !defined(BOOST_PP_IS_ITERATING)
|
sl@0
|
3 |
|
sl@0
|
4 |
///// header body
|
sl@0
|
5 |
|
sl@0
|
6 |
#ifndef BOOST_MPL_APPLY_HPP_INCLUDED
|
sl@0
|
7 |
#define BOOST_MPL_APPLY_HPP_INCLUDED
|
sl@0
|
8 |
|
sl@0
|
9 |
// Copyright Aleksey Gurtovoy 2000-2004
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Distributed under the Boost Software License, Version 1.0.
|
sl@0
|
12 |
// (See accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
13 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
14 |
//
|
sl@0
|
15 |
// See http://www.boost.org/libs/mpl for documentation.
|
sl@0
|
16 |
|
sl@0
|
17 |
// $Source: /cvsroot/boost/boost/boost/mpl/apply.hpp,v $
|
sl@0
|
18 |
// $Date: 2004/09/02 15:40:41 $
|
sl@0
|
19 |
// $Revision: 1.17 $
|
sl@0
|
20 |
|
sl@0
|
21 |
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
sl@0
|
22 |
# include <boost/mpl/apply_fwd.hpp>
|
sl@0
|
23 |
# include <boost/mpl/apply_wrap.hpp>
|
sl@0
|
24 |
# include <boost/mpl/placeholders.hpp>
|
sl@0
|
25 |
# include <boost/mpl/lambda.hpp>
|
sl@0
|
26 |
# include <boost/mpl/aux_/na.hpp>
|
sl@0
|
27 |
# include <boost/mpl/aux_/lambda_support.hpp>
|
sl@0
|
28 |
#endif
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
sl@0
|
31 |
|
sl@0
|
32 |
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
sl@0
|
33 |
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
sl@0
|
34 |
|
sl@0
|
35 |
# define BOOST_MPL_PREPROCESSED_HEADER apply.hpp
|
sl@0
|
36 |
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
sl@0
|
37 |
|
sl@0
|
38 |
#else
|
sl@0
|
39 |
|
sl@0
|
40 |
# include <boost/mpl/limits/arity.hpp>
|
sl@0
|
41 |
# include <boost/mpl/aux_/preprocessor/params.hpp>
|
sl@0
|
42 |
# include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
sl@0
|
43 |
# include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
|
sl@0
|
44 |
# include <boost/mpl/aux_/preprocessor/enum.hpp>
|
sl@0
|
45 |
# include <boost/mpl/aux_/config/lambda.hpp>
|
sl@0
|
46 |
# include <boost/mpl/aux_/config/dtp.hpp>
|
sl@0
|
47 |
# include <boost/mpl/aux_/nttp_decl.hpp>
|
sl@0
|
48 |
# include <boost/mpl/aux_/config/eti.hpp>
|
sl@0
|
49 |
# include <boost/mpl/aux_/config/msvc.hpp>
|
sl@0
|
50 |
# include <boost/mpl/aux_/config/workaround.hpp>
|
sl@0
|
51 |
|
sl@0
|
52 |
# include <boost/preprocessor/comma_if.hpp>
|
sl@0
|
53 |
# include <boost/preprocessor/inc.hpp>
|
sl@0
|
54 |
# include <boost/preprocessor/iterate.hpp>
|
sl@0
|
55 |
# include <boost/preprocessor/cat.hpp>
|
sl@0
|
56 |
|
sl@0
|
57 |
namespace boost { namespace mpl {
|
sl@0
|
58 |
|
sl@0
|
59 |
// local macros, #undef-ined at the end of the header
|
sl@0
|
60 |
# define AUX778076_APPLY_PARAMS(param) \
|
sl@0
|
61 |
BOOST_MPL_PP_PARAMS( \
|
sl@0
|
62 |
BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
|
sl@0
|
63 |
, param \
|
sl@0
|
64 |
) \
|
sl@0
|
65 |
/**/
|
sl@0
|
66 |
|
sl@0
|
67 |
# define AUX778076_APPLY_DEF_PARAMS(param, value) \
|
sl@0
|
68 |
BOOST_MPL_PP_DEFAULT_PARAMS( \
|
sl@0
|
69 |
BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
|
sl@0
|
70 |
, param \
|
sl@0
|
71 |
, value \
|
sl@0
|
72 |
) \
|
sl@0
|
73 |
/**/
|
sl@0
|
74 |
|
sl@0
|
75 |
# define AUX778076_APPLY_N_PARAMS(n, param) \
|
sl@0
|
76 |
BOOST_MPL_PP_PARAMS(n, param) \
|
sl@0
|
77 |
/**/
|
sl@0
|
78 |
|
sl@0
|
79 |
# define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
|
sl@0
|
80 |
BOOST_PP_COMMA_IF(n) \
|
sl@0
|
81 |
BOOST_MPL_PP_PARAMS(n, param) \
|
sl@0
|
82 |
/**/
|
sl@0
|
83 |
|
sl@0
|
84 |
# define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \
|
sl@0
|
85 |
BOOST_PP_COMMA_IF(n) \
|
sl@0
|
86 |
BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
|
sl@0
|
87 |
/**/
|
sl@0
|
88 |
|
sl@0
|
89 |
# define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \
|
sl@0
|
90 |
BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
|
sl@0
|
91 |
/**/
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
#define BOOST_PP_ITERATION_PARAMS_1 \
|
sl@0
|
95 |
(3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply.hpp>))
|
sl@0
|
96 |
#include BOOST_PP_ITERATE()
|
sl@0
|
97 |
|
sl@0
|
98 |
# if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
|
sl@0
|
99 |
// real C++ version is already taken care of
|
sl@0
|
100 |
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
sl@0
|
101 |
|
sl@0
|
102 |
namespace aux {
|
sl@0
|
103 |
// apply_count_args
|
sl@0
|
104 |
#define AUX778076_COUNT_ARGS_PREFIX apply
|
sl@0
|
105 |
#define AUX778076_COUNT_ARGS_DEFAULT na
|
sl@0
|
106 |
#define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
sl@0
|
107 |
#include <boost/mpl/aux_/count_args.hpp>
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
|
sl@0
|
111 |
template<
|
sl@0
|
112 |
typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
|
sl@0
|
113 |
>
|
sl@0
|
114 |
struct apply
|
sl@0
|
115 |
: aux::apply_chooser<
|
sl@0
|
116 |
aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value
|
sl@0
|
117 |
>::template result_< F, AUX778076_APPLY_PARAMS(T) >::type
|
sl@0
|
118 |
{
|
sl@0
|
119 |
};
|
sl@0
|
120 |
|
sl@0
|
121 |
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
sl@0
|
122 |
# endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
|
sl@0
|
123 |
|
sl@0
|
124 |
# undef AUX778076_APPLY_N_SPEC_PARAMS
|
sl@0
|
125 |
# undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS
|
sl@0
|
126 |
# undef AUX778076_APPLY_N_COMMA_PARAMS
|
sl@0
|
127 |
# undef AUX778076_APPLY_N_PARAMS
|
sl@0
|
128 |
# undef AUX778076_APPLY_DEF_PARAMS
|
sl@0
|
129 |
# undef AUX778076_APPLY_PARAMS
|
sl@0
|
130 |
|
sl@0
|
131 |
}}
|
sl@0
|
132 |
|
sl@0
|
133 |
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
sl@0
|
134 |
#endif // BOOST_MPL_APPLY_HPP_INCLUDED
|
sl@0
|
135 |
|
sl@0
|
136 |
///// iteration, depth == 1
|
sl@0
|
137 |
|
sl@0
|
138 |
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
sl@0
|
139 |
|
sl@0
|
140 |
# define i_ BOOST_PP_FRAME_ITERATION(1)
|
sl@0
|
141 |
|
sl@0
|
142 |
template<
|
sl@0
|
143 |
typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
|
sl@0
|
144 |
>
|
sl@0
|
145 |
struct BOOST_PP_CAT(apply,i_)
|
sl@0
|
146 |
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
sl@0
|
147 |
: BOOST_PP_CAT(apply_wrap,i_)<
|
sl@0
|
148 |
typename lambda<F>::type
|
sl@0
|
149 |
AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
|
sl@0
|
150 |
>
|
sl@0
|
151 |
{
|
sl@0
|
152 |
#else
|
sl@0
|
153 |
{
|
sl@0
|
154 |
typedef typename BOOST_PP_CAT(apply_wrap,i_)<
|
sl@0
|
155 |
typename lambda<F>::type
|
sl@0
|
156 |
AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
|
sl@0
|
157 |
>::type type;
|
sl@0
|
158 |
#endif
|
sl@0
|
159 |
BOOST_MPL_AUX_LAMBDA_SUPPORT(
|
sl@0
|
160 |
BOOST_PP_INC(i_)
|
sl@0
|
161 |
, BOOST_PP_CAT(apply,i_)
|
sl@0
|
162 |
, (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T))
|
sl@0
|
163 |
)
|
sl@0
|
164 |
};
|
sl@0
|
165 |
|
sl@0
|
166 |
|
sl@0
|
167 |
#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
|
sl@0
|
168 |
/// workaround for ETI bug
|
sl@0
|
169 |
template<>
|
sl@0
|
170 |
struct BOOST_PP_CAT(apply,i_)<AUX778076_APPLY_N_SPEC_PARAMS(i_, int)>
|
sl@0
|
171 |
{
|
sl@0
|
172 |
typedef int type;
|
sl@0
|
173 |
};
|
sl@0
|
174 |
#endif
|
sl@0
|
175 |
|
sl@0
|
176 |
# if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
|
sl@0
|
177 |
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
sl@0
|
178 |
|
sl@0
|
179 |
#if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
sl@0
|
180 |
/// primary template (not a specialization!)
|
sl@0
|
181 |
template<
|
sl@0
|
182 |
typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
|
sl@0
|
183 |
>
|
sl@0
|
184 |
struct apply
|
sl@0
|
185 |
: BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
|
sl@0
|
186 |
{
|
sl@0
|
187 |
};
|
sl@0
|
188 |
#else
|
sl@0
|
189 |
template<
|
sl@0
|
190 |
typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
|
sl@0
|
191 |
>
|
sl@0
|
192 |
struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) >
|
sl@0
|
193 |
: BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
|
sl@0
|
194 |
{
|
sl@0
|
195 |
};
|
sl@0
|
196 |
#endif
|
sl@0
|
197 |
|
sl@0
|
198 |
# else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
sl@0
|
199 |
|
sl@0
|
200 |
#if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
|
sl@0
|
201 |
namespace aux {
|
sl@0
|
202 |
|
sl@0
|
203 |
template<>
|
sl@0
|
204 |
struct apply_chooser<i_>
|
sl@0
|
205 |
{
|
sl@0
|
206 |
template<
|
sl@0
|
207 |
typename F, AUX778076_APPLY_PARAMS(typename T)
|
sl@0
|
208 |
>
|
sl@0
|
209 |
struct result_
|
sl@0
|
210 |
{
|
sl@0
|
211 |
typedef BOOST_PP_CAT(apply,i_)<
|
sl@0
|
212 |
F AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
|
sl@0
|
213 |
> type;
|
sl@0
|
214 |
};
|
sl@0
|
215 |
};
|
sl@0
|
216 |
|
sl@0
|
217 |
} // namespace aux
|
sl@0
|
218 |
#endif
|
sl@0
|
219 |
|
sl@0
|
220 |
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
sl@0
|
221 |
# endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE
|
sl@0
|
222 |
|
sl@0
|
223 |
# undef i_
|
sl@0
|
224 |
|
sl@0
|
225 |
#endif // BOOST_PP_IS_ITERATING
|