2 #if !defined(BOOST_PP_IS_ITERATING)
6 #ifndef BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
7 #define BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
9 // Copyright Aleksey Gurtovoy 2000-2004
11 // Distributed under the Boost Software License, Version 1.0.
12 // (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
15 // See http://www.boost.org/libs/mpl for documentation.
17 // $Id: lambda_no_ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
18 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
22 # include <boost/mpl/lambda_fwd.hpp>
23 # include <boost/mpl/bind_fwd.hpp>
24 # include <boost/mpl/protect.hpp>
25 # include <boost/mpl/is_placeholder.hpp>
26 # include <boost/mpl/if.hpp>
27 # include <boost/mpl/identity.hpp>
28 # include <boost/mpl/bool.hpp>
29 # include <boost/mpl/aux_/na_spec.hpp>
30 # include <boost/mpl/aux_/lambda_support.hpp>
31 # include <boost/mpl/aux_/template_arity.hpp>
32 # include <boost/mpl/aux_/value_wknd.hpp>
35 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
37 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
38 && !defined(BOOST_MPL_PREPROCESSING_MODE)
40 # define BOOST_MPL_PREPROCESSED_HEADER lambda_no_ctps.hpp
41 # include <boost/mpl/aux_/include_preprocessed.hpp>
45 # include <boost/mpl/limits/arity.hpp>
46 # include <boost/mpl/aux_/preprocessor/params.hpp>
47 # include <boost/mpl/aux_/preprocessor/default_params.hpp>
48 # include <boost/mpl/aux_/preprocessor/repeat.hpp>
49 # include <boost/mpl/aux_/preprocessor/enum.hpp>
50 # include <boost/mpl/aux_/config/msvc.hpp>
51 # include <boost/mpl/aux_/config/workaround.hpp>
53 # include <boost/preprocessor/comma_if.hpp>
54 # include <boost/preprocessor/iterate.hpp>
55 # include <boost/preprocessor/inc.hpp>
56 # include <boost/preprocessor/cat.hpp>
58 namespace boost { namespace mpl {
60 # define AUX778076_LAMBDA_PARAMS(i_, param) \
61 BOOST_MPL_PP_PARAMS(i_, param) \
66 #define n_ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
68 BOOST_MPL_PP_DEFAULT_PARAMS(n_,bool C,false)
76 struct lambda_or< BOOST_MPL_PP_ENUM(n_,false) >
82 template< typename Arity > struct lambda_impl
84 template< typename T, typename Tag, typename Protect > struct result_
87 typedef is_placeholder<T> is_le;
91 #define BOOST_PP_ITERATION_PARAMS_1 \
92 (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/aux_/lambda_no_ctps.hpp>))
93 #include BOOST_PP_ITERATE()
104 /// Metafunction forwarding confuses MSVC 6.x
105 typedef typename aux::template_arity<T>::type arity_;
106 typedef typename aux::lambda_impl<arity_>
107 ::template result_< T,Tag,Protect > l_;
109 typedef typename l_::type type;
110 typedef typename l_::is_le is_le;
112 BOOST_MPL_AUX_LAMBDA_SUPPORT(3, lambda, (T, Tag, Protect))
115 BOOST_MPL_AUX_NA_SPEC2(1, 3, lambda)
120 struct is_lambda_expression
125 # undef AUX778076_LAMBDA_PARAMS
129 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
130 #endif // BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
132 ///// iteration, depth == 1
136 #define i_ BOOST_PP_FRAME_ITERATION(1)
138 # define AUX778076_LAMBDA_TYPEDEF(unused, i_, F) \
140 typename F::BOOST_PP_CAT(arg,BOOST_PP_INC(i_)) \
143 > BOOST_PP_CAT(l,BOOST_PP_INC(i_)); \
146 # define AUX778076_IS_LE_TYPEDEF(unused, i_, unused2) \
147 typedef typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::is_le \
148 BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)); \
151 # define AUX778076_IS_LAMBDA_EXPR(unused, i_, unused2) \
152 BOOST_PP_COMMA_IF(i_) \
153 BOOST_MPL_AUX_MSVC_VALUE_WKND(BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)))::value \
156 # define AUX778076_LAMBDA_RESULT(unused, i_, unused2) \
157 , typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::type \
160 template<> struct lambda_impl< int_<i_> >
162 template< typename F, typename Tag, typename Protect > struct result_
164 BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_TYPEDEF, F)
165 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LE_TYPEDEF, unused)
167 typedef aux::lambda_or<
168 BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LAMBDA_EXPR, unused)
171 typedef BOOST_PP_CAT(bind,i_)<
173 BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_RESULT, unused)
176 typedef typename if_<
178 , if_< Protect, mpl::protect<bind_>, bind_ >
182 typedef typename type_::type type;
186 # undef AUX778076_LAMBDA_RESULT
187 # undef AUX778076_IS_LAMBDA_EXPR
188 # undef AUX778076_IS_LE_TYPEDEF
189 # undef AUX778076_LAMBDA_TYPEDEF
193 #endif // BOOST_PP_IS_ITERATING