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