Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:38

0001 
0002 #if !defined(BOOST_PP_IS_ITERATING)
0003 
0004 ///// header body
0005 
0006 #ifndef BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
0007 #define BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
0008 
0009 // Copyright Aleksey Gurtovoy 2000-2004
0010 //
0011 // Distributed under the Boost Software License, Version 1.0. 
0012 // (See accompanying file LICENSE_1_0.txt or copy at 
0013 // http://www.boost.org/LICENSE_1_0.txt)
0014 //
0015 // See http://www.boost.org/libs/mpl for documentation.
0016 
0017 // $Id$
0018 // $Date$
0019 // $Revision$
0020 
0021 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
0022 #   include <boost/mpl/lambda_fwd.hpp>
0023 #   include <boost/mpl/bind_fwd.hpp>
0024 #   include <boost/mpl/protect.hpp>
0025 #   include <boost/mpl/is_placeholder.hpp>
0026 #   include <boost/mpl/if.hpp>
0027 #   include <boost/mpl/identity.hpp>
0028 #   include <boost/mpl/bool.hpp>
0029 #   include <boost/mpl/aux_/na_spec.hpp>
0030 #   include <boost/mpl/aux_/lambda_support.hpp>
0031 #   include <boost/mpl/aux_/template_arity.hpp>
0032 #   include <boost/mpl/aux_/value_wknd.hpp>
0033 #endif
0034 
0035 #include <boost/mpl/aux_/config/use_preprocessed.hpp>
0036 
0037 #if    !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
0038     && !defined(BOOST_MPL_PREPROCESSING_MODE)
0039 
0040 #   define BOOST_MPL_PREPROCESSED_HEADER lambda_no_ctps.hpp
0041 #   include <boost/mpl/aux_/include_preprocessed.hpp>
0042 
0043 #else
0044 
0045 #   include <boost/mpl/limits/arity.hpp>
0046 #   include <boost/mpl/aux_/preprocessor/params.hpp>
0047 #   include <boost/mpl/aux_/preprocessor/default_params.hpp>
0048 #   include <boost/mpl/aux_/preprocessor/repeat.hpp>
0049 #   include <boost/mpl/aux_/preprocessor/enum.hpp>
0050 #   include <boost/mpl/aux_/config/msvc.hpp>
0051 #   include <boost/mpl/aux_/config/workaround.hpp>
0052 
0053 #   include <boost/preprocessor/comma_if.hpp>
0054 #   include <boost/preprocessor/iterate.hpp>
0055 #   include <boost/preprocessor/inc.hpp>
0056 #   include <boost/preprocessor/cat.hpp>
0057 
0058 namespace boost { namespace mpl {
0059 
0060 #   define AUX778076_LAMBDA_PARAMS(i_, param) \
0061     BOOST_MPL_PP_PARAMS(i_, param) \
0062     /**/
0063 
0064 namespace aux {
0065 
0066 #define n_ BOOST_MPL_LIMIT_METAFUNCTION_ARITY
0067 template<
0068       BOOST_MPL_PP_DEFAULT_PARAMS(n_,bool C,false)
0069     >
0070 struct lambda_or
0071     : true_
0072 {
0073 };
0074 
0075 template<>
0076 struct lambda_or< BOOST_MPL_PP_ENUM(n_,false) >
0077     : false_
0078 {
0079 };
0080 #undef n_
0081 
0082 template< typename Arity > struct lambda_impl
0083 {
0084     template< typename T, typename Tag, typename Protect > struct result_
0085     {
0086         typedef T type;
0087         typedef is_placeholder<T> is_le;
0088     };
0089 };
0090 
0091 #define BOOST_PP_ITERATION_PARAMS_1 \
0092     (3,(1, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/aux_/lambda_no_ctps.hpp>))
0093 #include BOOST_PP_ITERATE()
0094 
0095 } // namespace aux
0096 
0097 template<
0098       typename T
0099     , typename Tag
0100     , typename Protect
0101     >
0102 struct lambda
0103 {
0104     /// Metafunction forwarding confuses MSVC 6.x
0105     typedef typename aux::template_arity<T>::type arity_;
0106     typedef typename aux::lambda_impl<arity_>
0107         ::template result_< T,Tag,Protect > l_;
0108 
0109     typedef typename l_::type type;
0110     typedef typename l_::is_le is_le;
0111     
0112     BOOST_MPL_AUX_LAMBDA_SUPPORT(3, lambda, (T, Tag, Protect))
0113 };
0114 
0115 BOOST_MPL_AUX_NA_SPEC2(1, 3, lambda)
0116 
0117 template<
0118       typename T
0119     >
0120 struct is_lambda_expression
0121     : lambda<T>::is_le
0122 {
0123 };
0124 
0125 #   undef AUX778076_LAMBDA_PARAMS
0126 
0127 }}
0128 
0129 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
0130 #endif // BOOST_MPL_AUX_LAMBDA_NO_CTPS_HPP_INCLUDED
0131 
0132 ///// iteration, depth == 1
0133 
0134 #else
0135 
0136 #define i_ BOOST_PP_FRAME_ITERATION(1)
0137 
0138 #   define AUX778076_LAMBDA_TYPEDEF(unused, i_, F) \
0139     typedef lambda< \
0140           typename F::BOOST_PP_CAT(arg,BOOST_PP_INC(i_)) \
0141         , Tag \
0142         , false_ \
0143         > BOOST_PP_CAT(l,BOOST_PP_INC(i_)); \
0144     /**/
0145 
0146 #   define AUX778076_IS_LE_TYPEDEF(unused, i_, unused2) \
0147     typedef typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::is_le \
0148         BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)); \
0149     /**/
0150 
0151 #   define AUX778076_IS_LAMBDA_EXPR(unused, i_, unused2) \
0152     BOOST_PP_COMMA_IF(i_) \
0153     BOOST_MPL_AUX_MSVC_VALUE_WKND(BOOST_PP_CAT(is_le,BOOST_PP_INC(i_)))::value \
0154     /**/
0155 
0156 #   define AUX778076_LAMBDA_RESULT(unused, i_, unused2) \
0157     , typename BOOST_PP_CAT(l,BOOST_PP_INC(i_))::type \
0158     /**/
0159 
0160 template<> struct lambda_impl< int_<i_> >
0161 {
0162     template< typename F, typename Tag, typename Protect > struct result_
0163     {
0164         BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_TYPEDEF, F)
0165         BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LE_TYPEDEF, unused)
0166 
0167         typedef aux::lambda_or<
0168               BOOST_MPL_PP_REPEAT(i_, AUX778076_IS_LAMBDA_EXPR, unused)
0169             > is_le;
0170 
0171         typedef BOOST_PP_CAT(bind,i_)<
0172               typename F::rebind
0173             BOOST_MPL_PP_REPEAT(i_, AUX778076_LAMBDA_RESULT, unused)
0174             > bind_;
0175 
0176         typedef typename if_<
0177               is_le
0178             , if_< Protect, mpl::protect<bind_>, bind_ >
0179             , identity<F>
0180             >::type type_;
0181     
0182         typedef typename type_::type type;
0183     };
0184 };
0185 
0186 #   undef AUX778076_LAMBDA_RESULT
0187 #   undef AUX778076_IS_LAMBDA_EXPR
0188 #   undef AUX778076_IS_LE_TYPEDEF
0189 #   undef AUX778076_LAMBDA_TYPEDEF
0190 
0191 #undef i_
0192 
0193 #endif // BOOST_PP_IS_ITERATING