blob: 56da5b9b24a42f21ab757de88f021bc683f87748 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001//////////////////////////////////////////////////////////////////////////////
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 Thompson3d613fd2013-10-15 15:39:04 -070013#if !defined(NDNBOOST_PP_IS_ITERATING)
Jeff Thompsona28eed82013-08-22 16:21:10 -070014
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015 #ifndef NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
16 #define NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070017
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 Thompson3d613fd2013-10-15 15:39:04 -070028 #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 Thompsona28eed82013-08-22 16:21:10 -070031 #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 Thompson3d613fd2013-10-15 15:39:04 -070057 #endif //NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070058
Jeff Thompson3d613fd2013-10-15 15:39:04 -070059#else //!NDNBOOST_PP_IS_ITERATING
Jeff Thompsona28eed82013-08-22 16:21:10 -070060
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061 #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
62 #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!"
Jeff Thompsona28eed82013-08-22 16:21:10 -070063 #endif
64
Jeff Thompson3d613fd2013-10-15 15:39:04 -070065 #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
66 #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!"
Jeff Thompsona28eed82013-08-22 16:21:10 -070067 #endif
68
Jeff Thompson3d613fd2013-10-15 15:39:04 -070069 #ifndef NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
70 #error "NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!"
Jeff Thompsona28eed82013-08-22 16:21:10 -070071 #endif
72
Jeff Thompson3d613fd2013-10-15 15:39:04 -070073 #if NDNBOOST_PP_ITERATION_START() != 0
74 #error "NDNBOOST_PP_ITERATION_START() must be zero (0)"
Jeff Thompsona28eed82013-08-22 16:21:10 -070075 #endif
76
Jeff Thompson3d613fd2013-10-15 15:39:04 -070077 #if NDNBOOST_PP_ITERATION() == 0
Jeff Thompsona28eed82013-08-22 16:21:10 -070078
Jeff Thompson3d613fd2013-10-15 15:39:04 -070079 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
Jeff Thompsona28eed82013-08-22 16:21:10 -070080
81 template <typename Type>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070082 class NDNBOOST_PP_CAT(has_member_function_named_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
Jeff Thompsona28eed82013-08-22 16:21:10 -070083 {
84 struct BaseMixin
85 {
Jeff Thompson3d613fd2013-10-15 15:39:04 -070086 void NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME();
Jeff Thompsona28eed82013-08-22 16:21:10 -070087 };
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 Thompson3d613fd2013-10-15 15:39:04 -070094 (U*, Helper<void (BaseMixin::*)(), &U::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME>* = 0);
Jeff Thompsona28eed82013-08-22 16:21:10 -070095 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 Thompson3d613fd2013-10-15 15:39:04 -0700102 #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700103
104 template<typename Fun, bool HasFunc
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700105 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 Thompsona28eed82013-08-22 16:21:10 -0700107 //!
108
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700109 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 Thompsona28eed82013-08-22 16:21:10 -0700112 {
113 static const bool value = false;
114 };
115 //!
116
117 #if !defined(_MSC_VER) || (_MSC_VER < 1600)
118
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700119 #if defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700120
121 template<typename Fun>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700122 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 Thompsona28eed82013-08-22 16:21:10 -0700124 {
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 Thompson3d613fd2013-10-15 15:39:04 -0700130 #else //defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700131
132 //Special case for 0 args
133 template< class F
134 , std::size_t N =
135 sizeof((ndnboost::move_detail::declval<F>().
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700136 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 Thompsona28eed82013-08-22 16:21:10 -0700138 {
139 ndnboost_intrusive_has_member_function_callable_with::yes_type dummy;
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700140 NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
Jeff Thompsona28eed82013-08-22 16:21:10 -0700141 };
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 Thompson3d613fd2013-10-15 15:39:04 -0700146 struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0>
Jeff Thompsona28eed82013-08-22 16:21:10 -0700147 {
148 ndnboost_intrusive_has_member_function_callable_with::no_type dummy;
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700149 NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
Jeff Thompsona28eed82013-08-22 16:21:10 -0700150 };
151
152 template<typename Fun>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700153 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 Thompsona28eed82013-08-22 16:21:10 -0700155 {
156 template<class U>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700157 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 Thompsona28eed82013-08-22 16:21:10 -0700159
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 Thompson3d613fd2013-10-15 15:39:04 -0700166 #endif //defined(NDNBOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700167
168 #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600)
169 template<typename Fun>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700170 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 Thompsona28eed82013-08-22 16:21:10 -0700172 {
173 template<class U>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700174 static decltype( ndnboost::move_detail::declval<Fun>().NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME()
Jeff Thompsona28eed82013-08-22 16:21:10 -0700175 , 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 Thompson3d613fd2013-10-15 15:39:04 -0700186 #else //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700187
188 template<typename Fun, bool HasFunc, class ...Args>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700189 struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl);
Jeff Thompsona28eed82013-08-22 16:21:10 -0700190
191 template<typename Fun, class ...Args>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700192 struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700193 <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 Thompson3d613fd2013-10-15 15:39:04 -0700202 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 Thompsona28eed82013-08-22 16:21:10 -0700204 {
205 ndnboost_intrusive_has_member_function_callable_with::yes_type dummy;
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700206 NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
Jeff Thompsona28eed82013-08-22 16:21:10 -0700207 };
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 Thompson3d613fd2013-10-15 15:39:04 -0700212 struct NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0>
Jeff Thompsona28eed82013-08-22 16:21:10 -0700213 {
214 ndnboost_intrusive_has_member_function_callable_with::no_type dummy;
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700215 NDNBOOST_PP_CAT(zeroarg_checker_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int);
Jeff Thompsona28eed82013-08-22 16:21:10 -0700216 };
217
218 template<typename Fun>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700219 struct NDNBOOST_PP_CAT(NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700220 <Fun, true>
221 {
222 template<class U>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700223 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 Thompsona28eed82013-08-22 16:21:10 -0700225
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 Thompson3d613fd2013-10-15 15:39:04 -0700234 struct NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
Jeff Thompsona28eed82013-08-22 16:21:10 -0700235 : Fun
236 {
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700237 NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )();
238 using Fun::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
Jeff Thompsona28eed82013-08-22 16:21:10 -0700239
240 ndnboost_intrusive_has_member_function_callable_with::private_type
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700241 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
Jeff Thompsona28eed82013-08-22 16:21:10 -0700242 ( DontCares...) const;
243 };
244
245 template<typename Fun, class ...Args>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700246 struct NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(has_member_function_callable_with_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700247 <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 Thompson3d613fd2013-10-15 15:39:04 -0700255 typedef NDNBOOST_PP_CAT( funwrap_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )
Jeff Thompsona28eed82013-08-22 16:21:10 -0700256 <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 Thompson3d613fd2013-10-15 15:39:04 -0700261 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
Jeff Thompsona28eed82013-08-22 16:21:10 -0700262 ( ::ndnboost::move_detail::declval<Args>()... ), 0) )
263 )
264 );
265 };
266
267 template<typename Fun, class ...Args>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700268 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 Thompsona28eed82013-08-22 16:21:10 -0700272 < Fun
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700273 , NDNBOOST_PP_CAT( has_member_function_named_
274 , NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )<Fun>::value
Jeff Thompsona28eed82013-08-22 16:21:10 -0700275 , Args... >
276 {};
277
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700278 #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700279
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700280 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
Jeff Thompsona28eed82013-08-22 16:21:10 -0700281
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700282 #else //NDNBOOST_PP_ITERATION() == 0
Jeff Thompsona28eed82013-08-22 16:21:10 -0700283
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700284 #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700285
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700286 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
Jeff Thompsona28eed82013-08-22 16:21:10 -0700287
288 template<typename Fun>
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700289 struct NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(funwrap, NDNBOOST_PP_ITERATION())
290 , NDNBOOST_PP_CAT(_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))
Jeff Thompsona28eed82013-08-22 16:21:10 -0700291 : Fun
292 {
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700293 NDNBOOST_PP_CAT( NDNBOOST_PP_CAT(funwrap, NDNBOOST_PP_ITERATION())
294 , NDNBOOST_PP_CAT(_, NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))();
Jeff Thompsona28eed82013-08-22 16:21:10 -0700295
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700296 using Fun::NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME;
Jeff Thompsona28eed82013-08-22 16:21:10 -0700297 ndnboost_intrusive_has_member_function_callable_with::private_type
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700298 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
299 ( NDNBOOST_PP_ENUM(NDNBOOST_PP_ITERATION()
300 , NDNBOOST_INTRUSIVE_PP_IDENTITY
Jeff Thompsona28eed82013-08-22 16:21:10 -0700301 , ndnboost_intrusive_has_member_function_callable_with::dont_care)) const;
302 };
303
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700304 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 Thompsona28eed82013-08-22 16:21:10 -0700307 <Fun, true
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700308 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 Thompsona28eed82013-08-22 16:21:10 -0700311 , void)>
312 {
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700313 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 Thompsona28eed82013-08-22 16:21:10 -0700315 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 Thompson3d613fd2013-10-15 15:39:04 -0700320 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME
321 ( NDNBOOST_PP_ENUM( NDNBOOST_PP_ITERATION(), NDNBOOST_INTRUSIVE_PP_DECLVAL, _) ), 0
Jeff Thompsona28eed82013-08-22 16:21:10 -0700322 )
323 )
324 )
325 );
326 };
327
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700328 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
329 #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700330
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700331 #endif //NDNBOOST_PP_ITERATION() == 0
Jeff Thompsona28eed82013-08-22 16:21:10 -0700332
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700333 #if NDNBOOST_PP_ITERATION() == NDNBOOST_PP_ITERATION_FINISH()
Jeff Thompsona28eed82013-08-22 16:21:10 -0700334
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700335 #if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700336
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700337 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN
Jeff Thompsona28eed82013-08-22 16:21:10 -0700338
339 template<typename Fun
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700340 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 Thompsona28eed82013-08-22 16:21:10 -0700345 {};
346
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700347 NDNBOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END
Jeff Thompsona28eed82013-08-22 16:21:10 -0700348
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700349 #endif //#if !defined(NDNBOOST_INTRUSIVE_PERFECT_FORWARDING)
Jeff Thompsona28eed82013-08-22 16:21:10 -0700350
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700351 #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 Thompsona28eed82013-08-22 16:21:10 -0700354
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700355 #endif //#if NDNBOOST_PP_ITERATION() == NDNBOOST_PP_ITERATION_FINISH()
Jeff Thompsona28eed82013-08-22 16:21:10 -0700356
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700357#endif //!NDNBOOST_PP_IS_ITERATING