Chris@16
|
1
|
Chris@16
|
2 #if !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
3
|
Chris@16
|
4 ///// header body
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
|
Chris@16
|
7 #define BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
|
Chris@16
|
8
|
Chris@16
|
9 // Copyright Aleksey Gurtovoy 2000-2004
|
Chris@16
|
10 //
|
Chris@16
|
11 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
12 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14 //
|
Chris@16
|
15 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
16
|
Chris@101
|
17 // $Id$
|
Chris@101
|
18 // $Date$
|
Chris@101
|
19 // $Revision$
|
Chris@16
|
20
|
Chris@16
|
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
22 # include <boost/mpl/lambda_fwd.hpp>
|
Chris@16
|
23 # include <boost/mpl/bind_fwd.hpp>
|
Chris@16
|
24 # include <boost/mpl/protect.hpp>
|
Chris@16
|
25 # include <boost/mpl/is_placeholder.hpp>
|
Chris@16
|
26 # include <boost/mpl/if.hpp>
|
Chris@16
|
27 # include <boost/mpl/identity.hpp>
|
Chris@16
|
28 # include <boost/mpl/bool.hpp>
|
Chris@16
|
29 # include <boost/mpl/aux_/na_spec.hpp>
|
Chris@16
|
30 # include <boost/mpl/aux_/lambda_support.hpp>
|
Chris@16
|
31 # include <boost/mpl/aux_/template_arity.hpp>
|
Chris@16
|
32 # include <boost/mpl/aux_/value_wknd.hpp>
|
Chris@16
|
33 #endif
|
Chris@16
|
34
|
Chris@16
|
35 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
Chris@16
|
36
|
Chris@16
|
37 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
Chris@16
|
38 && !defined(BOOST_MPL_PREPROCESSING_MODE)
|
Chris@16
|
39
|
Chris@16
|
40 # define BOOST_MPL_PREPROCESSED_HEADER lambda_no_ctps.hpp
|
Chris@16
|
41 # include <boost/mpl/aux_/include_preprocessed.hpp>
|
Chris@16
|
42
|
Chris@16
|
43 #else
|
Chris@16
|
44
|
Chris@16
|
45 # include <boost/mpl/limits/arity.hpp>
|
Chris@16
|
46 # include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
47 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
Chris@16
|
48 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
Chris@16
|
49 # include <boost/mpl/aux_/preprocessor/enum.hpp>
|
Chris@16
|
50 # include <boost/mpl/aux_/config/msvc.hpp>
|
Chris@16
|
51 # include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
52
|
Chris@16
|
53 # include <boost/preprocessor/comma_if.hpp>
|
Chris@16
|
54 # include <boost/preprocessor/iterate.hpp>
|
Chris@16
|
55 # include <boost/preprocessor/inc.hpp>
|
Chris@16
|
56 # include <boost/preprocessor/cat.hpp>
|
Chris@16
|
57
|
Chris@16
|
58 namespace boost { namespace mpl {
|
Chris@16
|
59
|
Chris@16
|
60 # define AUX778076_LAMBDA_PARAMS(i_, param) \
|
Chris@16
|
61 BOOST_MPL_PP_PARAMS(i_, param) \
|
Chris@16
|
62 /**/
|
Chris@16
|
63
|
Chris@16
|
64 namespace aux {
|
Chris@16
|
65
|
Chris@16
|
66 #define n_ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
|
Chris@16
|
67 template<
|
Chris@16
|
68 BOOST_MPL_PP_DEFAULT_PARAMS(n_,bool C,false)
|
Chris@16
|
69 >
|
Chris@16
|
70 struct lambda_or
|
Chris@16
|
71 : true_
|
Chris@16
|
72 {
|
Chris@16
|
73 };
|
Chris@16
|
74
|
Chris@16
|
75 template<>
|
Chris@16
|
76 struct lambda_or< BOOST_MPL_PP_ENUM(n_,false) >
|
Chris@16
|
77 : false_
|
Chris@16
|
78 {
|
Chris@16
|
79 };
|
Chris@16
|
80 #undef n_
|
Chris@16
|
81
|
Chris@16
|
82 template< typename Arity > struct lambda_impl
|
Chris@16
|
83 {
|
Chris@16
|
84 template< typename T, typename Tag, typename Protect > struct result_
|
Chris@16
|
85 {
|
Chris@16
|
86 typedef T type;
|
Chris@16
|
87 typedef is_placeholder<T> is_le;
|
Chris@16
|
88 };
|
Chris@16
|
89 };
|
Chris@16
|
90
|
Chris@16
|
91 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
92 (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/aux_/lambda_no_ctps.hpp>))
|
Chris@16
|
93 #include BOOST_PP_ITERATE()
|
Chris@16
|
94
|
Chris@16
|
95 } // namespace aux
|
Chris@16
|
96
|
Chris@16
|
97 template<
|
Chris@16
|
98 typename T
|
Chris@16
|
99 , typename Tag
|
Chris@16
|
100 , typename Protect
|
Chris@16
|
101 >
|
Chris@16
|
102 struct lambda
|
Chris@16
|
103 {
|
Chris@16
|
104 /// Metafunction forwarding confuses MSVC 6.x
|
Chris@16
|
105 typedef typename aux::template_arity<T>::type arity_;
|
Chris@16
|
106 typedef typename aux::lambda_impl<arity_>
|
Chris@16
|
107 ::template result_< T,Tag,Protect > l_;
|
Chris@16
|
108
|
Chris@16
|
109 typedef typename l_::type type;
|
Chris@16
|
110 typedef typename l_::is_le is_le;
|
Chris@16
|
111
|
Chris@16
|
112 BOOST_MPL_AUX_LAMBDA_SUPPORT(3, lambda, (T, Tag, Protect))
|
Chris@16
|
113 };
|
Chris@16
|
114
|
Chris@16
|
115 BOOST_MPL_AUX_NA_SPEC2(1, 3, lambda)
|
Chris@16
|
116
|
Chris@16
|
117 template<
|
Chris@16
|
118 typename T
|
Chris@16
|
119 >
|
Chris@16
|
120 struct is_lambda_expression
|
Chris@16
|
121 : lambda<T>::is_le
|
Chris@16
|
122 {
|
Chris@16
|
123 };
|
Chris@16
|
124
|
Chris@16
|
125 # undef AUX778076_LAMBDA_PARAMS
|
Chris@16
|
126
|
Chris@16
|
127 }}
|
Chris@16
|
128
|
Chris@16
|
129 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
Chris@16
|
130 #endif // BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
|
Chris@16
|
131
|
Chris@16
|
132 ///// iteration, depth == 1
|
Chris@16
|
133
|
Chris@16
|
134 #else
|
Chris@16
|
135
|
Chris@16
|
136 #define i_ BOOST_PP_FRAME_ITERATION(1)
|
Chris@16
|
137
|
Chris@16
|
138 # define AUX778076_LAMBDA_TYPEDEF(unused, i_, F) \
|
Chris@16
|
139 typedef lambda< \
|
Chris@16
|
140 typename F::BOOST_PP_CAT(arg,BOOST_PP_INC(i_)) \
|
Chris@16
|
141 , Tag \
|
Chris@16
|
142 , false_ \
|
Chris@16
|
143 > BOOST_PP_CAT(l,BOOST_PP_INC(i_)); \
|
Chris@16
|
144 /**/
|
Chris@16
|
145
|
Chris@16
|
146 # define AUX778076_IS_LE_TYPEDEF(unused, i_, unused2) \
|
Chris@16
|
147 typedef typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::is_le \
|
Chris@16
|
148 BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)); \
|
Chris@16
|
149 /**/
|
Chris@16
|
150
|
Chris@16
|
151 # define AUX778076_IS_LAMBDA_EXPR(unused, i_, unused2) \
|
Chris@16
|
152 BOOST_PP_COMMA_IF(i_) \
|
Chris@16
|
153 BOOST_MPL_AUX_MSVC_VALUE_WKND(BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)))::value \
|
Chris@16
|
154 /**/
|
Chris@16
|
155
|
Chris@16
|
156 # define AUX778076_LAMBDA_RESULT(unused, i_, unused2) \
|
Chris@16
|
157 , typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::type \
|
Chris@16
|
158 /**/
|
Chris@16
|
159
|
Chris@16
|
160 template<> struct lambda_impl< int_<i_> >
|
Chris@16
|
161 {
|
Chris@16
|
162 template< typename F, typename Tag, typename Protect > struct result_
|
Chris@16
|
163 {
|
Chris@16
|
164 BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_TYPEDEF, F)
|
Chris@16
|
165 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LE_TYPEDEF, unused)
|
Chris@16
|
166
|
Chris@16
|
167 typedef aux::lambda_or<
|
Chris@16
|
168 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LAMBDA_EXPR, unused)
|
Chris@16
|
169 > is_le;
|
Chris@16
|
170
|
Chris@16
|
171 typedef BOOST_PP_CAT(bind,i_)<
|
Chris@16
|
172 typename F::rebind
|
Chris@16
|
173 BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_RESULT, unused)
|
Chris@16
|
174 > bind_;
|
Chris@16
|
175
|
Chris@16
|
176 typedef typename if_<
|
Chris@16
|
177 is_le
|
Chris@16
|
178 , if_< Protect, mpl::protect<bind_>, bind_ >
|
Chris@16
|
179 , identity<F>
|
Chris@16
|
180 >::type type_;
|
Chris@16
|
181
|
Chris@16
|
182 typedef typename type_::type type;
|
Chris@16
|
183 };
|
Chris@16
|
184 };
|
Chris@16
|
185
|
Chris@16
|
186 # undef AUX778076_LAMBDA_RESULT
|
Chris@16
|
187 # undef AUX778076_IS_LAMBDA_EXPR
|
Chris@16
|
188 # undef AUX778076_IS_LE_TYPEDEF
|
Chris@16
|
189 # undef AUX778076_LAMBDA_TYPEDEF
|
Chris@16
|
190
|
Chris@16
|
191 #undef i_
|
Chris@16
|
192
|
Chris@16
|
193 #endif // BOOST_PP_IS_ITERATING
|