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; // C++11
23 typedef integral_constant<bool, false> false_type; // C++11
25 template <bool B> // C++14
26 using bool_constant = integral_constant<bool, B>; // C++14
27 typedef bool_constant<true> true_type; // C++14
28 typedef bool_constant<false> false_type; // C++14
31 template <bool, class T = void> struct enable_if;
32 template <bool, class T, class F> struct conditional;
34 // Primary classification traits:
35 template <class T> struct is_void;
36 template <class T> struct is_null_pointer; // C++14
37 template <class T> struct is_integral;
38 template <class T> struct is_floating_point;
39 template <class T> struct is_array;
40 template <class T> struct is_pointer;
41 template <class T> struct is_lvalue_reference;
42 template <class T> struct is_rvalue_reference;
43 template <class T> struct is_member_object_pointer;
44 template <class T> struct is_member_function_pointer;
45 template <class T> struct is_enum;
46 template <class T> struct is_union;
47 template <class T> struct is_class;
48 template <class T> struct is_function;
50 // Secondary classification traits:
51 template <class T> struct is_reference;
52 template <class T> struct is_arithmetic;
53 template <class T> struct is_fundamental;
54 template <class T> struct is_member_pointer;
55 template <class T> struct is_scalar;
56 template <class T> struct is_object;
57 template <class T> struct is_compound;
59 // Const-volatile properties and transformations:
60 template <class T> struct is_const;
61 template <class T> struct is_volatile;
62 template <class T> struct remove_const;
63 template <class T> struct remove_volatile;
64 template <class T> struct remove_cv;
65 template <class T> struct add_const;
66 template <class T> struct add_volatile;
67 template <class T> struct add_cv;
69 // Reference transformations:
70 template <class T> struct remove_reference;
71 template <class T> struct add_lvalue_reference;
72 template <class T> struct add_rvalue_reference;
74 // Pointer transformations:
75 template <class T> struct remove_pointer;
76 template <class T> struct add_pointer;
78 // Integral properties:
79 template <class T> struct is_signed;
80 template <class T> struct is_unsigned;
81 template <class T> struct make_signed;
82 template <class T> struct make_unsigned;
84 // Array properties and transformations:
85 template <class T> struct rank;
86 template <class T, unsigned I = 0> struct extent;
87 template <class T> struct remove_extent;
88 template <class T> struct remove_all_extents;
90 // Member introspection:
91 template <class T> struct is_pod;
92 template <class T> struct is_trivial;
93 template <class T> struct is_trivially_copyable;
94 template <class T> struct is_standard_layout;
95 template <class T> struct is_literal_type;
96 template <class T> struct is_empty;
97 template <class T> struct is_polymorphic;
98 template <class T> struct is_abstract;
99 template <class T> struct is_final; // C++14
101 template <class T, class... Args> struct is_constructible;
102 template <class T> struct is_default_constructible;
103 template <class T> struct is_copy_constructible;
104 template <class T> struct is_move_constructible;
105 template <class T, class U> struct is_assignable;
106 template <class T> struct is_copy_assignable;
107 template <class T> struct is_move_assignable;
108 template <class T> struct is_destructible;
110 template <class T, class... Args> struct is_trivially_constructible;
111 template <class T> struct is_trivially_default_constructible;
112 template <class T> struct is_trivially_copy_constructible;
113 template <class T> struct is_trivially_move_constructible;
114 template <class T, class U> struct is_trivially_assignable;
115 template <class T> struct is_trivially_copy_assignable;
116 template <class T> struct is_trivially_move_assignable;
117 template <class T> struct is_trivially_destructible;
119 template <class T, class... Args> struct is_nothrow_constructible;
120 template <class T> struct is_nothrow_default_constructible;
121 template <class T> struct is_nothrow_copy_constructible;
122 template <class T> struct is_nothrow_move_constructible;
123 template <class T, class U> struct is_nothrow_assignable;
124 template <class T> struct is_nothrow_copy_assignable;
125 template <class T> struct is_nothrow_move_assignable;
126 template <class T> struct is_nothrow_destructible;
128 template <class T> struct has_virtual_destructor;
130 // Relationships between types:
131 template <class T, class U> struct is_same;
132 template <class Base, class Derived> struct is_base_of;
133 template <class From, class To> struct is_convertible;
135 // Alignment properties and transformations:
136 template <class T> struct alignment_of;
137 template <size_t Len, size_t Align = most_stringent_alignment_requirement>
138 struct aligned_storage;
139 template <size_t Len, class... Types> struct aligned_union;
141 template <class T> struct decay;
142 template <class... T> struct common_type;
143 template <class T> struct underlying_type;
144 template <class> class result_of; // undefined
145 template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>;
147 // const-volatile modifications:
149 using remove_const_t = typename remove_const<T>::type; // C++14
151 using remove_volatile_t = typename remove_volatile<T>::type; // C++14
153 using remove_cv_t = typename remove_cv<T>::type; // C++14
155 using add_const_t = typename add_const<T>::type; // C++14
157 using add_volatile_t = typename add_volatile<T>::type; // C++14
159 using add_cv_t = typename add_cv<T>::type; // C++14
161 // reference modifications:
163 using remove_reference_t = typename remove_reference<T>::type; // C++14
165 using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14
167 using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14
169 // sign modifications:
171 using make_signed_t = typename make_signed<T>::type; // C++14
173 using make_unsigned_t = typename make_unsigned<T>::type; // C++14
175 // array modifications:
177 using remove_extent_t = typename remove_extent<T>::type; // C++14
179 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14
181 // pointer modifications:
183 using remove_pointer_t = typename remove_pointer<T>::type; // C++14
185 using add_pointer_t = typename add_pointer<T>::type; // C++14
187 // other transformations:
188 template <size_t Len, std::size_t Align=default-alignment>
189 using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14
190 template <std::size_t Len, class... Types>
191 using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14
193 using decay_t = typename decay<T>::type; // C++14
194 template <bool b, class T=void>
195 using enable_if_t = typename enable_if<b,T>::type; // C++14
196 template <bool b, class T, class F>
197 using conditional_t = typename conditional<b,T,F>::type; // C++14
198 template <class... T>
199 using common_type_t = typename common_type<T...>::type; // C++14
201 using underlying_type_t = typename underlying_type<T>::type; // C++14
202 template <class F, class... ArgTypes>
203 using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14
206 using void_t = void; // C++17
208 // See C++14 20.10.4.1, primary type categories
209 template <class T> constexpr bool is_void_v
210 = is_void<T>::value; // C++17
211 template <class T> constexpr bool is_null_pointer_v
212 = is_null_pointer<T>::value; // C++17
213 template <class T> constexpr bool is_integral_v
214 = is_integral<T>::value; // C++17
215 template <class T> constexpr bool is_floating_point_v
216 = is_floating_point<T>::value; // C++17
217 template <class T> constexpr bool is_array_v
218 = is_array<T>::value; // C++17
219 template <class T> constexpr bool is_pointer_v
220 = is_pointer<T>::value; // C++17
221 template <class T> constexpr bool is_lvalue_reference_v
222 = is_lvalue_reference<T>::value; // C++17
223 template <class T> constexpr bool is_rvalue_reference_v
224 = is_rvalue_reference<T>::value; // C++17
225 template <class T> constexpr bool is_member_object_pointer_v
226 = is_member_object_pointer<T>::value; // C++17
227 template <class T> constexpr bool is_member_function_pointer_v
228 = is_member_function_pointer<T>::value; // C++17
229 template <class T> constexpr bool is_enum_v
230 = is_enum<T>::value; // C++17
231 template <class T> constexpr bool is_union_v
232 = is_union<T>::value; // C++17
233 template <class T> constexpr bool is_class_v
234 = is_class<T>::value; // C++17
235 template <class T> constexpr bool is_function_v
236 = is_function<T>::value; // C++17
238 // See C++14 20.10.4.2, composite type categories
239 template <class T> constexpr bool is_reference_v
240 = is_reference<T>::value; // C++17
241 template <class T> constexpr bool is_arithmetic_v
242 = is_arithmetic<T>::value; // C++17
243 template <class T> constexpr bool is_fundamental_v
244 = is_fundamental<T>::value; // C++17
245 template <class T> constexpr bool is_object_v
246 = is_object<T>::value; // C++17
247 template <class T> constexpr bool is_scalar_v
248 = is_scalar<T>::value; // C++17
249 template <class T> constexpr bool is_compound_v
250 = is_compound<T>::value; // C++17
251 template <class T> constexpr bool is_member_pointer_v
252 = is_member_pointer<T>::value; // C++17
254 // See C++14 20.10.4.3, type properties
255 template <class T> constexpr bool is_const_v
256 = is_const<T>::value; // C++17
257 template <class T> constexpr bool is_volatile_v
258 = is_volatile<T>::value; // C++17
259 template <class T> constexpr bool is_trivial_v
260 = is_trivial<T>::value; // C++17
261 template <class T> constexpr bool is_trivially_copyable_v
262 = is_trivially_copyable<T>::value; // C++17
263 template <class T> constexpr bool is_standard_layout_v
264 = is_standard_layout<T>::value; // C++17
265 template <class T> constexpr bool is_pod_v
266 = is_pod<T>::value; // C++17
267 template <class T> constexpr bool is_literal_type_v
268 = is_literal_type<T>::value; // C++17
269 template <class T> constexpr bool is_empty_v
270 = is_empty<T>::value; // C++17
271 template <class T> constexpr bool is_polymorphic_v
272 = is_polymorphic<T>::value; // C++17
273 template <class T> constexpr bool is_abstract_v
274 = is_abstract<T>::value; // C++17
275 template <class T> constexpr bool is_final_v
276 = is_final<T>::value; // C++17
277 template <class T> constexpr bool is_signed_v
278 = is_signed<T>::value; // C++17
279 template <class T> constexpr bool is_unsigned_v
280 = is_unsigned<T>::value; // C++17
281 template <class T, class... Args> constexpr bool is_constructible_v
282 = is_constructible<T, Args...>::value; // C++17
283 template <class T> constexpr bool is_default_constructible_v
284 = is_default_constructible<T>::value; // C++17
285 template <class T> constexpr bool is_copy_constructible_v
286 = is_copy_constructible<T>::value; // C++17
287 template <class T> constexpr bool is_move_constructible_v
288 = is_move_constructible<T>::value; // C++17
289 template <class T, class U> constexpr bool is_assignable_v
290 = is_assignable<T, U>::value; // C++17
291 template <class T> constexpr bool is_copy_assignable_v
292 = is_copy_assignable<T>::value; // C++17
293 template <class T> constexpr bool is_move_assignable_v
294 = is_move_assignable<T>::value; // C++17
295 template <class T> constexpr bool is_destructible_v
296 = is_destructible<T>::value; // C++17
297 template <class T, class... Args> constexpr bool is_trivially_constructible_v
298 = is_trivially_constructible<T, Args...>::value; // C++17
299 template <class T> constexpr bool is_trivially_default_constructible_v
300 = is_trivially_default_constructible<T>::value; // C++17
301 template <class T> constexpr bool is_trivially_copy_constructible_v
302 = is_trivially_copy_constructible<T>::value; // C++17
303 template <class T> constexpr bool is_trivially_move_constructible_v
304 = is_trivially_move_constructible<T>::value; // C++17
305 template <class T, class U> constexpr bool is_trivially_assignable_v
306 = is_trivially_assignable<T, U>::value; // C++17
307 template <class T> constexpr bool is_trivially_copy_assignable_v
308 = is_trivially_copy_assignable<T>::value; // C++17
309 template <class T> constexpr bool is_trivially_move_assignable_v
310 = is_trivially_move_assignable<T>::value; // C++17
311 template <class T> constexpr bool is_trivially_destructible_v
312 = is_trivially_destructible<T>::value; // C++17
313 template <class T, class... Args> constexpr bool is_nothrow_constructible_v
314 = is_nothrow_constructible<T, Args...>::value; // C++17
315 template <class T> constexpr bool is_nothrow_default_constructible_v
316 = is_nothrow_default_constructible<T>::value; // C++17
317 template <class T> constexpr bool is_nothrow_copy_constructible_v
318 = is_nothrow_copy_constructible<T>::value; // C++17
319 template <class T> constexpr bool is_nothrow_move_constructible_v
320 = is_nothrow_move_constructible<T>::value; // C++17
321 template <class T, class U> constexpr bool is_nothrow_assignable_v
322 = is_nothrow_assignable<T, U>::value; // C++17
323 template <class T> constexpr bool is_nothrow_copy_assignable_v
324 = is_nothrow_copy_assignable<T>::value; // C++17
325 template <class T> constexpr bool is_nothrow_move_assignable_v
326 = is_nothrow_move_assignable<T>::value; // C++17
327 template <class T> constexpr bool is_nothrow_destructible_v
328 = is_nothrow_destructible<T>::value; // C++17
329 template <class T> constexpr bool has_virtual_destructor_v
330 = has_virtual_destructor<T>::value; // C++17
332 // See C++14 20.10.5, type property queries
333 template <class T> constexpr size_t alignment_of_v
334 = alignment_of<T>::value; // C++17
335 template <class T> constexpr size_t rank_v
336 = rank<T>::value; // C++17
337 template <class T, unsigned I = 0> constexpr size_t extent_v
338 = extent<T, I>::value; // C++17
340 // See C++14 20.10.6, type relations
341 template <class T, class U> constexpr bool is_same_v
342 = is_same<T, U>::value; // C++17
343 template <class Base, class Derived> constexpr bool is_base_of_v
344 = is_base_of<Base, Derived>::value; // C++17
345 template <class From, class To> constexpr bool is_convertible_v
346 = is_convertible<From, To>::value; // C++17
348 // [meta.logical], logical operator traits:
349 template<class... B> struct conjunction; // C++17
351 constexpr bool conjunction_v = conjunction<B...>::value; // C++17
352 template<class... B> struct disjunction; // C++17
354 constexpr bool disjunction_v = disjunction<B...>::value; // C++17
355 template<class B> struct negation; // C++17
357 constexpr bool negation_v = negation<B>::value; // C++17
365 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
366 #pragma GCC system_header
369 _LIBCPP_BEGIN_NAMESPACE_STD
372 struct __void_t { typedef void type; };
375 struct __identity { typedef _Tp type; };
377 template <class _Tp, bool>
378 struct _LIBCPP_TYPE_VIS_ONLY __dependent_type : public _Tp {};
380 template <bool _Bp, class _If, class _Then>
381 struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
382 template <class _If, class _Then>
383 struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;};
385 #if _LIBCPP_STD_VER > 11
386 template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
389 template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {};
390 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
392 template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
393 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
395 #if _LIBCPP_STD_VER > 11
396 template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
402 inline _LIBCPP_INLINE_VISIBILITY
404 addressof(_Tp& __x) _NOEXCEPT
406 return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
409 #if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
410 // Objective-C++ Automatic Reference Counting uses qualified pointers
411 // that require special addressof() signatures. When
412 // _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
413 // itself is providing these definitions. Otherwise, we provide them.
415 inline _LIBCPP_INLINE_VISIBILITY
417 addressof(__strong _Tp& __x) _NOEXCEPT
422 #ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
424 inline _LIBCPP_INLINE_VISIBILITY
426 addressof(__weak _Tp& __x) _NOEXCEPT
433 inline _LIBCPP_INLINE_VISIBILITY
435 addressof(__autoreleasing _Tp& __x) _NOEXCEPT
441 inline _LIBCPP_INLINE_VISIBILITY
442 __unsafe_unretained _Tp*
443 addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
449 struct __two {char __lx[2];};
453 template <class _Tp, _Tp __v>
454 struct _LIBCPP_TYPE_VIS_ONLY integral_constant
456 static _LIBCPP_CONSTEXPR const _Tp value = __v;
457 typedef _Tp value_type;
458 typedef integral_constant type;
459 _LIBCPP_INLINE_VISIBILITY
460 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
461 #if _LIBCPP_STD_VER > 11
462 _LIBCPP_INLINE_VISIBILITY
463 constexpr value_type operator ()() const _NOEXCEPT {return value;}
467 template <class _Tp, _Tp __v>
468 _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
470 #if _LIBCPP_STD_VER > 14
472 using bool_constant = integral_constant<bool, __b>;
473 #define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
475 #define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
478 typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
479 typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
481 #if !defined(_LIBCPP_HAS_NO_VARIADICS)
485 template <bool _Last, class ..._Preds>
486 struct __lazy_and_impl;
488 template <class ..._Preds>
489 struct __lazy_and_impl<false, _Preds...> : false_type {};
492 struct __lazy_and_impl<true> : true_type {};
494 template <class _Pred>
495 struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
497 template <class _Hp, class ..._Tp>
498 struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
500 template <class _P1, class ..._Pr>
501 struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
505 template <bool _List, class ..._Preds>
506 struct __lazy_or_impl;
508 template <class ..._Preds>
509 struct __lazy_or_impl<true, _Preds...> : true_type {};
512 struct __lazy_or_impl<false> : false_type {};
514 template <class _Hp, class ..._Tp>
515 struct __lazy_or_impl<false, _Hp, _Tp...>
516 : __lazy_or_impl<_Hp::type::value, _Tp...> {};
518 template <class _P1, class ..._Pr>
519 struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {};
523 template <class _Pred>
524 struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
527 template<class...> struct __and_;
528 template<> struct __and_<> : true_type {};
530 template<class _B0> struct __and_<_B0> : _B0 {};
532 template<class _B0, class _B1>
533 struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
535 template<class _B0, class _B1, class _B2, class... _Bn>
536 struct __and_<_B0, _B1, _B2, _Bn...>
537 : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
540 template<class...> struct __or_;
541 template<> struct __or_<> : false_type {};
543 template<class _B0> struct __or_<_B0> : _B0 {};
545 template<class _B0, class _B1>
546 struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
548 template<class _B0, class _B1, class _B2, class... _Bn>
549 struct __or_<_B0, _B1, _B2, _Bn...>
550 : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
554 struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
556 #endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
560 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {};
561 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {};
563 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
564 template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
565 = is_const<_Tp>::value;
570 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {};
571 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {};
573 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
574 template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
575 = is_volatile<_Tp>::value;
580 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;};
581 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;};
582 #if _LIBCPP_STD_VER > 11
583 template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
588 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;};
589 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;};
590 #if _LIBCPP_STD_VER > 11
591 template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
596 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv
597 {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
598 #if _LIBCPP_STD_VER > 11
599 template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
604 template <class _Tp> struct __libcpp_is_void : public false_type {};
605 template <> struct __libcpp_is_void<void> : public true_type {};
607 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
608 : public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
610 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
611 template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
612 = is_void<_Tp>::value;
617 template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
618 template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
620 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
621 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
623 #if _LIBCPP_STD_VER > 11
624 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
625 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
627 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
628 template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
629 = is_null_pointer<_Tp>::value;
635 template <class _Tp> struct __libcpp_is_integral : public false_type {};
636 template <> struct __libcpp_is_integral<bool> : public true_type {};
637 template <> struct __libcpp_is_integral<char> : public true_type {};
638 template <> struct __libcpp_is_integral<signed char> : public true_type {};
639 template <> struct __libcpp_is_integral<unsigned char> : public true_type {};
640 template <> struct __libcpp_is_integral<wchar_t> : public true_type {};
641 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
642 template <> struct __libcpp_is_integral<char16_t> : public true_type {};
643 template <> struct __libcpp_is_integral<char32_t> : public true_type {};
644 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
645 template <> struct __libcpp_is_integral<short> : public true_type {};
646 template <> struct __libcpp_is_integral<unsigned short> : public true_type {};
647 template <> struct __libcpp_is_integral<int> : public true_type {};
648 template <> struct __libcpp_is_integral<unsigned int> : public true_type {};
649 template <> struct __libcpp_is_integral<long> : public true_type {};
650 template <> struct __libcpp_is_integral<unsigned long> : public true_type {};
651 template <> struct __libcpp_is_integral<long long> : public true_type {};
652 template <> struct __libcpp_is_integral<unsigned long long> : public true_type {};
653 #ifndef _LIBCPP_HAS_NO_INT128
654 template <> struct __libcpp_is_integral<__int128_t> : public true_type {};
655 template <> struct __libcpp_is_integral<__uint128_t> : public true_type {};
658 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
659 : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
661 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
662 template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
663 = is_integral<_Tp>::value;
668 template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
669 template <> struct __libcpp_is_floating_point<float> : public true_type {};
670 template <> struct __libcpp_is_floating_point<double> : public true_type {};
671 template <> struct __libcpp_is_floating_point<long double> : public true_type {};
673 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
674 : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
676 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
677 template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
678 = is_floating_point<_Tp>::value;
683 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array
684 : public false_type {};
685 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]>
686 : public true_type {};
687 template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
688 : public true_type {};
690 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
691 template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
692 = is_array<_Tp>::value;
697 template <class _Tp> struct __libcpp_is_pointer : public false_type {};
698 template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
700 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
701 : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
703 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
704 template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
705 = is_pointer<_Tp>::value;
710 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {};
711 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {};
713 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {};
714 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
715 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {};
718 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {};
719 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {};
720 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
721 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {};
724 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
725 template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
726 = is_reference<_Tp>::value;
728 template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
729 = is_lvalue_reference<_Tp>::value;
731 template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
732 = is_rvalue_reference<_Tp>::value;
736 #if __has_feature(is_union) || (_GNUC_VER >= 403)
738 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
739 : public integral_constant<bool, __is_union(_Tp)> {};
743 template <class _Tp> struct __libcpp_union : public false_type {};
744 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
745 : public __libcpp_union<typename remove_cv<_Tp>::type> {};
749 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
750 template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
751 = is_union<_Tp>::value;
756 #if __has_feature(is_class) || (_GNUC_VER >= 403)
758 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
759 : public integral_constant<bool, __is_class(_Tp)> {};
763 namespace __is_class_imp
765 template <class _Tp> char __test(int _Tp::*);
766 template <class _Tp> __two __test(...);
769 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
770 : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {};
774 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
775 template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
776 = is_class<_Tp>::value;
781 template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {};
782 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {};
784 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
785 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
786 = is_same<_Tp, _Up>::value;
791 namespace __libcpp_is_function_imp
793 struct __dummy_type {};
794 template <class _Tp> char __test(_Tp*);
795 template <class _Tp> char __test(__dummy_type);
796 template <class _Tp> __two __test(...);
797 template <class _Tp> _Tp& __source(int);
798 template <class _Tp> __dummy_type __source(...);
801 template <class _Tp, bool = is_class<_Tp>::value ||
802 is_union<_Tp>::value ||
803 is_void<_Tp>::value ||
804 is_reference<_Tp>::value ||
805 __is_nullptr_t<_Tp>::value >
806 struct __libcpp_is_function
807 : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1>
809 template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
811 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
812 : public __libcpp_is_function<_Tp> {};
814 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
815 template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
816 = is_function<_Tp>::value;
819 // is_member_function_pointer
821 // template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
822 // template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
825 template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
826 struct __member_pointer_traits_imp
827 { // forward declaration; specializations later
831 template <class _Tp> struct __libcpp_is_member_function_pointer
832 : public false_type {};
834 template <class _Ret, class _Class>
835 struct __libcpp_is_member_function_pointer<_Ret _Class::*>
836 : public is_function<_Ret> {};
838 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
839 : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};
841 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
842 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
843 = is_member_function_pointer<_Tp>::value;
848 template <class _Tp> struct __libcpp_is_member_pointer : public false_type {};
849 template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {};
851 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
852 : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
854 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
855 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
856 = is_member_pointer<_Tp>::value;
859 // is_member_object_pointer
861 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer
862 : public integral_constant<bool, is_member_pointer<_Tp>::value &&
863 !is_member_function_pointer<_Tp>::value> {};
865 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
866 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
867 = is_member_object_pointer<_Tp>::value;
872 #if __has_feature(is_enum) || (_GNUC_VER >= 403)
874 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
875 : public integral_constant<bool, __is_enum(_Tp)> {};
879 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
880 : public integral_constant<bool, !is_void<_Tp>::value &&
881 !is_integral<_Tp>::value &&
882 !is_floating_point<_Tp>::value &&
883 !is_array<_Tp>::value &&
884 !is_pointer<_Tp>::value &&
885 !is_reference<_Tp>::value &&
886 !is_member_pointer<_Tp>::value &&
887 !is_union<_Tp>::value &&
888 !is_class<_Tp>::value &&
889 !is_function<_Tp>::value > {};
893 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
894 template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
895 = is_enum<_Tp>::value;
900 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic
901 : public integral_constant<bool, is_integral<_Tp>::value ||
902 is_floating_point<_Tp>::value> {};
904 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
905 template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
906 = is_arithmetic<_Tp>::value;
911 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
912 : public integral_constant<bool, is_void<_Tp>::value ||
913 __is_nullptr_t<_Tp>::value ||
914 is_arithmetic<_Tp>::value> {};
916 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
917 template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
918 = is_fundamental<_Tp>::value;
923 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
924 : public integral_constant<bool, is_arithmetic<_Tp>::value ||
925 is_member_pointer<_Tp>::value ||
926 is_pointer<_Tp>::value ||
927 __is_nullptr_t<_Tp>::value ||
928 is_enum<_Tp>::value > {};
930 template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {};
932 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
933 template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
934 = is_scalar<_Tp>::value;
939 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
940 : public integral_constant<bool, is_scalar<_Tp>::value ||
941 is_array<_Tp>::value ||
942 is_union<_Tp>::value ||
943 is_class<_Tp>::value > {};
945 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
946 template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
947 = is_object<_Tp>::value;
952 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound
953 : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
955 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
956 template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
957 = is_compound<_Tp>::value;
962 template <class _Tp, bool = is_reference<_Tp>::value ||
963 is_function<_Tp>::value ||
964 is_const<_Tp>::value >
965 struct __add_const {typedef _Tp type;};
968 struct __add_const<_Tp, false> {typedef const _Tp type;};
970 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const
971 {typedef typename __add_const<_Tp>::type type;};
973 #if _LIBCPP_STD_VER > 11
974 template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
979 template <class _Tp, bool = is_reference<_Tp>::value ||
980 is_function<_Tp>::value ||
981 is_volatile<_Tp>::value >
982 struct __add_volatile {typedef _Tp type;};
985 struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
987 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile
988 {typedef typename __add_volatile<_Tp>::type type;};
990 #if _LIBCPP_STD_VER > 11
991 template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
996 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv
997 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};
999 #if _LIBCPP_STD_VER > 11
1000 template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
1005 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;};
1006 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;};
1007 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1008 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;};
1011 #if _LIBCPP_STD_VER > 11
1012 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
1015 // add_lvalue_reference
1017 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;};
1018 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler
1019 template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;};
1020 template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;};
1021 template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;};
1022 template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;};
1024 #if _LIBCPP_STD_VER > 11
1025 template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
1028 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1030 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;};
1031 template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;};
1032 template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;};
1033 template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;};
1034 template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;};
1036 #if _LIBCPP_STD_VER > 11
1037 template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
1040 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1042 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1044 template <class _Tp>
1045 typename add_rvalue_reference<_Tp>::type
1046 declval() _NOEXCEPT;
1048 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1050 template <class _Tp>
1051 typename add_lvalue_reference<_Tp>::type
1054 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1063 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;};
1064 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;};
1065 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;};
1066 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;};
1067 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;};
1069 #if _LIBCPP_STD_VER > 11
1070 template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
1075 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer
1076 {typedef typename remove_reference<_Tp>::type* type;};
1078 #if _LIBCPP_STD_VER > 11
1079 template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
1084 template <class _Tp, bool = is_integral<_Tp>::value>
1085 struct __libcpp_is_signed_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) {};
1087 template <class _Tp>
1088 struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point
1090 template <class _Tp, bool = is_arithmetic<_Tp>::value>
1091 struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {};
1093 template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {};
1095 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
1097 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1098 template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
1099 = is_signed<_Tp>::value;
1104 template <class _Tp, bool = is_integral<_Tp>::value>
1105 struct __libcpp_is_unsigned_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) {};
1107 template <class _Tp>
1108 struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
1110 template <class _Tp, bool = is_arithmetic<_Tp>::value>
1111 struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {};
1113 template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
1115 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
1117 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1118 template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
1119 = is_unsigned<_Tp>::value;
1124 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank
1125 : public integral_constant<size_t, 0> {};
1126 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]>
1127 : public integral_constant<size_t, rank<_Tp>::value + 1> {};
1128 template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]>
1129 : public integral_constant<size_t, rank<_Tp>::value + 1> {};
1131 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1132 template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
1138 template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent
1139 : public integral_constant<size_t, 0> {};
1140 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0>
1141 : public integral_constant<size_t, 0> {};
1142 template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip>
1143 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
1144 template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0>
1145 : public integral_constant<size_t, _Np> {};
1146 template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip>
1147 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
1149 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1150 template <class _Tp, unsigned _Ip = 0> _LIBCPP_CONSTEXPR size_t extent_v
1151 = extent<_Tp, _Ip>::value;
1156 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent
1157 {typedef _Tp type;};
1158 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]>
1159 {typedef _Tp type;};
1160 template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]>
1161 {typedef _Tp type;};
1163 #if _LIBCPP_STD_VER > 11
1164 template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
1167 // remove_all_extents
1169 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents
1170 {typedef _Tp type;};
1171 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]>
1172 {typedef typename remove_all_extents<_Tp>::type type;};
1173 template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]>
1174 {typedef typename remove_all_extents<_Tp>::type type;};
1176 #if _LIBCPP_STD_VER > 11
1177 template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
1182 template <class _Tp>
1183 struct _LIBCPP_TYPE_VIS_ONLY decay
1186 typedef typename remove_reference<_Tp>::type _Up;
1188 typedef typename conditional
1190 is_array<_Up>::value,
1191 typename remove_extent<_Up>::type*,
1192 typename conditional
1194 is_function<_Up>::value,
1195 typename add_pointer<_Up>::type,
1196 typename remove_cv<_Up>::type
1201 #if _LIBCPP_STD_VER > 11
1202 template <class _Tp> using decay_t = typename decay<_Tp>::type;
1207 namespace __is_abstract_imp
1209 template <class _Tp> char __test(_Tp (*)[1]);
1210 template <class _Tp> __two __test(...);
1213 template <class _Tp, bool = is_class<_Tp>::value>
1214 struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
1216 template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
1218 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
1220 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1221 template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
1222 = is_abstract<_Tp>::value;
1227 #if defined(_LIBCPP_HAS_IS_FINAL)
1228 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
1229 __libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
1231 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
1232 __libcpp_is_final : public false_type {};
1235 #if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11
1236 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
1237 is_final : public integral_constant<bool, __is_final(_Tp)> {};
1240 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1241 template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
1242 = is_final<_Tp>::value;
1247 #ifdef _LIBCPP_HAS_IS_BASE_OF
1249 template <class _Bp, class _Dp>
1250 struct _LIBCPP_TYPE_VIS_ONLY is_base_of
1251 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
1253 #else // _LIBCPP_HAS_IS_BASE_OF
1255 namespace __is_base_of_imp
1257 template <class _Tp>
1260 _Dst(const volatile _Tp &);
1262 template <class _Tp>
1265 operator const volatile _Tp &();
1266 template <class _Up> operator const _Dst<_Up> &();
1268 template <size_t> struct __one { typedef char type; };
1269 template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
1270 template <class _Bp, class _Dp> __two __test(...);
1273 template <class _Bp, class _Dp>
1274 struct _LIBCPP_TYPE_VIS_ONLY is_base_of
1275 : public integral_constant<bool, is_class<_Bp>::value &&
1276 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};
1278 #endif // _LIBCPP_HAS_IS_BASE_OF
1280 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1281 template <class _Bp, class _Dp> _LIBCPP_CONSTEXPR bool is_base_of_v
1282 = is_base_of<_Bp, _Dp>::value;
1287 #if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
1289 template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
1290 : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
1291 !is_abstract<_T2>::value> {};
1293 #else // __has_feature(is_convertible_to)
1295 namespace __is_convertible_imp
1297 template <class _Tp> void __test_convert(_Tp);
1299 template <class _From, class _To, class = void>
1300 struct __is_convertible_test : public false_type {};
1302 template <class _From, class _To>
1303 struct __is_convertible_test<_From, _To,
1304 decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
1307 template <class _Tp> __two __test(...);
1308 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1309 template <class _Tp> _Tp&& __source();
1311 template <class _Tp> typename remove_reference<_Tp>::type& __source();
1314 template <class _Tp, bool _IsArray = is_array<_Tp>::value,
1315 bool _IsFunction = is_function<_Tp>::value,
1316 bool _IsVoid = is_void<_Tp>::value>
1317 struct __is_array_function_or_void {enum {value = 0};};
1318 template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
1319 template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
1320 template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
1323 template <class _Tp,
1324 unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
1325 struct __is_convertible_check
1327 static const size_t __v = 0;
1330 template <class _Tp>
1331 struct __is_convertible_check<_Tp, 0>
1333 static const size_t __v = sizeof(_Tp);
1336 template <class _T1, class _T2,
1337 unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
1338 unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
1339 struct __is_convertible
1340 : public integral_constant<bool,
1341 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
1342 #if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
1343 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
1344 && (!is_const<typename remove_reference<_T2>::type>::value
1345 || is_volatile<typename remove_reference<_T2>::type>::value)
1346 && (is_same<typename remove_cv<_T1>::type,
1347 typename remove_cv<typename remove_reference<_T2>::type>::type>::value
1348 || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
1353 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};
1355 template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
1356 template <class _T1> struct __is_convertible<const _T1, const _T1&, 1, 0> : true_type {};
1357 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1358 template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
1359 template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
1360 template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {};
1361 template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {};
1362 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1364 template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0>
1365 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {};
1367 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0>
1368 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {};
1370 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0>
1371 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {};
1373 template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0>
1374 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {};
1376 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {};
1377 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1378 template <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {};
1380 template <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {};
1381 template <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {};
1382 template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {};
1383 template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {};
1384 template <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {};
1386 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {};
1388 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
1389 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
1390 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
1391 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
1393 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
1394 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
1395 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
1396 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
1398 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
1399 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
1400 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
1401 template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
1403 template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
1404 : public __is_convertible<_T1, _T2>
1406 static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
1407 static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
1410 #endif // __has_feature(is_convertible_to)
1412 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1413 template <class _From, class _To> _LIBCPP_CONSTEXPR bool is_convertible_v
1414 = is_convertible<_From, _To>::value;
1419 #if __has_feature(is_empty) || (_GNUC_VER >= 407)
1421 template <class _Tp>
1422 struct _LIBCPP_TYPE_VIS_ONLY is_empty
1423 : public integral_constant<bool, __is_empty(_Tp)> {};
1425 #else // __has_feature(is_empty)
1427 template <class _Tp>
1439 template <class _Tp, bool = is_class<_Tp>::value>
1440 struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {};
1442 template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};
1444 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {};
1446 #endif // __has_feature(is_empty)
1448 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1449 template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
1450 = is_empty<_Tp>::value;
1455 #if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
1457 template <class _Tp>
1458 struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
1459 : public integral_constant<bool, __is_polymorphic(_Tp)> {};
1463 template<typename _Tp> char &__is_polymorphic_impl(
1464 typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
1466 template<typename _Tp> __two &__is_polymorphic_impl(...);
1468 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
1469 : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};
1471 #endif // __has_feature(is_polymorphic)
1473 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1474 template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
1475 = is_polymorphic<_Tp>::value;
1478 // has_virtual_destructor
1480 #if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
1482 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
1483 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
1487 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
1488 : public false_type {};
1492 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1493 template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
1494 = has_virtual_destructor<_Tp>::value;
1499 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of
1500 : public integral_constant<size_t, __alignof__(_Tp)> {};
1502 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1503 template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
1504 = alignment_of<_Tp>::value;
1509 template <class _Hp, class _Tp>
1518 #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
1520 __nat(const __nat&) = delete;
1521 __nat& operator=(const __nat&) = delete;
1526 template <class _Tp>
1529 static const size_t value = alignment_of<_Tp>::value;
1533 struct __struct_double {long double __lx;};
1534 struct __struct_double4 {double __lx[4];};
1537 __type_list<__align_type<unsigned char>,
1538 __type_list<__align_type<unsigned short>,
1539 __type_list<__align_type<unsigned int>,
1540 __type_list<__align_type<unsigned long>,
1541 __type_list<__align_type<unsigned long long>,
1542 __type_list<__align_type<double>,
1543 __type_list<__align_type<long double>,
1544 __type_list<__align_type<__struct_double>,
1545 __type_list<__align_type<__struct_double4>,
1546 __type_list<__align_type<int*>,
1548 > > > > > > > > > > __all_types;
1550 template <class _TL, size_t _Align> struct __find_pod;
1552 template <class _Hp, size_t _Align>
1553 struct __find_pod<__type_list<_Hp, __nat>, _Align>
1555 typedef typename conditional<
1556 _Align == _Hp::value,
1562 template <class _Hp, class _Tp, size_t _Align>
1563 struct __find_pod<__type_list<_Hp, _Tp>, _Align>
1565 typedef typename conditional<
1566 _Align == _Hp::value,
1568 typename __find_pod<_Tp, _Align>::type
1572 template <class _TL, size_t _Len> struct __find_max_align;
1574 template <class _Hp, size_t _Len>
1575 struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};
1577 template <size_t _Len, size_t _A1, size_t _A2>
1578 struct __select_align
1581 static const size_t __min = _A2 < _A1 ? _A2 : _A1;
1582 static const size_t __max = _A1 < _A2 ? _A2 : _A1;
1584 static const size_t value = _Len < __max ? __min : __max;
1587 template <class _Hp, class _Tp, size_t _Len>
1588 struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
1589 : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};
1591 template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
1592 struct _LIBCPP_TYPE_VIS_ONLY aligned_storage
1594 typedef typename __find_pod<__all_types, _Align>::type _Aligner;
1595 static_assert(!is_void<_Aligner>::value, "");
1599 unsigned char __data[(_Len + _Align - 1)/_Align * _Align];
1603 #if _LIBCPP_STD_VER > 11
1604 template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
1605 using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
1608 #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \
1609 template <size_t _Len>\
1610 struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\
1612 struct _ALIGNAS(n) type\
1614 unsigned char __lx[(_Len + n - 1)/n * n];\
1618 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1);
1619 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
1620 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4);
1621 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8);
1622 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10);
1623 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20);
1624 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40);
1625 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80);
1626 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100);
1627 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200);
1628 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400);
1629 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
1630 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
1631 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
1632 // MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
1633 #if !defined(_LIBCPP_MSVC)
1634 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
1635 #endif // !_LIBCPP_MSVC
1637 #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
1639 #ifndef _LIBCPP_HAS_NO_VARIADICS
1643 template <size_t _I0, size_t ..._In>
1644 struct __static_max;
1646 template <size_t _I0>
1647 struct __static_max<_I0>
1649 static const size_t value = _I0;
1652 template <size_t _I0, size_t _I1, size_t ..._In>
1653 struct __static_max<_I0, _I1, _In...>
1655 static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value :
1656 __static_max<_I1, _In...>::value;
1659 template <size_t _Len, class _Type0, class ..._Types>
1660 struct aligned_union
1662 static const size_t alignment_value = __static_max<__alignof__(_Type0),
1663 __alignof__(_Types)...>::value;
1664 static const size_t __len = __static_max<_Len, sizeof(_Type0),
1665 sizeof(_Types)...>::value;
1666 typedef typename aligned_storage<__len, alignment_value>::type type;
1669 #if _LIBCPP_STD_VER > 11
1670 template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
1673 #endif // _LIBCPP_HAS_NO_VARIADICS
1675 template <class _Tp>
1676 struct __numeric_type
1678 static void __test(...);
1679 static float __test(float);
1680 static double __test(char);
1681 static double __test(int);
1682 static double __test(unsigned);
1683 static double __test(long);
1684 static double __test(unsigned long);
1685 static double __test(long long);
1686 static double __test(unsigned long long);
1687 static double __test(double);
1688 static long double __test(long double);
1690 typedef decltype(__test(declval<_Tp>())) type;
1691 static const bool value = !is_same<type, void>::value;
1695 struct __numeric_type<void>
1697 static const bool value = true;
1702 template <class _A1, class _A2 = void, class _A3 = void,
1703 bool = __numeric_type<_A1>::value &&
1704 __numeric_type<_A2>::value &&
1705 __numeric_type<_A3>::value>
1709 static const bool value = false;
1712 template <class _A1, class _A2, class _A3>
1713 class __promote_imp<_A1, _A2, _A3, true>
1716 typedef typename __promote_imp<_A1>::type __type1;
1717 typedef typename __promote_imp<_A2>::type __type2;
1718 typedef typename __promote_imp<_A3>::type __type3;
1720 typedef decltype(__type1() + __type2() + __type3()) type;
1721 static const bool value = true;
1724 template <class _A1, class _A2>
1725 class __promote_imp<_A1, _A2, void, true>
1728 typedef typename __promote_imp<_A1>::type __type1;
1729 typedef typename __promote_imp<_A2>::type __type2;
1731 typedef decltype(__type1() + __type2()) type;
1732 static const bool value = true;
1735 template <class _A1>
1736 class __promote_imp<_A1, void, void, true>
1739 typedef typename __numeric_type<_A1>::type type;
1740 static const bool value = true;
1743 template <class _A1, class _A2 = void, class _A3 = void>
1744 class __promote : public __promote_imp<_A1, _A2, _A3> {};
1746 // make_signed / make_unsigned
1749 __type_list<signed char,
1750 __type_list<signed short,
1751 __type_list<signed int,
1752 __type_list<signed long,
1753 __type_list<signed long long,
1754 #ifndef _LIBCPP_HAS_NO_INT128
1755 __type_list<__int128_t,
1758 #ifndef _LIBCPP_HAS_NO_INT128
1761 > > > > > __signed_types;
1764 __type_list<unsigned char,
1765 __type_list<unsigned short,
1766 __type_list<unsigned int,
1767 __type_list<unsigned long,
1768 __type_list<unsigned long long,
1769 #ifndef _LIBCPP_HAS_NO_INT128
1770 __type_list<__uint128_t,
1773 #ifndef _LIBCPP_HAS_NO_INT128
1776 > > > > > __unsigned_types;
1778 template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
1780 template <class _Hp, class _Tp, size_t _Size>
1781 struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
1786 template <class _Hp, class _Tp, size_t _Size>
1787 struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
1789 typedef typename __find_first<_Tp, _Size>::type type;
1792 template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
1793 bool = is_volatile<typename remove_reference<_Tp>::type>::value>
1799 template <class _Tp, class _Up>
1800 struct __apply_cv<_Tp, _Up, true, false>
1802 typedef const _Up type;
1805 template <class _Tp, class _Up>
1806 struct __apply_cv<_Tp, _Up, false, true>
1808 typedef volatile _Up type;
1811 template <class _Tp, class _Up>
1812 struct __apply_cv<_Tp, _Up, true, true>
1814 typedef const volatile _Up type;
1817 template <class _Tp, class _Up>
1818 struct __apply_cv<_Tp&, _Up, false, false>
1823 template <class _Tp, class _Up>
1824 struct __apply_cv<_Tp&, _Up, true, false>
1826 typedef const _Up& type;
1829 template <class _Tp, class _Up>
1830 struct __apply_cv<_Tp&, _Up, false, true>
1832 typedef volatile _Up& type;
1835 template <class _Tp, class _Up>
1836 struct __apply_cv<_Tp&, _Up, true, true>
1838 typedef const volatile _Up& type;
1841 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
1842 struct __make_signed {};
1844 template <class _Tp>
1845 struct __make_signed<_Tp, true>
1847 typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
1850 template <> struct __make_signed<bool, true> {};
1851 template <> struct __make_signed< signed short, true> {typedef short type;};
1852 template <> struct __make_signed<unsigned short, true> {typedef short type;};
1853 template <> struct __make_signed< signed int, true> {typedef int type;};
1854 template <> struct __make_signed<unsigned int, true> {typedef int type;};
1855 template <> struct __make_signed< signed long, true> {typedef long type;};
1856 template <> struct __make_signed<unsigned long, true> {typedef long type;};
1857 template <> struct __make_signed< signed long long, true> {typedef long long type;};
1858 template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
1859 #ifndef _LIBCPP_HAS_NO_INT128
1860 template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;};
1861 template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;};
1864 template <class _Tp>
1865 struct _LIBCPP_TYPE_VIS_ONLY make_signed
1867 typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
1870 #if _LIBCPP_STD_VER > 11
1871 template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type;
1874 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
1875 struct __make_unsigned {};
1877 template <class _Tp>
1878 struct __make_unsigned<_Tp, true>
1880 typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
1883 template <> struct __make_unsigned<bool, true> {};
1884 template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;};
1885 template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;};
1886 template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;};
1887 template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;};
1888 template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;};
1889 template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;};
1890 template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;};
1891 template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
1892 #ifndef _LIBCPP_HAS_NO_INT128
1893 template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;};
1894 template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;};
1897 template <class _Tp>
1898 struct _LIBCPP_TYPE_VIS_ONLY make_unsigned
1900 typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
1903 #if _LIBCPP_STD_VER > 11
1904 template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
1907 #ifdef _LIBCPP_HAS_NO_VARIADICS
1909 template <class _Tp, class _Up = void, class _Vp = void>
1910 struct _LIBCPP_TYPE_VIS_ONLY common_type
1913 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
1916 template <class _Tp>
1917 struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void>
1920 typedef typename decay<_Tp>::type type;
1923 template <class _Tp, class _Up>
1924 struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void>
1926 typedef typename decay<decltype(
1927 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
1931 #else // _LIBCPP_HAS_NO_VARIADICS
1933 // bullet 1 - sizeof...(Tp) == 0
1935 template <class ..._Tp>
1936 struct _LIBCPP_TYPE_VIS_ONLY common_type {};
1938 // bullet 2 - sizeof...(Tp) == 1
1940 template <class _Tp>
1941 struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp>
1943 typedef typename decay<_Tp>::type type;
1946 // bullet 3 - sizeof...(Tp) == 2
1948 template <class _Tp, class _Up, class = void>
1949 struct __common_type2 {};
1951 template <class _Tp, class _Up>
1952 struct __common_type2<_Tp, _Up,
1953 typename __void_t<decltype(
1954 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
1957 typedef typename decay<decltype(
1958 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
1962 template <class _Tp, class _Up>
1963 struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up>
1964 : __common_type2<_Tp, _Up> {};
1966 // bullet 4 - sizeof...(Tp) > 2
1968 template <class ...Tp> struct __common_types;
1970 template <class, class = void>
1971 struct __common_type_impl {};
1973 template <class _Tp, class _Up, class ..._Vp>
1974 struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>,
1975 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
1977 typedef typename common_type<
1978 typename common_type<_Tp, _Up>::type, _Vp...
1982 template <class _Tp, class _Up, class ..._Vp>
1983 struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
1984 : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
1986 #if _LIBCPP_STD_VER > 11
1987 template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
1990 #endif // _LIBCPP_HAS_NO_VARIADICS
1994 template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; };
1996 template <class _Tp, class _Arg>
1997 typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type
1998 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1999 __is_assignable_test(_Tp&&, _Arg&&);
2001 __is_assignable_test(_Tp, _Arg&);
2004 template <class _Arg>
2006 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2007 __is_assignable_test(__any, _Arg&&);
2009 __is_assignable_test(__any, _Arg&);
2012 template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
2013 struct __is_assignable_imp
2014 : public common_type
2016 decltype(_VSTD::__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
2019 template <class _Tp, class _Arg>
2020 struct __is_assignable_imp<_Tp, _Arg, true>
2025 template <class _Tp, class _Arg>
2026 struct is_assignable
2027 : public __is_assignable_imp<_Tp, _Arg> {};
2029 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
2030 template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_assignable_v
2031 = is_assignable<_Tp, _Arg>::value;
2034 // is_copy_assignable
2036 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
2037 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
2038 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
2040 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
2041 template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
2042 = is_copy_assignable<_Tp>::value;
2045 // is_move_assignable
2047 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable
2048 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2049 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
2050 const typename add_rvalue_reference<_Tp>::type> {};
2052 : public is_copy_assignable<_Tp> {};
2055 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
2056 template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
2057 = is_move_assignable<_Tp>::value;
2062 // if it's a reference, return true
2063 // if it's a function, return false
2064 // if it's void, return false
2065 // if it's an array of unknown bound, return false
2066 // Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed
2067 // where _Up is remove_all_extents<_Tp>::type
2070 struct __is_destructible_apply { typedef int type; };
2072 template <typename _Tp>
2073 struct __is_destructor_wellformed {
2074 template <typename _Tp1>
2075 static char __test (
2076 typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type
2079 template <typename _Tp1>
2080 static __two __test (...);
2082 static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
2085 template <class _Tp, bool>
2086 struct __destructible_imp;
2088 template <class _Tp>
2089 struct __destructible_imp<_Tp, false>
2090 : public _VSTD::integral_constant<bool,
2091 __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {};
2093 template <class _Tp>
2094 struct __destructible_imp<_Tp, true>
2095 : public _VSTD::true_type {};
2097 template <class _Tp, bool>
2098 struct __destructible_false;
2100 template <class _Tp>
2101 struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {};
2103 template <class _Tp>
2104 struct __destructible_false<_Tp, true> : public _VSTD::false_type {};
2106 template <class _Tp>
2107 struct is_destructible
2108 : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {};
2110 template <class _Tp>
2111 struct is_destructible<_Tp[]>
2112 : public _VSTD::false_type {};
2115 struct is_destructible<void>
2116 : public _VSTD::false_type {};
2118 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
2119 template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
2120 = is_destructible<_Tp>::value;
2125 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2127 template <class _Tp>
2128 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2129 typename remove_reference<_Tp>::type&&
2130 move(_Tp&& __t) _NOEXCEPT
2132 typedef typename remove_reference<_Tp>::type _Up;
2133 return static_cast<_Up&&>(__t);
2136 template <class _Tp>
2137 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2139 forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
2141 return static_cast<_Tp&&>(__t);
2144 template <class _Tp>
2145 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2147 forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
2149 static_assert(!std::is_lvalue_reference<_Tp>::value,
2150 "Can not forward an rvalue as an lvalue.");
2151 return static_cast<_Tp&&>(__t);
2154 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2156 template <class _Tp>
2157 inline _LIBCPP_INLINE_VISIBILITY
2164 template <class _Tp>
2165 inline _LIBCPP_INLINE_VISIBILITY
2167 move(const _Tp& __t)
2172 template <class _Tp>
2173 inline _LIBCPP_INLINE_VISIBILITY
2175 forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
2181 template <class _Tp>
2184 typedef typename remove_reference<_Tp>::type _Trr;
2187 _LIBCPP_INLINE_VISIBILITY
2188 _Trr* operator->() {return &t_;}
2189 _LIBCPP_INLINE_VISIBILITY
2190 explicit __rv(_Trr& __t) : t_(__t) {}
2193 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2195 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2197 template <class _Tp>
2198 inline _LIBCPP_INLINE_VISIBILITY
2199 typename decay<_Tp>::type
2200 __decay_copy(_Tp&& __t)
2202 return _VSTD::forward<_Tp>(__t);
2207 template <class _Tp>
2208 inline _LIBCPP_INLINE_VISIBILITY
2209 typename decay<_Tp>::type
2210 __decay_copy(const _Tp& __t)
2212 return _VSTD::forward<_Tp>(__t);
2217 #ifndef _LIBCPP_HAS_NO_VARIADICS
2219 template <class _Rp, class _Class, class ..._Param>
2220 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
2222 typedef _Class _ClassType;
2223 typedef _Rp _ReturnType;
2224 typedef _Rp (_FnType) (_Param...);
2227 template <class _Rp, class _Class, class ..._Param>
2228 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
2230 typedef _Class _ClassType;
2231 typedef _Rp _ReturnType;
2232 typedef _Rp (_FnType) (_Param..., ...);
2235 template <class _Rp, class _Class, class ..._Param>
2236 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
2238 typedef _Class const _ClassType;
2239 typedef _Rp _ReturnType;
2240 typedef _Rp (_FnType) (_Param...);
2243 template <class _Rp, class _Class, class ..._Param>
2244 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
2246 typedef _Class const _ClassType;
2247 typedef _Rp _ReturnType;
2248 typedef _Rp (_FnType) (_Param..., ...);
2251 template <class _Rp, class _Class, class ..._Param>
2252 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
2254 typedef _Class volatile _ClassType;
2255 typedef _Rp _ReturnType;
2256 typedef _Rp (_FnType) (_Param...);
2259 template <class _Rp, class _Class, class ..._Param>
2260 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
2262 typedef _Class volatile _ClassType;
2263 typedef _Rp _ReturnType;
2264 typedef _Rp (_FnType) (_Param..., ...);
2267 template <class _Rp, class _Class, class ..._Param>
2268 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
2270 typedef _Class const volatile _ClassType;
2271 typedef _Rp _ReturnType;
2272 typedef _Rp (_FnType) (_Param...);
2275 template <class _Rp, class _Class, class ..._Param>
2276 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
2278 typedef _Class const volatile _ClassType;
2279 typedef _Rp _ReturnType;
2280 typedef _Rp (_FnType) (_Param..., ...);
2283 #if __has_feature(cxx_reference_qualified_functions) || \
2284 (defined(_GNUC_VER) && _GNUC_VER >= 409)
2286 template <class _Rp, class _Class, class ..._Param>
2287 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
2289 typedef _Class& _ClassType;
2290 typedef _Rp _ReturnType;
2291 typedef _Rp (_FnType) (_Param...);
2294 template <class _Rp, class _Class, class ..._Param>
2295 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
2297 typedef _Class& _ClassType;
2298 typedef _Rp _ReturnType;
2299 typedef _Rp (_FnType) (_Param..., ...);
2302 template <class _Rp, class _Class, class ..._Param>
2303 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
2305 typedef _Class const& _ClassType;
2306 typedef _Rp _ReturnType;
2307 typedef _Rp (_FnType) (_Param...);
2310 template <class _Rp, class _Class, class ..._Param>
2311 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
2313 typedef _Class const& _ClassType;
2314 typedef _Rp _ReturnType;
2315 typedef _Rp (_FnType) (_Param..., ...);
2318 template <class _Rp, class _Class, class ..._Param>
2319 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
2321 typedef _Class volatile& _ClassType;
2322 typedef _Rp _ReturnType;
2323 typedef _Rp (_FnType) (_Param...);
2326 template <class _Rp, class _Class, class ..._Param>
2327 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
2329 typedef _Class volatile& _ClassType;
2330 typedef _Rp _ReturnType;
2331 typedef _Rp (_FnType) (_Param..., ...);
2334 template <class _Rp, class _Class, class ..._Param>
2335 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
2337 typedef _Class const volatile& _ClassType;
2338 typedef _Rp _ReturnType;
2339 typedef _Rp (_FnType) (_Param...);
2342 template <class _Rp, class _Class, class ..._Param>
2343 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
2345 typedef _Class const volatile& _ClassType;
2346 typedef _Rp _ReturnType;
2347 typedef _Rp (_FnType) (_Param..., ...);
2350 template <class _Rp, class _Class, class ..._Param>
2351 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
2353 typedef _Class&& _ClassType;
2354 typedef _Rp _ReturnType;
2355 typedef _Rp (_FnType) (_Param...);
2358 template <class _Rp, class _Class, class ..._Param>
2359 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
2361 typedef _Class&& _ClassType;
2362 typedef _Rp _ReturnType;
2363 typedef _Rp (_FnType) (_Param..., ...);
2366 template <class _Rp, class _Class, class ..._Param>
2367 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
2369 typedef _Class const&& _ClassType;
2370 typedef _Rp _ReturnType;
2371 typedef _Rp (_FnType) (_Param...);
2374 template <class _Rp, class _Class, class ..._Param>
2375 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
2377 typedef _Class const&& _ClassType;
2378 typedef _Rp _ReturnType;
2379 typedef _Rp (_FnType) (_Param..., ...);
2382 template <class _Rp, class _Class, class ..._Param>
2383 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
2385 typedef _Class volatile&& _ClassType;
2386 typedef _Rp _ReturnType;
2387 typedef _Rp (_FnType) (_Param...);
2390 template <class _Rp, class _Class, class ..._Param>
2391 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
2393 typedef _Class volatile&& _ClassType;
2394 typedef _Rp _ReturnType;
2395 typedef _Rp (_FnType) (_Param..., ...);
2398 template <class _Rp, class _Class, class ..._Param>
2399 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
2401 typedef _Class const volatile&& _ClassType;
2402 typedef _Rp _ReturnType;
2403 typedef _Rp (_FnType) (_Param...);
2406 template <class _Rp, class _Class, class ..._Param>
2407 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
2409 typedef _Class const volatile&& _ClassType;
2410 typedef _Rp _ReturnType;
2411 typedef _Rp (_FnType) (_Param..., ...);
2414 #endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
2416 #else // _LIBCPP_HAS_NO_VARIADICS
2418 template <class _Rp, class _Class>
2419 struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
2421 typedef _Class _ClassType;
2422 typedef _Rp _ReturnType;
2423 typedef _Rp (_FnType) ();
2426 template <class _Rp, class _Class>
2427 struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
2429 typedef _Class _ClassType;
2430 typedef _Rp _ReturnType;
2431 typedef _Rp (_FnType) (...);
2434 template <class _Rp, class _Class, class _P0>
2435 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
2437 typedef _Class _ClassType;
2438 typedef _Rp _ReturnType;
2439 typedef _Rp (_FnType) (_P0);
2442 template <class _Rp, class _Class, class _P0>
2443 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
2445 typedef _Class _ClassType;
2446 typedef _Rp _ReturnType;
2447 typedef _Rp (_FnType) (_P0, ...);
2450 template <class _Rp, class _Class, class _P0, class _P1>
2451 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
2453 typedef _Class _ClassType;
2454 typedef _Rp _ReturnType;
2455 typedef _Rp (_FnType) (_P0, _P1);
2458 template <class _Rp, class _Class, class _P0, class _P1>
2459 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
2461 typedef _Class _ClassType;
2462 typedef _Rp _ReturnType;
2463 typedef _Rp (_FnType) (_P0, _P1, ...);
2466 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2467 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
2469 typedef _Class _ClassType;
2470 typedef _Rp _ReturnType;
2471 typedef _Rp (_FnType) (_P0, _P1, _P2);
2474 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2475 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
2477 typedef _Class _ClassType;
2478 typedef _Rp _ReturnType;
2479 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2482 template <class _Rp, class _Class>
2483 struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
2485 typedef _Class const _ClassType;
2486 typedef _Rp _ReturnType;
2487 typedef _Rp (_FnType) ();
2490 template <class _Rp, class _Class>
2491 struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
2493 typedef _Class const _ClassType;
2494 typedef _Rp _ReturnType;
2495 typedef _Rp (_FnType) (...);
2498 template <class _Rp, class _Class, class _P0>
2499 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
2501 typedef _Class const _ClassType;
2502 typedef _Rp _ReturnType;
2503 typedef _Rp (_FnType) (_P0);
2506 template <class _Rp, class _Class, class _P0>
2507 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
2509 typedef _Class const _ClassType;
2510 typedef _Rp _ReturnType;
2511 typedef _Rp (_FnType) (_P0, ...);
2514 template <class _Rp, class _Class, class _P0, class _P1>
2515 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
2517 typedef _Class const _ClassType;
2518 typedef _Rp _ReturnType;
2519 typedef _Rp (_FnType) (_P0, _P1);
2522 template <class _Rp, class _Class, class _P0, class _P1>
2523 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
2525 typedef _Class const _ClassType;
2526 typedef _Rp _ReturnType;
2527 typedef _Rp (_FnType) (_P0, _P1, ...);
2530 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2531 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
2533 typedef _Class const _ClassType;
2534 typedef _Rp _ReturnType;
2535 typedef _Rp (_FnType) (_P0, _P1, _P2);
2538 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2539 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
2541 typedef _Class const _ClassType;
2542 typedef _Rp _ReturnType;
2543 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2546 template <class _Rp, class _Class>
2547 struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
2549 typedef _Class volatile _ClassType;
2550 typedef _Rp _ReturnType;
2551 typedef _Rp (_FnType) ();
2554 template <class _Rp, class _Class>
2555 struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
2557 typedef _Class volatile _ClassType;
2558 typedef _Rp _ReturnType;
2559 typedef _Rp (_FnType) (...);
2562 template <class _Rp, class _Class, class _P0>
2563 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
2565 typedef _Class volatile _ClassType;
2566 typedef _Rp _ReturnType;
2567 typedef _Rp (_FnType) (_P0);
2570 template <class _Rp, class _Class, class _P0>
2571 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
2573 typedef _Class volatile _ClassType;
2574 typedef _Rp _ReturnType;
2575 typedef _Rp (_FnType) (_P0, ...);
2578 template <class _Rp, class _Class, class _P0, class _P1>
2579 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
2581 typedef _Class volatile _ClassType;
2582 typedef _Rp _ReturnType;
2583 typedef _Rp (_FnType) (_P0, _P1);
2586 template <class _Rp, class _Class, class _P0, class _P1>
2587 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
2589 typedef _Class volatile _ClassType;
2590 typedef _Rp _ReturnType;
2591 typedef _Rp (_FnType) (_P0, _P1, ...);
2594 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2595 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
2597 typedef _Class volatile _ClassType;
2598 typedef _Rp _ReturnType;
2599 typedef _Rp (_FnType) (_P0, _P1, _P2);
2602 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2603 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
2605 typedef _Class volatile _ClassType;
2606 typedef _Rp _ReturnType;
2607 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2610 template <class _Rp, class _Class>
2611 struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
2613 typedef _Class const volatile _ClassType;
2614 typedef _Rp _ReturnType;
2615 typedef _Rp (_FnType) ();
2618 template <class _Rp, class _Class>
2619 struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
2621 typedef _Class const volatile _ClassType;
2622 typedef _Rp _ReturnType;
2623 typedef _Rp (_FnType) (...);
2626 template <class _Rp, class _Class, class _P0>
2627 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
2629 typedef _Class const volatile _ClassType;
2630 typedef _Rp _ReturnType;
2631 typedef _Rp (_FnType) (_P0);
2634 template <class _Rp, class _Class, class _P0>
2635 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
2637 typedef _Class const volatile _ClassType;
2638 typedef _Rp _ReturnType;
2639 typedef _Rp (_FnType) (_P0, ...);
2642 template <class _Rp, class _Class, class _P0, class _P1>
2643 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
2645 typedef _Class const volatile _ClassType;
2646 typedef _Rp _ReturnType;
2647 typedef _Rp (_FnType) (_P0, _P1);
2650 template <class _Rp, class _Class, class _P0, class _P1>
2651 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
2653 typedef _Class const volatile _ClassType;
2654 typedef _Rp _ReturnType;
2655 typedef _Rp (_FnType) (_P0, _P1, ...);
2658 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2659 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
2661 typedef _Class const volatile _ClassType;
2662 typedef _Rp _ReturnType;
2663 typedef _Rp (_FnType) (_P0, _P1, _P2);
2666 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2667 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
2669 typedef _Class const volatile _ClassType;
2670 typedef _Rp _ReturnType;
2671 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2674 #endif // _LIBCPP_HAS_NO_VARIADICS
2676 template <class _Rp, class _Class>
2677 struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
2679 typedef _Class _ClassType;
2680 typedef _Rp _ReturnType;
2683 template <class _MP>
2684 struct __member_pointer_traits
2685 : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
2686 is_member_function_pointer<_MP>::value,
2687 is_member_object_pointer<_MP>::value>
2689 // typedef ... _ClassType;
2690 // typedef ... _ReturnType;
2691 // typedef ... _FnType;
2696 template <class _Callable> class result_of;
2698 #ifdef _LIBCPP_HAS_NO_VARIADICS
2700 template <class _Fn, bool, bool>
2705 template <class _Fn>
2706 class __result_of<_Fn(), true, false>
2709 typedef decltype(declval<_Fn>()()) type;
2712 template <class _Fn, class _A0>
2713 class __result_of<_Fn(_A0), true, false>
2716 typedef decltype(declval<_Fn>()(declval<_A0>())) type;
2719 template <class _Fn, class _A0, class _A1>
2720 class __result_of<_Fn(_A0, _A1), true, false>
2723 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
2726 template <class _Fn, class _A0, class _A1, class _A2>
2727 class __result_of<_Fn(_A0, _A1, _A2), true, false>
2730 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
2733 template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
2734 struct __result_of_mp;
2736 // member function pointer
2738 template <class _MP, class _Tp>
2739 struct __result_of_mp<_MP, _Tp, true>
2740 : public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
2744 // member data pointer
2746 template <class _MP, class _Tp, bool>
2747 struct __result_of_mdp;
2749 template <class _Rp, class _Class, class _Tp>
2750 struct __result_of_mdp<_Rp _Class::*, _Tp, false>
2752 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
2755 template <class _Rp, class _Class, class _Tp>
2756 struct __result_of_mdp<_Rp _Class::*, _Tp, true>
2758 typedef typename __apply_cv<_Tp, _Rp>::type& type;
2761 template <class _Rp, class _Class, class _Tp>
2762 struct __result_of_mp<_Rp _Class::*, _Tp, false>
2763 : public __result_of_mdp<_Rp _Class::*, _Tp,
2764 is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
2770 template <class _Fn, class _Tp>
2771 class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer
2772 : public __result_of_mp<typename remove_reference<_Fn>::type,
2774 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
2778 template <class _Fn, class _Tp, class _A0>
2779 class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer
2780 : public __result_of_mp<typename remove_reference<_Fn>::type,
2782 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
2786 template <class _Fn, class _Tp, class _A0, class _A1>
2787 class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer
2788 : public __result_of_mp<typename remove_reference<_Fn>::type,
2790 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
2794 template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
2795 class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer
2796 : public __result_of_mp<typename remove_reference<_Fn>::type,
2798 is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
2804 template <class _Fn>
2805 class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()>
2806 : public __result_of<_Fn(),
2807 is_class<typename remove_reference<_Fn>::type>::value ||
2808 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
2809 is_member_pointer<typename remove_reference<_Fn>::type>::value
2814 template <class _Fn, class _A0>
2815 class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)>
2816 : public __result_of<_Fn(_A0),
2817 is_class<typename remove_reference<_Fn>::type>::value ||
2818 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
2819 is_member_pointer<typename remove_reference<_Fn>::type>::value
2824 template <class _Fn, class _A0, class _A1>
2825 class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)>
2826 : public __result_of<_Fn(_A0, _A1),
2827 is_class<typename remove_reference<_Fn>::type>::value ||
2828 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
2829 is_member_pointer<typename remove_reference<_Fn>::type>::value
2834 template <class _Fn, class _A0, class _A1, class _A2>
2835 class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)>
2836 : public __result_of<_Fn(_A0, _A1, _A2),
2837 is_class<typename remove_reference<_Fn>::type>::value ||
2838 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
2839 is_member_pointer<typename remove_reference<_Fn>::type>::value
2844 #endif // _LIBCPP_HAS_NO_VARIADICS
2846 // template <class T, class... Args> struct is_constructible;
2848 namespace __is_construct
2853 #if __has_feature(is_constructible)
2855 template <class _Tp, class ..._Args>
2856 struct _LIBCPP_TYPE_VIS_ONLY is_constructible
2857 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
2862 #ifndef _LIBCPP_HAS_NO_VARIADICS
2864 // main is_constructible test
2866 template <class _Tp, class ..._Args>
2867 typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type
2868 __is_constructible_test(_Tp&&, _Args&& ...);
2870 template <class ..._Args>
2872 __is_constructible_test(__any, _Args&& ...);
2874 template <bool, class _Tp, class... _Args>
2875 struct __libcpp_is_constructible // false, _Tp is not a scalar
2876 : public common_type
2878 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
2882 // function types are not constructible
2884 template <class _Rp, class... _A1, class... _A2>
2885 struct __libcpp_is_constructible<false, _Rp(_A1...), _A2...>
2889 // handle scalars and reference types
2891 // Scalars are default constructible, references are not
2893 template <class _Tp>
2894 struct __libcpp_is_constructible<true, _Tp>
2895 : public is_scalar<_Tp>
2898 // Scalars and references are constructible from one arg if that arg is
2899 // implicitly convertible to the scalar or reference.
2901 template <class _Tp>
2902 struct __is_constructible_ref
2904 true_type static __lxx(_Tp);
2905 false_type static __lxx(...);
2908 template <class _Tp, class _A0>
2909 struct __libcpp_is_constructible<true, _Tp, _A0>
2910 : public common_type
2912 decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>()))
2916 // Scalars and references are not constructible from multiple args.
2918 template <class _Tp, class _A0, class ..._Args>
2919 struct __libcpp_is_constructible<true, _Tp, _A0, _Args...>
2923 // Treat scalars and reference types separately
2925 template <bool, class _Tp, class... _Args>
2926 struct __is_constructible_void_check
2927 : public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
2931 // If any of T or Args is void, is_constructible should be false
2933 template <class _Tp, class... _Args>
2934 struct __is_constructible_void_check<true, _Tp, _Args...>
2938 template <class ..._Args> struct __contains_void;
2940 template <> struct __contains_void<> : false_type {};
2942 template <class _A0, class ..._Args>
2943 struct __contains_void<_A0, _Args...>
2945 static const bool value = is_void<_A0>::value ||
2946 __contains_void<_Args...>::value;
2949 // is_constructible entry point
2951 template <class _Tp, class... _Args>
2952 struct _LIBCPP_TYPE_VIS_ONLY is_constructible
2953 : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
2954 || is_abstract<_Tp>::value,
2958 // Array types are default constructible if their element type
2959 // is default constructible
2961 template <class _Ap, size_t _Np>
2962 struct __libcpp_is_constructible<false, _Ap[_Np]>
2963 : public is_constructible<typename remove_all_extents<_Ap>::type>
2966 // Otherwise array types are not constructible by this syntax
2968 template <class _Ap, size_t _Np, class ..._Args>
2969 struct __libcpp_is_constructible<false, _Ap[_Np], _Args...>
2973 // Incomplete array types are not constructible
2975 template <class _Ap, class ..._Args>
2976 struct __libcpp_is_constructible<false, _Ap[], _Args...>
2980 #else // _LIBCPP_HAS_NO_VARIADICS
2982 // template <class T> struct is_constructible0;
2984 // main is_constructible0 test
2986 template <class _Tp>
2987 decltype((_Tp(), true_type()))
2988 __is_constructible0_test(_Tp&);
2991 __is_constructible0_test(__any);
2993 template <class _Tp, class _A0>
2994 decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
2995 __is_constructible1_test(_Tp&, _A0&);
2997 template <class _A0>
2999 __is_constructible1_test(__any, _A0&);
3001 template <class _Tp, class _A0, class _A1>
3002 decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
3003 __is_constructible2_test(_Tp&, _A0&, _A1&);
3005 template <class _A0, class _A1>
3007 __is_constructible2_test(__any, _A0&, _A1&);
3009 template <bool, class _Tp>
3010 struct __is_constructible0_imp // false, _Tp is not a scalar
3011 : public common_type
3013 decltype(__is_constructible0_test(declval<_Tp&>()))
3017 template <bool, class _Tp, class _A0>
3018 struct __is_constructible1_imp // false, _Tp is not a scalar
3019 : public common_type
3021 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
3025 template <bool, class _Tp, class _A0, class _A1>
3026 struct __is_constructible2_imp // false, _Tp is not a scalar
3027 : public common_type
3029 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
3033 // handle scalars and reference types
3035 // Scalars are default constructible, references are not
3037 template <class _Tp>
3038 struct __is_constructible0_imp<true, _Tp>
3039 : public is_scalar<_Tp>
3042 template <class _Tp, class _A0>
3043 struct __is_constructible1_imp<true, _Tp, _A0>
3044 : public is_convertible<_A0, _Tp>
3047 template <class _Tp, class _A0, class _A1>
3048 struct __is_constructible2_imp<true, _Tp, _A0, _A1>
3052 // Treat scalars and reference types separately
3054 template <bool, class _Tp>
3055 struct __is_constructible0_void_check
3056 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3060 template <bool, class _Tp, class _A0>
3061 struct __is_constructible1_void_check
3062 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3066 template <bool, class _Tp, class _A0, class _A1>
3067 struct __is_constructible2_void_check
3068 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3072 // If any of T or Args is void, is_constructible should be false
3074 template <class _Tp>
3075 struct __is_constructible0_void_check<true, _Tp>
3079 template <class _Tp, class _A0>
3080 struct __is_constructible1_void_check<true, _Tp, _A0>
3084 template <class _Tp, class _A0, class _A1>
3085 struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
3089 // is_constructible entry point
3091 template <class _Tp, class _A0 = __is_construct::__nat,
3092 class _A1 = __is_construct::__nat>
3093 struct _LIBCPP_TYPE_VIS_ONLY is_constructible
3094 : public __is_constructible2_void_check<is_void<_Tp>::value
3095 || is_abstract<_Tp>::value
3096 || is_function<_Tp>::value
3097 || is_void<_A0>::value
3098 || is_void<_A1>::value,
3102 template <class _Tp>
3103 struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
3104 : public __is_constructible0_void_check<is_void<_Tp>::value
3105 || is_abstract<_Tp>::value
3106 || is_function<_Tp>::value,
3110 template <class _Tp, class _A0>
3111 struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat>
3112 : public __is_constructible1_void_check<is_void<_Tp>::value
3113 || is_abstract<_Tp>::value
3114 || is_function<_Tp>::value
3115 || is_void<_A0>::value,
3119 // Array types are default constructible if their element type
3120 // is default constructible
3122 template <class _Ap, size_t _Np>
3123 struct __is_constructible0_imp<false, _Ap[_Np]>
3124 : public is_constructible<typename remove_all_extents<_Ap>::type>
3127 template <class _Ap, size_t _Np, class _A0>
3128 struct __is_constructible1_imp<false, _Ap[_Np], _A0>
3132 template <class _Ap, size_t _Np, class _A0, class _A1>
3133 struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
3137 // Incomplete array types are not constructible
3139 template <class _Ap>
3140 struct __is_constructible0_imp<false, _Ap[]>
3144 template <class _Ap, class _A0>
3145 struct __is_constructible1_imp<false, _Ap[], _A0>
3149 template <class _Ap, class _A0, class _A1>
3150 struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
3154 #endif // _LIBCPP_HAS_NO_VARIADICS
3155 #endif // __has_feature(is_constructible)
3157 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
3158 template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_constructible_v
3159 = is_constructible<_Tp, _Args...>::value;
3162 // is_default_constructible
3164 template <class _Tp>
3165 struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible
3166 : public is_constructible<_Tp>
3169 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3170 template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
3171 = is_default_constructible<_Tp>::value;
3174 // is_copy_constructible
3176 template <class _Tp>
3177 struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
3178 : public is_constructible<_Tp,
3179 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
3181 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3182 template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
3183 = is_copy_constructible<_Tp>::value;
3186 // is_move_constructible
3188 template <class _Tp>
3189 struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
3190 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3191 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3193 : public is_copy_constructible<_Tp>
3197 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3198 template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
3199 = is_move_constructible<_Tp>::value;
3202 // is_trivially_constructible
3204 #ifndef _LIBCPP_HAS_NO_VARIADICS
3206 #if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
3208 template <class _Tp, class... _Args>
3209 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
3210 : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
3214 #else // !__has_feature(is_trivially_constructible)
3216 template <class _Tp, class... _Args>
3217 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
3222 template <class _Tp>
3223 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp>
3224 #if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403)
3225 : integral_constant<bool, __has_trivial_constructor(_Tp)>
3227 : integral_constant<bool, is_scalar<_Tp>::value>
3232 template <class _Tp>
3233 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3234 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&>
3236 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp>
3238 : integral_constant<bool, is_scalar<_Tp>::value>
3242 template <class _Tp>
3243 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&>
3244 : integral_constant<bool, is_scalar<_Tp>::value>
3248 template <class _Tp>
3249 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&>
3250 : integral_constant<bool, is_scalar<_Tp>::value>
3254 #endif // !__has_feature(is_trivially_constructible)
3256 #else // _LIBCPP_HAS_NO_VARIADICS
3258 template <class _Tp, class _A0 = __is_construct::__nat,
3259 class _A1 = __is_construct::__nat>
3260 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
3265 #if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
3267 template <class _Tp>
3268 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
3269 __is_construct::__nat>
3270 : integral_constant<bool, __is_trivially_constructible(_Tp)>
3274 template <class _Tp>
3275 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
3276 __is_construct::__nat>
3277 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
3281 template <class _Tp>
3282 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
3283 __is_construct::__nat>
3284 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
3288 template <class _Tp>
3289 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
3290 __is_construct::__nat>
3291 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
3295 #else // !__has_feature(is_trivially_constructible)
3297 template <class _Tp>
3298 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
3299 __is_construct::__nat>
3300 : integral_constant<bool, is_scalar<_Tp>::value>
3304 template <class _Tp>
3305 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp,
3306 __is_construct::__nat>
3307 : integral_constant<bool, is_scalar<_Tp>::value>
3311 template <class _Tp>
3312 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&,
3313 __is_construct::__nat>
3314 : integral_constant<bool, is_scalar<_Tp>::value>
3318 template <class _Tp>
3319 struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
3320 __is_construct::__nat>
3321 : integral_constant<bool, is_scalar<_Tp>::value>
3325 #endif // !__has_feature(is_trivially_constructible)
3327 #endif // _LIBCPP_HAS_NO_VARIADICS
3329 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
3330 template <class _Tp, class... _Args> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
3331 = is_trivially_constructible<_Tp, _Args...>::value;
3334 // is_trivially_default_constructible
3336 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible
3337 : public is_trivially_constructible<_Tp>
3340 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3341 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
3342 = is_trivially_default_constructible<_Tp>::value;
3345 // is_trivially_copy_constructible
3347 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible
3348 : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
3351 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3352 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
3353 = is_trivially_copy_constructible<_Tp>::value;
3356 // is_trivially_move_constructible
3358 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible
3359 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3360 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3362 : public is_trivially_copy_constructible<_Tp>
3366 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3367 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
3368 = is_trivially_move_constructible<_Tp>::value;
3371 // is_trivially_assignable
3373 #if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501
3375 template <class _Tp, class _Arg>
3376 struct is_trivially_assignable
3377 : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
3381 #else // !__has_feature(is_trivially_assignable)
3383 template <class _Tp, class _Arg>
3384 struct is_trivially_assignable
3385 : public false_type {};
3387 template <class _Tp>
3388 struct is_trivially_assignable<_Tp&, _Tp>
3389 : integral_constant<bool, is_scalar<_Tp>::value> {};
3391 template <class _Tp>
3392 struct is_trivially_assignable<_Tp&, _Tp&>
3393 : integral_constant<bool, is_scalar<_Tp>::value> {};
3395 template <class _Tp>
3396 struct is_trivially_assignable<_Tp&, const _Tp&>
3397 : integral_constant<bool, is_scalar<_Tp>::value> {};
3399 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3401 template <class _Tp>
3402 struct is_trivially_assignable<_Tp&, _Tp&&>
3403 : integral_constant<bool, is_scalar<_Tp>::value> {};
3405 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3407 #endif // !__has_feature(is_trivially_assignable)
3409 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3410 template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
3411 = is_trivially_assignable<_Tp, _Arg>::value;
3414 // is_trivially_copy_assignable
3416 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
3417 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
3418 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
3420 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3421 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
3422 = is_trivially_copy_assignable<_Tp>::value;
3425 // is_trivially_move_assignable
3427 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
3428 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
3429 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3430 typename add_rvalue_reference<_Tp>::type>
3432 typename add_lvalue_reference<_Tp>::type>
3436 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3437 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
3438 = is_trivially_move_assignable<_Tp>::value;
3441 // is_trivially_destructible
3443 #if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
3445 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
3446 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
3450 template <class _Tp> struct __libcpp_trivial_destructor
3451 : public integral_constant<bool, is_scalar<_Tp>::value ||
3452 is_reference<_Tp>::value> {};
3454 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
3455 : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};
3457 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible<_Tp[]>
3458 : public false_type {};
3462 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3463 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
3464 = is_trivially_destructible<_Tp>::value;
3467 // is_nothrow_constructible
3470 template <class _Tp, class... _Args>
3471 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
3472 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))>
3478 #ifndef _LIBCPP_HAS_NO_VARIADICS
3480 #if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3482 template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
3484 template <class _Tp, class... _Args>
3485 struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...>
3486 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
3490 template <class _Tp>
3491 void __implicit_conversion_to(_Tp) noexcept { }
3493 template <class _Tp, class _Arg>
3494 struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
3495 : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))>
3499 template <class _Tp, bool _IsReference, class... _Args>
3500 struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...>
3505 template <class _Tp, class... _Args>
3506 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
3507 : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
3511 template <class _Tp, size_t _Ns>
3512 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
3513 : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp>
3517 #else // __has_feature(cxx_noexcept)
3519 template <class _Tp, class... _Args>
3520 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
3525 template <class _Tp>
3526 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp>
3527 #if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3528 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3530 : integral_constant<bool, is_scalar<_Tp>::value>
3535 template <class _Tp>
3536 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3537 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&>
3539 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp>
3541 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3542 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3544 : integral_constant<bool, is_scalar<_Tp>::value>
3549 template <class _Tp>
3550 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&>
3551 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3552 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3554 : integral_constant<bool, is_scalar<_Tp>::value>
3559 template <class _Tp>
3560 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&>
3561 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3562 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3564 : integral_constant<bool, is_scalar<_Tp>::value>
3569 #endif // __has_feature(cxx_noexcept)
3571 #else // _LIBCPP_HAS_NO_VARIADICS
3573 template <class _Tp, class _A0 = __is_construct::__nat,
3574 class _A1 = __is_construct::__nat>
3575 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
3580 template <class _Tp>
3581 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat,
3582 __is_construct::__nat>
3583 #if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3584 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3586 : integral_constant<bool, is_scalar<_Tp>::value>
3591 template <class _Tp>
3592 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp,
3593 __is_construct::__nat>
3594 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3595 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3597 : integral_constant<bool, is_scalar<_Tp>::value>
3602 template <class _Tp>
3603 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&,
3604 __is_construct::__nat>
3605 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3606 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3608 : integral_constant<bool, is_scalar<_Tp>::value>
3613 template <class _Tp>
3614 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&,
3615 __is_construct::__nat>
3616 #if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3617 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3619 : integral_constant<bool, is_scalar<_Tp>::value>
3624 #endif // _LIBCPP_HAS_NO_VARIADICS
3625 #endif // __has_feature(is_nothrow_constructible)
3627 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
3628 template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
3629 = is_nothrow_constructible<_Tp, _Args...>::value;
3632 // is_nothrow_default_constructible
3634 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible
3635 : public is_nothrow_constructible<_Tp>
3638 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3639 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
3640 = is_nothrow_default_constructible<_Tp>::value;
3643 // is_nothrow_copy_constructible
3645 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
3646 : public is_nothrow_constructible<_Tp,
3647 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
3649 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3650 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
3651 = is_nothrow_copy_constructible<_Tp>::value;
3654 // is_nothrow_move_constructible
3656 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
3657 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3658 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3660 : public is_nothrow_copy_constructible<_Tp>
3664 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3665 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
3666 = is_nothrow_move_constructible<_Tp>::value;
3669 // is_nothrow_assignable
3671 #if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3673 template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
3675 template <class _Tp, class _Arg>
3676 struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg>
3681 template <class _Tp, class _Arg>
3682 struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg>
3683 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) >
3687 template <class _Tp, class _Arg>
3688 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
3689 : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
3693 #else // __has_feature(cxx_noexcept)
3695 template <class _Tp, class _Arg>
3696 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable
3697 : public false_type {};
3699 template <class _Tp>
3700 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp>
3701 #if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3702 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3704 : integral_constant<bool, is_scalar<_Tp>::value> {};
3707 template <class _Tp>
3708 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&>
3709 #if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3710 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3712 : integral_constant<bool, is_scalar<_Tp>::value> {};
3715 template <class _Tp>
3716 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&>
3717 #if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3718 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3720 : integral_constant<bool, is_scalar<_Tp>::value> {};
3723 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3725 template <class _Tp>
3726 struct is_nothrow_assignable<_Tp&, _Tp&&>
3727 #if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3728 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3730 : integral_constant<bool, is_scalar<_Tp>::value> {};
3733 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3735 #endif // __has_feature(cxx_noexcept)
3737 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3738 template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
3739 = is_nothrow_assignable<_Tp, _Arg>::value;
3742 // is_nothrow_copy_assignable
3744 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
3745 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
3746 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
3748 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3749 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
3750 = is_nothrow_copy_assignable<_Tp>::value;
3753 // is_nothrow_move_assignable
3755 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
3756 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
3757 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3758 typename add_rvalue_reference<_Tp>::type>
3760 typename add_lvalue_reference<_Tp>::type>
3764 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3765 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
3766 = is_nothrow_move_assignable<_Tp>::value;
3769 // is_nothrow_destructible
3771 #if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3773 template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
3775 template <class _Tp>
3776 struct __libcpp_is_nothrow_destructible<false, _Tp>
3781 template <class _Tp>
3782 struct __libcpp_is_nothrow_destructible<true, _Tp>
3783 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) >
3787 template <class _Tp>
3788 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
3789 : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
3793 template <class _Tp, size_t _Ns>
3794 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]>
3795 : public is_nothrow_destructible<_Tp>
3799 template <class _Tp>
3800 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&>
3805 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3807 template <class _Tp>
3808 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&>
3817 template <class _Tp> struct __libcpp_nothrow_destructor
3818 : public integral_constant<bool, is_scalar<_Tp>::value ||
3819 is_reference<_Tp>::value> {};
3821 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
3822 : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};
3824 template <class _Tp>
3825 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[]>
3826 : public false_type {};
3830 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3831 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
3832 = is_nothrow_destructible<_Tp>::value;
3837 #if __has_feature(is_pod) || (_GNUC_VER >= 403)
3839 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
3840 : public integral_constant<bool, __is_pod(_Tp)> {};
3844 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
3845 : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value &&
3846 is_trivially_copy_constructible<_Tp>::value &&
3847 is_trivially_copy_assignable<_Tp>::value &&
3848 is_trivially_destructible<_Tp>::value> {};
3852 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3853 template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
3854 = is_pod<_Tp>::value;
3859 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
3860 #ifdef _LIBCPP_IS_LITERAL
3861 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)>
3863 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
3864 is_reference<typename remove_all_extents<_Tp>::type>::value>
3868 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3869 template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
3870 = is_literal_type<_Tp>::value;
3873 // is_standard_layout;
3875 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
3876 #if __has_feature(is_standard_layout) || (_GNUC_VER >= 407)
3877 : public integral_constant<bool, __is_standard_layout(_Tp)>
3879 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
3883 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3884 template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
3885 = is_standard_layout<_Tp>::value;
3888 // is_trivially_copyable;
3890 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
3891 #if __has_feature(is_trivially_copyable)
3892 : public integral_constant<bool, __is_trivially_copyable(_Tp)>
3893 #elif _GNUC_VER >= 501
3894 : public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)>
3896 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
3900 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3901 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
3902 = is_trivially_copyable<_Tp>::value;
3907 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
3908 #if __has_feature(is_trivial) || _GNUC_VER >= 407
3909 : public integral_constant<bool, __is_trivial(_Tp)>
3911 : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
3912 is_trivially_default_constructible<_Tp>::value>
3916 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3917 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
3918 = is_trivial<_Tp>::value;
3921 #ifndef _LIBCPP_HAS_NO_VARIADICS
3923 // Check for complete types
3925 template <class ..._Tp> struct __check_complete;
3928 struct __check_complete<>
3932 template <class _Hp, class _T0, class ..._Tp>
3933 struct __check_complete<_Hp, _T0, _Tp...>
3934 : private __check_complete<_Hp>,
3935 private __check_complete<_T0, _Tp...>
3939 template <class _Hp>
3940 struct __check_complete<_Hp, _Hp>
3941 : private __check_complete<_Hp>
3945 template <class _Tp>
3946 struct __check_complete<_Tp>
3948 static_assert(sizeof(_Tp) > 0, "Type must be complete.");
3951 template <class _Tp>
3952 struct __check_complete<_Tp&>
3953 : private __check_complete<_Tp>
3957 template <class _Tp>
3958 struct __check_complete<_Tp&&>
3959 : private __check_complete<_Tp>
3963 template <class _Rp, class ..._Param>
3964 struct __check_complete<_Rp (*)(_Param...)>
3965 : private __check_complete<_Rp>
3969 template <class ..._Param>
3970 struct __check_complete<void (*)(_Param...)>
3974 template <class _Rp, class ..._Param>
3975 struct __check_complete<_Rp (_Param...)>
3976 : private __check_complete<_Rp>
3980 template <class ..._Param>
3981 struct __check_complete<void (_Param...)>
3985 template <class _Rp, class _Class, class ..._Param>
3986 struct __check_complete<_Rp (_Class::*)(_Param...)>
3987 : private __check_complete<_Class>
3991 template <class _Rp, class _Class, class ..._Param>
3992 struct __check_complete<_Rp (_Class::*)(_Param...) const>
3993 : private __check_complete<_Class>
3997 template <class _Rp, class _Class, class ..._Param>
3998 struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
3999 : private __check_complete<_Class>
4003 template <class _Rp, class _Class, class ..._Param>
4004 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
4005 : private __check_complete<_Class>
4009 #if __has_feature(cxx_reference_qualified_functions)
4011 template <class _Rp, class _Class, class ..._Param>
4012 struct __check_complete<_Rp (_Class::*)(_Param...) &>
4013 : private __check_complete<_Class>
4017 template <class _Rp, class _Class, class ..._Param>
4018 struct __check_complete<_Rp (_Class::*)(_Param...) const&>
4019 : private __check_complete<_Class>
4023 template <class _Rp, class _Class, class ..._Param>
4024 struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
4025 : private __check_complete<_Class>
4029 template <class _Rp, class _Class, class ..._Param>
4030 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
4031 : private __check_complete<_Class>
4035 template <class _Rp, class _Class, class ..._Param>
4036 struct __check_complete<_Rp (_Class::*)(_Param...) &&>
4037 : private __check_complete<_Class>
4041 template <class _Rp, class _Class, class ..._Param>
4042 struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
4043 : private __check_complete<_Class>
4047 template <class _Rp, class _Class, class ..._Param>
4048 struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
4049 : private __check_complete<_Class>
4053 template <class _Rp, class _Class, class ..._Param>
4054 struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
4055 : private __check_complete<_Class>
4061 template <class _Rp, class _Class>
4062 struct __check_complete<_Rp _Class::*>
4063 : private __check_complete<_Class>
4067 // __invoke forward declarations
4069 // fall back - none of the bullets
4071 template <class ..._Args>
4073 __invoke(__any, _Args&& ...__args)
4078 template <class _Fp, class _A0, class ..._Args,
4079 class = typename enable_if
4081 is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
4082 is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
4083 typename remove_reference<_A0>::type>::value
4086 _LIBCPP_INLINE_VISIBILITY
4088 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
4089 -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
4091 template <class _Fp, class _A0, class ..._Args,
4092 class = typename enable_if
4094 is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
4095 !is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type,
4096 typename remove_reference<_A0>::type>::value
4099 _LIBCPP_INLINE_VISIBILITY
4101 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
4102 -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
4106 template <class _Fp, class _A0,
4107 class = typename enable_if
4109 is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
4110 is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
4111 typename remove_reference<_A0>::type>::value
4114 _LIBCPP_INLINE_VISIBILITY
4116 __invoke(_Fp&& __f, _A0&& __a0)
4117 -> decltype(_VSTD::forward<_A0>(__a0).*__f);
4119 template <class _Fp, class _A0,
4120 class = typename enable_if
4122 is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
4123 !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType,
4124 typename remove_reference<_A0>::type>::value
4127 _LIBCPP_INLINE_VISIBILITY
4129 __invoke(_Fp&& __f, _A0&& __a0)
4130 -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
4134 template <class _Fp, class ..._Args>
4135 _LIBCPP_INLINE_VISIBILITY
4137 __invoke(_Fp&& __f, _Args&& ...__args)
4138 -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
4142 template <class _Fp, class ..._Args>
4143 struct __invokable_imp
4144 : private __check_complete<_Fp>
4147 __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
4149 static const bool value = !is_same<type, __nat>::value;
4152 template <class _Fp, class ..._Args>
4154 : public integral_constant<bool,
4155 __invokable_imp<_Fp, _Args...>::value>
4161 template <bool _Invokable, class _Fp, class ..._Args>
4162 struct __invoke_of_imp // false
4166 template <class _Fp, class ..._Args>
4167 struct __invoke_of_imp<true, _Fp, _Args...>
4169 typedef typename __invokable_imp<_Fp, _Args...>::type type;
4172 template <class _Fp, class ..._Args>
4174 : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
4178 template <class _Fp, class ..._Args>
4179 class _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)>
4180 : public __invoke_of<_Fp, _Args...>
4184 #if _LIBCPP_STD_VER > 11
4185 template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
4188 #endif // _LIBCPP_HAS_NO_VARIADICS
4190 template <class _Tp>
4191 inline _LIBCPP_INLINE_VISIBILITY
4192 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
4195 is_move_constructible<_Tp>::value &&
4196 is_move_assignable<_Tp>::value
4201 swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
4202 is_nothrow_move_assignable<_Tp>::value)
4204 _Tp __t(_VSTD::move(__x));
4205 __x = _VSTD::move(__y);
4206 __y = _VSTD::move(__t);
4209 template <class _ForwardIterator1, class _ForwardIterator2>
4210 inline _LIBCPP_INLINE_VISIBILITY
4212 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
4213 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
4214 _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(),
4215 *_VSTD::declval<_ForwardIterator2>())))
4226 __nat swap(__any, __any);
4228 template <class _Tp>
4231 typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type;
4232 static const bool value = !is_same<type, __nat>::value;
4237 template <class _Tp>
4238 struct __is_swappable
4239 : public integral_constant<bool, __detail::__swappable<_Tp>::value>
4243 #if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
4245 template <bool, class _Tp>
4246 struct __is_nothrow_swappable_imp
4247 : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(),
4248 _VSTD::declval<_Tp&>()))>
4252 template <class _Tp>
4253 struct __is_nothrow_swappable_imp<false, _Tp>
4258 template <class _Tp>
4259 struct __is_nothrow_swappable
4260 : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp>
4264 #else // __has_feature(cxx_noexcept)
4266 template <class _Tp>
4267 struct __is_nothrow_swappable
4272 #endif // __has_feature(cxx_noexcept)
4274 #ifdef _LIBCPP_UNDERLYING_TYPE
4276 template <class _Tp>
4277 struct underlying_type
4279 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type;
4282 #if _LIBCPP_STD_VER > 11
4283 template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
4286 #else // _LIBCPP_UNDERLYING_TYPE
4288 template <class _Tp, bool _Support = false>
4289 struct underlying_type
4291 static_assert(_Support, "The underyling_type trait requires compiler "
4292 "support. Either no such support exists or "
4293 "libc++ does not know how to use it.");
4296 #endif // _LIBCPP_UNDERLYING_TYPE
4299 template <class _Tp, bool = std::is_enum<_Tp>::value>
4300 struct __sfinae_underlying_type
4302 typedef typename underlying_type<_Tp>::type type;
4303 typedef decltype(((type)1) + 0) __promoted_type;
4306 template <class _Tp>
4307 struct __sfinae_underlying_type<_Tp, false> {};
4309 inline _LIBCPP_INLINE_VISIBILITY
4310 int __convert_to_integral(int __val) { return __val; }
4312 inline _LIBCPP_INLINE_VISIBILITY
4313 unsigned __convert_to_integral(unsigned __val) { return __val; }
4315 inline _LIBCPP_INLINE_VISIBILITY
4316 long __convert_to_integral(long __val) { return __val; }
4318 inline _LIBCPP_INLINE_VISIBILITY
4319 unsigned long __convert_to_integral(unsigned long __val) { return __val; }
4321 inline _LIBCPP_INLINE_VISIBILITY
4322 long long __convert_to_integral(long long __val) { return __val; }
4324 inline _LIBCPP_INLINE_VISIBILITY
4325 unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
4327 #ifndef _LIBCPP_HAS_NO_INT128
4328 inline _LIBCPP_INLINE_VISIBILITY
4329 __int128_t __convert_to_integral(__int128_t __val) { return __val; }
4331 inline _LIBCPP_INLINE_VISIBILITY
4332 __uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
4335 template <class _Tp>
4336 inline _LIBCPP_INLINE_VISIBILITY
4337 typename __sfinae_underlying_type<_Tp>::__promoted_type
4338 __convert_to_integral(_Tp __val) { return __val; }
4340 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
4342 template <class _Tp>
4343 struct __has_operator_addressof_member_imp
4345 template <class _Up>
4346 static auto __test(int)
4347 -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type;
4349 static auto __test(long) -> false_type;
4351 static const bool value = decltype(__test<_Tp>(0))::value;
4354 template <class _Tp>
4355 struct __has_operator_addressof_free_imp
4357 template <class _Up>
4358 static auto __test(int)
4359 -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type;
4361 static auto __test(long) -> false_type;
4363 static const bool value = decltype(__test<_Tp>(0))::value;
4366 template <class _Tp>
4367 struct __has_operator_addressof
4368 : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value
4369 || __has_operator_addressof_free_imp<_Tp>::value>
4372 #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
4374 #if _LIBCPP_STD_VER > 14
4375 template <class...> using void_t = void;
4377 # ifndef _LIBCPP_HAS_NO_VARIADICS
4378 template <class... _Args>
4379 struct conjunction : __and_<_Args...> {};
4380 template<class... _Args> constexpr bool conjunction_v = conjunction<_Args...>::value;
4382 template <class... _Args>
4383 struct disjunction : __or_<_Args...> {};
4384 template<class... _Args> constexpr bool disjunction_v = disjunction<_Args...>::value;
4386 template <class _Tp>
4387 struct negation : __not_<_Tp> {};
4388 template<class _Tp> constexpr bool negation_v = negation<_Tp>::value;
4389 # endif // _LIBCPP_HAS_NO_VARIADICS
4390 #endif // _LIBCPP_STD_VER > 14
4392 _LIBCPP_END_NAMESPACE_STD
4394 #endif // _LIBCPP_TYPE_TRAITS