type_traits revision 278724
1290001Sglebius// -*- C++ -*- 2290001Sglebius//===------------------------ type_traits ---------------------------------===// 3290001Sglebius// 4290001Sglebius// The LLVM Compiler Infrastructure 5290001Sglebius// 6290001Sglebius// This file is dual licensed under the MIT and the University of Illinois Open 7290001Sglebius// Source Licenses. See LICENSE.TXT for details. 8290001Sglebius// 9290001Sglebius//===----------------------------------------------------------------------===// 10290001Sglebius 11290001Sglebius#ifndef _LIBCPP_TYPE_TRAITS 12290001Sglebius#define _LIBCPP_TYPE_TRAITS 13290001Sglebius 14290001Sglebius/* 15290001Sglebius type_traits synopsis 16290001Sglebius 17290001Sglebiusnamespace std 18290001Sglebius{ 19290001Sglebius 20290001Sglebius // helper class: 21290001Sglebius template <class T, T v> struct integral_constant; 22290001Sglebius typedef integral_constant<bool, true> true_type; 23290001Sglebius typedef integral_constant<bool, false> false_type; 24290001Sglebius 25290001Sglebius // helper traits 26290001Sglebius template <bool, class T = void> struct enable_if; 27290001Sglebius template <bool, class T, class F> struct conditional; 28290001Sglebius 29290001Sglebius // Primary classification traits: 30290001Sglebius template <class T> struct is_void; 31290001Sglebius template <class T> struct is_null_pointer; // C++14 32290001Sglebius template <class T> struct is_integral; 33290001Sglebius template <class T> struct is_floating_point; 34290001Sglebius template <class T> struct is_array; 35290001Sglebius template <class T> struct is_pointer; 36290001Sglebius template <class T> struct is_lvalue_reference; 37290001Sglebius template <class T> struct is_rvalue_reference; 38290001Sglebius template <class T> struct is_member_object_pointer; 39290001Sglebius template <class T> struct is_member_function_pointer; 40290001Sglebius template <class T> struct is_enum; 41290001Sglebius template <class T> struct is_union; 42290001Sglebius template <class T> struct is_class; 43290001Sglebius template <class T> struct is_function; 44290001Sglebius 45290001Sglebius // Secondary classification traits: 46290001Sglebius template <class T> struct is_reference; 47290001Sglebius template <class T> struct is_arithmetic; 48290001Sglebius template <class T> struct is_fundamental; 49290001Sglebius template <class T> struct is_member_pointer; 50290001Sglebius template <class T> struct is_scalar; 51290001Sglebius template <class T> struct is_object; 52290001Sglebius template <class T> struct is_compound; 53290001Sglebius 54290001Sglebius // Const-volatile properties and transformations: 55290001Sglebius template <class T> struct is_const; 56290001Sglebius template <class T> struct is_volatile; 57290001Sglebius template <class T> struct remove_const; 58290001Sglebius template <class T> struct remove_volatile; 59290001Sglebius template <class T> struct remove_cv; 60290001Sglebius template <class T> struct add_const; 61290001Sglebius template <class T> struct add_volatile; 62290001Sglebius template <class T> struct add_cv; 63 64 // Reference transformations: 65 template <class T> struct remove_reference; 66 template <class T> struct add_lvalue_reference; 67 template <class T> struct add_rvalue_reference; 68 69 // Pointer transformations: 70 template <class T> struct remove_pointer; 71 template <class T> struct add_pointer; 72 73 // Integral properties: 74 template <class T> struct is_signed; 75 template <class T> struct is_unsigned; 76 template <class T> struct make_signed; 77 template <class T> struct make_unsigned; 78 79 // Array properties and transformations: 80 template <class T> struct rank; 81 template <class T, unsigned I = 0> struct extent; 82 template <class T> struct remove_extent; 83 template <class T> struct remove_all_extents; 84 85 // Member introspection: 86 template <class T> struct is_pod; 87 template <class T> struct is_trivial; 88 template <class T> struct is_trivially_copyable; 89 template <class T> struct is_standard_layout; 90 template <class T> struct is_literal_type; 91 template <class T> struct is_empty; 92 template <class T> struct is_polymorphic; 93 template <class T> struct is_abstract; 94 template <class T> struct is_final; // C++14 95 96 template <class T, class... Args> struct is_constructible; 97 template <class T> struct is_default_constructible; 98 template <class T> struct is_copy_constructible; 99 template <class T> struct is_move_constructible; 100 template <class T, class U> struct is_assignable; 101 template <class T> struct is_copy_assignable; 102 template <class T> struct is_move_assignable; 103 template <class T> struct is_destructible; 104 105 template <class T, class... Args> struct is_trivially_constructible; 106 template <class T> struct is_trivially_default_constructible; 107 template <class T> struct is_trivially_copy_constructible; 108 template <class T> struct is_trivially_move_constructible; 109 template <class T, class U> struct is_trivially_assignable; 110 template <class T> struct is_trivially_copy_assignable; 111 template <class T> struct is_trivially_move_assignable; 112 template <class T> struct is_trivially_destructible; 113 114 template <class T, class... Args> struct is_nothrow_constructible; 115 template <class T> struct is_nothrow_default_constructible; 116 template <class T> struct is_nothrow_copy_constructible; 117 template <class T> struct is_nothrow_move_constructible; 118 template <class T, class U> struct is_nothrow_assignable; 119 template <class T> struct is_nothrow_copy_assignable; 120 template <class T> struct is_nothrow_move_assignable; 121 template <class T> struct is_nothrow_destructible; 122 123 template <class T> struct has_virtual_destructor; 124 125 // Relationships between types: 126 template <class T, class U> struct is_same; 127 template <class Base, class Derived> struct is_base_of; 128 template <class From, class To> struct is_convertible; 129 130 // Alignment properties and transformations: 131 template <class T> struct alignment_of; 132 template <size_t Len, size_t Align = most_stringent_alignment_requirement> 133 struct aligned_storage; 134 template <size_t Len, class... Types> struct aligned_union; 135 136 template <class T> struct decay; 137 template <class... T> struct common_type; 138 template <class T> struct underlying_type; 139 template <class> class result_of; // undefined 140 template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>; 141 142 // const-volatile modifications: 143 template <class T> 144 using remove_const_t = typename remove_const<T>::type; // C++14 145 template <class T> 146 using remove_volatile_t = typename remove_volatile<T>::type; // C++14 147 template <class T> 148 using remove_cv_t = typename remove_cv<T>::type; // C++14 149 template <class T> 150 using add_const_t = typename add_const<T>::type; // C++14 151 template <class T> 152 using add_volatile_t = typename add_volatile<T>::type; // C++14 153 template <class T> 154 using add_cv_t = typename add_cv<T>::type; // C++14 155 156 // reference modifications: 157 template <class T> 158 using remove_reference_t = typename remove_reference<T>::type; // C++14 159 template <class T> 160 using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14 161 template <class T> 162 using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14 163 164 // sign modifications: 165 template <class T> 166 using make_signed_t = typename make_signed<T>::type; // C++14 167 template <class T> 168 using make_unsigned_t = typename make_unsigned<T>::type; // C++14 169 170 // array modifications: 171 template <class T> 172 using remove_extent_t = typename remove_extent<T>::type; // C++14 173 template <class T> 174 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14 175 176 // pointer modifications: 177 template <class T> 178 using remove_pointer_t = typename remove_pointer<T>::type; // C++14 179 template <class T> 180 using add_pointer_t = typename add_pointer<T>::type; // C++14 181 182 // other transformations: 183 template <size_t Len, std::size_t Align=default-alignment> 184 using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14 185 template <std::size_t Len, class... Types> 186 using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14 187 template <class T> 188 using decay_t = typename decay<T>::type; // C++14 189 template <bool b, class T=void> 190 using enable_if_t = typename enable_if<b,T>::type; // C++14 191 template <bool b, class T, class F> 192 using conditional_t = typename conditional<b,T,F>::type; // C++14 193 template <class... T> 194 using common_type_t = typename common_type<T...>::type; // C++14 195 template <class T> 196 using underlying_type_t = typename underlying_type<T>::type; // C++14 197 template <class F, class... ArgTypes> 198 using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14 199 200 template <class...> 201 using void_t = void; 202} // C++17 203 204*/ 205#include <__config> 206#include <cstddef> 207 208#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 209#pragma GCC system_header 210#endif 211 212_LIBCPP_BEGIN_NAMESPACE_STD 213 214#ifndef _LIBCPP_HAS_NO_VARIADICS 215template <class...> 216struct __void_t { typedef void type; }; 217#endif 218 219template <bool _Bp, class _If, class _Then> 220 struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;}; 221template <class _If, class _Then> 222 struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;}; 223 224#if _LIBCPP_STD_VER > 11 225template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; 226#endif 227 228template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {}; 229template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;}; 230 231template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {}; 232template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;}; 233 234#if _LIBCPP_STD_VER > 11 235template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; 236#endif 237 238 239struct __two {char __lx[2];}; 240 241// helper class: 242 243template <class _Tp, _Tp __v> 244struct _LIBCPP_TYPE_VIS_ONLY integral_constant 245{ 246 static _LIBCPP_CONSTEXPR const _Tp value = __v; 247 typedef _Tp value_type; 248 typedef integral_constant type; 249 _LIBCPP_INLINE_VISIBILITY 250 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;} 251#if _LIBCPP_STD_VER > 11 252 _LIBCPP_INLINE_VISIBILITY 253 constexpr value_type operator ()() const _NOEXCEPT {return value;} 254#endif 255}; 256 257template <class _Tp, _Tp __v> 258_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; 259 260typedef integral_constant<bool, true> true_type; 261typedef integral_constant<bool, false> false_type; 262 263// is_const 264 265template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; 266template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; 267 268// is_volatile 269 270template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; 271template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; 272 273// remove_const 274 275template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; 276template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;}; 277#if _LIBCPP_STD_VER > 11 278template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; 279#endif 280 281// remove_volatile 282 283template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;}; 284template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;}; 285#if _LIBCPP_STD_VER > 11 286template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; 287#endif 288 289// remove_cv 290 291template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv 292{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; 293#if _LIBCPP_STD_VER > 11 294template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; 295#endif 296 297// is_void 298 299template <class _Tp> struct __libcpp_is_void : public false_type {}; 300template <> struct __libcpp_is_void<void> : public true_type {}; 301 302template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void 303 : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; 304 305// __is_nullptr_t 306 307template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; 308template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; 309 310template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t 311 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 312 313#if _LIBCPP_STD_VER > 11 314template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer 315 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 316#endif 317 318// is_integral 319 320template <class _Tp> struct __libcpp_is_integral : public false_type {}; 321template <> struct __libcpp_is_integral<bool> : public true_type {}; 322template <> struct __libcpp_is_integral<char> : public true_type {}; 323template <> struct __libcpp_is_integral<signed char> : public true_type {}; 324template <> struct __libcpp_is_integral<unsigned char> : public true_type {}; 325template <> struct __libcpp_is_integral<wchar_t> : public true_type {}; 326#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 327template <> struct __libcpp_is_integral<char16_t> : public true_type {}; 328template <> struct __libcpp_is_integral<char32_t> : public true_type {}; 329#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 330template <> struct __libcpp_is_integral<short> : public true_type {}; 331template <> struct __libcpp_is_integral<unsigned short> : public true_type {}; 332template <> struct __libcpp_is_integral<int> : public true_type {}; 333template <> struct __libcpp_is_integral<unsigned int> : public true_type {}; 334template <> struct __libcpp_is_integral<long> : public true_type {}; 335template <> struct __libcpp_is_integral<unsigned long> : public true_type {}; 336template <> struct __libcpp_is_integral<long long> : public true_type {}; 337template <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; 338#ifndef _LIBCPP_HAS_NO_INT128 339template <> struct __libcpp_is_integral<__int128_t> : public true_type {}; 340template <> struct __libcpp_is_integral<__uint128_t> : public true_type {}; 341#endif 342 343template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral 344 : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; 345 346// is_floating_point 347 348template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; 349template <> struct __libcpp_is_floating_point<float> : public true_type {}; 350template <> struct __libcpp_is_floating_point<double> : public true_type {}; 351template <> struct __libcpp_is_floating_point<long double> : public true_type {}; 352 353template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point 354 : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; 355 356// is_array 357 358template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array 359 : public false_type {}; 360template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> 361 : public true_type {}; 362template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> 363 : public true_type {}; 364 365// is_pointer 366 367template <class _Tp> struct __libcpp_is_pointer : public false_type {}; 368template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; 369 370template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer 371 : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; 372 373// is_reference 374 375template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; 376template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {}; 377 378template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {}; 379#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 380template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {}; 381#endif 382 383template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {}; 384template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {}; 385#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 386template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; 387#endif 388 389// is_union 390 391#if __has_feature(is_union) || (_GNUC_VER >= 403) 392 393template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 394 : public integral_constant<bool, __is_union(_Tp)> {}; 395 396#else 397 398template <class _Tp> struct __libcpp_union : public false_type {}; 399template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 400 : public __libcpp_union<typename remove_cv<_Tp>::type> {}; 401 402#endif 403 404// is_class 405 406#if __has_feature(is_class) || (_GNUC_VER >= 403) 407 408template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 409 : public integral_constant<bool, __is_class(_Tp)> {}; 410 411#else 412 413namespace __is_class_imp 414{ 415template <class _Tp> char __test(int _Tp::*); 416template <class _Tp> __two __test(...); 417} 418 419template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 420 : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; 421 422#endif 423 424// is_same 425 426template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; 427template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; 428 429// is_function 430 431namespace __libcpp_is_function_imp 432{ 433template <class _Tp> char __test(_Tp*); 434template <class _Tp> __two __test(...); 435template <class _Tp> _Tp& __source(); 436} 437 438template <class _Tp, bool = is_class<_Tp>::value || 439 is_union<_Tp>::value || 440 is_void<_Tp>::value || 441 is_reference<_Tp>::value || 442 __is_nullptr_t<_Tp>::value > 443struct __libcpp_is_function 444 : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>())) == 1> 445 {}; 446template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; 447 448template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function 449 : public __libcpp_is_function<_Tp> {}; 450 451// is_member_function_pointer 452 453// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 454// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 455// 456 457template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 458struct __member_pointer_traits_imp 459{ // forward declaration; specializations later 460}; 461 462 463namespace __libcpp_is_member_function_pointer_imp { 464 template <typename _Tp> 465 char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); 466 467 template <typename> 468 std::__two __test(...); 469}; 470 471template <class _Tp> struct __libcpp_is_member_function_pointer 472 : public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {}; 473 474template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 475 : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 476 477// is_member_pointer 478 479template <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 480template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 481 482template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 483 : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 484 485// is_member_object_pointer 486 487template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer 488 : public integral_constant<bool, is_member_pointer<_Tp>::value && 489 !is_member_function_pointer<_Tp>::value> {}; 490 491// is_enum 492 493#if __has_feature(is_enum) || (_GNUC_VER >= 403) 494 495template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 496 : public integral_constant<bool, __is_enum(_Tp)> {}; 497 498#else 499 500template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 501 : public integral_constant<bool, !is_void<_Tp>::value && 502 !is_integral<_Tp>::value && 503 !is_floating_point<_Tp>::value && 504 !is_array<_Tp>::value && 505 !is_pointer<_Tp>::value && 506 !is_reference<_Tp>::value && 507 !is_member_pointer<_Tp>::value && 508 !is_union<_Tp>::value && 509 !is_class<_Tp>::value && 510 !is_function<_Tp>::value > {}; 511 512#endif 513 514// is_arithmetic 515 516template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic 517 : public integral_constant<bool, is_integral<_Tp>::value || 518 is_floating_point<_Tp>::value> {}; 519 520// is_fundamental 521 522template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental 523 : public integral_constant<bool, is_void<_Tp>::value || 524 __is_nullptr_t<_Tp>::value || 525 is_arithmetic<_Tp>::value> {}; 526 527// is_scalar 528 529template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar 530 : public integral_constant<bool, is_arithmetic<_Tp>::value || 531 is_member_pointer<_Tp>::value || 532 is_pointer<_Tp>::value || 533 __is_nullptr_t<_Tp>::value || 534 is_enum<_Tp>::value > {}; 535 536template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 537 538// is_object 539 540template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object 541 : public integral_constant<bool, is_scalar<_Tp>::value || 542 is_array<_Tp>::value || 543 is_union<_Tp>::value || 544 is_class<_Tp>::value > {}; 545 546// is_compound 547 548template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound 549 : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 550 551// add_const 552 553template <class _Tp, bool = is_reference<_Tp>::value || 554 is_function<_Tp>::value || 555 is_const<_Tp>::value > 556struct __add_const {typedef _Tp type;}; 557 558template <class _Tp> 559struct __add_const<_Tp, false> {typedef const _Tp type;}; 560 561template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const 562 {typedef typename __add_const<_Tp>::type type;}; 563 564#if _LIBCPP_STD_VER > 11 565template <class _Tp> using add_const_t = typename add_const<_Tp>::type; 566#endif 567 568// add_volatile 569 570template <class _Tp, bool = is_reference<_Tp>::value || 571 is_function<_Tp>::value || 572 is_volatile<_Tp>::value > 573struct __add_volatile {typedef _Tp type;}; 574 575template <class _Tp> 576struct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 577 578template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile 579 {typedef typename __add_volatile<_Tp>::type type;}; 580 581#if _LIBCPP_STD_VER > 11 582template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; 583#endif 584 585// add_cv 586 587template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv 588 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 589 590#if _LIBCPP_STD_VER > 11 591template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; 592#endif 593 594// remove_reference 595 596template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 597template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 598#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 599template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;}; 600#endif 601 602#if _LIBCPP_STD_VER > 11 603template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; 604#endif 605 606// add_lvalue_reference 607 608template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;}; 609template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 610template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;}; 611template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;}; 612template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;}; 613template <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;}; 614 615#if _LIBCPP_STD_VER > 11 616template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; 617#endif 618 619#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 620 621template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;}; 622template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;}; 623template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;}; 624template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;}; 625template <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;}; 626 627#if _LIBCPP_STD_VER > 11 628template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; 629#endif 630 631#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 632 633#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 634 635template <class _Tp> 636typename add_rvalue_reference<_Tp>::type 637declval() _NOEXCEPT; 638 639#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 640 641template <class _Tp> 642typename add_lvalue_reference<_Tp>::type 643declval(); 644 645#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 646 647struct __any 648{ 649 __any(...); 650}; 651 652// remove_pointer 653 654template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 655template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 656template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 657template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 658template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 659 660#if _LIBCPP_STD_VER > 11 661template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; 662#endif 663 664// add_pointer 665 666template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer 667 {typedef typename remove_reference<_Tp>::type* type;}; 668 669#if _LIBCPP_STD_VER > 11 670template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 671#endif 672 673// is_signed 674 675template <class _Tp, bool = is_integral<_Tp>::value> 676struct __libcpp_is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; 677 678template <class _Tp> 679struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point 680 681template <class _Tp, bool = is_arithmetic<_Tp>::value> 682struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; 683 684template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 685 686template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; 687 688// is_unsigned 689 690template <class _Tp, bool = is_integral<_Tp>::value> 691struct __libcpp_is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; 692 693template <class _Tp> 694struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point 695 696template <class _Tp, bool = is_arithmetic<_Tp>::value> 697struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; 698 699template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 700 701template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 702 703// rank 704 705template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 706 : public integral_constant<size_t, 0> {}; 707template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 708 : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 709template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]> 710 : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 711 712// extent 713 714template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 715 : public integral_constant<size_t, 0> {}; 716template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 717 : public integral_constant<size_t, 0> {}; 718template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 719 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 720template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 721 : public integral_constant<size_t, _Np> {}; 722template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip> 723 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 724 725// remove_extent 726 727template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 728 {typedef _Tp type;}; 729template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 730 {typedef _Tp type;}; 731template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]> 732 {typedef _Tp type;}; 733 734#if _LIBCPP_STD_VER > 11 735template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; 736#endif 737 738// remove_all_extents 739 740template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 741 {typedef _Tp type;}; 742template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 743 {typedef typename remove_all_extents<_Tp>::type type;}; 744template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]> 745 {typedef typename remove_all_extents<_Tp>::type type;}; 746 747#if _LIBCPP_STD_VER > 11 748template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; 749#endif 750 751// decay 752 753template <class _Tp> 754struct _LIBCPP_TYPE_VIS_ONLY decay 755{ 756private: 757 typedef typename remove_reference<_Tp>::type _Up; 758public: 759 typedef typename conditional 760 < 761 is_array<_Up>::value, 762 typename remove_extent<_Up>::type*, 763 typename conditional 764 < 765 is_function<_Up>::value, 766 typename add_pointer<_Up>::type, 767 typename remove_cv<_Up>::type 768 >::type 769 >::type type; 770}; 771 772#if _LIBCPP_STD_VER > 11 773template <class _Tp> using decay_t = typename decay<_Tp>::type; 774#endif 775 776// is_abstract 777 778namespace __is_abstract_imp 779{ 780template <class _Tp> char __test(_Tp (*)[1]); 781template <class _Tp> __two __test(...); 782} 783 784template <class _Tp, bool = is_class<_Tp>::value> 785struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 786 787template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 788 789template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 790 791// is_final 792 793#if _LIBCPP_STD_VER > 11 && __has_feature(is_final) 794template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 795is_final : public integral_constant<bool, __is_final(_Tp)> {}; 796#endif 797 798// is_base_of 799 800#ifdef _LIBCPP_HAS_IS_BASE_OF 801 802template <class _Bp, class _Dp> 803struct _LIBCPP_TYPE_VIS_ONLY is_base_of 804 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 805 806#else // _LIBCPP_HAS_IS_BASE_OF 807 808namespace __is_base_of_imp 809{ 810template <class _Tp> 811struct _Dst 812{ 813 _Dst(const volatile _Tp &); 814}; 815template <class _Tp> 816struct _Src 817{ 818 operator const volatile _Tp &(); 819 template <class _Up> operator const _Dst<_Up> &(); 820}; 821template <size_t> struct __one { typedef char type; }; 822template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 823template <class _Bp, class _Dp> __two __test(...); 824} 825 826template <class _Bp, class _Dp> 827struct _LIBCPP_TYPE_VIS_ONLY is_base_of 828 : public integral_constant<bool, is_class<_Bp>::value && 829 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 830 831#endif // _LIBCPP_HAS_IS_BASE_OF 832 833// is_convertible 834 835#if __has_feature(is_convertible_to) 836 837template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 838 : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 839 !is_abstract<_T2>::value> {}; 840 841#else // __has_feature(is_convertible_to) 842 843namespace __is_convertible_imp 844{ 845template <class _Tp> char __test(_Tp); 846template <class _Tp> __two __test(...); 847#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 848template <class _Tp> _Tp&& __source(); 849#else 850template <class _Tp> typename remove_reference<_Tp>::type& __source(); 851#endif 852 853template <class _Tp, bool _IsArray = is_array<_Tp>::value, 854 bool _IsFunction = is_function<_Tp>::value, 855 bool _IsVoid = is_void<_Tp>::value> 856 struct __is_array_function_or_void {enum {value = 0};}; 857template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 858template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 859template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 860} 861 862template <class _Tp, 863 unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 864struct __is_convertible_check 865{ 866 static const size_t __v = 0; 867}; 868 869template <class _Tp> 870struct __is_convertible_check<_Tp, 0> 871{ 872 static const size_t __v = sizeof(_Tp); 873}; 874 875template <class _T1, class _T2, 876 unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 877 unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 878struct __is_convertible 879 : public integral_constant<bool, 880#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 881 sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 882#else 883 sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 884 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 885 && (!is_const<typename remove_reference<_T2>::type>::value 886 || is_volatile<typename remove_reference<_T2>::type>::value) 887 && (is_same<typename remove_cv<_T1>::type, 888 typename remove_cv<typename remove_reference<_T2>::type>::type>::value 889 || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 890#endif 891 > 892{}; 893 894template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 895 896template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 897#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 898template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 899template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 900template <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 901template <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 902#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 903 904template <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 905 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 906 907template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 908 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 909 910template <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 911 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 912 913template <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 914 : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 915 916template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 917#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 918template <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 919#endif 920template <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; 921template <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 922template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 923template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 924template <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 925 926template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 927 928template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 929template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 930template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 931template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 932 933template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 934template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 935template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 936template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 937 938template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 939template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 940template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 941template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 942 943template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 944 : public __is_convertible<_T1, _T2> 945{ 946 static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 947 static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 948}; 949 950#endif // __has_feature(is_convertible_to) 951 952// is_empty 953 954#if __has_feature(is_empty) || (_GNUC_VER >= 407) 955 956template <class _Tp> 957struct _LIBCPP_TYPE_VIS_ONLY is_empty 958 : public integral_constant<bool, __is_empty(_Tp)> {}; 959 960#else // __has_feature(is_empty) 961 962template <class _Tp> 963struct __is_empty1 964 : public _Tp 965{ 966 double __lx; 967}; 968 969struct __is_empty2 970{ 971 double __lx; 972}; 973 974template <class _Tp, bool = is_class<_Tp>::value> 975struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 976 977template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 978 979template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {}; 980 981#endif // __has_feature(is_empty) 982 983// is_polymorphic 984 985#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC) 986 987template <class _Tp> 988struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 989 : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 990 991#else 992 993template<typename _Tp> char &__is_polymorphic_impl( 994 typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 995 int>::type); 996template<typename _Tp> __two &__is_polymorphic_impl(...); 997 998template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 999 : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 1000 1001#endif // __has_feature(is_polymorphic) 1002 1003// has_virtual_destructor 1004 1005#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) 1006 1007template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1008 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 1009 1010#else 1011 1012template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1013 : public false_type {}; 1014 1015#endif 1016 1017// alignment_of 1018 1019template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of 1020 : public integral_constant<size_t, __alignof__(_Tp)> {}; 1021 1022// aligned_storage 1023 1024template <class _Hp, class _Tp> 1025struct __type_list 1026{ 1027 typedef _Hp _Head; 1028 typedef _Tp _Tail; 1029}; 1030 1031struct __nat 1032{ 1033#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 1034 __nat() = delete; 1035 __nat(const __nat&) = delete; 1036 __nat& operator=(const __nat&) = delete; 1037 ~__nat() = delete; 1038#endif 1039}; 1040 1041template <class _Tp> 1042struct __align_type 1043{ 1044 static const size_t value = alignment_of<_Tp>::value; 1045 typedef _Tp type; 1046}; 1047 1048struct __struct_double {long double __lx;}; 1049struct __struct_double4 {double __lx[4];}; 1050 1051typedef 1052 __type_list<__align_type<unsigned char>, 1053 __type_list<__align_type<unsigned short>, 1054 __type_list<__align_type<unsigned int>, 1055 __type_list<__align_type<unsigned long>, 1056 __type_list<__align_type<unsigned long long>, 1057 __type_list<__align_type<double>, 1058 __type_list<__align_type<long double>, 1059 __type_list<__align_type<__struct_double>, 1060 __type_list<__align_type<__struct_double4>, 1061 __type_list<__align_type<int*>, 1062 __nat 1063 > > > > > > > > > > __all_types; 1064 1065template <class _TL, size_t _Align> struct __find_pod; 1066 1067template <class _Hp, size_t _Align> 1068struct __find_pod<__type_list<_Hp, __nat>, _Align> 1069{ 1070 typedef typename conditional< 1071 _Align == _Hp::value, 1072 typename _Hp::type, 1073 void 1074 >::type type; 1075}; 1076 1077template <class _Hp, class _Tp, size_t _Align> 1078struct __find_pod<__type_list<_Hp, _Tp>, _Align> 1079{ 1080 typedef typename conditional< 1081 _Align == _Hp::value, 1082 typename _Hp::type, 1083 typename __find_pod<_Tp, _Align>::type 1084 >::type type; 1085}; 1086 1087template <class _TL, size_t _Len> struct __find_max_align; 1088 1089template <class _Hp, size_t _Len> 1090struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1091 1092template <size_t _Len, size_t _A1, size_t _A2> 1093struct __select_align 1094{ 1095private: 1096 static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1097 static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1098public: 1099 static const size_t value = _Len < __max ? __min : __max; 1100}; 1101 1102template <class _Hp, class _Tp, size_t _Len> 1103struct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1104 : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1105 1106template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1107struct _LIBCPP_TYPE_VIS_ONLY aligned_storage 1108{ 1109 typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1110 static_assert(!is_void<_Aligner>::value, ""); 1111 union type 1112 { 1113 _Aligner __align; 1114 unsigned char __data[_Len]; 1115 }; 1116}; 1117 1118#if _LIBCPP_STD_VER > 11 1119template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1120 using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1121#endif 1122 1123#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1124template <size_t _Len>\ 1125struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\ 1126{\ 1127 struct _ALIGNAS(n) type\ 1128 {\ 1129 unsigned char __lx[_Len];\ 1130 };\ 1131} 1132 1133_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1134_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1135_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1136_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1137_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1138_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1139_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1140_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1141_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1142_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1143_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1144_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1145_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1146_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1147// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 1148#if !defined(_LIBCPP_MSVC) 1149_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1150#endif // !_LIBCPP_MSVC 1151 1152#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1153 1154#ifndef _LIBCPP_HAS_NO_VARIADICS 1155 1156// aligned_union 1157 1158template <size_t _I0, size_t ..._In> 1159struct __static_max; 1160 1161template <size_t _I0> 1162struct __static_max<_I0> 1163{ 1164 static const size_t value = _I0; 1165}; 1166 1167template <size_t _I0, size_t _I1, size_t ..._In> 1168struct __static_max<_I0, _I1, _In...> 1169{ 1170 static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1171 __static_max<_I1, _In...>::value; 1172}; 1173 1174template <size_t _Len, class _Type0, class ..._Types> 1175struct aligned_union 1176{ 1177 static const size_t alignment_value = __static_max<__alignof__(_Type0), 1178 __alignof__(_Types)...>::value; 1179 static const size_t __len = __static_max<_Len, sizeof(_Type0), 1180 sizeof(_Types)...>::value; 1181 typedef typename aligned_storage<__len, alignment_value>::type type; 1182}; 1183 1184#if _LIBCPP_STD_VER > 11 1185template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1186#endif 1187 1188#endif // _LIBCPP_HAS_NO_VARIADICS 1189 1190template <class _Tp> 1191struct __numeric_type 1192{ 1193 static void __test(...); 1194 static float __test(float); 1195 static double __test(char); 1196 static double __test(int); 1197 static double __test(unsigned); 1198 static double __test(long); 1199 static double __test(unsigned long); 1200 static double __test(long long); 1201 static double __test(unsigned long long); 1202 static double __test(double); 1203 static long double __test(long double); 1204 1205 typedef decltype(__test(declval<_Tp>())) type; 1206 static const bool value = !is_same<type, void>::value; 1207}; 1208 1209template <> 1210struct __numeric_type<void> 1211{ 1212 static const bool value = true; 1213}; 1214 1215// __promote 1216 1217template <class _A1, class _A2 = void, class _A3 = void, 1218 bool = __numeric_type<_A1>::value && 1219 __numeric_type<_A2>::value && 1220 __numeric_type<_A3>::value> 1221class __promote_imp 1222{ 1223public: 1224 static const bool value = false; 1225}; 1226 1227template <class _A1, class _A2, class _A3> 1228class __promote_imp<_A1, _A2, _A3, true> 1229{ 1230private: 1231 typedef typename __promote_imp<_A1>::type __type1; 1232 typedef typename __promote_imp<_A2>::type __type2; 1233 typedef typename __promote_imp<_A3>::type __type3; 1234public: 1235 typedef decltype(__type1() + __type2() + __type3()) type; 1236 static const bool value = true; 1237}; 1238 1239template <class _A1, class _A2> 1240class __promote_imp<_A1, _A2, void, true> 1241{ 1242private: 1243 typedef typename __promote_imp<_A1>::type __type1; 1244 typedef typename __promote_imp<_A2>::type __type2; 1245public: 1246 typedef decltype(__type1() + __type2()) type; 1247 static const bool value = true; 1248}; 1249 1250template <class _A1> 1251class __promote_imp<_A1, void, void, true> 1252{ 1253public: 1254 typedef typename __numeric_type<_A1>::type type; 1255 static const bool value = true; 1256}; 1257 1258template <class _A1, class _A2 = void, class _A3 = void> 1259class __promote : public __promote_imp<_A1, _A2, _A3> {}; 1260 1261#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 1262 1263// __transform 1264 1265template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 1266template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 1267template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 1268template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 1269template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 1270 1271#endif // _LIBCPP_STORE_AS_OPTIMIZATION 1272 1273// make_signed / make_unsigned 1274 1275typedef 1276 __type_list<signed char, 1277 __type_list<signed short, 1278 __type_list<signed int, 1279 __type_list<signed long, 1280 __type_list<signed long long, 1281#ifndef _LIBCPP_HAS_NO_INT128 1282 __type_list<__int128_t, 1283#endif 1284 __nat 1285#ifndef _LIBCPP_HAS_NO_INT128 1286 > 1287#endif 1288 > > > > > __signed_types; 1289 1290typedef 1291 __type_list<unsigned char, 1292 __type_list<unsigned short, 1293 __type_list<unsigned int, 1294 __type_list<unsigned long, 1295 __type_list<unsigned long long, 1296#ifndef _LIBCPP_HAS_NO_INT128 1297 __type_list<__uint128_t, 1298#endif 1299 __nat 1300#ifndef _LIBCPP_HAS_NO_INT128 1301 > 1302#endif 1303 > > > > > __unsigned_types; 1304 1305template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1306 1307template <class _Hp, class _Tp, size_t _Size> 1308struct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1309{ 1310 typedef _Hp type; 1311}; 1312 1313template <class _Hp, class _Tp, size_t _Size> 1314struct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1315{ 1316 typedef typename __find_first<_Tp, _Size>::type type; 1317}; 1318 1319template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1320 bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1321struct __apply_cv 1322{ 1323 typedef _Up type; 1324}; 1325 1326template <class _Tp, class _Up> 1327struct __apply_cv<_Tp, _Up, true, false> 1328{ 1329 typedef const _Up type; 1330}; 1331 1332template <class _Tp, class _Up> 1333struct __apply_cv<_Tp, _Up, false, true> 1334{ 1335 typedef volatile _Up type; 1336}; 1337 1338template <class _Tp, class _Up> 1339struct __apply_cv<_Tp, _Up, true, true> 1340{ 1341 typedef const volatile _Up type; 1342}; 1343 1344template <class _Tp, class _Up> 1345struct __apply_cv<_Tp&, _Up, false, false> 1346{ 1347 typedef _Up& type; 1348}; 1349 1350template <class _Tp, class _Up> 1351struct __apply_cv<_Tp&, _Up, true, false> 1352{ 1353 typedef const _Up& type; 1354}; 1355 1356template <class _Tp, class _Up> 1357struct __apply_cv<_Tp&, _Up, false, true> 1358{ 1359 typedef volatile _Up& type; 1360}; 1361 1362template <class _Tp, class _Up> 1363struct __apply_cv<_Tp&, _Up, true, true> 1364{ 1365 typedef const volatile _Up& type; 1366}; 1367 1368template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1369struct __make_signed {}; 1370 1371template <class _Tp> 1372struct __make_signed<_Tp, true> 1373{ 1374 typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1375}; 1376 1377template <> struct __make_signed<bool, true> {}; 1378template <> struct __make_signed< signed short, true> {typedef short type;}; 1379template <> struct __make_signed<unsigned short, true> {typedef short type;}; 1380template <> struct __make_signed< signed int, true> {typedef int type;}; 1381template <> struct __make_signed<unsigned int, true> {typedef int type;}; 1382template <> struct __make_signed< signed long, true> {typedef long type;}; 1383template <> struct __make_signed<unsigned long, true> {typedef long type;}; 1384template <> struct __make_signed< signed long long, true> {typedef long long type;}; 1385template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1386#ifndef _LIBCPP_HAS_NO_INT128 1387template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; 1388template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; 1389#endif 1390 1391template <class _Tp> 1392struct _LIBCPP_TYPE_VIS_ONLY make_signed 1393{ 1394 typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1395}; 1396 1397#if _LIBCPP_STD_VER > 11 1398template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1399#endif 1400 1401template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1402struct __make_unsigned {}; 1403 1404template <class _Tp> 1405struct __make_unsigned<_Tp, true> 1406{ 1407 typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1408}; 1409 1410template <> struct __make_unsigned<bool, true> {}; 1411template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1412template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1413template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1414template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1415template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1416template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1417template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1418template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1419#ifndef _LIBCPP_HAS_NO_INT128 1420template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; 1421template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; 1422#endif 1423 1424template <class _Tp> 1425struct _LIBCPP_TYPE_VIS_ONLY make_unsigned 1426{ 1427 typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1428}; 1429 1430#if _LIBCPP_STD_VER > 11 1431template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1432#endif 1433 1434#ifdef _LIBCPP_HAS_NO_VARIADICS 1435 1436template <class _Tp, class _Up = void, class V = void> 1437struct _LIBCPP_TYPE_VIS_ONLY common_type 1438{ 1439public: 1440 typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1441}; 1442 1443template <class _Tp> 1444struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1445{ 1446public: 1447 typedef typename decay<_Tp>::type type; 1448}; 1449 1450template <class _Tp, class _Up> 1451struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void> 1452{ 1453private: 1454#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1455 static _Tp&& __t(); 1456 static _Up&& __u(); 1457#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1458 static _Tp __t(); 1459 static _Up __u(); 1460#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1461public: 1462 typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1463}; 1464 1465#else // _LIBCPP_HAS_NO_VARIADICS 1466 1467template <class ..._Tp> struct common_type; 1468 1469template <class _Tp> 1470struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1471{ 1472 typedef typename decay<_Tp>::type type; 1473}; 1474 1475template <class _Tp, class _Up> 1476struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 1477{ 1478private: 1479 static _Tp&& __t(); 1480 static _Up&& __u(); 1481 static bool __f(); 1482public: 1483 typedef typename decay<decltype(__f() ? __t() : __u())>::type type; 1484}; 1485 1486template <class _Tp, class _Up, class ..._Vp> 1487struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...> 1488{ 1489 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1490}; 1491 1492#if _LIBCPP_STD_VER > 11 1493template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 1494#endif 1495 1496#endif // _LIBCPP_HAS_NO_VARIADICS 1497 1498// is_assignable 1499 1500template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 1501 1502template <class _Tp, class _Arg> 1503typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 1504#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1505__is_assignable_test(_Tp&&, _Arg&&); 1506#else 1507__is_assignable_test(_Tp, _Arg&); 1508#endif 1509 1510template <class _Arg> 1511false_type 1512#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1513__is_assignable_test(__any, _Arg&&); 1514#else 1515__is_assignable_test(__any, _Arg&); 1516#endif 1517 1518template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1519struct __is_assignable_imp 1520 : public common_type 1521 < 1522 decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1523 >::type {}; 1524 1525template <class _Tp, class _Arg> 1526struct __is_assignable_imp<_Tp, _Arg, true> 1527 : public false_type 1528{ 1529}; 1530 1531template <class _Tp, class _Arg> 1532struct is_assignable 1533 : public __is_assignable_imp<_Tp, _Arg> {}; 1534 1535// is_copy_assignable 1536 1537template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable 1538 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1539 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 1540 1541// is_move_assignable 1542 1543template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable 1544#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1545 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1546 const typename add_rvalue_reference<_Tp>::type> {}; 1547#else 1548 : public is_copy_assignable<_Tp> {}; 1549#endif 1550 1551// is_destructible 1552 1553// if it's a reference, return true 1554// if it's a function, return false 1555// if it's void, return false 1556// if it's an array of unknown bound, return false 1557// Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed 1558// where _Up is remove_all_extents<_Tp>::type 1559 1560template <class> 1561struct __is_destructible_apply { typedef int type; }; 1562 1563template <typename _Tp> 1564struct __is_destructor_wellformed { 1565 template <typename _Tp1> 1566 static char __test ( 1567 typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type 1568 ); 1569 1570 template <typename _Tp1> 1571 static __two __test (...); 1572 1573 static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); 1574}; 1575 1576template <class _Tp, bool> 1577struct __destructible_imp; 1578 1579template <class _Tp> 1580struct __destructible_imp<_Tp, false> 1581 : public _VSTD::integral_constant<bool, 1582 __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {}; 1583 1584template <class _Tp> 1585struct __destructible_imp<_Tp, true> 1586 : public _VSTD::true_type {}; 1587 1588template <class _Tp, bool> 1589struct __destructible_false; 1590 1591template <class _Tp> 1592struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {}; 1593 1594template <class _Tp> 1595struct __destructible_false<_Tp, true> : public _VSTD::false_type {}; 1596 1597template <class _Tp> 1598struct is_destructible 1599 : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {}; 1600 1601template <class _Tp> 1602struct is_destructible<_Tp[]> 1603 : public _VSTD::false_type {}; 1604 1605template <> 1606struct is_destructible<void> 1607 : public _VSTD::false_type {}; 1608 1609// move 1610 1611#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1612 1613template <class _Tp> 1614inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1615typename remove_reference<_Tp>::type&& 1616move(_Tp&& __t) _NOEXCEPT 1617{ 1618 typedef typename remove_reference<_Tp>::type _Up; 1619 return static_cast<_Up&&>(__t); 1620} 1621 1622template <class _Tp> 1623inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1624_Tp&& 1625forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1626{ 1627 return static_cast<_Tp&&>(__t); 1628} 1629 1630template <class _Tp> 1631inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1632_Tp&& 1633forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1634{ 1635 static_assert(!std::is_lvalue_reference<_Tp>::value, 1636 "Can not forward an rvalue as an lvalue."); 1637 return static_cast<_Tp&&>(__t); 1638} 1639 1640#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1641 1642template <class _Tp> 1643inline _LIBCPP_INLINE_VISIBILITY 1644_Tp& 1645move(_Tp& __t) 1646{ 1647 return __t; 1648} 1649 1650template <class _Tp> 1651inline _LIBCPP_INLINE_VISIBILITY 1652const _Tp& 1653move(const _Tp& __t) 1654{ 1655 return __t; 1656} 1657 1658template <class _Tp> 1659inline _LIBCPP_INLINE_VISIBILITY 1660_Tp& 1661forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1662{ 1663 return __t; 1664} 1665 1666 1667template <class _Tp> 1668class __rv 1669{ 1670 typedef typename remove_reference<_Tp>::type _Trr; 1671 _Trr& t_; 1672public: 1673 _LIBCPP_INLINE_VISIBILITY 1674 _Trr* operator->() {return &t_;} 1675 _LIBCPP_INLINE_VISIBILITY 1676 explicit __rv(_Trr& __t) : t_(__t) {} 1677}; 1678 1679#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1680 1681#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1682 1683template <class _Tp> 1684inline _LIBCPP_INLINE_VISIBILITY 1685typename decay<_Tp>::type 1686__decay_copy(_Tp&& __t) 1687{ 1688 return _VSTD::forward<_Tp>(__t); 1689} 1690 1691#else 1692 1693template <class _Tp> 1694inline _LIBCPP_INLINE_VISIBILITY 1695typename decay<_Tp>::type 1696__decay_copy(const _Tp& __t) 1697{ 1698 return _VSTD::forward<_Tp>(__t); 1699} 1700 1701#endif 1702 1703#ifndef _LIBCPP_HAS_NO_VARIADICS 1704 1705template <class _Rp, class _Class, class ..._Param> 1706struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1707{ 1708 typedef _Class _ClassType; 1709 typedef _Rp _ReturnType; 1710 typedef _Rp (_FnType) (_Param...); 1711}; 1712 1713template <class _Rp, class _Class, class ..._Param> 1714struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> 1715{ 1716 typedef _Class _ClassType; 1717 typedef _Rp _ReturnType; 1718 typedef _Rp (_FnType) (_Param..., ...); 1719}; 1720 1721template <class _Rp, class _Class, class ..._Param> 1722struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1723{ 1724 typedef _Class const _ClassType; 1725 typedef _Rp _ReturnType; 1726 typedef _Rp (_FnType) (_Param...); 1727}; 1728 1729template <class _Rp, class _Class, class ..._Param> 1730struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> 1731{ 1732 typedef _Class const _ClassType; 1733 typedef _Rp _ReturnType; 1734 typedef _Rp (_FnType) (_Param..., ...); 1735}; 1736 1737template <class _Rp, class _Class, class ..._Param> 1738struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1739{ 1740 typedef _Class volatile _ClassType; 1741 typedef _Rp _ReturnType; 1742 typedef _Rp (_FnType) (_Param...); 1743}; 1744 1745template <class _Rp, class _Class, class ..._Param> 1746struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> 1747{ 1748 typedef _Class volatile _ClassType; 1749 typedef _Rp _ReturnType; 1750 typedef _Rp (_FnType) (_Param..., ...); 1751}; 1752 1753template <class _Rp, class _Class, class ..._Param> 1754struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1755{ 1756 typedef _Class const volatile _ClassType; 1757 typedef _Rp _ReturnType; 1758 typedef _Rp (_FnType) (_Param...); 1759}; 1760 1761template <class _Rp, class _Class, class ..._Param> 1762struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> 1763{ 1764 typedef _Class const volatile _ClassType; 1765 typedef _Rp _ReturnType; 1766 typedef _Rp (_FnType) (_Param..., ...); 1767}; 1768 1769#if __has_feature(cxx_reference_qualified_functions) 1770 1771template <class _Rp, class _Class, class ..._Param> 1772struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1773{ 1774 typedef _Class& _ClassType; 1775 typedef _Rp _ReturnType; 1776 typedef _Rp (_FnType) (_Param...); 1777}; 1778 1779template <class _Rp, class _Class, class ..._Param> 1780struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> 1781{ 1782 typedef _Class& _ClassType; 1783 typedef _Rp _ReturnType; 1784 typedef _Rp (_FnType) (_Param..., ...); 1785}; 1786 1787template <class _Rp, class _Class, class ..._Param> 1788struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1789{ 1790 typedef _Class const& _ClassType; 1791 typedef _Rp _ReturnType; 1792 typedef _Rp (_FnType) (_Param...); 1793}; 1794 1795template <class _Rp, class _Class, class ..._Param> 1796struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> 1797{ 1798 typedef _Class const& _ClassType; 1799 typedef _Rp _ReturnType; 1800 typedef _Rp (_FnType) (_Param..., ...); 1801}; 1802 1803template <class _Rp, class _Class, class ..._Param> 1804struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1805{ 1806 typedef _Class volatile& _ClassType; 1807 typedef _Rp _ReturnType; 1808 typedef _Rp (_FnType) (_Param...); 1809}; 1810 1811template <class _Rp, class _Class, class ..._Param> 1812struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> 1813{ 1814 typedef _Class volatile& _ClassType; 1815 typedef _Rp _ReturnType; 1816 typedef _Rp (_FnType) (_Param..., ...); 1817}; 1818 1819template <class _Rp, class _Class, class ..._Param> 1820struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1821{ 1822 typedef _Class const volatile& _ClassType; 1823 typedef _Rp _ReturnType; 1824 typedef _Rp (_FnType) (_Param...); 1825}; 1826 1827template <class _Rp, class _Class, class ..._Param> 1828struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> 1829{ 1830 typedef _Class const volatile& _ClassType; 1831 typedef _Rp _ReturnType; 1832 typedef _Rp (_FnType) (_Param..., ...); 1833}; 1834 1835template <class _Rp, class _Class, class ..._Param> 1836struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1837{ 1838 typedef _Class&& _ClassType; 1839 typedef _Rp _ReturnType; 1840 typedef _Rp (_FnType) (_Param...); 1841}; 1842 1843template <class _Rp, class _Class, class ..._Param> 1844struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> 1845{ 1846 typedef _Class&& _ClassType; 1847 typedef _Rp _ReturnType; 1848 typedef _Rp (_FnType) (_Param..., ...); 1849}; 1850 1851template <class _Rp, class _Class, class ..._Param> 1852struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1853{ 1854 typedef _Class const&& _ClassType; 1855 typedef _Rp _ReturnType; 1856 typedef _Rp (_FnType) (_Param...); 1857}; 1858 1859template <class _Rp, class _Class, class ..._Param> 1860struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> 1861{ 1862 typedef _Class const&& _ClassType; 1863 typedef _Rp _ReturnType; 1864 typedef _Rp (_FnType) (_Param..., ...); 1865}; 1866 1867template <class _Rp, class _Class, class ..._Param> 1868struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1869{ 1870 typedef _Class volatile&& _ClassType; 1871 typedef _Rp _ReturnType; 1872 typedef _Rp (_FnType) (_Param...); 1873}; 1874 1875template <class _Rp, class _Class, class ..._Param> 1876struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> 1877{ 1878 typedef _Class volatile&& _ClassType; 1879 typedef _Rp _ReturnType; 1880 typedef _Rp (_FnType) (_Param..., ...); 1881}; 1882 1883template <class _Rp, class _Class, class ..._Param> 1884struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1885{ 1886 typedef _Class const volatile&& _ClassType; 1887 typedef _Rp _ReturnType; 1888 typedef _Rp (_FnType) (_Param...); 1889}; 1890 1891template <class _Rp, class _Class, class ..._Param> 1892struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> 1893{ 1894 typedef _Class const volatile&& _ClassType; 1895 typedef _Rp _ReturnType; 1896 typedef _Rp (_FnType) (_Param..., ...); 1897}; 1898 1899#endif // __has_feature(cxx_reference_qualified_functions) 1900 1901#else // _LIBCPP_HAS_NO_VARIADICS 1902 1903template <class _Rp, class _Class> 1904struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1905{ 1906 typedef _Class _ClassType; 1907 typedef _Rp _ReturnType; 1908 typedef _Rp (_FnType) (); 1909}; 1910 1911template <class _Rp, class _Class> 1912struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false> 1913{ 1914 typedef _Class _ClassType; 1915 typedef _Rp _ReturnType; 1916 typedef _Rp (_FnType) (...); 1917}; 1918 1919template <class _Rp, class _Class, class _P0> 1920struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1921{ 1922 typedef _Class _ClassType; 1923 typedef _Rp _ReturnType; 1924 typedef _Rp (_FnType) (_P0); 1925}; 1926 1927template <class _Rp, class _Class, class _P0> 1928struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false> 1929{ 1930 typedef _Class _ClassType; 1931 typedef _Rp _ReturnType; 1932 typedef _Rp (_FnType) (_P0, ...); 1933}; 1934 1935template <class _Rp, class _Class, class _P0, class _P1> 1936struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1937{ 1938 typedef _Class _ClassType; 1939 typedef _Rp _ReturnType; 1940 typedef _Rp (_FnType) (_P0, _P1); 1941}; 1942 1943template <class _Rp, class _Class, class _P0, class _P1> 1944struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false> 1945{ 1946 typedef _Class _ClassType; 1947 typedef _Rp _ReturnType; 1948 typedef _Rp (_FnType) (_P0, _P1, ...); 1949}; 1950 1951template <class _Rp, class _Class, class _P0, class _P1, class _P2> 1952struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1953{ 1954 typedef _Class _ClassType; 1955 typedef _Rp _ReturnType; 1956 typedef _Rp (_FnType) (_P0, _P1, _P2); 1957}; 1958 1959template <class _Rp, class _Class, class _P0, class _P1, class _P2> 1960struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false> 1961{ 1962 typedef _Class _ClassType; 1963 typedef _Rp _ReturnType; 1964 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 1965}; 1966 1967template <class _Rp, class _Class> 1968struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1969{ 1970 typedef _Class const _ClassType; 1971 typedef _Rp _ReturnType; 1972 typedef _Rp (_FnType) (); 1973}; 1974 1975template <class _Rp, class _Class> 1976struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false> 1977{ 1978 typedef _Class const _ClassType; 1979 typedef _Rp _ReturnType; 1980 typedef _Rp (_FnType) (...); 1981}; 1982 1983template <class _Rp, class _Class, class _P0> 1984struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1985{ 1986 typedef _Class const _ClassType; 1987 typedef _Rp _ReturnType; 1988 typedef _Rp (_FnType) (_P0); 1989}; 1990 1991template <class _Rp, class _Class, class _P0> 1992struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false> 1993{ 1994 typedef _Class const _ClassType; 1995 typedef _Rp _ReturnType; 1996 typedef _Rp (_FnType) (_P0, ...); 1997}; 1998 1999template <class _Rp, class _Class, class _P0, class _P1> 2000struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 2001{ 2002 typedef _Class const _ClassType; 2003 typedef _Rp _ReturnType; 2004 typedef _Rp (_FnType) (_P0, _P1); 2005}; 2006 2007template <class _Rp, class _Class, class _P0, class _P1> 2008struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false> 2009{ 2010 typedef _Class const _ClassType; 2011 typedef _Rp _ReturnType; 2012 typedef _Rp (_FnType) (_P0, _P1, ...); 2013}; 2014 2015template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2016struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 2017{ 2018 typedef _Class const _ClassType; 2019 typedef _Rp _ReturnType; 2020 typedef _Rp (_FnType) (_P0, _P1, _P2); 2021}; 2022 2023template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2024struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false> 2025{ 2026 typedef _Class const _ClassType; 2027 typedef _Rp _ReturnType; 2028 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2029}; 2030 2031template <class _Rp, class _Class> 2032struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 2033{ 2034 typedef _Class volatile _ClassType; 2035 typedef _Rp _ReturnType; 2036 typedef _Rp (_FnType) (); 2037}; 2038 2039template <class _Rp, class _Class> 2040struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false> 2041{ 2042 typedef _Class volatile _ClassType; 2043 typedef _Rp _ReturnType; 2044 typedef _Rp (_FnType) (...); 2045}; 2046 2047template <class _Rp, class _Class, class _P0> 2048struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 2049{ 2050 typedef _Class volatile _ClassType; 2051 typedef _Rp _ReturnType; 2052 typedef _Rp (_FnType) (_P0); 2053}; 2054 2055template <class _Rp, class _Class, class _P0> 2056struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false> 2057{ 2058 typedef _Class volatile _ClassType; 2059 typedef _Rp _ReturnType; 2060 typedef _Rp (_FnType) (_P0, ...); 2061}; 2062 2063template <class _Rp, class _Class, class _P0, class _P1> 2064struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 2065{ 2066 typedef _Class volatile _ClassType; 2067 typedef _Rp _ReturnType; 2068 typedef _Rp (_FnType) (_P0, _P1); 2069}; 2070 2071template <class _Rp, class _Class, class _P0, class _P1> 2072struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false> 2073{ 2074 typedef _Class volatile _ClassType; 2075 typedef _Rp _ReturnType; 2076 typedef _Rp (_FnType) (_P0, _P1, ...); 2077}; 2078 2079template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2080struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 2081{ 2082 typedef _Class volatile _ClassType; 2083 typedef _Rp _ReturnType; 2084 typedef _Rp (_FnType) (_P0, _P1, _P2); 2085}; 2086 2087template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2088struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false> 2089{ 2090 typedef _Class volatile _ClassType; 2091 typedef _Rp _ReturnType; 2092 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2093}; 2094 2095template <class _Rp, class _Class> 2096struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 2097{ 2098 typedef _Class const volatile _ClassType; 2099 typedef _Rp _ReturnType; 2100 typedef _Rp (_FnType) (); 2101}; 2102 2103template <class _Rp, class _Class> 2104struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false> 2105{ 2106 typedef _Class const volatile _ClassType; 2107 typedef _Rp _ReturnType; 2108 typedef _Rp (_FnType) (...); 2109}; 2110 2111template <class _Rp, class _Class, class _P0> 2112struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 2113{ 2114 typedef _Class const volatile _ClassType; 2115 typedef _Rp _ReturnType; 2116 typedef _Rp (_FnType) (_P0); 2117}; 2118 2119template <class _Rp, class _Class, class _P0> 2120struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false> 2121{ 2122 typedef _Class const volatile _ClassType; 2123 typedef _Rp _ReturnType; 2124 typedef _Rp (_FnType) (_P0, ...); 2125}; 2126 2127template <class _Rp, class _Class, class _P0, class _P1> 2128struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 2129{ 2130 typedef _Class const volatile _ClassType; 2131 typedef _Rp _ReturnType; 2132 typedef _Rp (_FnType) (_P0, _P1); 2133}; 2134 2135template <class _Rp, class _Class, class _P0, class _P1> 2136struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false> 2137{ 2138 typedef _Class const volatile _ClassType; 2139 typedef _Rp _ReturnType; 2140 typedef _Rp (_FnType) (_P0, _P1, ...); 2141}; 2142 2143template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2144struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 2145{ 2146 typedef _Class const volatile _ClassType; 2147 typedef _Rp _ReturnType; 2148 typedef _Rp (_FnType) (_P0, _P1, _P2); 2149}; 2150 2151template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2152struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false> 2153{ 2154 typedef _Class const volatile _ClassType; 2155 typedef _Rp _ReturnType; 2156 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2157}; 2158 2159#endif // _LIBCPP_HAS_NO_VARIADICS 2160 2161template <class _Rp, class _Class> 2162struct __member_pointer_traits_imp<_Rp _Class::*, false, true> 2163{ 2164 typedef _Class _ClassType; 2165 typedef _Rp _ReturnType; 2166}; 2167 2168template <class _MP> 2169struct __member_pointer_traits 2170 : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 2171 is_member_function_pointer<_MP>::value, 2172 is_member_object_pointer<_MP>::value> 2173{ 2174// typedef ... _ClassType; 2175// typedef ... _ReturnType; 2176// typedef ... _FnType; 2177}; 2178 2179// result_of 2180 2181template <class _Callable> class result_of; 2182 2183#ifdef _LIBCPP_HAS_NO_VARIADICS 2184 2185template <class _Fn, bool, bool> 2186class __result_of 2187{ 2188}; 2189 2190template <class _Fn> 2191class __result_of<_Fn(), true, false> 2192{ 2193public: 2194 typedef decltype(declval<_Fn>()()) type; 2195}; 2196 2197template <class _Fn, class _A0> 2198class __result_of<_Fn(_A0), true, false> 2199{ 2200public: 2201 typedef decltype(declval<_Fn>()(declval<_A0>())) type; 2202}; 2203 2204template <class _Fn, class _A0, class _A1> 2205class __result_of<_Fn(_A0, _A1), true, false> 2206{ 2207public: 2208 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 2209}; 2210 2211template <class _Fn, class _A0, class _A1, class _A2> 2212class __result_of<_Fn(_A0, _A1, _A2), true, false> 2213{ 2214public: 2215 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 2216}; 2217 2218template <class _MP, class _Tp, bool _IsMemberFunctionPtr> 2219struct __result_of_mp; 2220 2221// member function pointer 2222 2223template <class _MP, class _Tp> 2224struct __result_of_mp<_MP, _Tp, true> 2225 : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 2226{ 2227}; 2228 2229// member data pointer 2230 2231template <class _MP, class _Tp, bool> 2232struct __result_of_mdp; 2233 2234template <class _Rp, class _Class, class _Tp> 2235struct __result_of_mdp<_Rp _Class::*, _Tp, false> 2236{ 2237 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 2238}; 2239 2240template <class _Rp, class _Class, class _Tp> 2241struct __result_of_mdp<_Rp _Class::*, _Tp, true> 2242{ 2243 typedef typename __apply_cv<_Tp, _Rp>::type& type; 2244}; 2245 2246template <class _Rp, class _Class, class _Tp> 2247struct __result_of_mp<_Rp _Class::*, _Tp, false> 2248 : public __result_of_mdp<_Rp _Class::*, _Tp, 2249 is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 2250{ 2251}; 2252 2253 2254 2255template <class _Fn, class _Tp> 2256class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 2257 : public __result_of_mp<typename remove_reference<_Fn>::type, 2258 _Tp, 2259 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2260{ 2261}; 2262 2263template <class _Fn, class _Tp, class _A0> 2264class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 2265 : public __result_of_mp<typename remove_reference<_Fn>::type, 2266 _Tp, 2267 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2268{ 2269}; 2270 2271template <class _Fn, class _Tp, class _A0, class _A1> 2272class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 2273 : public __result_of_mp<typename remove_reference<_Fn>::type, 2274 _Tp, 2275 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2276{ 2277}; 2278 2279template <class _Fn, class _Tp, class _A0, class _A1, class _A2> 2280class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 2281 : public __result_of_mp<typename remove_reference<_Fn>::type, 2282 _Tp, 2283 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2284{ 2285}; 2286 2287// result_of 2288 2289template <class _Fn> 2290class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()> 2291 : public __result_of<_Fn(), 2292 is_class<typename remove_reference<_Fn>::type>::value || 2293 is_function<typename remove_reference<_Fn>::type>::value, 2294 is_member_pointer<typename remove_reference<_Fn>::type>::value 2295 > 2296{ 2297}; 2298 2299template <class _Fn, class _A0> 2300class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)> 2301 : public __result_of<_Fn(_A0), 2302 is_class<typename remove_reference<_Fn>::type>::value || 2303 is_function<typename remove_reference<_Fn>::type>::value, 2304 is_member_pointer<typename remove_reference<_Fn>::type>::value 2305 > 2306{ 2307}; 2308 2309template <class _Fn, class _A0, class _A1> 2310class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)> 2311 : public __result_of<_Fn(_A0, _A1), 2312 is_class<typename remove_reference<_Fn>::type>::value || 2313 is_function<typename remove_reference<_Fn>::type>::value, 2314 is_member_pointer<typename remove_reference<_Fn>::type>::value 2315 > 2316{ 2317}; 2318 2319template <class _Fn, class _A0, class _A1, class _A2> 2320class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> 2321 : public __result_of<_Fn(_A0, _A1, _A2), 2322 is_class<typename remove_reference<_Fn>::type>::value || 2323 is_function<typename remove_reference<_Fn>::type>::value, 2324 is_member_pointer<typename remove_reference<_Fn>::type>::value 2325 > 2326{ 2327}; 2328 2329#endif // _LIBCPP_HAS_NO_VARIADICS 2330 2331// template <class T, class... Args> struct is_constructible; 2332 2333namespace __is_construct 2334{ 2335struct __nat {}; 2336} 2337 2338#if __has_feature(is_constructible) 2339 2340template <class _Tp, class ..._Args> 2341struct _LIBCPP_TYPE_VIS_ONLY is_constructible 2342 : public integral_constant<bool, __is_constructible(_Tp, _Args...)> 2343 {}; 2344 2345#else 2346 2347#ifndef _LIBCPP_HAS_NO_VARIADICS 2348 2349// main is_constructible test 2350 2351template <class _Tp, class ..._Args> 2352typename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type 2353__is_constructible_test(_Tp&&, _Args&& ...); 2354 2355template <class ..._Args> 2356false_type 2357__is_constructible_test(__any, _Args&& ...); 2358 2359template <bool, class _Tp, class... _Args> 2360struct __libcpp_is_constructible // false, _Tp is not a scalar 2361 : public common_type 2362 < 2363 decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 2364 >::type 2365 {}; 2366 2367// function types are not constructible 2368 2369template <class _Rp, class... _A1, class... _A2> 2370struct __libcpp_is_constructible<false, _Rp(_A1...), _A2...> 2371 : public false_type 2372 {}; 2373 2374// handle scalars and reference types 2375 2376// Scalars are default constructible, references are not 2377 2378template <class _Tp> 2379struct __libcpp_is_constructible<true, _Tp> 2380 : public is_scalar<_Tp> 2381 {}; 2382 2383// Scalars and references are constructible from one arg if that arg is 2384// implicitly convertible to the scalar or reference. 2385 2386template <class _Tp> 2387struct __is_constructible_ref 2388{ 2389 true_type static __lxx(_Tp); 2390 false_type static __lxx(...); 2391}; 2392 2393template <class _Tp, class _A0> 2394struct __libcpp_is_constructible<true, _Tp, _A0> 2395 : public common_type 2396 < 2397 decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) 2398 >::type 2399 {}; 2400 2401// Scalars and references are not constructible from multiple args. 2402 2403template <class _Tp, class _A0, class ..._Args> 2404struct __libcpp_is_constructible<true, _Tp, _A0, _Args...> 2405 : public false_type 2406 {}; 2407 2408// Treat scalars and reference types separately 2409 2410template <bool, class _Tp, class... _Args> 2411struct __is_constructible_void_check 2412 : public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2413 _Tp, _Args...> 2414 {}; 2415 2416// If any of T or Args is void, is_constructible should be false 2417 2418template <class _Tp, class... _Args> 2419struct __is_constructible_void_check<true, _Tp, _Args...> 2420 : public false_type 2421 {}; 2422 2423template <class ..._Args> struct __contains_void; 2424 2425template <> struct __contains_void<> : false_type {}; 2426 2427template <class _A0, class ..._Args> 2428struct __contains_void<_A0, _Args...> 2429{ 2430 static const bool value = is_void<_A0>::value || 2431 __contains_void<_Args...>::value; 2432}; 2433 2434// is_constructible entry point 2435 2436template <class _Tp, class... _Args> 2437struct _LIBCPP_TYPE_VIS_ONLY is_constructible 2438 : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 2439 || is_abstract<_Tp>::value, 2440 _Tp, _Args...> 2441 {}; 2442 2443// Array types are default constructible if their element type 2444// is default constructible 2445 2446template <class _Ap, size_t _Np> 2447struct __libcpp_is_constructible<false, _Ap[_Np]> 2448 : public is_constructible<typename remove_all_extents<_Ap>::type> 2449 {}; 2450 2451// Otherwise array types are not constructible by this syntax 2452 2453template <class _Ap, size_t _Np, class ..._Args> 2454struct __libcpp_is_constructible<false, _Ap[_Np], _Args...> 2455 : public false_type 2456 {}; 2457 2458// Incomplete array types are not constructible 2459 2460template <class _Ap, class ..._Args> 2461struct __libcpp_is_constructible<false, _Ap[], _Args...> 2462 : public false_type 2463 {}; 2464 2465#else // _LIBCPP_HAS_NO_VARIADICS 2466 2467// template <class T> struct is_constructible0; 2468 2469// main is_constructible0 test 2470 2471template <class _Tp> 2472decltype((_Tp(), true_type())) 2473__is_constructible0_test(_Tp&); 2474 2475false_type 2476__is_constructible0_test(__any); 2477 2478template <class _Tp, class _A0> 2479decltype((_Tp(_VSTD::declval<_A0>()), true_type())) 2480__is_constructible1_test(_Tp&, _A0&); 2481 2482template <class _A0> 2483false_type 2484__is_constructible1_test(__any, _A0&); 2485 2486template <class _Tp, class _A0, class _A1> 2487decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 2488__is_constructible2_test(_Tp&, _A0&, _A1&); 2489 2490template <class _A0, class _A1> 2491false_type 2492__is_constructible2_test(__any, _A0&, _A1&); 2493 2494template <bool, class _Tp> 2495struct __is_constructible0_imp // false, _Tp is not a scalar 2496 : public common_type 2497 < 2498 decltype(__is_constructible0_test(declval<_Tp&>())) 2499 >::type 2500 {}; 2501 2502template <bool, class _Tp, class _A0> 2503struct __is_constructible1_imp // false, _Tp is not a scalar 2504 : public common_type 2505 < 2506 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 2507 >::type 2508 {}; 2509 2510template <bool, class _Tp, class _A0, class _A1> 2511struct __is_constructible2_imp // false, _Tp is not a scalar 2512 : public common_type 2513 < 2514 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 2515 >::type 2516 {}; 2517 2518// handle scalars and reference types 2519 2520// Scalars are default constructible, references are not 2521 2522template <class _Tp> 2523struct __is_constructible0_imp<true, _Tp> 2524 : public is_scalar<_Tp> 2525 {}; 2526 2527template <class _Tp, class _A0> 2528struct __is_constructible1_imp<true, _Tp, _A0> 2529 : public is_convertible<_A0, _Tp> 2530 {}; 2531 2532template <class _Tp, class _A0, class _A1> 2533struct __is_constructible2_imp<true, _Tp, _A0, _A1> 2534 : public false_type 2535 {}; 2536 2537// Treat scalars and reference types separately 2538 2539template <bool, class _Tp> 2540struct __is_constructible0_void_check 2541 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2542 _Tp> 2543 {}; 2544 2545template <bool, class _Tp, class _A0> 2546struct __is_constructible1_void_check 2547 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2548 _Tp, _A0> 2549 {}; 2550 2551template <bool, class _Tp, class _A0, class _A1> 2552struct __is_constructible2_void_check 2553 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2554 _Tp, _A0, _A1> 2555 {}; 2556 2557// If any of T or Args is void, is_constructible should be false 2558 2559template <class _Tp> 2560struct __is_constructible0_void_check<true, _Tp> 2561 : public false_type 2562 {}; 2563 2564template <class _Tp, class _A0> 2565struct __is_constructible1_void_check<true, _Tp, _A0> 2566 : public false_type 2567 {}; 2568 2569template <class _Tp, class _A0, class _A1> 2570struct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2571 : public false_type 2572 {}; 2573 2574// is_constructible entry point 2575 2576template <class _Tp, class _A0 = __is_construct::__nat, 2577 class _A1 = __is_construct::__nat> 2578struct _LIBCPP_TYPE_VIS_ONLY is_constructible 2579 : public __is_constructible2_void_check<is_void<_Tp>::value 2580 || is_abstract<_Tp>::value 2581 || is_function<_Tp>::value 2582 || is_void<_A0>::value 2583 || is_void<_A1>::value, 2584 _Tp, _A0, _A1> 2585 {}; 2586 2587template <class _Tp> 2588struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2589 : public __is_constructible0_void_check<is_void<_Tp>::value 2590 || is_abstract<_Tp>::value 2591 || is_function<_Tp>::value, 2592 _Tp> 2593 {}; 2594 2595template <class _Tp, class _A0> 2596struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 2597 : public __is_constructible1_void_check<is_void<_Tp>::value 2598 || is_abstract<_Tp>::value 2599 || is_function<_Tp>::value 2600 || is_void<_A0>::value, 2601 _Tp, _A0> 2602 {}; 2603 2604// Array types are default constructible if their element type 2605// is default constructible 2606 2607template <class _Ap, size_t _Np> 2608struct __is_constructible0_imp<false, _Ap[_Np]> 2609 : public is_constructible<typename remove_all_extents<_Ap>::type> 2610 {}; 2611 2612template <class _Ap, size_t _Np, class _A0> 2613struct __is_constructible1_imp<false, _Ap[_Np], _A0> 2614 : public false_type 2615 {}; 2616 2617template <class _Ap, size_t _Np, class _A0, class _A1> 2618struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2619 : public false_type 2620 {}; 2621 2622// Incomplete array types are not constructible 2623 2624template <class _Ap> 2625struct __is_constructible0_imp<false, _Ap[]> 2626 : public false_type 2627 {}; 2628 2629template <class _Ap, class _A0> 2630struct __is_constructible1_imp<false, _Ap[], _A0> 2631 : public false_type 2632 {}; 2633 2634template <class _Ap, class _A0, class _A1> 2635struct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2636 : public false_type 2637 {}; 2638 2639#endif // _LIBCPP_HAS_NO_VARIADICS 2640#endif // __has_feature(is_constructible) 2641 2642// is_default_constructible 2643 2644template <class _Tp> 2645struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 2646 : public is_constructible<_Tp> 2647 {}; 2648 2649// is_copy_constructible 2650 2651template <class _Tp> 2652struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 2653 : public is_constructible<_Tp, 2654 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2655 2656// is_move_constructible 2657 2658template <class _Tp> 2659struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 2660#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2661 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2662#else 2663 : public is_copy_constructible<_Tp> 2664#endif 2665 {}; 2666 2667// is_trivially_constructible 2668 2669#ifndef _LIBCPP_HAS_NO_VARIADICS 2670 2671#if __has_feature(is_trivially_constructible) 2672 2673template <class _Tp, class... _Args> 2674struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2675 : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2676{ 2677}; 2678 2679#else // !__has_feature(is_trivially_constructible) 2680 2681template <class _Tp, class... _Args> 2682struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2683 : false_type 2684{ 2685}; 2686 2687template <class _Tp> 2688struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 2689#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) 2690 : integral_constant<bool, __has_trivial_constructor(_Tp)> 2691#else 2692 : integral_constant<bool, is_scalar<_Tp>::value> 2693#endif 2694{ 2695}; 2696 2697template <class _Tp> 2698#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2699struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 2700#else 2701struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 2702#endif 2703 : integral_constant<bool, is_scalar<_Tp>::value> 2704{ 2705}; 2706 2707template <class _Tp> 2708struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 2709 : integral_constant<bool, is_scalar<_Tp>::value> 2710{ 2711}; 2712 2713template <class _Tp> 2714struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 2715 : integral_constant<bool, is_scalar<_Tp>::value> 2716{ 2717}; 2718 2719#endif // !__has_feature(is_trivially_constructible) 2720 2721#else // _LIBCPP_HAS_NO_VARIADICS 2722 2723template <class _Tp, class _A0 = __is_construct::__nat, 2724 class _A1 = __is_construct::__nat> 2725struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2726 : false_type 2727{ 2728}; 2729 2730#if __has_feature(is_trivially_constructible) 2731 2732template <class _Tp> 2733struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2734 __is_construct::__nat> 2735 : integral_constant<bool, __is_trivially_constructible(_Tp)> 2736{ 2737}; 2738 2739template <class _Tp> 2740struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2741 __is_construct::__nat> 2742 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2743{ 2744}; 2745 2746template <class _Tp> 2747struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2748 __is_construct::__nat> 2749 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2750{ 2751}; 2752 2753template <class _Tp> 2754struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2755 __is_construct::__nat> 2756 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2757{ 2758}; 2759 2760#else // !__has_feature(is_trivially_constructible) 2761 2762template <class _Tp> 2763struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2764 __is_construct::__nat> 2765 : integral_constant<bool, is_scalar<_Tp>::value> 2766{ 2767}; 2768 2769template <class _Tp> 2770struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2771 __is_construct::__nat> 2772 : integral_constant<bool, is_scalar<_Tp>::value> 2773{ 2774}; 2775 2776template <class _Tp> 2777struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2778 __is_construct::__nat> 2779 : integral_constant<bool, is_scalar<_Tp>::value> 2780{ 2781}; 2782 2783template <class _Tp> 2784struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2785 __is_construct::__nat> 2786 : integral_constant<bool, is_scalar<_Tp>::value> 2787{ 2788}; 2789 2790#endif // !__has_feature(is_trivially_constructible) 2791 2792#endif // _LIBCPP_HAS_NO_VARIADICS 2793 2794// is_trivially_default_constructible 2795 2796template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 2797 : public is_trivially_constructible<_Tp> 2798 {}; 2799 2800// is_trivially_copy_constructible 2801 2802template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 2803 : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 2804 {}; 2805 2806// is_trivially_move_constructible 2807 2808template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 2809#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2810 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2811#else 2812 : public is_trivially_copy_constructible<_Tp> 2813#endif 2814 {}; 2815 2816// is_trivially_assignable 2817 2818#if __has_feature(is_trivially_assignable) 2819 2820template <class _Tp, class _Arg> 2821struct is_trivially_assignable 2822 : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2823{ 2824}; 2825 2826#else // !__has_feature(is_trivially_assignable) 2827 2828template <class _Tp, class _Arg> 2829struct is_trivially_assignable 2830 : public false_type {}; 2831 2832template <class _Tp> 2833struct is_trivially_assignable<_Tp&, _Tp> 2834 : integral_constant<bool, is_scalar<_Tp>::value> {}; 2835 2836template <class _Tp> 2837struct is_trivially_assignable<_Tp&, _Tp&> 2838 : integral_constant<bool, is_scalar<_Tp>::value> {}; 2839 2840template <class _Tp> 2841struct is_trivially_assignable<_Tp&, const _Tp&> 2842 : integral_constant<bool, is_scalar<_Tp>::value> {}; 2843 2844#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2845 2846template <class _Tp> 2847struct is_trivially_assignable<_Tp&, _Tp&&> 2848 : integral_constant<bool, is_scalar<_Tp>::value> {}; 2849 2850#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2851 2852#endif // !__has_feature(is_trivially_assignable) 2853 2854// is_trivially_copy_assignable 2855 2856template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 2857 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2858 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2859 2860// is_trivially_move_assignable 2861 2862template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 2863 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2864#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2865 typename add_rvalue_reference<_Tp>::type> 2866#else 2867 typename add_lvalue_reference<_Tp>::type> 2868#endif 2869 {}; 2870 2871// is_trivially_destructible 2872 2873#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) 2874 2875template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2876 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; 2877 2878#else 2879 2880template <class _Tp> struct __libcpp_trivial_destructor 2881 : public integral_constant<bool, is_scalar<_Tp>::value || 2882 is_reference<_Tp>::value> {}; 2883 2884template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2885 : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2886 2887#endif 2888 2889// is_nothrow_constructible 2890 2891#if 0 2892template <class _Tp, class... _Args> 2893struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2894 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 2895{ 2896}; 2897 2898#else 2899 2900#ifndef _LIBCPP_HAS_NO_VARIADICS 2901 2902#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 2903 2904template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; 2905 2906template <class _Tp, class... _Args> 2907struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...> 2908 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2909{ 2910}; 2911 2912template <class _Tp> 2913void __implicit_conversion_to(_Tp) noexcept { } 2914 2915template <class _Tp, class _Arg> 2916struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> 2917 : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))> 2918{ 2919}; 2920 2921template <class _Tp, bool _IsReference, class... _Args> 2922struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...> 2923 : public false_type 2924{ 2925}; 2926 2927template <class _Tp, class... _Args> 2928struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2929 : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...> 2930{ 2931}; 2932 2933template <class _Tp, size_t _Ns> 2934struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 2935 : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> 2936{ 2937}; 2938 2939#else // __has_feature(cxx_noexcept) 2940 2941template <class _Tp, class... _Args> 2942struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2943 : false_type 2944{ 2945}; 2946 2947template <class _Tp> 2948struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 2949#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 2950 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2951#else 2952 : integral_constant<bool, is_scalar<_Tp>::value> 2953#endif 2954{ 2955}; 2956 2957template <class _Tp> 2958#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2959struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 2960#else 2961struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 2962#endif 2963#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2964 : integral_constant<bool, __has_nothrow_copy(_Tp)> 2965#else 2966 : integral_constant<bool, is_scalar<_Tp>::value> 2967#endif 2968{ 2969}; 2970 2971template <class _Tp> 2972struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 2973#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2974 : integral_constant<bool, __has_nothrow_copy(_Tp)> 2975#else 2976 : integral_constant<bool, is_scalar<_Tp>::value> 2977#endif 2978{ 2979}; 2980 2981template <class _Tp> 2982struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 2983#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2984 : integral_constant<bool, __has_nothrow_copy(_Tp)> 2985#else 2986 : integral_constant<bool, is_scalar<_Tp>::value> 2987#endif 2988{ 2989}; 2990 2991#endif // __has_feature(cxx_noexcept) 2992 2993#else // _LIBCPP_HAS_NO_VARIADICS 2994 2995template <class _Tp, class _A0 = __is_construct::__nat, 2996 class _A1 = __is_construct::__nat> 2997struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2998 : false_type 2999{ 3000}; 3001 3002template <class _Tp> 3003struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 3004 __is_construct::__nat> 3005#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3006 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3007#else 3008 : integral_constant<bool, is_scalar<_Tp>::value> 3009#endif 3010{ 3011}; 3012 3013template <class _Tp> 3014struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 3015 __is_construct::__nat> 3016#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3017 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3018#else 3019 : integral_constant<bool, is_scalar<_Tp>::value> 3020#endif 3021{ 3022}; 3023 3024template <class _Tp> 3025struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 3026 __is_construct::__nat> 3027#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3028 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3029#else 3030 : integral_constant<bool, is_scalar<_Tp>::value> 3031#endif 3032{ 3033}; 3034 3035template <class _Tp> 3036struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 3037 __is_construct::__nat> 3038#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3039 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3040#else 3041 : integral_constant<bool, is_scalar<_Tp>::value> 3042#endif 3043{ 3044}; 3045 3046#endif // _LIBCPP_HAS_NO_VARIADICS 3047#endif // __has_feature(is_nothrow_constructible) 3048 3049// is_nothrow_default_constructible 3050 3051template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 3052 : public is_nothrow_constructible<_Tp> 3053 {}; 3054 3055// is_nothrow_copy_constructible 3056 3057template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 3058 : public is_nothrow_constructible<_Tp, 3059 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3060 3061// is_nothrow_move_constructible 3062 3063template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 3064#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3065 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3066#else 3067 : public is_nothrow_copy_constructible<_Tp> 3068#endif 3069 {}; 3070 3071// is_nothrow_assignable 3072 3073#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3074 3075template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; 3076 3077template <class _Tp, class _Arg> 3078struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> 3079 : public false_type 3080{ 3081}; 3082 3083template <class _Tp, class _Arg> 3084struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> 3085 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 3086{ 3087}; 3088 3089template <class _Tp, class _Arg> 3090struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3091 : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 3092{ 3093}; 3094 3095#else // __has_feature(cxx_noexcept) 3096 3097template <class _Tp, class _Arg> 3098struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3099 : public false_type {}; 3100 3101template <class _Tp> 3102struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 3103#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3104 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3105#else 3106 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3107#endif 3108 3109template <class _Tp> 3110struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> 3111#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3112 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3113#else 3114 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3115#endif 3116 3117template <class _Tp> 3118struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> 3119#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3120 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3121#else 3122 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3123#endif 3124 3125#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3126 3127template <class _Tp> 3128struct is_nothrow_assignable<_Tp&, _Tp&&> 3129#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3130 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3131#else 3132 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3133#endif 3134 3135#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3136 3137#endif // __has_feature(cxx_noexcept) 3138 3139// is_nothrow_copy_assignable 3140 3141template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 3142 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3143 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3144 3145// is_nothrow_move_assignable 3146 3147template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 3148 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3149#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3150 typename add_rvalue_reference<_Tp>::type> 3151#else 3152 typename add_lvalue_reference<_Tp>::type> 3153#endif 3154 {}; 3155 3156// is_nothrow_destructible 3157 3158#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3159 3160template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; 3161 3162template <class _Tp> 3163struct __libcpp_is_nothrow_destructible<false, _Tp> 3164 : public false_type 3165{ 3166}; 3167 3168template <class _Tp> 3169struct __libcpp_is_nothrow_destructible<true, _Tp> 3170 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 3171{ 3172}; 3173 3174template <class _Tp> 3175struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3176 : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 3177{ 3178}; 3179 3180template <class _Tp, size_t _Ns> 3181struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 3182 : public is_nothrow_destructible<_Tp> 3183{ 3184}; 3185 3186template <class _Tp> 3187struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 3188 : public true_type 3189{ 3190}; 3191 3192#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3193 3194template <class _Tp> 3195struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 3196 : public true_type 3197{ 3198}; 3199 3200#endif 3201 3202#else 3203 3204template <class _Tp> struct __libcpp_nothrow_destructor 3205 : public integral_constant<bool, is_scalar<_Tp>::value || 3206 is_reference<_Tp>::value> {}; 3207 3208template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3209 : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 3210 3211#endif 3212 3213// is_pod 3214 3215#if __has_feature(is_pod) || (_GNUC_VER >= 403) 3216 3217template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3218 : public integral_constant<bool, __is_pod(_Tp)> {}; 3219 3220#else 3221 3222template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3223 : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 3224 is_trivially_copy_constructible<_Tp>::value && 3225 is_trivially_copy_assignable<_Tp>::value && 3226 is_trivially_destructible<_Tp>::value> {}; 3227 3228#endif 3229 3230// is_literal_type; 3231 3232template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 3233#ifdef _LIBCPP_IS_LITERAL 3234 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)> 3235#else 3236 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 3237 is_reference<typename remove_all_extents<_Tp>::type>::value> 3238#endif 3239 {}; 3240 3241// is_standard_layout; 3242 3243template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 3244#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) 3245 : public integral_constant<bool, __is_standard_layout(_Tp)> 3246#else 3247 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3248#endif 3249 {}; 3250 3251// is_trivially_copyable; 3252 3253template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 3254#if __has_feature(is_trivially_copyable) 3255 : public integral_constant<bool, __is_trivially_copyable(_Tp)> 3256#else 3257 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3258#endif 3259 {}; 3260 3261// is_trivial; 3262 3263template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 3264#if __has_feature(is_trivial) || (_GNUC_VER >= 407) 3265 : public integral_constant<bool, __is_trivial(_Tp)> 3266#else 3267 : integral_constant<bool, is_trivially_copyable<_Tp>::value && 3268 is_trivially_default_constructible<_Tp>::value> 3269#endif 3270 {}; 3271 3272#ifndef _LIBCPP_HAS_NO_VARIADICS 3273 3274// Check for complete types 3275 3276template <class ..._Tp> struct __check_complete; 3277 3278template <> 3279struct __check_complete<> 3280{ 3281}; 3282 3283template <class _Hp, class _T0, class ..._Tp> 3284struct __check_complete<_Hp, _T0, _Tp...> 3285 : private __check_complete<_Hp>, 3286 private __check_complete<_T0, _Tp...> 3287{ 3288}; 3289 3290template <class _Hp> 3291struct __check_complete<_Hp, _Hp> 3292 : private __check_complete<_Hp> 3293{ 3294}; 3295 3296template <class _Tp> 3297struct __check_complete<_Tp> 3298{ 3299 static_assert(sizeof(_Tp) > 0, "Type must be complete."); 3300}; 3301 3302template <class _Tp> 3303struct __check_complete<_Tp&> 3304 : private __check_complete<_Tp> 3305{ 3306}; 3307 3308template <class _Tp> 3309struct __check_complete<_Tp&&> 3310 : private __check_complete<_Tp> 3311{ 3312}; 3313 3314template <class _Rp, class ..._Param> 3315struct __check_complete<_Rp (*)(_Param...)> 3316 : private __check_complete<_Rp> 3317{ 3318}; 3319 3320template <class ..._Param> 3321struct __check_complete<void (*)(_Param...)> 3322{ 3323}; 3324 3325template <class _Rp, class ..._Param> 3326struct __check_complete<_Rp (_Param...)> 3327 : private __check_complete<_Rp> 3328{ 3329}; 3330 3331template <class ..._Param> 3332struct __check_complete<void (_Param...)> 3333{ 3334}; 3335 3336template <class _Rp, class _Class, class ..._Param> 3337struct __check_complete<_Rp (_Class::*)(_Param...)> 3338 : private __check_complete<_Class> 3339{ 3340}; 3341 3342template <class _Rp, class _Class, class ..._Param> 3343struct __check_complete<_Rp (_Class::*)(_Param...) const> 3344 : private __check_complete<_Class> 3345{ 3346}; 3347 3348template <class _Rp, class _Class, class ..._Param> 3349struct __check_complete<_Rp (_Class::*)(_Param...) volatile> 3350 : private __check_complete<_Class> 3351{ 3352}; 3353 3354template <class _Rp, class _Class, class ..._Param> 3355struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 3356 : private __check_complete<_Class> 3357{ 3358}; 3359 3360#if __has_feature(cxx_reference_qualified_functions) 3361 3362template <class _Rp, class _Class, class ..._Param> 3363struct __check_complete<_Rp (_Class::*)(_Param...) &> 3364 : private __check_complete<_Class> 3365{ 3366}; 3367 3368template <class _Rp, class _Class, class ..._Param> 3369struct __check_complete<_Rp (_Class::*)(_Param...) const&> 3370 : private __check_complete<_Class> 3371{ 3372}; 3373 3374template <class _Rp, class _Class, class ..._Param> 3375struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 3376 : private __check_complete<_Class> 3377{ 3378}; 3379 3380template <class _Rp, class _Class, class ..._Param> 3381struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 3382 : private __check_complete<_Class> 3383{ 3384}; 3385 3386template <class _Rp, class _Class, class ..._Param> 3387struct __check_complete<_Rp (_Class::*)(_Param...) &&> 3388 : private __check_complete<_Class> 3389{ 3390}; 3391 3392template <class _Rp, class _Class, class ..._Param> 3393struct __check_complete<_Rp (_Class::*)(_Param...) const&&> 3394 : private __check_complete<_Class> 3395{ 3396}; 3397 3398template <class _Rp, class _Class, class ..._Param> 3399struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 3400 : private __check_complete<_Class> 3401{ 3402}; 3403 3404template <class _Rp, class _Class, class ..._Param> 3405struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 3406 : private __check_complete<_Class> 3407{ 3408}; 3409 3410#endif 3411 3412template <class _Rp, class _Class> 3413struct __check_complete<_Rp _Class::*> 3414 : private __check_complete<_Class> 3415{ 3416}; 3417 3418// __invoke forward declarations 3419 3420// fall back - none of the bullets 3421 3422template <class ..._Args> 3423auto 3424__invoke(__any, _Args&& ...__args) 3425 -> __nat; 3426 3427// bullets 1 and 2 3428 3429template <class _Fp, class _A0, class ..._Args, 3430 class = typename enable_if 3431 < 3432 is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3433 is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type, 3434 typename remove_reference<_A0>::type>::value 3435 >::type 3436 > 3437_LIBCPP_INLINE_VISIBILITY 3438auto 3439__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3440 -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 3441 3442template <class _Fp, class _A0, class ..._Args, 3443 class = typename enable_if 3444 < 3445 is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3446 !is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type, 3447 typename remove_reference<_A0>::type>::value 3448 >::type 3449 > 3450_LIBCPP_INLINE_VISIBILITY 3451auto 3452__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3453 -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 3454 3455// bullets 3 and 4 3456 3457template <class _Fp, class _A0, 3458 class = typename enable_if 3459 < 3460 is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3461 is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3462 typename remove_reference<_A0>::type>::value 3463 >::type 3464 > 3465_LIBCPP_INLINE_VISIBILITY 3466auto 3467__invoke(_Fp&& __f, _A0&& __a0) 3468 -> decltype(_VSTD::forward<_A0>(__a0).*__f); 3469 3470template <class _Fp, class _A0, 3471 class = typename enable_if 3472 < 3473 is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3474 !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3475 typename remove_reference<_A0>::type>::value 3476 >::type 3477 > 3478_LIBCPP_INLINE_VISIBILITY 3479auto 3480__invoke(_Fp&& __f, _A0&& __a0) 3481 -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 3482 3483// bullet 5 3484 3485template <class _Fp, class ..._Args> 3486_LIBCPP_INLINE_VISIBILITY 3487auto 3488__invoke(_Fp&& __f, _Args&& ...__args) 3489 -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 3490 3491// __invokable 3492 3493template <class _Fp, class ..._Args> 3494struct __invokable_imp 3495 : private __check_complete<_Fp> 3496{ 3497 typedef decltype( 3498 __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 3499 ) type; 3500 static const bool value = !is_same<type, __nat>::value; 3501}; 3502 3503template <class _Fp, class ..._Args> 3504struct __invokable 3505 : public integral_constant<bool, 3506 __invokable_imp<_Fp, _Args...>::value> 3507{ 3508}; 3509 3510// __invoke_of 3511 3512template <bool _Invokable, class _Fp, class ..._Args> 3513struct __invoke_of_imp // false 3514{ 3515}; 3516 3517template <class _Fp, class ..._Args> 3518struct __invoke_of_imp<true, _Fp, _Args...> 3519{ 3520 typedef typename __invokable_imp<_Fp, _Args...>::type type; 3521}; 3522 3523template <class _Fp, class ..._Args> 3524struct __invoke_of 3525 : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 3526{ 3527}; 3528 3529template <class _Fp, class ..._Args> 3530class _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 3531 : public __invoke_of<_Fp, _Args...> 3532{ 3533}; 3534 3535#if _LIBCPP_STD_VER > 11 3536template <class _Tp> using result_of_t = typename result_of<_Tp>::type; 3537#endif 3538 3539#endif // _LIBCPP_HAS_NO_VARIADICS 3540 3541template <class _Tp> 3542inline _LIBCPP_INLINE_VISIBILITY 3543#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3544typename enable_if 3545< 3546 is_move_constructible<_Tp>::value && 3547 is_move_assignable<_Tp>::value 3548>::type 3549#else 3550void 3551#endif 3552swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 3553 is_nothrow_move_assignable<_Tp>::value) 3554{ 3555 _Tp __t(_VSTD::move(__x)); 3556 __x = _VSTD::move(__y); 3557 __y = _VSTD::move(__t); 3558} 3559 3560template <class _ForwardIterator1, class _ForwardIterator2> 3561inline _LIBCPP_INLINE_VISIBILITY 3562void 3563iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 3564 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 3565 _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 3566 *_VSTD::declval<_ForwardIterator2>()))) 3567{ 3568 swap(*__a, *__b); 3569} 3570 3571// __swappable 3572 3573namespace __detail 3574{ 3575 3576using _VSTD::swap; 3577__nat swap(__any, __any); 3578 3579template <class _Tp> 3580struct __swappable 3581{ 3582 typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 3583 static const bool value = !is_same<type, __nat>::value; 3584}; 3585 3586} // __detail 3587 3588template <class _Tp> 3589struct __is_swappable 3590 : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3591{ 3592}; 3593 3594#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3595 3596template <bool, class _Tp> 3597struct __is_nothrow_swappable_imp 3598 : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3599 _VSTD::declval<_Tp&>()))> 3600{ 3601}; 3602 3603template <class _Tp> 3604struct __is_nothrow_swappable_imp<false, _Tp> 3605 : public false_type 3606{ 3607}; 3608 3609template <class _Tp> 3610struct __is_nothrow_swappable 3611 : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3612{ 3613}; 3614 3615#else // __has_feature(cxx_noexcept) 3616 3617template <class _Tp> 3618struct __is_nothrow_swappable 3619 : public false_type 3620{ 3621}; 3622 3623#endif // __has_feature(cxx_noexcept) 3624 3625#ifdef _LIBCPP_UNDERLYING_TYPE 3626 3627template <class _Tp> 3628struct underlying_type 3629{ 3630 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; 3631}; 3632 3633#if _LIBCPP_STD_VER > 11 3634template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 3635#endif 3636 3637#else // _LIBCPP_UNDERLYING_TYPE 3638 3639template <class _Tp, bool _Support = false> 3640struct underlying_type 3641{ 3642 static_assert(_Support, "The underyling_type trait requires compiler " 3643 "support. Either no such support exists or " 3644 "libc++ does not know how to use it."); 3645}; 3646 3647#endif // _LIBCPP_UNDERLYING_TYPE 3648 3649#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3650 3651template <class _Tp> 3652struct __has_operator_addressof_member_imp 3653{ 3654 template <class _Up> 3655 static auto __test(int) 3656 -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type; 3657 template <class> 3658 static auto __test(long) -> false_type; 3659 3660 static const bool value = decltype(__test<_Tp>(0))::value; 3661}; 3662 3663template <class _Tp> 3664struct __has_operator_addressof_free_imp 3665{ 3666 template <class _Up> 3667 static auto __test(int) 3668 -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type; 3669 template <class> 3670 static auto __test(long) -> false_type; 3671 3672 static const bool value = decltype(__test<_Tp>(0))::value; 3673}; 3674 3675template <class _Tp> 3676struct __has_operator_addressof 3677 : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value 3678 || __has_operator_addressof_free_imp<_Tp>::value> 3679{}; 3680 3681#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE 3682 3683#if _LIBCPP_STD_VER > 14 3684template <class...> using void_t = void; 3685#endif 3686 3687_LIBCPP_END_NAMESPACE_STD 3688 3689#endif // _LIBCPP_TYPE_TRAITS 3690