Chris@102
|
1 //////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
2 //
|
Chris@102
|
3 // (C) Copyright Ion Gaztanaga 2012-2012.
|
Chris@102
|
4 // Distributed under the Boost Software License, Version 1.0.
|
Chris@102
|
5 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
6 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
7 //
|
Chris@102
|
8 // See http://www.boost.org/libs/move for documentation.
|
Chris@102
|
9 //
|
Chris@102
|
10 //////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
11
|
Chris@102
|
12 //! \file
|
Chris@102
|
13
|
Chris@102
|
14 #ifndef BOOST_MOVE_UNIQUE_PTR_DETAIL_META_UTILS_HPP
|
Chris@102
|
15 #define BOOST_MOVE_UNIQUE_PTR_DETAIL_META_UTILS_HPP
|
Chris@102
|
16
|
Chris@102
|
17 #ifndef BOOST_CONFIG_HPP
|
Chris@102
|
18 # include <boost/config.hpp>
|
Chris@102
|
19 #endif
|
Chris@102
|
20 #
|
Chris@102
|
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@102
|
22 # pragma once
|
Chris@102
|
23 #endif
|
Chris@102
|
24
|
Chris@102
|
25 #include <cstddef> //for std::size_t
|
Chris@102
|
26
|
Chris@102
|
27 //Small meta-typetraits to support move
|
Chris@102
|
28
|
Chris@102
|
29 namespace boost {
|
Chris@102
|
30
|
Chris@102
|
31 namespace movelib {
|
Chris@102
|
32
|
Chris@102
|
33 template <class T>
|
Chris@102
|
34 struct default_delete;
|
Chris@102
|
35
|
Chris@102
|
36 } //namespace movelib {
|
Chris@102
|
37
|
Chris@102
|
38 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
Chris@102
|
39 //Forward declare boost::rv
|
Chris@102
|
40 template <class T> class rv;
|
Chris@102
|
41 #endif
|
Chris@102
|
42
|
Chris@102
|
43 namespace move_upmu {
|
Chris@102
|
44
|
Chris@102
|
45 //////////////////////////////////////
|
Chris@102
|
46 // nat
|
Chris@102
|
47 //////////////////////////////////////
|
Chris@102
|
48 struct nat{};
|
Chris@102
|
49
|
Chris@102
|
50 //////////////////////////////////////
|
Chris@102
|
51 // natify
|
Chris@102
|
52 //////////////////////////////////////
|
Chris@102
|
53 template <class T> struct natify{};
|
Chris@102
|
54
|
Chris@102
|
55 //////////////////////////////////////
|
Chris@102
|
56 // if_c
|
Chris@102
|
57 //////////////////////////////////////
|
Chris@102
|
58 template<bool C, typename T1, typename T2>
|
Chris@102
|
59 struct if_c
|
Chris@102
|
60 {
|
Chris@102
|
61 typedef T1 type;
|
Chris@102
|
62 };
|
Chris@102
|
63
|
Chris@102
|
64 template<typename T1, typename T2>
|
Chris@102
|
65 struct if_c<false,T1,T2>
|
Chris@102
|
66 {
|
Chris@102
|
67 typedef T2 type;
|
Chris@102
|
68 };
|
Chris@102
|
69
|
Chris@102
|
70 //////////////////////////////////////
|
Chris@102
|
71 // if_
|
Chris@102
|
72 //////////////////////////////////////
|
Chris@102
|
73 template<typename T1, typename T2, typename T3>
|
Chris@102
|
74 struct if_ : if_c<0 != T1::value, T2, T3>
|
Chris@102
|
75 {};
|
Chris@102
|
76
|
Chris@102
|
77 //enable_if_
|
Chris@102
|
78 template <bool B, class T = nat>
|
Chris@102
|
79 struct enable_if_c
|
Chris@102
|
80 {
|
Chris@102
|
81 typedef T type;
|
Chris@102
|
82 };
|
Chris@102
|
83
|
Chris@102
|
84 //////////////////////////////////////
|
Chris@102
|
85 // enable_if_c
|
Chris@102
|
86 //////////////////////////////////////
|
Chris@102
|
87 template <class T>
|
Chris@102
|
88 struct enable_if_c<false, T> {};
|
Chris@102
|
89
|
Chris@102
|
90 //////////////////////////////////////
|
Chris@102
|
91 // enable_if
|
Chris@102
|
92 //////////////////////////////////////
|
Chris@102
|
93 template <class Cond, class T = nat>
|
Chris@102
|
94 struct enable_if : public enable_if_c<Cond::value, T> {};
|
Chris@102
|
95
|
Chris@102
|
96 //////////////////////////////////////
|
Chris@102
|
97 // remove_reference
|
Chris@102
|
98 //////////////////////////////////////
|
Chris@102
|
99 template<class T>
|
Chris@102
|
100 struct remove_reference
|
Chris@102
|
101 {
|
Chris@102
|
102 typedef T type;
|
Chris@102
|
103 };
|
Chris@102
|
104
|
Chris@102
|
105 template<class T>
|
Chris@102
|
106 struct remove_reference<T&>
|
Chris@102
|
107 {
|
Chris@102
|
108 typedef T type;
|
Chris@102
|
109 };
|
Chris@102
|
110
|
Chris@102
|
111 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
Chris@102
|
112
|
Chris@102
|
113 template<class T>
|
Chris@102
|
114 struct remove_reference<T&&>
|
Chris@102
|
115 {
|
Chris@102
|
116 typedef T type;
|
Chris@102
|
117 };
|
Chris@102
|
118
|
Chris@102
|
119 #else
|
Chris@102
|
120
|
Chris@102
|
121 template<class T>
|
Chris@102
|
122 struct remove_reference< rv<T> >
|
Chris@102
|
123 {
|
Chris@102
|
124 typedef T type;
|
Chris@102
|
125 };
|
Chris@102
|
126
|
Chris@102
|
127 template<class T>
|
Chris@102
|
128 struct remove_reference< rv<T> &>
|
Chris@102
|
129 {
|
Chris@102
|
130 typedef T type;
|
Chris@102
|
131 };
|
Chris@102
|
132
|
Chris@102
|
133 template<class T>
|
Chris@102
|
134 struct remove_reference< const rv<T> &>
|
Chris@102
|
135 {
|
Chris@102
|
136 typedef T type;
|
Chris@102
|
137 };
|
Chris@102
|
138
|
Chris@102
|
139
|
Chris@102
|
140 #endif
|
Chris@102
|
141
|
Chris@102
|
142 //////////////////////////////////////
|
Chris@102
|
143 // remove_const
|
Chris@102
|
144 //////////////////////////////////////
|
Chris@102
|
145 template< class T >
|
Chris@102
|
146 struct remove_const
|
Chris@102
|
147 {
|
Chris@102
|
148 typedef T type;
|
Chris@102
|
149 };
|
Chris@102
|
150
|
Chris@102
|
151 template< class T >
|
Chris@102
|
152 struct remove_const<const T>
|
Chris@102
|
153 {
|
Chris@102
|
154 typedef T type;
|
Chris@102
|
155 };
|
Chris@102
|
156
|
Chris@102
|
157 //////////////////////////////////////
|
Chris@102
|
158 // remove_volatile
|
Chris@102
|
159 //////////////////////////////////////
|
Chris@102
|
160 template< class T >
|
Chris@102
|
161 struct remove_volatile
|
Chris@102
|
162 {
|
Chris@102
|
163 typedef T type;
|
Chris@102
|
164 };
|
Chris@102
|
165
|
Chris@102
|
166 template< class T >
|
Chris@102
|
167 struct remove_volatile<volatile T>
|
Chris@102
|
168 {
|
Chris@102
|
169 typedef T type;
|
Chris@102
|
170 };
|
Chris@102
|
171
|
Chris@102
|
172 //////////////////////////////////////
|
Chris@102
|
173 // remove_cv
|
Chris@102
|
174 //////////////////////////////////////
|
Chris@102
|
175 template< class T >
|
Chris@102
|
176 struct remove_cv
|
Chris@102
|
177 {
|
Chris@102
|
178 typedef typename remove_volatile
|
Chris@102
|
179 <typename remove_const<T>::type>::type type;
|
Chris@102
|
180 };
|
Chris@102
|
181
|
Chris@102
|
182 //////////////////////////////////////
|
Chris@102
|
183 // remove_extent
|
Chris@102
|
184 //////////////////////////////////////
|
Chris@102
|
185 template<class T>
|
Chris@102
|
186 struct remove_extent
|
Chris@102
|
187 {
|
Chris@102
|
188 typedef T type;
|
Chris@102
|
189 };
|
Chris@102
|
190
|
Chris@102
|
191 template<class T>
|
Chris@102
|
192 struct remove_extent<T[]>
|
Chris@102
|
193 {
|
Chris@102
|
194 typedef T type;
|
Chris@102
|
195 };
|
Chris@102
|
196
|
Chris@102
|
197 template<class T, std::size_t N>
|
Chris@102
|
198 struct remove_extent<T[N]>
|
Chris@102
|
199 {
|
Chris@102
|
200 typedef T type;
|
Chris@102
|
201 };
|
Chris@102
|
202
|
Chris@102
|
203 //////////////////////////////////////
|
Chris@102
|
204 // extent
|
Chris@102
|
205 //////////////////////////////////////
|
Chris@102
|
206
|
Chris@102
|
207 template<class T, unsigned N = 0>
|
Chris@102
|
208 struct extent
|
Chris@102
|
209 {
|
Chris@102
|
210 static const std::size_t value = 0;
|
Chris@102
|
211 };
|
Chris@102
|
212
|
Chris@102
|
213 template<class T>
|
Chris@102
|
214 struct extent<T[], 0>
|
Chris@102
|
215 {
|
Chris@102
|
216 static const std::size_t value = 0;
|
Chris@102
|
217 };
|
Chris@102
|
218
|
Chris@102
|
219 template<class T, unsigned N>
|
Chris@102
|
220 struct extent<T[], N>
|
Chris@102
|
221 {
|
Chris@102
|
222 static const std::size_t value = extent<T, N-1>::value;
|
Chris@102
|
223 };
|
Chris@102
|
224
|
Chris@102
|
225 template<class T, std::size_t N>
|
Chris@102
|
226 struct extent<T[N], 0>
|
Chris@102
|
227 {
|
Chris@102
|
228 static const std::size_t value = N;
|
Chris@102
|
229 };
|
Chris@102
|
230
|
Chris@102
|
231 template<class T, std::size_t I, unsigned N>
|
Chris@102
|
232 struct extent<T[I], N>
|
Chris@102
|
233 {
|
Chris@102
|
234 static const std::size_t value = extent<T, N-1>::value;
|
Chris@102
|
235 };
|
Chris@102
|
236
|
Chris@102
|
237 //////////////////////////////////////
|
Chris@102
|
238 // add_lvalue_reference
|
Chris@102
|
239 //////////////////////////////////////
|
Chris@102
|
240 template<class T>
|
Chris@102
|
241 struct add_lvalue_reference
|
Chris@102
|
242 {
|
Chris@102
|
243 typedef T& type;
|
Chris@102
|
244 };
|
Chris@102
|
245
|
Chris@102
|
246 template<class T>
|
Chris@102
|
247 struct add_lvalue_reference<T&>
|
Chris@102
|
248 {
|
Chris@102
|
249 typedef T& type;
|
Chris@102
|
250 };
|
Chris@102
|
251
|
Chris@102
|
252 template<>
|
Chris@102
|
253 struct add_lvalue_reference<void>
|
Chris@102
|
254 {
|
Chris@102
|
255 typedef void type;
|
Chris@102
|
256 };
|
Chris@102
|
257
|
Chris@102
|
258 template<>
|
Chris@102
|
259 struct add_lvalue_reference<const void>
|
Chris@102
|
260 {
|
Chris@102
|
261 typedef const void type;
|
Chris@102
|
262 };
|
Chris@102
|
263
|
Chris@102
|
264 template<>
|
Chris@102
|
265 struct add_lvalue_reference<volatile void>
|
Chris@102
|
266 {
|
Chris@102
|
267 typedef volatile void type;
|
Chris@102
|
268 };
|
Chris@102
|
269
|
Chris@102
|
270 template<>
|
Chris@102
|
271 struct add_lvalue_reference<const volatile void>
|
Chris@102
|
272 {
|
Chris@102
|
273 typedef const volatile void type;
|
Chris@102
|
274 };
|
Chris@102
|
275
|
Chris@102
|
276 template<class T>
|
Chris@102
|
277 struct add_const_lvalue_reference
|
Chris@102
|
278 {
|
Chris@102
|
279 typedef typename remove_reference<T>::type t_unreferenced;
|
Chris@102
|
280 typedef const t_unreferenced t_unreferenced_const;
|
Chris@102
|
281 typedef typename add_lvalue_reference
|
Chris@102
|
282 <t_unreferenced_const>::type type;
|
Chris@102
|
283 };
|
Chris@102
|
284
|
Chris@102
|
285 //////////////////////////////////////
|
Chris@102
|
286 // is_same
|
Chris@102
|
287 //////////////////////////////////////
|
Chris@102
|
288 template<class T, class U>
|
Chris@102
|
289 struct is_same
|
Chris@102
|
290 {
|
Chris@102
|
291 static const bool value = false;
|
Chris@102
|
292 };
|
Chris@102
|
293
|
Chris@102
|
294 template<class T>
|
Chris@102
|
295 struct is_same<T, T>
|
Chris@102
|
296 {
|
Chris@102
|
297 static const bool value = true;
|
Chris@102
|
298 };
|
Chris@102
|
299
|
Chris@102
|
300 //////////////////////////////////////
|
Chris@102
|
301 // is_pointer
|
Chris@102
|
302 //////////////////////////////////////
|
Chris@102
|
303 template< class T >
|
Chris@102
|
304 struct is_pointer
|
Chris@102
|
305 {
|
Chris@102
|
306 static const bool value = false;
|
Chris@102
|
307 };
|
Chris@102
|
308
|
Chris@102
|
309 template< class T >
|
Chris@102
|
310 struct is_pointer<T*>
|
Chris@102
|
311 {
|
Chris@102
|
312 static const bool value = true;
|
Chris@102
|
313 };
|
Chris@102
|
314
|
Chris@102
|
315 //////////////////////////////////////
|
Chris@102
|
316 // is_reference
|
Chris@102
|
317 //////////////////////////////////////
|
Chris@102
|
318 template< class T >
|
Chris@102
|
319 struct is_reference
|
Chris@102
|
320 {
|
Chris@102
|
321 static const bool value = false;
|
Chris@102
|
322 };
|
Chris@102
|
323
|
Chris@102
|
324 template< class T >
|
Chris@102
|
325 struct is_reference<T&>
|
Chris@102
|
326 {
|
Chris@102
|
327 static const bool value = true;
|
Chris@102
|
328 };
|
Chris@102
|
329
|
Chris@102
|
330 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
Chris@102
|
331
|
Chris@102
|
332 template< class T >
|
Chris@102
|
333 struct is_reference<T&&>
|
Chris@102
|
334 {
|
Chris@102
|
335 static const bool value = true;
|
Chris@102
|
336 };
|
Chris@102
|
337
|
Chris@102
|
338 #endif
|
Chris@102
|
339
|
Chris@102
|
340 //////////////////////////////////////
|
Chris@102
|
341 // is_lvalue_reference
|
Chris@102
|
342 //////////////////////////////////////
|
Chris@102
|
343 template<class T>
|
Chris@102
|
344 struct is_lvalue_reference
|
Chris@102
|
345 {
|
Chris@102
|
346 static const bool value = false;
|
Chris@102
|
347 };
|
Chris@102
|
348
|
Chris@102
|
349 template<class T>
|
Chris@102
|
350 struct is_lvalue_reference<T&>
|
Chris@102
|
351 {
|
Chris@102
|
352 static const bool value = true;
|
Chris@102
|
353 };
|
Chris@102
|
354
|
Chris@102
|
355 //////////////////////////////////////
|
Chris@102
|
356 // is_array
|
Chris@102
|
357 //////////////////////////////////////
|
Chris@102
|
358 template<class T>
|
Chris@102
|
359 struct is_array
|
Chris@102
|
360 {
|
Chris@102
|
361 static const bool value = false;
|
Chris@102
|
362 };
|
Chris@102
|
363
|
Chris@102
|
364 template<class T>
|
Chris@102
|
365 struct is_array<T[]>
|
Chris@102
|
366 {
|
Chris@102
|
367 static const bool value = true;
|
Chris@102
|
368 };
|
Chris@102
|
369
|
Chris@102
|
370 template<class T, std::size_t N>
|
Chris@102
|
371 struct is_array<T[N]>
|
Chris@102
|
372 {
|
Chris@102
|
373 static const bool value = true;
|
Chris@102
|
374 };
|
Chris@102
|
375
|
Chris@102
|
376 //////////////////////////////////////
|
Chris@102
|
377 // has_pointer_type
|
Chris@102
|
378 //////////////////////////////////////
|
Chris@102
|
379 template <class T>
|
Chris@102
|
380 struct has_pointer_type
|
Chris@102
|
381 {
|
Chris@102
|
382 struct two { char c[2]; };
|
Chris@102
|
383 template <class U> static two test(...);
|
Chris@102
|
384 template <class U> static char test(typename U::pointer* = 0);
|
Chris@102
|
385 static const bool value = sizeof(test<T>(0)) == 1;
|
Chris@102
|
386 };
|
Chris@102
|
387
|
Chris@102
|
388 //////////////////////////////////////
|
Chris@102
|
389 // pointer_type
|
Chris@102
|
390 //////////////////////////////////////
|
Chris@102
|
391 template <class T, class D, bool = has_pointer_type<D>::value>
|
Chris@102
|
392 struct pointer_type_imp
|
Chris@102
|
393 {
|
Chris@102
|
394 typedef typename D::pointer type;
|
Chris@102
|
395 };
|
Chris@102
|
396
|
Chris@102
|
397 template <class T, class D>
|
Chris@102
|
398 struct pointer_type_imp<T, D, false>
|
Chris@102
|
399 {
|
Chris@102
|
400 typedef typename remove_extent<T>::type* type;
|
Chris@102
|
401 };
|
Chris@102
|
402
|
Chris@102
|
403 template <class T, class D>
|
Chris@102
|
404 struct pointer_type
|
Chris@102
|
405 {
|
Chris@102
|
406 typedef typename pointer_type_imp
|
Chris@102
|
407 <typename remove_extent<T>::type, typename remove_reference<D>::type>::type type;
|
Chris@102
|
408 };
|
Chris@102
|
409
|
Chris@102
|
410 //////////////////////////////////////
|
Chris@102
|
411 // is_convertible
|
Chris@102
|
412 //////////////////////////////////////
|
Chris@102
|
413 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
Chris@102
|
414
|
Chris@102
|
415 //use intrinsic since in MSVC
|
Chris@102
|
416 //overaligned types can't go through ellipsis
|
Chris@102
|
417 template <class T, class U>
|
Chris@102
|
418 struct is_convertible
|
Chris@102
|
419 {
|
Chris@102
|
420 static const bool value = __is_convertible_to(T, U);
|
Chris@102
|
421 };
|
Chris@102
|
422
|
Chris@102
|
423 #else
|
Chris@102
|
424
|
Chris@102
|
425 template <class T, class U>
|
Chris@102
|
426 class is_convertible
|
Chris@102
|
427 {
|
Chris@102
|
428 typedef typename add_lvalue_reference<T>::type t_reference;
|
Chris@102
|
429 typedef char true_t;
|
Chris@102
|
430 class false_t { char dummy[2]; };
|
Chris@102
|
431 static false_t dispatch(...);
|
Chris@102
|
432 static true_t dispatch(U);
|
Chris@102
|
433 static t_reference trigger();
|
Chris@102
|
434 public:
|
Chris@102
|
435 static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
|
Chris@102
|
436 };
|
Chris@102
|
437
|
Chris@102
|
438 #endif
|
Chris@102
|
439
|
Chris@102
|
440 //////////////////////////////////////
|
Chris@102
|
441 // is_unary_function
|
Chris@102
|
442 //////////////////////////////////////
|
Chris@102
|
443 #if defined(BOOST_MSVC) || defined(__BORLANDC_)
|
Chris@102
|
444 #define BOOST_MOVE_TT_DECL __cdecl
|
Chris@102
|
445 #else
|
Chris@102
|
446 #define BOOST_MOVE_TT_DECL
|
Chris@102
|
447 #endif
|
Chris@102
|
448
|
Chris@102
|
449 #if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
|
Chris@102
|
450 #define BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
Chris@102
|
451 #endif
|
Chris@102
|
452
|
Chris@102
|
453 template <typename T>
|
Chris@102
|
454 struct is_unary_function_impl
|
Chris@102
|
455 { static const bool value = false; };
|
Chris@102
|
456
|
Chris@102
|
457 // avoid duplicate definitions of is_unary_function_impl
|
Chris@102
|
458 #ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
Chris@102
|
459
|
Chris@102
|
460 template <typename R>
|
Chris@102
|
461 struct is_unary_function_impl<R (*)()>
|
Chris@102
|
462 { static const bool value = true; };
|
Chris@102
|
463
|
Chris@102
|
464 template <typename R>
|
Chris@102
|
465 struct is_unary_function_impl<R (*)(...)>
|
Chris@102
|
466 { static const bool value = true; };
|
Chris@102
|
467
|
Chris@102
|
468 #else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
Chris@102
|
469
|
Chris@102
|
470 template <typename R>
|
Chris@102
|
471 struct is_unary_function_impl<R (__stdcall*)()>
|
Chris@102
|
472 { static const bool value = true; };
|
Chris@102
|
473
|
Chris@102
|
474 #ifndef _MANAGED
|
Chris@102
|
475
|
Chris@102
|
476 template <typename R>
|
Chris@102
|
477 struct is_unary_function_impl<R (__fastcall*)()>
|
Chris@102
|
478 { static const bool value = true; };
|
Chris@102
|
479
|
Chris@102
|
480 #endif
|
Chris@102
|
481
|
Chris@102
|
482 template <typename R>
|
Chris@102
|
483 struct is_unary_function_impl<R (__cdecl*)()>
|
Chris@102
|
484 { static const bool value = true; };
|
Chris@102
|
485
|
Chris@102
|
486 template <typename R>
|
Chris@102
|
487 struct is_unary_function_impl<R (__cdecl*)(...)>
|
Chris@102
|
488 { static const bool value = true; };
|
Chris@102
|
489
|
Chris@102
|
490 #endif
|
Chris@102
|
491
|
Chris@102
|
492 // avoid duplicate definitions of is_unary_function_impl
|
Chris@102
|
493 #ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
Chris@102
|
494
|
Chris@102
|
495 template <typename R, class T0>
|
Chris@102
|
496 struct is_unary_function_impl<R (*)(T0)>
|
Chris@102
|
497 { static const bool value = true; };
|
Chris@102
|
498
|
Chris@102
|
499 template <typename R, class T0>
|
Chris@102
|
500 struct is_unary_function_impl<R (*)(T0...)>
|
Chris@102
|
501 { static const bool value = true; };
|
Chris@102
|
502
|
Chris@102
|
503 #else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
Chris@102
|
504
|
Chris@102
|
505 template <typename R, class T0>
|
Chris@102
|
506 struct is_unary_function_impl<R (__stdcall*)(T0)>
|
Chris@102
|
507 { static const bool value = true; };
|
Chris@102
|
508
|
Chris@102
|
509 #ifndef _MANAGED
|
Chris@102
|
510
|
Chris@102
|
511 template <typename R, class T0>
|
Chris@102
|
512 struct is_unary_function_impl<R (__fastcall*)(T0)>
|
Chris@102
|
513 { static const bool value = true; };
|
Chris@102
|
514
|
Chris@102
|
515 #endif
|
Chris@102
|
516
|
Chris@102
|
517 template <typename R, class T0>
|
Chris@102
|
518 struct is_unary_function_impl<R (__cdecl*)(T0)>
|
Chris@102
|
519 { static const bool value = true; };
|
Chris@102
|
520
|
Chris@102
|
521 template <typename R, class T0>
|
Chris@102
|
522 struct is_unary_function_impl<R (__cdecl*)(T0...)>
|
Chris@102
|
523 { static const bool value = true; };
|
Chris@102
|
524
|
Chris@102
|
525 #endif
|
Chris@102
|
526
|
Chris@102
|
527 template <typename T>
|
Chris@102
|
528 struct is_unary_function_impl<T&>
|
Chris@102
|
529 { static const bool value = false; };
|
Chris@102
|
530
|
Chris@102
|
531 template<typename T>
|
Chris@102
|
532 struct is_unary_function
|
Chris@102
|
533 { static const bool value = is_unary_function_impl<T>::value; };
|
Chris@102
|
534
|
Chris@102
|
535 //////////////////////////////////////
|
Chris@102
|
536 // has_virtual_destructor
|
Chris@102
|
537 //////////////////////////////////////
|
Chris@102
|
538 #if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\
|
Chris@102
|
539 || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500))
|
Chris@102
|
540 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
Chris@102
|
541 #elif defined(BOOST_CLANG) && defined(__has_feature)
|
Chris@102
|
542 # if __has_feature(has_virtual_destructor)
|
Chris@102
|
543 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
Chris@102
|
544 # endif
|
Chris@102
|
545 #elif defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
|
Chris@102
|
546 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
Chris@102
|
547 #elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
|
Chris@102
|
548 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
Chris@102
|
549 #elif defined(__CODEGEARC__)
|
Chris@102
|
550 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
Chris@102
|
551 #endif
|
Chris@102
|
552
|
Chris@102
|
553 #ifdef BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR
|
Chris@102
|
554 template<class T>
|
Chris@102
|
555 struct has_virtual_destructor{ static const bool value = BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T); };
|
Chris@102
|
556 #else
|
Chris@102
|
557 //If no intrinsic is available you trust the programmer knows what is doing
|
Chris@102
|
558 template<class T>
|
Chris@102
|
559 struct has_virtual_destructor{ static const bool value = true; };
|
Chris@102
|
560 #endif
|
Chris@102
|
561
|
Chris@102
|
562 //////////////////////////////////////
|
Chris@102
|
563 // missing_virtual_destructor
|
Chris@102
|
564 //////////////////////////////////////
|
Chris@102
|
565
|
Chris@102
|
566 template< class T, class U
|
Chris@102
|
567 , bool enable = is_convertible< U*, T*>::value &&
|
Chris@102
|
568 !is_array<T>::value &&
|
Chris@102
|
569 !is_same<typename remove_cv<T>::type, void>::value &&
|
Chris@102
|
570 !is_same<typename remove_cv<U>::type, typename remove_cv<T>::type>::value
|
Chris@102
|
571 >
|
Chris@102
|
572 struct missing_virtual_destructor_default_delete
|
Chris@102
|
573 { static const bool value = !has_virtual_destructor<T>::value; };
|
Chris@102
|
574
|
Chris@102
|
575 template<class T, class U>
|
Chris@102
|
576 struct missing_virtual_destructor_default_delete<T, U, false>
|
Chris@102
|
577 { static const bool value = false; };
|
Chris@102
|
578
|
Chris@102
|
579 template<class Deleter, class U>
|
Chris@102
|
580 struct missing_virtual_destructor
|
Chris@102
|
581 { static const bool value = false; };
|
Chris@102
|
582
|
Chris@102
|
583 template<class T, class U>
|
Chris@102
|
584 struct missing_virtual_destructor< ::boost::movelib::default_delete<T>, U >
|
Chris@102
|
585 : missing_virtual_destructor_default_delete<T, U>
|
Chris@102
|
586 {};
|
Chris@102
|
587
|
Chris@102
|
588 } //namespace move_upmu {
|
Chris@102
|
589 } //namespace boost {
|
Chris@102
|
590
|
Chris@102
|
591 #endif //#ifndef BOOST_MOVE_UNIQUE_PTR_DETAIL_META_UTILS_HPP
|