fixing stuff
[dyninst.git] / dynutil / h / dyn_detail / boost / mpl / aux_ / lambda_support.hpp
1
2 #ifndef DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED
3 #define DYN_DETAIL_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 // $Id: lambda_support.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
15 // $Revision: 49267 $
16
17 #include <dyn_detail/boost/mpl/aux_/config/lambda.hpp>
18
19 #if !defined(DYN_DETAIL_BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
20
21 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) /**/
22 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i,name,params) /**/
23
24 #else
25 #error
26
27 #   include <dyn_detail/boost/mpl/int_fwd.hpp>
28 #   include <dyn_detail/boost/mpl/aux_/yes_no.hpp>
29 #   include <dyn_detail/boost/mpl/aux_/na_fwd.hpp>
30 #   include <dyn_detail/boost/mpl/aux_/preprocessor/params.hpp>
31 #   include <dyn_detail/boost/mpl/aux_/preprocessor/enum.hpp>
32 #   include <dyn_detail/boost/mpl/aux_/config/msvc.hpp>
33 #   include <dyn_detail/boost/mpl/aux_/config/workaround.hpp>
34
35 #   include <dyn_detail/boost/preprocessor/tuple/to_list.hpp>
36 #   include <dyn_detail/boost/preprocessor/list/for_each_i.hpp>
37 #   include <dyn_detail/boost/preprocessor/inc.hpp>
38 #   include <dyn_detail/boost/preprocessor/cat.hpp>
39
40 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC(R,typedef_,i,param) \
41     typedef_ param DYN_DETAIL_BOOST_PP_CAT(arg,DYN_DETAIL_BOOST_PP_INC(i)); \
42     /**/
43
44 // agurt, 07/mar/03: restore an old revision for the sake of SGI MIPSpro C++
45 #if DYN_DETAIL_BOOST_WORKAROUND(__EDG_VERSION__, <= 238) 
46
47 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
48     typedef DYN_DETAIL_BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
49     DYN_DETAIL_BOOST_PP_LIST_FOR_EACH_I_R( \
50           1 \
51         , DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
52         , typedef \
53         , DYN_DETAIL_BOOST_PP_TUPLE_TO_LIST(i,params) \
54         ) \
55     struct rebind \
56     { \
57         template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
58             : name< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,U) > \
59         { \
60         }; \
61     }; \
62     /**/
63
64 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
65     DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
66     /**/
67
68 #elif DYN_DETAIL_BOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(DYN_DETAIL_BOOST_INTEL_CXX_VERSION)
69 // agurt, 18/jan/03: old EDG-based compilers actually enforce 11.4 para 9
70 // (in strict mode), so we have to provide an alternative to the 
71 // MSVC-optimized implementation
72
73 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
74     typedef DYN_DETAIL_BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
75     DYN_DETAIL_BOOST_PP_LIST_FOR_EACH_I_R( \
76           1 \
77         , DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
78         , typedef \
79         , DYN_DETAIL_BOOST_PP_TUPLE_TO_LIST(i,params) \
80         ) \
81     struct rebind; \
82 /**/
83
84 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
85     DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
86 }; \
87 template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename T) > \
88 struct name<DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,T)>::rebind \
89 { \
90     template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
91         : name< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,U) > \
92     { \
93     }; \
94 /**/
95
96 #else // __EDG_VERSION__
97
98 namespace dyn_detail {namespace boost { namespace mpl { namespace aux {
99 template< typename T > struct has_rebind_tag;
100 }}}}
101
102 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
103     typedef DYN_DETAIL_BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \
104     DYN_DETAIL_BOOST_PP_LIST_FOR_EACH_I_R( \
105           1 \
106         , DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \
107         , typedef \
108         , DYN_DETAIL_BOOST_PP_TUPLE_TO_LIST(i,params) \
109         ) \
110     friend class DYN_DETAIL_BOOST_PP_CAT(name,_rebind); \
111     typedef DYN_DETAIL_BOOST_PP_CAT(name,_rebind) rebind; \
112 /**/
113
114 #if DYN_DETAIL_BOOST_WORKAROUND(__BORLANDC__, DYN_DETAIL_BOOST_TESTED_AT(0x610))
115 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
116 template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename T) > \
117 dyn_detail::boost::mpl::aux::yes_tag operator|( \
118       dyn_detail::boost::mpl::aux::has_rebind_tag<int> \
119     , name<DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,T)>* \
120     ); \
121 dyn_detail::boost::mpl::aux::no_tag operator|( \
122       dyn_detail::boost::mpl::aux::has_rebind_tag<int> \
123     , name< DYN_DETAIL_BOOST_MPL_PP_ENUM(i,dyn_detail::boost::mpl::na) >* \
124     ); \
125 /**/
126 #elif !DYN_DETAIL_BOOST_WORKAROUND(DYN_DETAIL_BOOST_MSVC, < 1300)
127 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
128 template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename T) > \
129 dyn_detail::boost::mpl::aux::yes_tag operator|( \
130       dyn_detail::boost::mpl::aux::has_rebind_tag<int> \
131     , dyn_detail::boost::mpl::aux::has_rebind_tag< name<DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,T)> >* \
132     ); \
133 /**/
134 #else
135 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) /**/
136 #endif
137
138 #   if !defined(__BORLANDC__)
139 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
140     DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
141 }; \
142 DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
143 class DYN_DETAIL_BOOST_PP_CAT(name,_rebind) \
144 { \
145  public: \
146     template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
147         : name< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,U) > \
148     { \
149     }; \
150 /**/
151 #   else
152 #   define DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
153     DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
154 }; \
155 DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \
156 class DYN_DETAIL_BOOST_PP_CAT(name,_rebind) \
157 { \
158  public: \
159     template< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
160     { \
161         typedef typename name< DYN_DETAIL_BOOST_MPL_PP_PARAMS(i,U) >::type type; \
162     }; \
163 /**/
164 #   endif // __BORLANDC__
165
166 #endif // __EDG_VERSION__
167
168 #endif // DYN_DETAIL_BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
169
170 #endif // DYN_DETAIL_BOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED