Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2001-2004
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
8 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10 //
|
Chris@16
|
11 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
12
|
Chris@101
|
13 // $Id$
|
Chris@101
|
14 // $Date$
|
Chris@101
|
15 // $Revision$
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/mpl/aux_/config/lambda.hpp>
|
Chris@16
|
18
|
Chris@16
|
19 #if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
|
Chris@16
|
20
|
Chris@16
|
21 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) /**/
|
Chris@16
|
22 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i,name,params) /**/
|
Chris@16
|
23
|
Chris@16
|
24 #else
|
Chris@16
|
25
|
Chris@16
|
26 # include <boost/mpl/int_fwd.hpp>
|
Chris@16
|
27 # include <boost/mpl/aux_/yes_no.hpp>
|
Chris@16
|
28 # include <boost/mpl/aux_/na_fwd.hpp>
|
Chris@16
|
29 # include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
30 # include <boost/mpl/aux_/preprocessor/enum.hpp>
|
Chris@16
|
31 # include <boost/mpl/aux_/config/msvc.hpp>
|
Chris@16
|
32 # include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
33
|
Chris@16
|
34 # include <boost/preprocessor/tuple/to_list.hpp>
|
Chris@16
|
35 # include <boost/preprocessor/list/for_each_i.hpp>
|
Chris@16
|
36 # include <boost/preprocessor/inc.hpp>
|
Chris@16
|
37 # include <boost/preprocessor/cat.hpp>
|
Chris@16
|
38
|
Chris@16
|
39 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC(R,typedef_,i,param) \
|
Chris@16
|
40 typedef_ param BOOST_PP_CAT(arg,BOOST_PP_INC(i)); \
|
Chris@16
|
41 /**/
|
Chris@16
|
42
|
Chris@16
|
43 // agurt, 07/mar/03: restore an old revision for the sake of SGI MIPSpro C++
|
Chris@16
|
44 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
Chris@16
|
45
|
Chris@16
|
46 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
|
Chris@16
|
47 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
|
Chris@16
|
48 BOOST_PP_LIST_FOR_EACH_I_R( \
|
Chris@16
|
49 1 \
|
Chris@16
|
50 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
|
Chris@16
|
51 , typedef \
|
Chris@16
|
52 , BOOST_PP_TUPLE_TO_LIST(i,params) \
|
Chris@16
|
53 ) \
|
Chris@16
|
54 struct rebind \
|
Chris@16
|
55 { \
|
Chris@16
|
56 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
|
Chris@16
|
57 : name< BOOST_MPL_PP_PARAMS(i,U) > \
|
Chris@16
|
58 { \
|
Chris@16
|
59 }; \
|
Chris@16
|
60 }; \
|
Chris@16
|
61 /**/
|
Chris@16
|
62
|
Chris@16
|
63 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
64 BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
|
Chris@16
|
65 /**/
|
Chris@16
|
66
|
Chris@16
|
67 #elif BOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(BOOST_INTEL_CXX_VERSION)
|
Chris@16
|
68 // agurt, 18/jan/03: old EDG-based compilers actually enforce 11.4 para 9
|
Chris@16
|
69 // (in strict mode), so we have to provide an alternative to the
|
Chris@16
|
70 // MSVC-optimized implementation
|
Chris@16
|
71
|
Chris@16
|
72 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
73 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
|
Chris@16
|
74 BOOST_PP_LIST_FOR_EACH_I_R( \
|
Chris@16
|
75 1 \
|
Chris@16
|
76 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
|
Chris@16
|
77 , typedef \
|
Chris@16
|
78 , BOOST_PP_TUPLE_TO_LIST(i,params) \
|
Chris@16
|
79 ) \
|
Chris@16
|
80 struct rebind; \
|
Chris@16
|
81 /**/
|
Chris@16
|
82
|
Chris@16
|
83 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
|
Chris@16
|
84 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
85 }; \
|
Chris@16
|
86 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
|
Chris@16
|
87 struct name<BOOST_MPL_PP_PARAMS(i,T)>::rebind \
|
Chris@16
|
88 { \
|
Chris@16
|
89 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
|
Chris@16
|
90 : name< BOOST_MPL_PP_PARAMS(i,U) > \
|
Chris@16
|
91 { \
|
Chris@16
|
92 }; \
|
Chris@16
|
93 /**/
|
Chris@16
|
94
|
Chris@16
|
95 #else // __EDG_VERSION__
|
Chris@16
|
96
|
Chris@16
|
97 namespace boost { namespace mpl { namespace aux {
|
Chris@16
|
98 template< typename T > struct has_rebind_tag;
|
Chris@16
|
99 }}}
|
Chris@16
|
100
|
Chris@16
|
101 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
102 typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
|
Chris@16
|
103 BOOST_PP_LIST_FOR_EACH_I_R( \
|
Chris@16
|
104 1 \
|
Chris@16
|
105 , BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
|
Chris@16
|
106 , typedef \
|
Chris@16
|
107 , BOOST_PP_TUPLE_TO_LIST(i,params) \
|
Chris@16
|
108 ) \
|
Chris@16
|
109 friend class BOOST_PP_CAT(name,_rebind); \
|
Chris@16
|
110 typedef BOOST_PP_CAT(name,_rebind) rebind; \
|
Chris@16
|
111 /**/
|
Chris@16
|
112
|
Chris@16
|
113 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610))
|
Chris@16
|
114 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
|
Chris@16
|
115 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
|
Chris@16
|
116 ::boost::mpl::aux::yes_tag operator|( \
|
Chris@16
|
117 ::boost::mpl::aux::has_rebind_tag<int> \
|
Chris@16
|
118 , name<BOOST_MPL_PP_PARAMS(i,T)>* \
|
Chris@16
|
119 ); \
|
Chris@16
|
120 ::boost::mpl::aux::no_tag operator|( \
|
Chris@16
|
121 ::boost::mpl::aux::has_rebind_tag<int> \
|
Chris@16
|
122 , name< BOOST_MPL_PP_ENUM(i,::boost::mpl::na) >* \
|
Chris@16
|
123 ); \
|
Chris@16
|
124 /**/
|
Chris@16
|
125 #elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
Chris@16
|
126 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
|
Chris@16
|
127 template< BOOST_MPL_PP_PARAMS(i,typename T) > \
|
Chris@16
|
128 ::boost::mpl::aux::yes_tag operator|( \
|
Chris@16
|
129 ::boost::mpl::aux::has_rebind_tag<int> \
|
Chris@16
|
130 , ::boost::mpl::aux::has_rebind_tag< name<BOOST_MPL_PP_PARAMS(i,T)> >* \
|
Chris@16
|
131 ); \
|
Chris@16
|
132 /**/
|
Chris@16
|
133 #else
|
Chris@16
|
134 # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) /**/
|
Chris@16
|
135 #endif
|
Chris@16
|
136
|
Chris@16
|
137 # if !defined(__BORLANDC__)
|
Chris@16
|
138 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
|
Chris@16
|
139 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
140 }; \
|
Chris@16
|
141 BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
|
Chris@16
|
142 class BOOST_PP_CAT(name,_rebind) \
|
Chris@16
|
143 { \
|
Chris@16
|
144 public: \
|
Chris@16
|
145 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
|
Chris@16
|
146 : name< BOOST_MPL_PP_PARAMS(i,U) > \
|
Chris@16
|
147 { \
|
Chris@16
|
148 }; \
|
Chris@16
|
149 /**/
|
Chris@16
|
150 # else
|
Chris@16
|
151 # define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
|
Chris@16
|
152 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
|
Chris@16
|
153 }; \
|
Chris@16
|
154 BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
|
Chris@16
|
155 class BOOST_PP_CAT(name,_rebind) \
|
Chris@16
|
156 { \
|
Chris@16
|
157 public: \
|
Chris@16
|
158 template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
|
Chris@16
|
159 { \
|
Chris@16
|
160 typedef typename name< BOOST_MPL_PP_PARAMS(i,U) >::type type; \
|
Chris@16
|
161 }; \
|
Chris@16
|
162 /**/
|
Chris@16
|
163 # endif // __BORLANDC__
|
Chris@16
|
164
|
Chris@16
|
165 #endif // __EDG_VERSION__
|
Chris@16
|
166
|
Chris@16
|
167 #endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
|
Chris@16
|
168
|
Chris@16
|
169 #endif // BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
|