Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 2 | #ifndef NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED |
| 3 | #define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ |
| 15 | // $Revision: 49267 $ |
| 16 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 17 | #include <ndnboost/mpl/aux_/config/lambda.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 18 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 19 | #if !defined(NDNBOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 20 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 21 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) /**/ |
| 22 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i,name,params) /**/ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 23 | |
| 24 | #else |
| 25 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 26 | # include <ndnboost/mpl/int_fwd.hpp> |
| 27 | # include <ndnboost/mpl/aux_/yes_no.hpp> |
| 28 | # include <ndnboost/mpl/aux_/na_fwd.hpp> |
| 29 | # include <ndnboost/mpl/aux_/preprocessor/params.hpp> |
| 30 | # include <ndnboost/mpl/aux_/preprocessor/enum.hpp> |
| 31 | # include <ndnboost/mpl/aux_/config/msvc.hpp> |
| 32 | # include <ndnboost/mpl/aux_/config/workaround.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 33 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 34 | # include <ndnboost/preprocessor/tuple/to_list.hpp> |
| 35 | # include <ndnboost/preprocessor/list/for_each_i.hpp> |
| 36 | # include <ndnboost/preprocessor/inc.hpp> |
| 37 | # include <ndnboost/preprocessor/cat.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 38 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 39 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC(R,typedef_,i,param) \ |
| 40 | typedef_ param NDNBOOST_PP_CAT(arg,NDNBOOST_PP_INC(i)); \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 41 | /**/ |
| 42 | |
| 43 | // agurt, 07/mar/03: restore an old revision for the sake of SGI MIPSpro C++ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 44 | #if NDNBOOST_WORKAROUND(__EDG_VERSION__, <= 238) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 45 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 46 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \ |
| 47 | typedef NDNBOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \ |
| 48 | NDNBOOST_PP_LIST_FOR_EACH_I_R( \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 49 | 1 \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 50 | , NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 51 | , typedef \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 52 | , NDNBOOST_PP_TUPLE_TO_LIST(i,params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 53 | ) \ |
| 54 | struct rebind \ |
| 55 | { \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 56 | template< NDNBOOST_MPL_PP_PARAMS(i,typename U) > struct apply \ |
| 57 | : name< NDNBOOST_MPL_PP_PARAMS(i,U) > \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 58 | { \ |
| 59 | }; \ |
| 60 | }; \ |
| 61 | /**/ |
| 62 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 63 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
| 64 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 65 | /**/ |
| 66 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 67 | #elif NDNBOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(NDNBOOST_INTEL_CXX_VERSION) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 72 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
| 73 | typedef NDNBOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \ |
| 74 | NDNBOOST_PP_LIST_FOR_EACH_I_R( \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 75 | 1 \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 76 | , NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 77 | , typedef \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 78 | , NDNBOOST_PP_TUPLE_TO_LIST(i,params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 79 | ) \ |
| 80 | struct rebind; \ |
| 81 | /**/ |
| 82 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 83 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \ |
| 84 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 85 | }; \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 86 | template< NDNBOOST_MPL_PP_PARAMS(i,typename T) > \ |
| 87 | struct name<NDNBOOST_MPL_PP_PARAMS(i,T)>::rebind \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 88 | { \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 89 | template< NDNBOOST_MPL_PP_PARAMS(i,typename U) > struct apply \ |
| 90 | : name< NDNBOOST_MPL_PP_PARAMS(i,U) > \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 91 | { \ |
| 92 | }; \ |
| 93 | /**/ |
| 94 | |
| 95 | #else // __EDG_VERSION__ |
| 96 | |
| 97 | namespace ndnboost { namespace mpl { namespace aux { |
| 98 | template< typename T > struct has_rebind_tag; |
| 99 | }}} |
| 100 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 101 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
| 102 | typedef NDNBOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::int_<i> arity; \ |
| 103 | NDNBOOST_PP_LIST_FOR_EACH_I_R( \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 104 | 1 \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 105 | , NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_ARG_TYPEDEF_FUNC \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 106 | , typedef \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 107 | , NDNBOOST_PP_TUPLE_TO_LIST(i,params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 108 | ) \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 109 | friend class NDNBOOST_PP_CAT(name,_rebind); \ |
| 110 | typedef NDNBOOST_PP_CAT(name,_rebind) rebind; \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 111 | /**/ |
| 112 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 113 | #if NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x610)) |
| 114 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ |
| 115 | template< NDNBOOST_MPL_PP_PARAMS(i,typename T) > \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 116 | ::ndnboost::mpl::aux::yes_tag operator|( \ |
| 117 | ::ndnboost::mpl::aux::has_rebind_tag<int> \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 118 | , name<NDNBOOST_MPL_PP_PARAMS(i,T)>* \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 119 | ); \ |
| 120 | ::ndnboost::mpl::aux::no_tag operator|( \ |
| 121 | ::ndnboost::mpl::aux::has_rebind_tag<int> \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 122 | , name< NDNBOOST_MPL_PP_ENUM(i,::ndnboost::mpl::na) >* \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 123 | ); \ |
| 124 | /**/ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 125 | #elif !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300) |
| 126 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ |
| 127 | template< NDNBOOST_MPL_PP_PARAMS(i,typename T) > \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 128 | ::ndnboost::mpl::aux::yes_tag operator|( \ |
| 129 | ::ndnboost::mpl::aux::has_rebind_tag<int> \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 130 | , ::ndnboost::mpl::aux::has_rebind_tag< name<NDNBOOST_MPL_PP_PARAMS(i,T)> >* \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 131 | ); \ |
| 132 | /**/ |
| 133 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 134 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) /**/ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 135 | #endif |
| 136 | |
| 137 | # if !defined(__BORLANDC__) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 138 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \ |
| 139 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 140 | }; \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 141 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ |
| 142 | class NDNBOOST_PP_CAT(name,_rebind) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 143 | { \ |
| 144 | public: \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 145 | template< NDNBOOST_MPL_PP_PARAMS(i,typename U) > struct apply \ |
| 146 | : name< NDNBOOST_MPL_PP_PARAMS(i,U) > \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 147 | { \ |
| 148 | }; \ |
| 149 | /**/ |
| 150 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 151 | # define NDNBOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \ |
| 152 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 153 | }; \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 154 | NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ |
| 155 | class NDNBOOST_PP_CAT(name,_rebind) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 156 | { \ |
| 157 | public: \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 158 | template< NDNBOOST_MPL_PP_PARAMS(i,typename U) > struct apply \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 159 | { \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 160 | typedef typename name< NDNBOOST_MPL_PP_PARAMS(i,U) >::type type; \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 161 | }; \ |
| 162 | /**/ |
| 163 | # endif // __BORLANDC__ |
| 164 | |
| 165 | #endif // __EDG_VERSION__ |
| 166 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 167 | #endif // NDNBOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 168 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 169 | #endif // NDNBOOST_MPL_AUX_LAMBDA_SUPPORT_HPP_INCLUDED |