2 //===------------------------ type_traits ---------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_TYPE_TRAITS
12 #define _LIBCPP_TYPE_TRAITS
21 template <class T, T v> struct integral_constant;
22 typedef integral_constant<bool, true> true_type;
23 typedef integral_constant<bool, false> false_type;
26 template <bool, class T = void> struct enable_if;
27 template <bool, class T, class F> struct conditional;
29 // Primary classification traits:
30 template <class T> struct is_void;
31 template <class T> struct is_integral;
32 template <class T> struct is_floating_point;
33 template <class T> struct is_array;
34 template <class T> struct is_pointer;
35 template <class T> struct is_lvalue_reference;
36 template <class T> struct is_rvalue_reference;
37 template <class T> struct is_member_object_pointer;
38 template <class T> struct is_member_function_pointer;
39 template <class T> struct is_enum;
40 template <class T> struct is_union;
41 template <class T> struct is_class;
42 template <class T> struct is_function;
44 // Secondary classification traits:
45 template <class T> struct is_reference;
46 template <class T> struct is_arithmetic;
47 template <class T> struct is_fundamental;
48 template <class T> struct is_member_pointer;
49 template <class T> struct is_scalar;
50 template <class T> struct is_object;
51 template <class T> struct is_compound;
53 // Const-volatile properties and transformations:
54 template <class T> struct is_const;
55 template <class T> struct is_volatile;
56 template <class T> struct remove_const;
57 template <class T> struct remove_volatile;
58 template <class T> struct remove_cv;
59 template <class T> struct add_const;
60 template <class T> struct add_volatile;
61 template <class T> struct add_cv;
63 // Reference transformations:
64 template <class T> struct remove_reference;
65 template <class T> struct add_lvalue_reference;
66 template <class T> struct add_rvalue_reference;
68 // Pointer transformations:
69 template <class T> struct remove_pointer;
70 template <class T> struct add_pointer;
72 // Integral properties:
73 template <class T> struct is_signed;
74 template <class T> struct is_unsigned;
75 template <class T> struct make_signed;
76 template <class T> struct make_unsigned;
78 // Array properties and transformations:
79 template <class T> struct rank;
80 template <class T, unsigned I = 0> struct extent;
81 template <class T> struct remove_extent;
82 template <class T> struct remove_all_extents;
84 // Member introspection:
85 template <class T> struct is_pod;
86 template <class T> struct is_trivial;
87 template <class T> struct is_trivially_copyable;
88 template <class T> struct is_standard_layout;
89 template <class T> struct is_literal_type;
90 template <class T> struct is_empty;
91 template <class T> struct is_polymorphic;
92 template <class T> struct is_abstract;
94 template <class T, class... Args> struct is_constructible;
95 template <class T> struct is_default_constructible;
96 template <class T> struct is_copy_constructible;
97 template <class T> struct is_move_constructible;
98 template <class T, class U> struct is_assignable;
99 template <class T> struct is_copy_assignable;
100 template <class T> struct is_move_assignable;
101 template <class T> struct is_destructible;
103 template <class T, class... Args> struct is_trivially_constructible;
104 template <class T> struct is_trivially_default_constructible;
105 template <class T> struct is_trivially_copy_constructible;
106 template <class T> struct is_trivially_move_constructible;
107 template <class T, class U> struct is_trivially_assignable;
108 template <class T> struct is_trivially_copy_assignable;
109 template <class T> struct is_trivially_move_assignable;
110 template <class T> struct is_trivially_destructible;
112 template <class T, class... Args> struct is_nothrow_constructible;
113 template <class T> struct is_nothrow_default_constructible;
114 template <class T> struct is_nothrow_copy_constructible;
115 template <class T> struct is_nothrow_move_constructible;
116 template <class T, class U> struct is_nothrow_assignable;
117 template <class T> struct is_nothrow_copy_assignable;
118 template <class T> struct is_nothrow_move_assignable;
119 template <class T> struct is_nothrow_destructible;
121 template <class T> struct has_virtual_destructor;
123 // Relationships between types:
124 template <class T, class U> struct is_same;
125 template <class Base, class Derived> struct is_base_of;
126 template <class From, class To> struct is_convertible;
128 // Alignment properties and transformations:
129 template <class T> struct alignment_of;
130 template <size_t Len, size_t Align = most_stringent_alignment_requirement>
131 struct aligned_storage;
133 template <class T> struct decay;
134 template <class... T> struct common_type;
135 template <class T> struct underlying_type;
136 template <class> class result_of; // undefined
137 template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>;
145 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
146 #pragma GCC system_header
149 _LIBCPP_BEGIN_NAMESPACE_STD
151 template <bool _Bp, class _If, class _Then>
152 struct _LIBCPP_VISIBLE conditional {typedef _If type;};
153 template <class _If, class _Then>
154 struct _LIBCPP_VISIBLE conditional<false, _If, _Then> {typedef _Then type;};
156 template <bool, class _Tp = void> struct _LIBCPP_VISIBLE enable_if {};
157 template <class _Tp> struct _LIBCPP_VISIBLE enable_if<true, _Tp> {typedef _Tp type;};
159 struct __two {char _[2];};
163 template <class _Tp, _Tp __v>
164 struct _LIBCPP_VISIBLE integral_constant
166 static _LIBCPP_CONSTEXPR const _Tp value = __v;
167 typedef _Tp value_type;
168 typedef integral_constant type;
169 _LIBCPP_INLINE_VISIBILITY
170 _LIBCPP_CONSTEXPR operator value_type() const {return value;}
173 template <class _Tp, _Tp __v>
174 _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
176 typedef integral_constant<bool, true> true_type;
177 typedef integral_constant<bool, false> false_type;
181 template <class _Tp> struct _LIBCPP_VISIBLE is_const : public false_type {};
182 template <class _Tp> struct _LIBCPP_VISIBLE is_const<_Tp const> : public true_type {};
186 template <class _Tp> struct _LIBCPP_VISIBLE is_volatile : public false_type {};
187 template <class _Tp> struct _LIBCPP_VISIBLE is_volatile<_Tp volatile> : public true_type {};
191 template <class _Tp> struct _LIBCPP_VISIBLE remove_const {typedef _Tp type;};
192 template <class _Tp> struct _LIBCPP_VISIBLE remove_const<const _Tp> {typedef _Tp type;};
196 template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile {typedef _Tp type;};
197 template <class _Tp> struct _LIBCPP_VISIBLE remove_volatile<volatile _Tp> {typedef _Tp type;};
201 template <class _Tp> struct _LIBCPP_VISIBLE remove_cv
202 {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
206 template <class _Tp> struct __is_void : public false_type {};
207 template <> struct __is_void<void> : public true_type {};
209 template <class _Tp> struct _LIBCPP_VISIBLE is_void
210 : public __is_void<typename remove_cv<_Tp>::type> {};
214 template <class _Tp> struct ____is_nullptr_t : public false_type {};
215 template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
217 template <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t
218 : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
222 template <class _Tp> struct __is_integral : public false_type {};
223 template <> struct __is_integral<bool> : public true_type {};
224 template <> struct __is_integral<char> : public true_type {};
225 template <> struct __is_integral<signed char> : public true_type {};
226 template <> struct __is_integral<unsigned char> : public true_type {};
227 template <> struct __is_integral<wchar_t> : public true_type {};
228 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
229 template <> struct __is_integral<char16_t> : public true_type {};
230 template <> struct __is_integral<char32_t> : public true_type {};
231 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
232 template <> struct __is_integral<short> : public true_type {};
233 template <> struct __is_integral<unsigned short> : public true_type {};
234 template <> struct __is_integral<int> : public true_type {};
235 template <> struct __is_integral<unsigned int> : public true_type {};
236 template <> struct __is_integral<long> : public true_type {};
237 template <> struct __is_integral<unsigned long> : public true_type {};
238 template <> struct __is_integral<long long> : public true_type {};
239 template <> struct __is_integral<unsigned long long> : public true_type {};
241 template <class _Tp> struct _LIBCPP_VISIBLE is_integral
242 : public __is_integral<typename remove_cv<_Tp>::type> {};
246 template <class _Tp> struct __is_floating_point : public false_type {};
247 template <> struct __is_floating_point<float> : public true_type {};
248 template <> struct __is_floating_point<double> : public true_type {};
249 template <> struct __is_floating_point<long double> : public true_type {};
251 template <class _Tp> struct _LIBCPP_VISIBLE is_floating_point
252 : public __is_floating_point<typename remove_cv<_Tp>::type> {};
256 template <class _Tp> struct _LIBCPP_VISIBLE is_array
257 : public false_type {};
258 template <class _Tp> struct _LIBCPP_VISIBLE is_array<_Tp[]>
259 : public true_type {};
260 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE is_array<_Tp[_Np]>
261 : public true_type {};
265 template <class _Tp> struct __is_pointer : public false_type {};
266 template <class _Tp> struct __is_pointer<_Tp*> : public true_type {};
268 template <class _Tp> struct _LIBCPP_VISIBLE is_pointer
269 : public __is_pointer<typename remove_cv<_Tp>::type> {};
273 template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference : public false_type {};
274 template <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference<_Tp&> : public true_type {};
276 template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference : public false_type {};
277 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
278 template <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference<_Tp&&> : public true_type {};
281 template <class _Tp> struct _LIBCPP_VISIBLE is_reference : public false_type {};
282 template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&> : public true_type {};
283 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
284 template <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&&> : public true_type {};
287 #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
288 #define _LIBCPP_HAS_TYPE_TRAITS
293 #if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
295 template <class _Tp> struct _LIBCPP_VISIBLE is_union
296 : public integral_constant<bool, __is_union(_Tp)> {};
300 template <class _Tp> struct __libcpp_union : public false_type {};
301 template <class _Tp> struct _LIBCPP_VISIBLE is_union
302 : public __libcpp_union<typename remove_cv<_Tp>::type> {};
308 #if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
310 template <class _Tp> struct _LIBCPP_VISIBLE is_class
311 : public integral_constant<bool, __is_class(_Tp)> {};
315 namespace __is_class_imp
317 template <class _Tp> char __test(int _Tp::*);
318 template <class _Tp> __two __test(...);
321 template <class _Tp> struct _LIBCPP_VISIBLE is_class
322 : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {};
328 template <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same : public false_type {};
329 template <class _Tp> struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {};
333 namespace __is_function_imp
335 template <class _Tp> char __test(_Tp*);
336 template <class _Tp> __two __test(...);
337 template <class _Tp> _Tp& __source();
340 template <class _Tp, bool = is_class<_Tp>::value ||
341 is_union<_Tp>::value ||
342 is_void<_Tp>::value ||
343 is_reference<_Tp>::value ||
344 is_same<_Tp, nullptr_t>::value >
346 : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1>
348 template <class _Tp> struct __is_function<_Tp, true> : public false_type {};
350 template <class _Tp> struct _LIBCPP_VISIBLE is_function
351 : public __is_function<_Tp> {};
353 // is_member_function_pointer
355 template <class _Tp> struct __is_member_function_pointer : public false_type {};
356 template <class _Tp, class _Up> struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
358 template <class _Tp> struct _LIBCPP_VISIBLE is_member_function_pointer
359 : public __is_member_function_pointer<typename remove_cv<_Tp>::type> {};
363 template <class _Tp> struct __is_member_pointer : public false_type {};
364 template <class _Tp, class _Up> struct __is_member_pointer<_Tp _Up::*> : public true_type {};
366 template <class _Tp> struct _LIBCPP_VISIBLE is_member_pointer
367 : public __is_member_pointer<typename remove_cv<_Tp>::type> {};
369 // is_member_object_pointer
371 template <class _Tp> struct _LIBCPP_VISIBLE is_member_object_pointer
372 : public integral_constant<bool, is_member_pointer<_Tp>::value &&
373 !is_member_function_pointer<_Tp>::value> {};
377 #if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
379 template <class _Tp> struct _LIBCPP_VISIBLE is_enum
380 : public integral_constant<bool, __is_enum(_Tp)> {};
384 template <class _Tp> struct _LIBCPP_VISIBLE is_enum
385 : public integral_constant<bool, !is_void<_Tp>::value &&
386 !is_integral<_Tp>::value &&
387 !is_floating_point<_Tp>::value &&
388 !is_array<_Tp>::value &&
389 !is_pointer<_Tp>::value &&
390 !is_reference<_Tp>::value &&
391 !is_member_pointer<_Tp>::value &&
392 !is_union<_Tp>::value &&
393 !is_class<_Tp>::value &&
394 !is_function<_Tp>::value > {};
400 template <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic
401 : public integral_constant<bool, is_integral<_Tp>::value ||
402 is_floating_point<_Tp>::value> {};
406 template <class _Tp> struct _LIBCPP_VISIBLE is_fundamental
407 : public integral_constant<bool, is_void<_Tp>::value ||
408 __is_nullptr_t<_Tp>::value ||
409 is_arithmetic<_Tp>::value> {};
413 template <class _Tp> struct _LIBCPP_VISIBLE is_scalar
414 : public integral_constant<bool, is_arithmetic<_Tp>::value ||
415 is_member_pointer<_Tp>::value ||
416 is_pointer<_Tp>::value ||
417 __is_nullptr_t<_Tp>::value ||
418 is_enum<_Tp>::value > {};
420 template <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {};
424 template <class _Tp> struct _LIBCPP_VISIBLE is_object
425 : public integral_constant<bool, is_scalar<_Tp>::value ||
426 is_array<_Tp>::value ||
427 is_union<_Tp>::value ||
428 is_class<_Tp>::value > {};
432 template <class _Tp> struct _LIBCPP_VISIBLE is_compound
433 : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
437 template <class _Tp, bool = is_reference<_Tp>::value ||
438 is_function<_Tp>::value ||
439 is_const<_Tp>::value >
440 struct __add_const {typedef _Tp type;};
443 struct __add_const<_Tp, false> {typedef const _Tp type;};
445 template <class _Tp> struct _LIBCPP_VISIBLE add_const
446 {typedef typename __add_const<_Tp>::type type;};
450 template <class _Tp, bool = is_reference<_Tp>::value ||
451 is_function<_Tp>::value ||
452 is_volatile<_Tp>::value >
453 struct __add_volatile {typedef _Tp type;};
456 struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
458 template <class _Tp> struct _LIBCPP_VISIBLE add_volatile
459 {typedef typename __add_volatile<_Tp>::type type;};
463 template <class _Tp> struct _LIBCPP_VISIBLE add_cv
464 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};
468 template <class _Tp> struct _LIBCPP_VISIBLE remove_reference {typedef _Tp type;};
469 template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&> {typedef _Tp type;};
470 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
471 template <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&&> {typedef _Tp type;};
474 // add_lvalue_reference
476 template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef _Tp& type;};
477 template <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler
478 template <> struct _LIBCPP_VISIBLE add_lvalue_reference<void> {typedef void type;};
479 template <> struct _LIBCPP_VISIBLE add_lvalue_reference<const void> {typedef const void type;};
480 template <> struct _LIBCPP_VISIBLE add_lvalue_reference<volatile void> {typedef volatile void type;};
481 template <> struct _LIBCPP_VISIBLE add_lvalue_reference<const volatile void> {typedef const volatile void type;};
483 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
485 template <class _Tp> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef _Tp&& type;};
486 template <> struct _LIBCPP_VISIBLE add_rvalue_reference<void> {typedef void type;};
487 template <> struct _LIBCPP_VISIBLE add_rvalue_reference<const void> {typedef const void type;};
488 template <> struct _LIBCPP_VISIBLE add_rvalue_reference<volatile void> {typedef volatile void type;};
489 template <> struct _LIBCPP_VISIBLE add_rvalue_reference<const volatile void> {typedef const volatile void type;};
491 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
493 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
496 typename add_rvalue_reference<_Tp>::type
499 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
502 typename add_lvalue_reference<_Tp>::type
505 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
514 template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer {typedef _Tp type;};
515 template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp*> {typedef _Tp type;};
516 template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const> {typedef _Tp type;};
517 template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* volatile> {typedef _Tp type;};
518 template <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const volatile> {typedef _Tp type;};
522 template <class _Tp> struct _LIBCPP_VISIBLE add_pointer
523 {typedef typename remove_reference<_Tp>::type* type;};
527 template <class _Tp, bool = is_integral<_Tp>::value>
528 struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
531 struct ___is_signed<_Tp, false> : public true_type {}; // floating point
533 template <class _Tp, bool = is_arithmetic<_Tp>::value>
534 struct __is_signed : public ___is_signed<_Tp> {};
536 template <class _Tp> struct __is_signed<_Tp, false> : public false_type {};
538 template <class _Tp> struct _LIBCPP_VISIBLE is_signed : public __is_signed<_Tp> {};
542 template <class _Tp, bool = is_integral<_Tp>::value>
543 struct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
546 struct ___is_unsigned<_Tp, false> : public false_type {}; // floating point
548 template <class _Tp, bool = is_arithmetic<_Tp>::value>
549 struct __is_unsigned : public ___is_unsigned<_Tp> {};
551 template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {};
553 template <class _Tp> struct _LIBCPP_VISIBLE is_unsigned : public __is_unsigned<_Tp> {};
557 template <class _Tp> struct _LIBCPP_VISIBLE rank
558 : public integral_constant<size_t, 0> {};
559 template <class _Tp> struct _LIBCPP_VISIBLE rank<_Tp[]>
560 : public integral_constant<size_t, rank<_Tp>::value + 1> {};
561 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE rank<_Tp[_Np]>
562 : public integral_constant<size_t, rank<_Tp>::value + 1> {};
566 template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_VISIBLE extent
567 : public integral_constant<size_t, 0> {};
568 template <class _Tp> struct _LIBCPP_VISIBLE extent<_Tp[], 0>
569 : public integral_constant<size_t, 0> {};
570 template <class _Tp, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[], _Ip>
571 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
572 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE extent<_Tp[_Np], 0>
573 : public integral_constant<size_t, _Np> {};
574 template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[_Np], _Ip>
575 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
579 template <class _Tp> struct _LIBCPP_VISIBLE remove_extent
581 template <class _Tp> struct _LIBCPP_VISIBLE remove_extent<_Tp[]>
583 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_extent<_Tp[_Np]>
586 // remove_all_extents
588 template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents
590 template <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[]>
591 {typedef typename remove_all_extents<_Tp>::type type;};
592 template <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]>
593 {typedef typename remove_all_extents<_Tp>::type type;};
597 namespace __is_abstract_imp
599 template <class _Tp> char __test(_Tp (*)[1]);
600 template <class _Tp> __two __test(...);
603 template <class _Tp, bool = is_class<_Tp>::value>
604 struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
606 template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
608 template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {};
612 #if __has_feature(is_convertible_to)
614 template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
615 : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
617 #else // __has_feature(is_convertible_to)
619 namespace __is_convertible_imp
621 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
622 template <class _Tp> char __test(const volatile typename remove_reference<_Tp>::type&&);
624 template <class _Tp> char __test(_Tp);
626 template <class _Tp> __two __test(...);
627 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
628 template <class _Tp> _Tp&& __source();
630 template <class _Tp> typename remove_reference<_Tp>::type& __source();
633 template <class _Tp, bool _IsArray = is_array<_Tp>::value,
634 bool _IsFunction = is_function<_Tp>::value,
635 bool _IsVoid = is_void<_Tp>::value>
636 struct __is_array_function_or_void {enum {value = 0};};
637 template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
638 template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
639 template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
643 unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
644 struct __is_convertible_check
646 static const size_t __v = 0;
650 struct __is_convertible_check<_Tp, 0>
652 static const size_t __v = sizeof(_Tp);
655 template <class _T1, class _T2,
656 unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
657 unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
658 struct __is_convertible
659 : public integral_constant<bool,
660 sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
664 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};
666 template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
667 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
668 template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
669 template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
670 template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {};
671 template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {};
672 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
674 template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0>
675 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {};
677 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0>
678 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {};
680 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0>
681 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {};
683 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0>
684 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {};
686 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {};
687 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
688 template <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {};
690 template <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {};
691 template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {};
692 template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {};
693 template <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {};
695 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {};
697 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
698 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
699 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
700 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
702 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
703 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
704 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
705 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
707 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
708 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
709 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
710 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
712 template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
713 : public __is_convertible<_T1, _T2>
715 static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
716 static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
719 #endif // __has_feature(is_convertible_to)
723 #ifdef _LIBCP_HAS_IS_BASE_OF
725 template <class _Bp, class _Dp>
726 struct _LIBCPP_VISIBLE is_base_of
727 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
729 #else // __has_feature(is_base_of)
731 #error is_base_of not implemented.
733 #endif // __has_feature(is_base_of)
737 #if __has_feature(is_empty)
740 struct _LIBCPP_VISIBLE is_empty
741 : public integral_constant<bool, __is_empty(_Tp)> {};
743 #else // __has_feature(is_empty)
757 template <class _Tp, bool = is_class<_Tp>::value>
758 struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {};
760 template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};
762 template <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {};
764 #endif // __has_feature(is_empty)
768 #if __has_feature(is_polymorphic)
771 struct _LIBCPP_VISIBLE is_polymorphic
772 : public integral_constant<bool, __is_polymorphic(_Tp)> {};
776 template <class _Tp> struct __is_polymorphic1 : public _Tp {};
777 template <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();};
779 template <class _Tp, bool = is_class<_Tp>::value>
780 struct __libcpp_polymorphic
781 : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == sizeof(__is_polymorphic2<_Tp>)> {};
783 template <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type {};
785 template <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic
786 : public __libcpp_polymorphic<_Tp> {};
788 #endif // __has_feature(is_polymorphic)
790 // has_virtual_destructor
792 #if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
794 template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
795 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
797 #else // _LIBCPP_HAS_TYPE_TRAITS
799 template <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor
800 : public false_type {};
802 #endif // _LIBCPP_HAS_TYPE_TRAITS
806 template <class _Tp> struct __alignment_of {_Tp _;};
808 template <class _Tp> struct _LIBCPP_VISIBLE alignment_of
809 : public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {};
813 template <class _Hp, class _Tp>
822 #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
824 __nat(const __nat&) = delete;
825 __nat& operator=(const __nat&) = delete;
833 static const size_t value = alignment_of<_Tp>::value;
837 struct __struct_double {long double _;};
838 struct __struct_double4 {double _[4];};
841 __type_list<__align_type<unsigned char>,
842 __type_list<__align_type<unsigned short>,
843 __type_list<__align_type<unsigned int>,
844 __type_list<__align_type<unsigned long>,
845 __type_list<__align_type<unsigned long long>,
846 __type_list<__align_type<double>,
847 __type_list<__align_type<long double>,
848 __type_list<__align_type<__struct_double>,
849 __type_list<__align_type<__struct_double4>,
850 __type_list<__align_type<int*>,
852 > > > > > > > > > > __all_types;
854 template <class _TL, size_t _Align> struct __find_pod;
856 template <class _Hp, size_t _Align>
857 struct __find_pod<__type_list<_Hp, __nat>, _Align>
859 typedef typename conditional<
860 _Align == _Hp::value,
866 template <class _Hp, class _Tp, size_t _Align>
867 struct __find_pod<__type_list<_Hp, _Tp>, _Align>
869 typedef typename conditional<
870 _Align == _Hp::value,
872 typename __find_pod<_Tp, _Align>::type
876 template <class _TL, size_t _Len> struct __find_max_align;
878 template <class _Hp, size_t _Len>
879 struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};
881 template <size_t _Len, size_t _A1, size_t _A2>
882 struct __select_align
885 static const size_t __min = _A2 < _A1 ? _A2 : _A1;
886 static const size_t __max = _A1 < _A2 ? _A2 : _A1;
888 static const size_t value = _Len < __max ? __min : __max;
891 template <class _Hp, class _Tp, size_t _Len>
892 struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
893 : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};
895 template <size_t _Len, const size_t _Align = __find_max_align<__all_types, _Len>::value>
896 struct _LIBCPP_VISIBLE aligned_storage
898 typedef typename __find_pod<__all_types, _Align>::type _Aligner;
899 static_assert(!is_void<_Aligner>::value, "");
903 unsigned char __data[_Len];
907 #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \
908 template <size_t _Len>\
909 struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\
911 struct _ALIGNAS(n) type\
913 unsigned char _[_Len];\
917 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1);
918 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
919 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4);
920 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8);
921 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10);
922 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20);
923 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40);
924 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80);
925 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100);
926 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200);
927 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400);
928 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
929 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
930 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
931 // MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
932 #if !defined(_MSC_VER)
933 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
936 #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
940 template <class _A1, class _A2 = void, class _A3 = void,
941 bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) &&
942 (is_arithmetic<_A2>::value || is_void<_A2>::value) &&
943 (is_arithmetic<_A3>::value || is_void<_A3>::value)>
946 template <class _A1, class _A2, class _A3>
947 class __promote<_A1, _A2, _A3, true>
950 typedef typename __promote<_A1>::type __type1;
951 typedef typename __promote<_A2>::type __type2;
952 typedef typename __promote<_A3>::type __type3;
954 typedef decltype(__type1() + __type2() + __type3()) type;
957 template <class _A1, class _A2>
958 class __promote<_A1, _A2, void, true>
961 typedef typename __promote<_A1>::type __type1;
962 typedef typename __promote<_A2>::type __type2;
964 typedef decltype(__type1() + __type2()) type;
968 class __promote<_A1, void, void, true>
971 typedef typename conditional<is_arithmetic<_A1>::value,
972 typename conditional<is_integral<_A1>::value, double, _A1>::type,
977 #ifdef _LIBCPP_STORE_AS_OPTIMIZATION
981 template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;};
982 template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;};
983 template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;};
984 template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;};
985 template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;};
987 #endif // _LIBCPP_STORE_AS_OPTIMIZATION
989 // make_signed / make_unsigned
992 __type_list<signed char,
993 __type_list<signed short,
994 __type_list<signed int,
995 __type_list<signed long,
996 __type_list<signed long long,
998 > > > > > __signed_types;
1001 __type_list<unsigned char,
1002 __type_list<unsigned short,
1003 __type_list<unsigned int,
1004 __type_list<unsigned long,
1005 __type_list<unsigned long long,
1007 > > > > > __unsigned_types;
1009 template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
1011 template <class _Hp, class _Tp, size_t _Size>
1012 struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
1017 template <class _Hp, class _Tp, size_t _Size>
1018 struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
1020 typedef typename __find_first<_Tp, _Size>::type type;
1023 template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
1024 bool = is_volatile<typename remove_reference<_Tp>::type>::value>
1030 template <class _Tp, class _Up>
1031 struct __apply_cv<_Tp, _Up, true, false>
1033 typedef const _Up type;
1036 template <class _Tp, class _Up>
1037 struct __apply_cv<_Tp, _Up, false, true>
1039 typedef volatile _Up type;
1042 template <class _Tp, class _Up>
1043 struct __apply_cv<_Tp, _Up, true, true>
1045 typedef const volatile _Up type;
1048 template <class _Tp, class _Up>
1049 struct __apply_cv<_Tp&, _Up, false, false>
1054 template <class _Tp, class _Up>
1055 struct __apply_cv<_Tp&, _Up, true, false>
1057 typedef const _Up& type;
1060 template <class _Tp, class _Up>
1061 struct __apply_cv<_Tp&, _Up, false, true>
1063 typedef volatile _Up& type;
1066 template <class _Tp, class _Up>
1067 struct __apply_cv<_Tp&, _Up, true, true>
1069 typedef const volatile _Up& type;
1072 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
1073 struct __make_signed {};
1075 template <class _Tp>
1076 struct __make_signed<_Tp, true>
1078 typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
1081 template <> struct __make_signed<bool, true> {};
1082 template <> struct __make_signed< signed short, true> {typedef short type;};
1083 template <> struct __make_signed<unsigned short, true> {typedef short type;};
1084 template <> struct __make_signed< signed int, true> {typedef int type;};
1085 template <> struct __make_signed<unsigned int, true> {typedef int type;};
1086 template <> struct __make_signed< signed long, true> {typedef long type;};
1087 template <> struct __make_signed<unsigned long, true> {typedef long type;};
1088 template <> struct __make_signed< signed long long, true> {typedef long long type;};
1089 template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
1091 template <class _Tp>
1092 struct _LIBCPP_VISIBLE make_signed
1094 typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
1097 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
1098 struct __make_unsigned {};
1100 template <class _Tp>
1101 struct __make_unsigned<_Tp, true>
1103 typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
1106 template <> struct __make_unsigned<bool, true> {};
1107 template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;};
1108 template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;};
1109 template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;};
1110 template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;};
1111 template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;};
1112 template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;};
1113 template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;};
1114 template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
1116 template <class _Tp>
1117 struct _LIBCPP_VISIBLE make_unsigned
1119 typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
1122 #ifdef _LIBCPP_HAS_NO_VARIADICS
1124 template <class _Tp, class _Up = void, class V = void>
1125 struct _LIBCPP_VISIBLE common_type
1128 typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type;
1131 template <class _Tp>
1132 struct _LIBCPP_VISIBLE common_type<_Tp, void, void>
1138 template <class _Tp, class _Up>
1139 struct _LIBCPP_VISIBLE common_type<_Tp, _Up, void>
1142 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1145 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1148 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1150 typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
1153 #else // _LIBCPP_HAS_NO_VARIADICS
1155 template <class ..._Tp> struct common_type;
1157 template <class _Tp>
1158 struct _LIBCPP_VISIBLE common_type<_Tp>
1163 template <class _Tp, class _Up>
1164 struct _LIBCPP_VISIBLE common_type<_Tp, _Up>
1171 typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type;
1174 template <class _Tp, class _Up, class ..._Vp>
1175 struct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...>
1177 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
1180 #endif // _LIBCPP_HAS_NO_VARIADICS
1184 template <class _Tp, class _Arg>
1185 decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type()))
1186 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1187 __is_assignable_test(_Tp&&, _Arg&&);
1189 __is_assignable_test(_Tp, _Arg&);
1192 template <class _Arg>
1194 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1195 __is_assignable_test(__any, _Arg&&);
1197 __is_assignable_test(__any, _Arg&);
1200 template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
1201 struct __is_assignable_imp
1202 : public common_type
1204 decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
1207 template <class _Tp, class _Arg>
1208 struct __is_assignable_imp<_Tp, _Arg, true>
1213 template <class _Tp, class _Arg>
1214 struct is_assignable
1215 : public __is_assignable_imp<_Tp, _Arg> {};
1217 // is_copy_assignable
1219 template <class _Tp> struct _LIBCPP_VISIBLE is_copy_assignable
1220 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
1221 const typename add_lvalue_reference<_Tp>::type> {};
1223 // is_move_assignable
1225 template <class _Tp> struct _LIBCPP_VISIBLE is_move_assignable
1226 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1227 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
1228 const typename add_rvalue_reference<_Tp>::type> {};
1230 : public is_copy_assignable<_Tp> {};
1235 template <class _Tp>
1236 struct __destructible_test
1241 template <class _Tp>
1242 decltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type()))
1243 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1244 __is_destructible_test(_Tp&&);
1246 __is_destructible_test(_Tp&);
1250 __is_destructible_test(__any);
1252 template <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value>
1253 struct __destructible_imp
1254 : public common_type
1256 decltype(__is_destructible_test(declval<_Tp>()))
1259 template <class _Tp>
1260 struct __destructible_imp<_Tp, true>
1261 : public false_type {};
1263 template <class _Tp>
1264 struct is_destructible
1265 : public __destructible_imp<_Tp> {};
1269 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1271 template <class _Tp>
1272 inline _LIBCPP_INLINE_VISIBILITY
1273 typename remove_reference<_Tp>::type&&
1274 move(_Tp&& __t) _NOEXCEPT
1276 typedef typename remove_reference<_Tp>::type _Up;
1277 return static_cast<_Up&&>(__t);
1280 template <class _Tp>
1281 inline _LIBCPP_INLINE_VISIBILITY
1283 forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
1285 return static_cast<_Tp&&>(__t);
1288 template <class _Tp>
1289 inline _LIBCPP_INLINE_VISIBILITY
1291 forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
1293 static_assert(!std::is_lvalue_reference<_Tp>::value,
1294 "Can not forward an rvalue as an lvalue.");
1295 return static_cast<_Tp&&>(__t);
1298 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1300 template <class _Tp>
1301 inline _LIBCPP_INLINE_VISIBILITY
1308 template <class _Tp>
1309 inline _LIBCPP_INLINE_VISIBILITY
1311 move(const _Tp& __t)
1316 template <class _Tp>
1317 inline _LIBCPP_INLINE_VISIBILITY
1319 forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
1325 template <class _Tp>
1328 typedef typename remove_reference<_Tp>::type _Trr;
1331 _LIBCPP_INLINE_VISIBILITY
1332 _Trr* operator->() {return &t_;}
1333 _LIBCPP_INLINE_VISIBILITY
1334 explicit __rv(_Trr& __t) : t_(__t) {}
1337 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1339 template <class _Tp>
1340 struct _LIBCPP_VISIBLE decay
1343 typedef typename remove_reference<_Tp>::type _Up;
1345 typedef typename conditional
1347 is_array<_Up>::value,
1348 typename remove_extent<_Up>::type*,
1349 typename conditional
1351 is_function<_Up>::value,
1352 typename add_pointer<_Up>::type,
1353 typename remove_cv<_Up>::type
1358 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1360 template <class _Tp>
1361 inline _LIBCPP_INLINE_VISIBILITY
1362 typename decay<_Tp>::type
1363 __decay_copy(_Tp&& __t)
1365 return _VSTD::forward<_Tp>(__t);
1370 template <class _Tp>
1371 inline _LIBCPP_INLINE_VISIBILITY
1372 typename decay<_Tp>::type
1373 __decay_copy(const _Tp& __t)
1375 return _VSTD::forward<_Tp>(__t);
1380 template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
1381 struct __member_pointer_traits_imp
1385 #ifndef _LIBCPP_HAS_NO_VARIADICS
1387 template <class _Rp, class _Class, class ..._Param>
1388 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
1390 typedef _Class _ClassType;
1391 typedef _Rp _ReturnType;
1394 template <class _Rp, class _Class, class ..._Param>
1395 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
1397 typedef _Class const _ClassType;
1398 typedef _Rp _ReturnType;
1401 template <class _Rp, class _Class, class ..._Param>
1402 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
1404 typedef _Class volatile _ClassType;
1405 typedef _Rp _ReturnType;
1408 template <class _Rp, class _Class, class ..._Param>
1409 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
1411 typedef _Class const volatile _ClassType;
1412 typedef _Rp _ReturnType;
1415 #if __has_feature(cxx_reference_qualified_functions)
1417 template <class _Rp, class _Class, class ..._Param>
1418 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
1420 typedef _Class& _ClassType;
1421 typedef _Rp _ReturnType;
1424 template <class _Rp, class _Class, class ..._Param>
1425 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
1427 typedef _Class const& _ClassType;
1428 typedef _Rp _ReturnType;
1431 template <class _Rp, class _Class, class ..._Param>
1432 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
1434 typedef _Class volatile& _ClassType;
1435 typedef _Rp _ReturnType;
1438 template <class _Rp, class _Class, class ..._Param>
1439 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
1441 typedef _Class const volatile& _ClassType;
1442 typedef _Rp _ReturnType;
1445 template <class _Rp, class _Class, class ..._Param>
1446 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
1448 typedef _Class&& _ClassType;
1449 typedef _Rp _ReturnType;
1452 template <class _Rp, class _Class, class ..._Param>
1453 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
1455 typedef _Class const&& _ClassType;
1456 typedef _Rp _ReturnType;
1459 template <class _Rp, class _Class, class ..._Param>
1460 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
1462 typedef _Class volatile&& _ClassType;
1463 typedef _Rp _ReturnType;
1466 template <class _Rp, class _Class, class ..._Param>
1467 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
1469 typedef _Class const volatile&& _ClassType;
1470 typedef _Rp _ReturnType;
1473 #endif // __has_feature(cxx_reference_qualified_functions)
1475 #else // _LIBCPP_HAS_NO_VARIADICS
1477 template <class _Rp, class _Class>
1478 struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
1480 typedef _Class _ClassType;
1481 typedef _Rp _ReturnType;
1484 template <class _Rp, class _Class, class _P0>
1485 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
1487 typedef _Class _ClassType;
1488 typedef _Rp _ReturnType;
1491 template <class _Rp, class _Class, class _P0, class _P1>
1492 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
1494 typedef _Class _ClassType;
1495 typedef _Rp _ReturnType;
1498 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
1499 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
1501 typedef _Class _ClassType;
1502 typedef _Rp _ReturnType;
1505 template <class _Rp, class _Class>
1506 struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
1508 typedef _Class const _ClassType;
1509 typedef _Rp _ReturnType;
1512 template <class _Rp, class _Class, class _P0>
1513 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
1515 typedef _Class const _ClassType;
1516 typedef _Rp _ReturnType;
1519 template <class _Rp, class _Class, class _P0, class _P1>
1520 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
1522 typedef _Class const _ClassType;
1523 typedef _Rp _ReturnType;
1526 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
1527 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
1529 typedef _Class const _ClassType;
1530 typedef _Rp _ReturnType;
1533 template <class _Rp, class _Class>
1534 struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
1536 typedef _Class volatile _ClassType;
1537 typedef _Rp _ReturnType;
1540 template <class _Rp, class _Class, class _P0>
1541 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
1543 typedef _Class volatile _ClassType;
1544 typedef _Rp _ReturnType;
1547 template <class _Rp, class _Class, class _P0, class _P1>
1548 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
1550 typedef _Class volatile _ClassType;
1551 typedef _Rp _ReturnType;
1554 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
1555 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
1557 typedef _Class volatile _ClassType;
1558 typedef _Rp _ReturnType;
1561 template <class _Rp, class _Class>
1562 struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
1564 typedef _Class const volatile _ClassType;
1565 typedef _Rp _ReturnType;
1568 template <class _Rp, class _Class, class _P0>
1569 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
1571 typedef _Class const volatile _ClassType;
1572 typedef _Rp _ReturnType;
1575 template <class _Rp, class _Class, class _P0, class _P1>
1576 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
1578 typedef _Class const volatile _ClassType;
1579 typedef _Rp _ReturnType;
1582 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
1583 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
1585 typedef _Class const volatile _ClassType;
1586 typedef _Rp _ReturnType;
1589 #endif // _LIBCPP_HAS_NO_VARIADICS
1591 template <class _Rp, class _Class>
1592 struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
1594 typedef _Class _ClassType;
1595 typedef _Rp _ReturnType;
1598 template <class _MP>
1599 struct __member_pointer_traits
1600 : public __member_pointer_traits_imp<_MP,
1601 is_member_function_pointer<_MP>::value,
1602 is_member_object_pointer<_MP>::value>
1604 // typedef ... _ClassType;
1605 // typedef ... _ReturnType;
1610 template <class _Callable> class result_of;
1612 template <class _Fn, bool, bool>
1617 #ifndef _LIBCPP_HAS_NO_VARIADICS
1619 template <class _Fn, class ..._ArgTypes>
1620 class __result_of<_Fn(_ArgTypes...), true, false>
1623 typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type;
1626 template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
1627 struct __result_of_mp;
1629 // member function pointer
1631 template <class _MP, class _Tp>
1632 struct __result_of_mp<_MP, _Tp, true>
1633 : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
1637 // member data pointer
1639 template <class _MP, class _Tp, bool>
1640 struct __result_of_mdp;
1642 template <class _Rp, class _Class, class _Tp>
1643 struct __result_of_mdp<_Rp _Class::*, _Tp, false>
1645 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type;
1648 template <class _Rp, class _Class, class _Tp>
1649 struct __result_of_mdp<_Rp _Class::*, _Tp, true>
1651 typedef typename __apply_cv<_Tp, _Rp>::type&& type;
1654 template <class _Rp, class _Class, class _Tp>
1655 struct __result_of_mp<_Rp _Class::*, _Tp, false>
1656 : public __result_of_mdp<_Rp _Class::*, _Tp,
1657 is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
1661 template <class _Fn, class _Tp, class ..._ArgTypes>
1662 class __result_of<_Fn(_Tp, _ArgTypes...), false, true> // _Fn must be member pointer
1663 : public __result_of_mp<typename remove_reference<_Fn>::type,
1665 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
1671 template <class _Fn, class ..._ArgTypes>
1672 class _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)>
1673 : public __result_of<_Fn(_ArgTypes...),
1674 is_class<typename remove_reference<_Fn>::type>::value ||
1675 is_function<typename remove_reference<_Fn>::type>::value,
1676 is_member_pointer<typename remove_reference<_Fn>::type>::value
1681 #else // _LIBCPP_HAS_NO_VARIADICS
1683 template <class _Fn>
1684 class __result_of<_Fn(), true, false>
1687 typedef decltype(declval<_Fn>()()) type;
1690 template <class _Fn, class _A0>
1691 class __result_of<_Fn(_A0), true, false>
1694 typedef decltype(declval<_Fn>()(declval<_A0>())) type;
1697 template <class _Fn, class _A0, class _A1>
1698 class __result_of<_Fn(_A0, _A1), true, false>
1701 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
1704 template <class _Fn, class _A0, class _A1, class _A2>
1705 class __result_of<_Fn(_A0, _A1, _A2), true, false>
1708 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
1711 template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
1712 struct __result_of_mp;
1714 // member function pointer
1716 template <class _MP, class _Tp>
1717 struct __result_of_mp<_MP, _Tp, true>
1718 : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
1722 // member data pointer
1724 template <class _MP, class _Tp, bool>
1725 struct __result_of_mdp;
1727 template <class _Rp, class _Class, class _Tp>
1728 struct __result_of_mdp<_Rp _Class::*, _Tp, false>
1730 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
1733 template <class _Rp, class _Class, class _Tp>
1734 struct __result_of_mdp<_Rp _Class::*, _Tp, true>
1736 typedef typename __apply_cv<_Tp, _Rp>::type& type;
1739 template <class _Rp, class _Class, class _Tp>
1740 struct __result_of_mp<_Rp _Class::*, _Tp, false>
1741 : public __result_of_mdp<_Rp _Class::*, _Tp,
1742 is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
1748 template <class _Fn, class _Tp>
1749 class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer
1750 : public __result_of_mp<typename remove_reference<_Fn>::type,
1752 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
1756 template <class _Fn, class _Tp, class _A0>
1757 class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer
1758 : public __result_of_mp<typename remove_reference<_Fn>::type,
1760 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
1764 template <class _Fn, class _Tp, class _A0, class _A1>
1765 class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer
1766 : public __result_of_mp<typename remove_reference<_Fn>::type,
1768 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
1772 template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
1773 class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer
1774 : public __result_of_mp<typename remove_reference<_Fn>::type,
1776 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
1782 template <class _Fn>
1783 class _LIBCPP_VISIBLE result_of<_Fn()>
1784 : public __result_of<_Fn(),
1785 is_class<typename remove_reference<_Fn>::type>::value ||
1786 is_function<typename remove_reference<_Fn>::type>::value,
1787 is_member_pointer<typename remove_reference<_Fn>::type>::value
1792 template <class _Fn, class _A0>
1793 class _LIBCPP_VISIBLE result_of<_Fn(_A0)>
1794 : public __result_of<_Fn(_A0),
1795 is_class<typename remove_reference<_Fn>::type>::value ||
1796 is_function<typename remove_reference<_Fn>::type>::value,
1797 is_member_pointer<typename remove_reference<_Fn>::type>::value
1802 template <class _Fn, class _A0, class _A1>
1803 class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)>
1804 : public __result_of<_Fn(_A0, _A1),
1805 is_class<typename remove_reference<_Fn>::type>::value ||
1806 is_function<typename remove_reference<_Fn>::type>::value,
1807 is_member_pointer<typename remove_reference<_Fn>::type>::value
1812 template <class _Fn, class _A0, class _A1, class _A2>
1813 class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)>
1814 : public __result_of<_Fn(_A0, _A1, _A2),
1815 is_class<typename remove_reference<_Fn>::type>::value ||
1816 is_function<typename remove_reference<_Fn>::type>::value,
1817 is_member_pointer<typename remove_reference<_Fn>::type>::value
1822 #endif // _LIBCPP_HAS_NO_VARIADICS
1824 #ifndef _LIBCPP_HAS_NO_VARIADICS
1826 // template <class T, class... Args> struct is_constructible;
1828 // main is_constructible test
1830 template <class _Tp, class ..._Args>
1831 decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
1832 __is_constructible_test(_Tp&&, _Args&& ...);
1834 template <class ..._Args>
1836 __is_constructible_test(__any, _Args&& ...);
1838 template <bool, class _Tp, class... _Args>
1839 struct __is_constructible // false, _Tp is not a scalar
1840 : public common_type
1842 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
1846 // function types are not constructible
1848 template <class _Rp, class... _A1, class... _A2>
1849 struct __is_constructible<false, _Rp(_A1...), _A2...>
1853 // handle scalars and reference types
1855 // Scalars are default constructible, references are not
1857 template <class _Tp>
1858 struct __is_constructible<true, _Tp>
1859 : public is_scalar<_Tp>
1862 // Scalars and references are constructible from one arg if that arg is
1863 // implicitly convertible to the scalar or reference.
1865 template <class _Tp>
1866 struct __is_constructible_ref
1868 true_type static __(_Tp);
1869 false_type static __(...);
1872 template <class _Tp, class _A0>
1873 struct __is_constructible<true, _Tp, _A0>
1874 : public common_type
1876 decltype(__is_constructible_ref<_Tp>::__(declval<_A0>()))
1880 // Scalars and references are not constructible from multiple args.
1882 template <class _Tp, class _A0, class ..._Args>
1883 struct __is_constructible<true, _Tp, _A0, _Args...>
1887 // Treat scalars and reference types separately
1889 template <bool, class _Tp, class... _Args>
1890 struct __is_constructible_void_check
1891 : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
1895 // If any of T or Args is void, is_constructible should be false
1897 template <class _Tp, class... _Args>
1898 struct __is_constructible_void_check<true, _Tp, _Args...>
1902 template <class ..._Args> struct __contains_void;
1904 template <> struct __contains_void<> : false_type {};
1906 template <class _A0, class ..._Args>
1907 struct __contains_void<_A0, _Args...>
1909 static const bool value = is_void<_A0>::value ||
1910 __contains_void<_Args...>::value;
1913 // is_constructible entry point
1915 template <class _Tp, class... _Args>
1916 struct _LIBCPP_VISIBLE is_constructible
1917 : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
1918 || is_abstract<_Tp>::value,
1922 // Array types are default constructible if their element type
1923 // is default constructible
1925 template <class _Ap, size_t _Np>
1926 struct __is_constructible<false, _Ap[_Np]>
1927 : public is_constructible<typename remove_all_extents<_Ap>::type>
1930 // Otherwise array types are not constructible by this syntax
1932 template <class _Ap, size_t _Np, class ..._Args>
1933 struct __is_constructible<false, _Ap[_Np], _Args...>
1937 // Incomplete array types are not constructible
1939 template <class _Ap, class ..._Args>
1940 struct __is_constructible<false, _Ap[], _Args...>
1944 #else // _LIBCPP_HAS_NO_VARIADICS
1946 // template <class T> struct is_constructible0;
1948 // main is_constructible0 test
1950 template <class _Tp>
1951 decltype((_Tp(), true_type()))
1952 __is_constructible0_test(_Tp&);
1955 __is_constructible0_test(__any);
1957 template <class _Tp, class _A0>
1958 decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
1959 __is_constructible1_test(_Tp&, _A0&);
1961 template <class _A0>
1963 __is_constructible1_test(__any, _A0&);
1965 template <class _Tp, class _A0, class _A1>
1966 decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
1967 __is_constructible2_test(_Tp&, _A0&, _A1&);
1969 template <class _A0, class _A1>
1971 __is_constructible2_test(__any, _A0&, _A1&);
1973 template <bool, class _Tp>
1974 struct __is_constructible0_imp // false, _Tp is not a scalar
1975 : public common_type
1977 decltype(__is_constructible0_test(declval<_Tp&>()))
1981 template <bool, class _Tp, class _A0>
1982 struct __is_constructible1_imp // false, _Tp is not a scalar
1983 : public common_type
1985 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
1989 template <bool, class _Tp, class _A0, class _A1>
1990 struct __is_constructible2_imp // false, _Tp is not a scalar
1991 : public common_type
1993 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
1997 // handle scalars and reference types
1999 // Scalars are default constructible, references are not
2001 template <class _Tp>
2002 struct __is_constructible0_imp<true, _Tp>
2003 : public is_scalar<_Tp>
2006 template <class _Tp, class _A0>
2007 struct __is_constructible1_imp<true, _Tp, _A0>
2008 : public is_convertible<_A0, _Tp>
2011 template <class _Tp, class _A0, class _A1>
2012 struct __is_constructible2_imp<true, _Tp, _A0, _A1>
2016 // Treat scalars and reference types separately
2018 template <bool, class _Tp>
2019 struct __is_constructible0_void_check
2020 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
2024 template <bool, class _Tp, class _A0>
2025 struct __is_constructible1_void_check
2026 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
2030 template <bool, class _Tp, class _A0, class _A1>
2031 struct __is_constructible2_void_check
2032 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
2036 // If any of T or Args is void, is_constructible should be false
2038 template <class _Tp>
2039 struct __is_constructible0_void_check<true, _Tp>
2043 template <class _Tp, class _A0>
2044 struct __is_constructible1_void_check<true, _Tp, _A0>
2048 template <class _Tp, class _A0, class _A1>
2049 struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
2053 // is_constructible entry point
2055 namespace __is_construct
2062 template <class _Tp, class _A0 = __is_construct::__nat,
2063 class _A1 = __is_construct::__nat>
2064 struct _LIBCPP_VISIBLE is_constructible
2065 : public __is_constructible2_void_check<is_void<_Tp>::value
2066 || is_abstract<_Tp>::value
2067 || is_function<_Tp>::value
2068 || is_void<_A0>::value
2069 || is_void<_A1>::value,
2073 template <class _Tp>
2074 struct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
2075 : public __is_constructible0_void_check<is_void<_Tp>::value
2076 || is_abstract<_Tp>::value
2077 || is_function<_Tp>::value,
2081 template <class _Tp, class _A0>
2082 struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat>
2083 : public __is_constructible1_void_check<is_void<_Tp>::value
2084 || is_abstract<_Tp>::value
2085 || is_function<_Tp>::value
2086 || is_void<_A0>::value,
2090 // Array types are default constructible if their element type
2091 // is default constructible
2093 template <class _Ap, size_t _Np>
2094 struct __is_constructible0_imp<false, _Ap[_Np]>
2095 : public is_constructible<typename remove_all_extents<_Ap>::type>
2098 template <class _Ap, size_t _Np, class _A0>
2099 struct __is_constructible1_imp<false, _Ap[_Np], _A0>
2103 template <class _Ap, size_t _Np, class _A0, class _A1>
2104 struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
2108 // Incomplete array types are not constructible
2110 template <class _Ap>
2111 struct __is_constructible0_imp<false, _Ap[]>
2115 template <class _Ap, class _A0>
2116 struct __is_constructible1_imp<false, _Ap[], _A0>
2120 template <class _Ap, class _A0, class _A1>
2121 struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
2125 #endif // _LIBCPP_HAS_NO_VARIADICS
2127 // is_default_constructible
2129 template <class _Tp>
2130 struct _LIBCPP_VISIBLE is_default_constructible
2131 : public is_constructible<_Tp>
2134 // is_copy_constructible
2136 template <class _Tp>
2137 struct _LIBCPP_VISIBLE is_copy_constructible
2138 : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
2141 // is_move_constructible
2143 template <class _Tp>
2144 struct _LIBCPP_VISIBLE is_move_constructible
2145 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2146 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
2148 : public is_copy_constructible<_Tp>
2152 // is_trivially_constructible
2154 #ifndef _LIBCPP_HAS_NO_VARIADICS
2156 #if __has_feature(is_trivially_constructible)
2158 template <class _Tp, class... _Args>
2159 struct _LIBCPP_VISIBLE is_trivially_constructible
2160 : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
2164 #else // !__has_feature(is_trivially_constructible)
2166 template <class _Tp, class... _Args>
2167 struct _LIBCPP_VISIBLE is_trivially_constructible
2172 template <class _Tp>
2173 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp>
2174 #if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2175 : integral_constant<bool, __has_trivial_constructor(_Tp)>
2177 : integral_constant<bool, is_scalar<_Tp>::value>
2182 template <class _Tp>
2183 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2184 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&>
2186 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
2188 : integral_constant<bool, is_scalar<_Tp>::value>
2192 template <class _Tp>
2193 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
2194 : integral_constant<bool, is_scalar<_Tp>::value>
2198 template <class _Tp>
2199 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
2200 : integral_constant<bool, is_scalar<_Tp>::value>
2204 #endif // !__has_feature(is_trivially_constructible)
2206 #else // _LIBCPP_HAS_NO_VARIADICS
2208 template <class _Tp, class _A0 = __is_construct::__nat,
2209 class _A1 = __is_construct::__nat>
2210 struct _LIBCPP_VISIBLE is_trivially_constructible
2215 #if __has_feature(is_trivially_constructible)
2217 template <class _Tp>
2218 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
2219 __is_construct::__nat>
2220 : integral_constant<bool, __is_trivially_constructible(_Tp)>
2224 template <class _Tp>
2225 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
2226 __is_construct::__nat>
2227 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
2231 template <class _Tp>
2232 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
2233 __is_construct::__nat>
2234 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
2238 template <class _Tp>
2239 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
2240 __is_construct::__nat>
2241 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
2245 #else // !__has_feature(is_trivially_constructible)
2247 template <class _Tp>
2248 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
2249 __is_construct::__nat>
2250 : integral_constant<bool, is_scalar<_Tp>::value>
2254 template <class _Tp>
2255 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
2256 __is_construct::__nat>
2257 : integral_constant<bool, is_scalar<_Tp>::value>
2261 template <class _Tp>
2262 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
2263 __is_construct::__nat>
2264 : integral_constant<bool, is_scalar<_Tp>::value>
2268 template <class _Tp>
2269 struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
2270 __is_construct::__nat>
2271 : integral_constant<bool, is_scalar<_Tp>::value>
2275 #endif // !__has_feature(is_trivially_constructible)
2277 #endif // _LIBCPP_HAS_NO_VARIADICS
2279 // is_trivially_default_constructible
2281 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_default_constructible
2282 : public is_trivially_constructible<_Tp>
2285 // is_trivially_copy_constructible
2287 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_constructible
2288 : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
2291 // is_trivially_move_constructible
2293 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible
2294 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2295 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
2297 : public is_trivially_copy_constructible<_Tp>
2301 // is_trivially_assignable
2303 #if __has_feature(is_trivially_constructible)
2305 template <class _Tp, class _Arg>
2306 struct is_trivially_assignable
2307 : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
2311 #else // !__has_feature(is_trivially_constructible)
2313 template <class _Tp, class _Arg>
2314 struct is_trivially_assignable
2315 : public false_type {};
2317 template <class _Tp>
2318 struct is_trivially_assignable<_Tp&, _Tp>
2319 : integral_constant<bool, is_scalar<_Tp>::value> {};
2321 template <class _Tp>
2322 struct is_trivially_assignable<_Tp&, _Tp&>
2323 : integral_constant<bool, is_scalar<_Tp>::value> {};
2325 template <class _Tp>
2326 struct is_trivially_assignable<_Tp&, const _Tp&>
2327 : integral_constant<bool, is_scalar<_Tp>::value> {};
2329 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2331 template <class _Tp>
2332 struct is_trivially_assignable<_Tp&, _Tp&&>
2333 : integral_constant<bool, is_scalar<_Tp>::value> {};
2335 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2337 #endif // !__has_feature(is_trivially_constructible)
2339 // is_trivially_copy_assignable
2341 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable
2342 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
2343 const typename add_lvalue_reference<_Tp>::type>
2346 // is_trivially_move_assignable
2348 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_assignable
2349 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
2350 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2351 typename add_rvalue_reference<_Tp>::type>
2353 typename add_lvalue_reference<_Tp>::type>
2357 // is_trivially_destructible
2359 #if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2361 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
2362 : public integral_constant<bool, __has_trivial_destructor(_Tp)> {};
2364 #else // _LIBCPP_HAS_TYPE_TRAITS
2366 template <class _Tp> struct __libcpp_trivial_destructor
2367 : public integral_constant<bool, is_scalar<_Tp>::value ||
2368 is_reference<_Tp>::value> {};
2370 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
2371 : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};
2373 #endif // _LIBCPP_HAS_TYPE_TRAITS
2375 // is_nothrow_constructible
2377 #ifndef _LIBCPP_HAS_NO_VARIADICS
2379 #if __has_feature(cxx_noexcept)
2381 template <bool, class _Tp, class... _Args> struct __is_nothrow_constructible;
2383 template <class _Tp, class... _Args>
2384 struct __is_nothrow_constructible<true, _Tp, _Args...>
2385 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
2389 template <class _Tp, class... _Args>
2390 struct __is_nothrow_constructible<false, _Tp, _Args...>
2395 template <class _Tp, class... _Args>
2396 struct _LIBCPP_VISIBLE is_nothrow_constructible
2397 : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
2401 template <class _Tp, size_t _Ns>
2402 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]>
2403 : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
2407 #else // __has_feature(cxx_noexcept)
2409 template <class _Tp, class... _Args>
2410 struct _LIBCPP_VISIBLE is_nothrow_constructible
2415 template <class _Tp>
2416 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp>
2417 #if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2418 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
2420 : integral_constant<bool, is_scalar<_Tp>::value>
2425 template <class _Tp>
2426 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2427 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&>
2429 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp>
2431 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2432 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2434 : integral_constant<bool, is_scalar<_Tp>::value>
2439 template <class _Tp>
2440 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&>
2441 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2442 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2444 : integral_constant<bool, is_scalar<_Tp>::value>
2449 template <class _Tp>
2450 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&>
2451 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2452 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2454 : integral_constant<bool, is_scalar<_Tp>::value>
2459 #endif // __has_feature(cxx_noexcept)
2461 #else // _LIBCPP_HAS_NO_VARIADICS
2463 template <class _Tp, class _A0 = __is_construct::__nat,
2464 class _A1 = __is_construct::__nat>
2465 struct _LIBCPP_VISIBLE is_nothrow_constructible
2470 template <class _Tp>
2471 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat,
2472 __is_construct::__nat>
2473 #if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2474 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
2476 : integral_constant<bool, is_scalar<_Tp>::value>
2481 template <class _Tp>
2482 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp,
2483 __is_construct::__nat>
2484 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2485 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2487 : integral_constant<bool, is_scalar<_Tp>::value>
2492 template <class _Tp>
2493 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&,
2494 __is_construct::__nat>
2495 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2496 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2498 : integral_constant<bool, is_scalar<_Tp>::value>
2503 template <class _Tp>
2504 struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&,
2505 __is_construct::__nat>
2506 #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2507 : integral_constant<bool, __has_nothrow_copy(_Tp)>
2509 : integral_constant<bool, is_scalar<_Tp>::value>
2514 #endif // _LIBCPP_HAS_NO_VARIADICS
2516 // is_nothrow_default_constructible
2518 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_default_constructible
2519 : public is_nothrow_constructible<_Tp>
2522 // is_nothrow_copy_constructible
2524 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_constructible
2525 : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
2528 // is_nothrow_move_constructible
2530 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_constructible
2531 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2532 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
2534 : public is_nothrow_copy_constructible<_Tp>
2538 // is_nothrow_assignable
2540 #if __has_feature(cxx_noexcept)
2542 template <bool, class _Tp, class _Arg> struct __is_nothrow_assignable;
2544 template <class _Tp, class _Arg>
2545 struct __is_nothrow_assignable<false, _Tp, _Arg>
2550 template <class _Tp, class _Arg>
2551 struct __is_nothrow_assignable<true, _Tp, _Arg>
2552 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
2556 template <class _Tp, class _Arg>
2557 struct _LIBCPP_VISIBLE is_nothrow_assignable
2558 : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
2562 #else // __has_feature(cxx_noexcept)
2564 template <class _Tp, class _Arg>
2565 struct _LIBCPP_VISIBLE is_nothrow_assignable
2566 : public false_type {};
2568 template <class _Tp>
2569 struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp>
2570 #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2571 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
2573 : integral_constant<bool, is_scalar<_Tp>::value> {};
2576 template <class _Tp>
2577 struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&>
2578 #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2579 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
2581 : integral_constant<bool, is_scalar<_Tp>::value> {};
2584 template <class _Tp>
2585 struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&>
2586 #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2587 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
2589 : integral_constant<bool, is_scalar<_Tp>::value> {};
2592 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2594 template <class _Tp>
2595 struct is_nothrow_assignable<_Tp&, _Tp&&>
2596 #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2597 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
2599 : integral_constant<bool, is_scalar<_Tp>::value> {};
2602 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2604 #endif // __has_feature(cxx_noexcept)
2606 // is_nothrow_copy_assignable
2608 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_assignable
2609 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
2610 const typename add_lvalue_reference<_Tp>::type>
2613 // is_nothrow_move_assignable
2615 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_assignable
2616 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
2617 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2618 typename add_rvalue_reference<_Tp>::type>
2620 typename add_lvalue_reference<_Tp>::type>
2624 // is_nothrow_destructible
2626 #if __has_feature(cxx_noexcept)
2628 template <bool, class _Tp> struct __is_nothrow_destructible;
2630 template <class _Tp>
2631 struct __is_nothrow_destructible<false, _Tp>
2636 template <class _Tp>
2637 struct __is_nothrow_destructible<true, _Tp>
2638 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
2642 template <class _Tp>
2643 struct _LIBCPP_VISIBLE is_nothrow_destructible
2644 : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
2648 template <class _Tp, size_t _Ns>
2649 struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]>
2650 : public is_nothrow_destructible<_Tp>
2654 template <class _Tp>
2655 struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&>
2660 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2662 template <class _Tp>
2663 struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&>
2672 template <class _Tp> struct __libcpp_nothrow_destructor
2673 : public integral_constant<bool, is_scalar<_Tp>::value ||
2674 is_reference<_Tp>::value> {};
2676 template <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_destructible
2677 : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};
2683 #if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
2685 template <class _Tp> struct _LIBCPP_VISIBLE is_pod
2686 : public integral_constant<bool, __is_pod(_Tp)> {};
2688 #else // _LIBCPP_HAS_TYPE_TRAITS
2690 template <class _Tp> struct _LIBCPP_VISIBLE is_pod
2691 : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value &&
2692 is_trivially_copy_constructible<_Tp>::value &&
2693 is_trivially_copy_assignable<_Tp>::value &&
2694 is_trivially_destructible<_Tp>::value> {};
2696 #endif // _LIBCPP_HAS_TYPE_TRAITS
2700 template <class _Tp> struct _LIBCPP_VISIBLE is_literal_type
2701 #if __has_feature(is_literal)
2702 : public integral_constant<bool, __is_literal(_Tp)>
2704 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
2705 is_reference<typename remove_all_extents<_Tp>::type>::value>
2709 // is_standard_layout;
2711 template <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout
2712 #if __has_feature(is_standard_layout)
2713 : public integral_constant<bool, __is_standard_layout(_Tp)>
2715 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
2719 // is_trivially_copyable;
2721 template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copyable
2722 #if __has_feature(is_trivially_copyable)
2723 : public integral_constant<bool, __is_trivially_copyable(_Tp)>
2725 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
2731 template <class _Tp> struct _LIBCPP_VISIBLE is_trivial
2732 #if __has_feature(is_trivial)
2733 : public integral_constant<bool, __is_trivial(_Tp)>
2735 : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
2736 is_trivially_default_constructible<_Tp>::value>
2740 #ifndef _LIBCPP_HAS_NO_VARIADICS
2742 // Check for complete types
2744 template <class ..._Tp> struct __check_complete;
2747 struct __check_complete<>
2751 template <class _Hp, class _T0, class ..._Tp>
2752 struct __check_complete<_Hp, _T0, _Tp...>
2753 : private __check_complete<_Hp>,
2754 private __check_complete<_T0, _Tp...>
2758 template <class _Hp>
2759 struct __check_complete<_Hp, _Hp>
2760 : private __check_complete<_Hp>
2764 template <class _Tp>
2765 struct __check_complete<_Tp>
2767 static_assert(sizeof(_Tp) > 0, "Type must be complete.");
2770 template <class _Tp>
2771 struct __check_complete<_Tp&>
2772 : private __check_complete<_Tp>
2776 template <class _Tp>
2777 struct __check_complete<_Tp&&>
2778 : private __check_complete<_Tp>
2782 template <class _Rp, class ..._Param>
2783 struct __check_complete<_Rp (*)(_Param...)>
2784 : private __check_complete<_Param...>
2788 template <class _Rp, class ..._Param>
2789 struct __check_complete<_Rp (_Param...)>
2790 : private __check_complete<_Param...>
2794 template <class _Rp, class _Class, class ..._Param>
2795 struct __check_complete<_Rp (_Class::*)(_Param...)>
2796 : private __check_complete<_Class, _Param...>
2800 template <class _Rp, class _Class, class ..._Param>
2801 struct __check_complete<_Rp (_Class::*)(_Param...) const>
2802 : private __check_complete<_Class, _Param...>
2806 template <class _Rp, class _Class, class ..._Param>
2807 struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
2808 : private __check_complete<_Class, _Param...>
2812 template <class _Rp, class _Class, class ..._Param>
2813 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
2814 : private __check_complete<_Class, _Param...>
2818 #if __has_feature(cxx_reference_qualified_functions)
2820 template <class _Rp, class _Class, class ..._Param>
2821 struct __check_complete<_Rp (_Class::*)(_Param...) &>
2822 : private __check_complete<_Class, _Param...>
2826 template <class _Rp, class _Class, class ..._Param>
2827 struct __check_complete<_Rp (_Class::*)(_Param...) const&>
2828 : private __check_complete<_Class, _Param...>
2832 template <class _Rp, class _Class, class ..._Param>
2833 struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
2834 : private __check_complete<_Class, _Param...>
2838 template <class _Rp, class _Class, class ..._Param>
2839 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
2840 : private __check_complete<_Class, _Param...>
2844 template <class _Rp, class _Class, class ..._Param>
2845 struct __check_complete<_Rp (_Class::*)(_Param...) &&>
2846 : private __check_complete<_Class, _Param...>
2850 template <class _Rp, class _Class, class ..._Param>
2851 struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
2852 : private __check_complete<_Class, _Param...>
2856 template <class _Rp, class _Class, class ..._Param>
2857 struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
2858 : private __check_complete<_Class, _Param...>
2862 template <class _Rp, class _Class, class ..._Param>
2863 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
2864 : private __check_complete<_Class, _Param...>
2870 template <class _Rp, class _Class>
2871 struct __check_complete<_Rp _Class::*>
2872 : private __check_complete<_Class>
2876 // __invoke forward declarations
2878 // fall back - none of the bullets
2880 template <class ..._Args>
2882 __invoke(__any, _Args&& ...__args)
2887 template <class _Fp, class _A0, class ..._Args>
2889 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
2890 -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
2892 template <class _Fp, class _A0, class ..._Args>
2894 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
2895 -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
2899 template <class _Fp, class _A0>
2901 __invoke(_Fp&& __f, _A0&& __a0)
2902 -> decltype(_VSTD::forward<_A0>(__a0).*__f);
2904 template <class _Fp, class _A0>
2906 __invoke(_Fp&& __f, _A0&& __a0)
2907 -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
2911 template <class _Fp, class ..._Args>
2913 __invoke(_Fp&& __f, _Args&& ...__args)
2914 -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
2918 template <class _Fp, class ..._Args>
2919 struct __invokable_imp
2920 : private __check_complete<_Fp, _Args...>
2923 __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
2925 static const bool value = !is_same<type, __nat>::value;
2928 template <class _Fp, class ..._Args>
2930 : public integral_constant<bool,
2931 __invokable_imp<_Fp, _Args...>::value>
2937 template <bool _Invokable, class _Fp, class ..._Args>
2938 struct __invoke_of_imp // false
2942 template <class _Fp, class ..._Args>
2943 struct __invoke_of_imp<true, _Fp, _Args...>
2945 typedef typename __invokable_imp<_Fp, _Args...>::type type;
2948 template <class _Fp, class ..._Args>
2950 : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
2954 #endif // _LIBCPP_HAS_NO_VARIADICS
2956 template <class _Tp>
2957 inline _LIBCPP_INLINE_VISIBILITY
2958 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
2961 is_move_constructible<_Tp>::value &&
2962 is_move_assignable<_Tp>::value
2967 swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
2968 is_nothrow_move_assignable<_Tp>::value)
2970 _Tp __t(_VSTD::move(__x));
2971 __x = _VSTD::move(__y);
2972 __y = _VSTD::move(__t);
2975 template <class _ForwardIterator1, class _ForwardIterator2>
2976 inline _LIBCPP_INLINE_VISIBILITY
2978 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
2979 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
2980 _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
2981 *_VSTD::declval<_ForwardIterator2>())))
2992 __nat swap(__any, __any);
2994 template <class _Tp>
2997 typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type;
2998 static const bool value = !is_same<type, __nat>::value;
3003 template <class _Tp>
3004 struct __is_swappable
3005 : public integral_constant<bool, __detail::__swappable<_Tp>::value>
3009 #if __has_feature(cxx_noexcept)
3011 template <bool, class _Tp>
3012 struct __is_nothrow_swappable_imp
3013 : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(),
3014 _VSTD::declval<_Tp&>()))>
3018 template <class _Tp>
3019 struct __is_nothrow_swappable_imp<false, _Tp>
3024 template <class _Tp>
3025 struct __is_nothrow_swappable
3026 : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
3030 #else // __has_feature(cxx_noexcept)
3032 template <class _Tp>
3033 struct __is_nothrow_swappable
3038 #endif // __has_feature(cxx_noexcept)
3040 #ifdef _LIBCXX_UNDERLYING_TYPE
3042 template <class _Tp>
3043 struct underlying_type
3045 typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type;
3048 #else // _LIBCXX_UNDERLYING_TYPE
3050 template <class _Tp, bool _Support = false>
3051 struct underlying_type
3053 static_assert(_Support, "The underyling_type trait requires compiler "
3054 "support. Either no such support exists or "
3055 "libc++ does not know how to use it.");
3058 #endif // _LIBCXX_UNDERLYING_TYPE
3060 _LIBCPP_END_NAMESPACE_STD
3062 #endif // _LIBCPP_TYPE_TRAITS