Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | ////////////////////////////////////////////////////////////////////////////// |
| 2 | // |
| 3 | // (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost |
| 4 | // Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // See http://www.boost.org/libs/intrusive for documentation. |
| 8 | // |
| 9 | ////////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | // sample.h |
| 12 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 13 | #if !defined(NDNBOOST_PP_IS_ITERATING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | #ifndef NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED |
| 16 | #define NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 17 | |
| 18 | #include <ndnboost/intrusive/detail/config_begin.hpp> |
| 19 | #include <ndnboost/intrusive/detail/workaround.hpp> |
| 20 | #include <ndnboost/intrusive/detail/preprocessor.hpp> |
| 21 | #include <ndnboost/intrusive/detail/mpl.hpp> |
| 22 | #include <ndnboost/static_assert.hpp> |
| 23 | #include <ndnboost/move/move.hpp> |
| 24 | |
| 25 | //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and |
| 26 | //wrong SFINAE for GCC 4.2/4.3 |
| 27 | #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 28 | #define NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED |
| 29 | #elif defined(NDNBOOST_INTEL) && (NDNBOOST_INTEL < 1200 ) |
| 30 | #define NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 31 | #endif |
| 32 | |
| 33 | namespace ndnboost_intrusive_has_member_function_callable_with { |
| 34 | |
| 35 | struct dont_care |
| 36 | { |
| 37 | dont_care(...); |
| 38 | }; |
| 39 | |
| 40 | struct private_type |
| 41 | { |
| 42 | static private_type p; |
| 43 | private_type const &operator,(int) const; |
| 44 | }; |
| 45 | |
| 46 | typedef char yes_type; // sizeof(yes_type) == 1 |
| 47 | struct no_type{ char dummy[2]; }; // sizeof(no_type) == 2 |
| 48 | |
| 49 | template<typename T> |
| 50 | no_type is_private_type(T const &); |
| 51 | yes_type is_private_type(private_type const &); |
| 52 | |
| 53 | } //boost_intrusive_has_member_function_callable_with |
| 54 | |
| 55 | #include <ndnboost/intrusive/detail/config_end.hpp> |
| 56 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 57 | #endif //NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 58 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 59 | #else //!NDNBOOST_PP_IS_ITERATING |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 60 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 61 | #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
| 62 | #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 63 | #endif |
| 64 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 65 | #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN |
| 66 | #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 67 | #endif |
| 68 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 69 | #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END |
| 70 | #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 71 | #endif |
| 72 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 73 | #if NDNBOOST_PP_ITERATION_START() != 0 |
| 74 | #error "NDNBOOST_PP_ITERATION_START() must be zero (0)" |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 75 | #endif |
| 76 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 77 | #if NDNBOOST_PP_ITERATION() == 0 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 78 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 79 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 80 | |
| 81 | template <typename Type> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 82 | class NDNBOOST_PP_CAT(has_member_function_named_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 83 | { |
| 84 | struct BaseMixin |
| 85 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 86 | void NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | struct Base : public ::ndnboost::intrusive::detail::remove_cv<Type>::type, public BaseMixin { Base(); }; |
| 90 | template <typename T, T t> class Helper{}; |
| 91 | |
| 92 | template <typename U> |
| 93 | static ndnboost_intrusive_has_member_function_callable_with::no_type deduce |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 94 | (U*, Helper<void (BaseMixin::*)(), &U::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME>* = 0); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 95 | static ndnboost_intrusive_has_member_function_callable_with::yes_type deduce(...); |
| 96 | |
| 97 | public: |
| 98 | static const bool value = |
| 99 | sizeof(ndnboost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0))); |
| 100 | }; |
| 101 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 102 | #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 103 | |
| 104 | template<typename Fun, bool HasFunc |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 105 | NDNBOOST_PP_ENUM_TRAILING(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> |
| 106 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 107 | //! |
| 108 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 109 | template<typename Fun NDNBOOST_PP_ENUM_TRAILING_PARAMS(NDNBOOST_PP_ITERATION_FINISH(), class P)> |
| 110 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) |
| 111 | <Fun, false NDNBOOST_PP_ENUM_TRAILING_PARAMS(NDNBOOST_PP_ITERATION_FINISH(), P)> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 112 | { |
| 113 | static const bool value = false; |
| 114 | }; |
| 115 | //! |
| 116 | |
| 117 | #if !defined(_MSC_VER) || (_MSC_VER < 1600) |
| 118 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 119 | #if defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 120 | |
| 121 | template<typename Fun> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 122 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
| 123 | <Fun, true NDNBOOST_PP_ENUM_TRAILING(NDNBOOST_PP_SUB(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_PP_ITERATION()), NDNBOOST_INTRUSIVE_PP_IDENTITY, void)> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 124 | { |
| 125 | //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and |
| 126 | //wrong SFINAE for GCC 4.2/4.3 |
| 127 | static const bool value = true; |
| 128 | }; |
| 129 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 130 | #else //defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 131 | |
| 132 | //Special case for 0 args |
| 133 | template< class F |
| 134 | , std::size_t N = |
| 135 | sizeof((ndnboost::move_detail::declval<F>(). |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 136 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> |
| 137 | struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 138 | { |
| 139 | ndnboost_intrusive_has_member_function_callable_with::yes_type dummy; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 140 | NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 141 | }; |
| 142 | |
| 143 | //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not |
| 144 | //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. |
| 145 | template<class F> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 146 | struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 147 | { |
| 148 | ndnboost_intrusive_has_member_function_callable_with::no_type dummy; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 149 | NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | template<typename Fun> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 153 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
| 154 | <Fun, true NDNBOOST_PP_ENUM_TRAILING(NDNBOOST_PP_SUB(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_PP_ITERATION()), NDNBOOST_INTRUSIVE_PP_IDENTITY, void)> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 155 | { |
| 156 | template<class U> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 157 | static NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U> |
| 158 | Test(NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 159 | |
| 160 | template <class U> |
| 161 | static ndnboost_intrusive_has_member_function_callable_with::no_type Test(...); |
| 162 | |
| 163 | static const bool value = sizeof(Test< Fun >(0)) |
| 164 | == sizeof(ndnboost_intrusive_has_member_function_callable_with::yes_type); |
| 165 | }; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 166 | #endif //defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 167 | |
| 168 | #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) |
| 169 | template<typename Fun> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 170 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
| 171 | <Fun, true NDNBOOST_PP_ENUM_TRAILING(NDNBOOST_PP_SUB(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_PP_ITERATION()), NDNBOOST_INTRUSIVE_PP_IDENTITY, void)> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 172 | { |
| 173 | template<class U> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 174 | static decltype( ndnboost::move_detail::declval<Fun>().NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 175 | , ndnboost_intrusive_has_member_function_callable_with::yes_type()) |
| 176 | Test(Fun*); |
| 177 | |
| 178 | template<class U> |
| 179 | static ndnboost_intrusive_has_member_function_callable_with::no_type Test(...); |
| 180 | |
| 181 | static const bool value = sizeof(Test<Fun>(0)) |
| 182 | == sizeof(ndnboost_intrusive_has_member_function_callable_with::yes_type); |
| 183 | }; |
| 184 | #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) |
| 185 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 186 | #else //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 187 | |
| 188 | template<typename Fun, bool HasFunc, class ...Args> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 189 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 190 | |
| 191 | template<typename Fun, class ...Args> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 192 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 193 | <Fun, false, Args...> |
| 194 | { |
| 195 | static const bool value = false; |
| 196 | }; |
| 197 | |
| 198 | //Special case for 0 args |
| 199 | template< class F |
| 200 | , std::size_t N = |
| 201 | sizeof((ndnboost::move_detail::declval<F>(). |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 202 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> |
| 203 | struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 204 | { |
| 205 | ndnboost_intrusive_has_member_function_callable_with::yes_type dummy; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 206 | NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 207 | }; |
| 208 | |
| 209 | //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not |
| 210 | //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. |
| 211 | template<class F> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 212 | struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 213 | { |
| 214 | ndnboost_intrusive_has_member_function_callable_with::no_type dummy; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 215 | NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 216 | }; |
| 217 | |
| 218 | template<typename Fun> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 219 | struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 220 | <Fun, true> |
| 221 | { |
| 222 | template<class U> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 223 | static NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
| 224 | <U> Test(NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 225 | |
| 226 | template <class U> |
| 227 | static ndnboost_intrusive_has_member_function_callable_with::no_type Test(...); |
| 228 | |
| 229 | static const bool value = sizeof(Test< Fun >(0)) |
| 230 | == sizeof(ndnboost_intrusive_has_member_function_callable_with::yes_type); |
| 231 | }; |
| 232 | |
| 233 | template<typename Fun, class ...DontCares> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 234 | struct NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 235 | : Fun |
| 236 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 237 | NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )(); |
| 238 | using Fun::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 239 | |
| 240 | ndnboost_intrusive_has_member_function_callable_with::private_type |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 241 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 242 | ( DontCares...) const; |
| 243 | }; |
| 244 | |
| 245 | template<typename Fun, class ...Args> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 246 | struct NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 247 | <Fun, true , Args...> |
| 248 | { |
| 249 | template<class T> |
| 250 | struct make_dontcare |
| 251 | { |
| 252 | typedef ndnboost_intrusive_has_member_function_callable_with::dont_care type; |
| 253 | }; |
| 254 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 255 | typedef NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 256 | <Fun, typename make_dontcare<Args>::type...> FunWrap; |
| 257 | |
| 258 | static bool const value = (sizeof(ndnboost_intrusive_has_member_function_callable_with::no_type) == |
| 259 | sizeof(ndnboost_intrusive_has_member_function_callable_with::is_private_type |
| 260 | ( (::ndnboost::move_detail::declval< FunWrap >(). |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 261 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 262 | ( ::ndnboost::move_detail::declval<Args>()... ), 0) ) |
| 263 | ) |
| 264 | ); |
| 265 | }; |
| 266 | |
| 267 | template<typename Fun, class ...Args> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 268 | struct NDNBOOST_PP_CAT( has_member_function_callable_with_ |
| 269 | , NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
| 270 | : public NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(has_member_function_callable_with_ |
| 271 | , NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 272 | < Fun |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 273 | , NDNBOOST_PP_CAT( has_member_function_named_ |
| 274 | , NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )<Fun>::value |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 275 | , Args... > |
| 276 | {}; |
| 277 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 278 | #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 279 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 280 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 281 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 282 | #else //NDNBOOST_PP_ITERATION() == 0 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 283 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 284 | #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 285 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 286 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 287 | |
| 288 | template<typename Fun> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 289 | struct NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(funwrap, NDNBOOST_PP_ITERATION()) |
| 290 | , NDNBOOST_PP_CAT(_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 291 | : Fun |
| 292 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 293 | NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(funwrap, NDNBOOST_PP_ITERATION()) |
| 294 | , NDNBOOST_PP_CAT(_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))(); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 295 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 296 | using Fun::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 297 | ndnboost_intrusive_has_member_function_callable_with::private_type |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 298 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
| 299 | ( NDNBOOST_PP_ENUM(NDNBOOST_PP_ITERATION() |
| 300 | , NDNBOOST_INTRUSIVE_PP_IDENTITY |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 301 | , ndnboost_intrusive_has_member_function_callable_with::dont_care)) const; |
| 302 | }; |
| 303 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 304 | template<typename Fun NDNBOOST_PP_ENUM_TRAILING_PARAMS(NDNBOOST_PP_ITERATION(), class P)> |
| 305 | struct NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(has_member_function_callable_with_ |
| 306 | , NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 307 | <Fun, true |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 308 | NDNBOOST_PP_ENUM_TRAILING_PARAMS(NDNBOOST_PP_ITERATION(), P) |
| 309 | NDNBOOST_PP_ENUM_TRAILING( NDNBOOST_PP_SUB(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_PP_ITERATION()) |
| 310 | , NDNBOOST_INTRUSIVE_PP_IDENTITY |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 311 | , void)> |
| 312 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 313 | typedef NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(funwrap, NDNBOOST_PP_ITERATION()) |
| 314 | , NDNBOOST_PP_CAT(_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))<Fun> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 315 | FunWrap; |
| 316 | static bool const value = |
| 317 | (sizeof(ndnboost_intrusive_has_member_function_callable_with::no_type) == |
| 318 | sizeof(ndnboost_intrusive_has_member_function_callable_with::is_private_type |
| 319 | ( (ndnboost::move_detail::declval<FunWrap>(). |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 320 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
| 321 | ( NDNBOOST_PP_ENUM( NDNBOOST_PP_ITERATION(), NDNBOOST_INTRUSIVE_PP_DECLVAL, _) ), 0 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 322 | ) |
| 323 | ) |
| 324 | ) |
| 325 | ); |
| 326 | }; |
| 327 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 328 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END |
| 329 | #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 330 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 331 | #endif //NDNBOOST_PP_ITERATION() == 0 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 332 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 333 | #if NDNBOOST_PP_ITERATION() == NDNBOOST_PP_ITERATION_FINISH() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 334 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 335 | #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 336 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 337 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 338 | |
| 339 | template<typename Fun |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 340 | NDNBOOST_PP_ENUM_TRAILING(NDNBOOST_PP_ITERATION_FINISH(), NDNBOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> |
| 341 | struct NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) |
| 342 | : public NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) |
| 343 | <Fun, NDNBOOST_PP_CAT(has_member_function_named_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<Fun>::value |
| 344 | NDNBOOST_PP_ENUM_TRAILING_PARAMS(NDNBOOST_PP_ITERATION_FINISH(), P) > |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 345 | {}; |
| 346 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 347 | NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 348 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 349 | #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 350 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 351 | #undef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME |
| 352 | #undef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN |
| 353 | #undef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 354 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 355 | #endif //#if NDNBOOST_PP_ITERATION() == NDNBOOST_PP_ITERATION_FINISH() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 356 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 357 | #endif //!NDNBOOST_PP_IS_ITERATING |