2 #ifndef BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
\r
3 #define BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2001-2004
\r
7 // Distributed under the Boost Software License, Version 1.0.
\r
8 // (See accompanying file LICENSE_1_0.txt or copy at
\r
9 // http://www.boost.org/LICENSE_1_0.txt)
\r
11 // See http://www.boost.org/libs/mpl for documentation.
\r
13 // $Id: lambda_support.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
15 // $Revision: 49267 $
\r
17 #include <boost/mpl/aux_/config/lambda.hpp>
\r
19 #if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
\r
21 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) /**/
\r
22 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i,name,params) /**/
\r
26 # include <boost/mpl/int_fwd.hpp>
\r
27 # include <boost/mpl/aux_/yes_no.hpp>
\r
28 # include <boost/mpl/aux_/na_fwd.hpp>
\r
29 # include <boost/mpl/aux_/preprocessor/params.hpp>
\r
30 # include <boost/mpl/aux_/preprocessor/enum.hpp>
\r
31 # include <boost/mpl/aux_/config/msvc.hpp>
\r
32 # include <boost/mpl/aux_/config/workaround.hpp>
\r
34 # include <boost/preprocessor/tuple/to_list.hpp>
\r
35 # include <boost/preprocessor/list/for_each_i.hpp>
\r
36 # include <boost/preprocessor/inc.hpp>
\r
37 # include <boost/preprocessor/cat.hpp>
\r
39 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC(R,typedef_,i,param) \
\r
40 typedef_ param BOOST_PP_CAT(arg,BOOST_PP_INC(i)); \
\r
43 // agurt, 07/mar/03: restore an old revision for the sake of SGI MIPSpro C++
\r
44 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
\r
46 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
\r
47 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
\r
48 BOOST_PP_LIST_FOR_EACH_I_R( \
\r
50 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
\r
52 , BOOST_PP_TUPLE_TO_LIST(i,params) \
\r
56 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
\r
57 : name< BOOST_MPL_PP_PARAMS(i,U) > \
\r
63 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
64 BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
\r
67 #elif BOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(BOOST_INTEL_CXX_VERSION)
\r
68 // agurt, 18/jan/03: old EDG-based compilers actually enforce 11.4 para 9
\r
69 // (in strict mode), so we have to provide an alternative to the
\r
70 // MSVC-optimized implementation
\r
72 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
73 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
\r
74 BOOST_PP_LIST_FOR_EACH_I_R( \
\r
76 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
\r
78 , BOOST_PP_TUPLE_TO_LIST(i,params) \
\r
83 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
\r
84 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
86 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
\r
87 struct name<BOOST_MPL_PP_PARAMS(i,T)>::rebind \
\r
89 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
\r
90 : name< BOOST_MPL_PP_PARAMS(i,U) > \
\r
95 #else // __EDG_VERSION__
\r
97 namespace boost { namespace mpl { namespace aux {
\r
98 template< typename T > struct has_rebind_tag;
\r
101 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
102 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
\r
103 BOOST_PP_LIST_FOR_EACH_I_R( \
\r
105 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
\r
107 , BOOST_PP_TUPLE_TO_LIST(i,params) \
\r
109 friend class BOOST_PP_CAT(name,_rebind); \
\r
110 typedef BOOST_PP_CAT(name,_rebind) rebind; \
\r
113 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610))
\r
114 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
\r
115 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
\r
116 ::boost::mpl::aux::yes_tag operator|( \
\r
117 ::boost::mpl::aux::has_rebind_tag<int> \
\r
118 , name<BOOST_MPL_PP_PARAMS(i,T)>* \
\r
120 ::boost::mpl::aux::no_tag operator|( \
\r
121 ::boost::mpl::aux::has_rebind_tag<int> \
\r
122 , name< BOOST_MPL_PP_ENUM(i,::boost::mpl::na) >* \
\r
125 #elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
\r
126 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
\r
127 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
\r
128 ::boost::mpl::aux::yes_tag operator|( \
\r
129 ::boost::mpl::aux::has_rebind_tag<int> \
\r
130 , ::boost::mpl::aux::has_rebind_tag< name<BOOST_MPL_PP_PARAMS(i,T)> >* \
\r
134 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) /**/
\r
137 # if !defined(__BORLANDC__)
\r
138 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
\r
139 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
141 BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
\r
142 class BOOST_PP_CAT(name,_rebind) \
\r
145 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
\r
146 : name< BOOST_MPL_PP_PARAMS(i,U) > \
\r
151 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
\r
152 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
\r
154 BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
\r
155 class BOOST_PP_CAT(name,_rebind) \
\r
158 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
\r
160 typedef typename name< BOOST_MPL_PP_PARAMS(i,U) >::type type; \
\r
163 # endif // __BORLANDC__
\r
165 #endif // __EDG_VERSION__
\r
167 #endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
\r
169 #endif // BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
\r