1// -*- C++ -*- 2//===------------------------ type_traits ---------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// 9//===----------------------------------------------------------------------===// 10 11#ifndef _LIBCPP_TYPE_TRAITS 12#define _LIBCPP_TYPE_TRAITS 13 14/* 15 type_traits synopsis 16 17namespace std 18{ 19 20 // helper class: 21 template <class T, T v> struct integral_constant; 22 typedef integral_constant<bool, true> true_type; // C++11 23 typedef integral_constant<bool, false> false_type; // C++11 24 25 template <bool B> // C++14 26 using bool_constant = integral_constant<bool, B>; // C++14 27 typedef bool_constant<true> true_type; // C++14 28 typedef bool_constant<false> false_type; // C++14 29 30 // helper traits 31 template <bool, class T = void> struct enable_if; 32 template <bool, class T, class F> struct conditional; 33 34 // Primary classification traits: 35 template <class T> struct is_void; 36 template <class T> struct is_null_pointer; // C++14 37 template <class T> struct is_integral; 38 template <class T> struct is_floating_point; 39 template <class T> struct is_array; 40 template <class T> struct is_pointer; 41 template <class T> struct is_lvalue_reference; 42 template <class T> struct is_rvalue_reference; 43 template <class T> struct is_member_object_pointer; 44 template <class T> struct is_member_function_pointer; 45 template <class T> struct is_enum; 46 template <class T> struct is_union; 47 template <class T> struct is_class; 48 template <class T> struct is_function; 49 50 // Secondary classification traits: 51 template <class T> struct is_reference; 52 template <class T> struct is_arithmetic; 53 template <class T> struct is_fundamental; 54 template <class T> struct is_member_pointer; 55 template <class T> struct is_scalar; 56 template <class T> struct is_object; 57 template <class T> struct is_compound; 58 59 // Const-volatile properties and transformations: 60 template <class T> struct is_const; 61 template <class T> struct is_volatile; 62 template <class T> struct remove_const; 63 template <class T> struct remove_volatile; 64 template <class T> struct remove_cv; 65 template <class T> struct add_const; 66 template <class T> struct add_volatile; 67 template <class T> struct add_cv; 68 69 // Reference transformations: 70 template <class T> struct remove_reference; 71 template <class T> struct add_lvalue_reference; 72 template <class T> struct add_rvalue_reference; 73 74 // Pointer transformations: 75 template <class T> struct remove_pointer; 76 template <class T> struct add_pointer; 77 78 // Integral properties: 79 template <class T> struct is_signed; 80 template <class T> struct is_unsigned; 81 template <class T> struct make_signed; 82 template <class T> struct make_unsigned; 83 84 // Array properties and transformations: 85 template <class T> struct rank; 86 template <class T, unsigned I = 0> struct extent; 87 template <class T> struct remove_extent; 88 template <class T> struct remove_all_extents; 89 90 // Member introspection: 91 template <class T> struct is_pod; 92 template <class T> struct is_trivial; 93 template <class T> struct is_trivially_copyable; 94 template <class T> struct is_standard_layout; 95 template <class T> struct is_literal_type; 96 template <class T> struct is_empty; 97 template <class T> struct is_polymorphic; 98 template <class T> struct is_abstract; 99 template <class T> struct is_final; // C++14 100 101 template <class T, class... Args> struct is_constructible; 102 template <class T> struct is_default_constructible; 103 template <class T> struct is_copy_constructible; 104 template <class T> struct is_move_constructible; 105 template <class T, class U> struct is_assignable; 106 template <class T> struct is_copy_assignable; 107 template <class T> struct is_move_assignable; 108 template <class T, class U> struct is_swappable_with; // C++17 109 template <class T> struct is_swappable; // C++17 110 template <class T> struct is_destructible; 111 112 template <class T, class... Args> struct is_trivially_constructible; 113 template <class T> struct is_trivially_default_constructible; 114 template <class T> struct is_trivially_copy_constructible; 115 template <class T> struct is_trivially_move_constructible; 116 template <class T, class U> struct is_trivially_assignable; 117 template <class T> struct is_trivially_copy_assignable; 118 template <class T> struct is_trivially_move_assignable; 119 template <class T> struct is_trivially_destructible; 120 121 template <class T, class... Args> struct is_nothrow_constructible; 122 template <class T> struct is_nothrow_default_constructible; 123 template <class T> struct is_nothrow_copy_constructible; 124 template <class T> struct is_nothrow_move_constructible; 125 template <class T, class U> struct is_nothrow_assignable; 126 template <class T> struct is_nothrow_copy_assignable; 127 template <class T> struct is_nothrow_move_assignable; 128 template <class T, class U> struct is_nothrow_swappable_with; // C++17 129 template <class T> struct is_nothrow_swappable; // C++17 130 template <class T> struct is_nothrow_destructible; 131 132 template <class T> struct has_virtual_destructor; 133 134 // Relationships between types: 135 template <class T, class U> struct is_same; 136 template <class Base, class Derived> struct is_base_of; 137 template <class From, class To> struct is_convertible; 138 139 template <class, class R = void> struct is_callable; // not defined 140 template <class Fn, class... ArgTypes, class R> 141 struct is_callable<Fn(ArgTypes...), R>; 142 143 template <class, class R = void> struct is_nothrow_callable; // not defined 144 template <class Fn, class... ArgTypes, class R> 145 struct is_nothrow_callable<Fn(ArgTypes...), R>; 146 147 // Alignment properties and transformations: 148 template <class T> struct alignment_of; 149 template <size_t Len, size_t Align = most_stringent_alignment_requirement> 150 struct aligned_storage; 151 template <size_t Len, class... Types> struct aligned_union; 152 153 template <class T> struct decay; 154 template <class... T> struct common_type; 155 template <class T> struct underlying_type; 156 template <class> class result_of; // undefined 157 template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>; 158 159 // const-volatile modifications: 160 template <class T> 161 using remove_const_t = typename remove_const<T>::type; // C++14 162 template <class T> 163 using remove_volatile_t = typename remove_volatile<T>::type; // C++14 164 template <class T> 165 using remove_cv_t = typename remove_cv<T>::type; // C++14 166 template <class T> 167 using add_const_t = typename add_const<T>::type; // C++14 168 template <class T> 169 using add_volatile_t = typename add_volatile<T>::type; // C++14 170 template <class T> 171 using add_cv_t = typename add_cv<T>::type; // C++14 172 173 // reference modifications: 174 template <class T> 175 using remove_reference_t = typename remove_reference<T>::type; // C++14 176 template <class T> 177 using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14 178 template <class T> 179 using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14 180 181 // sign modifications: 182 template <class T> 183 using make_signed_t = typename make_signed<T>::type; // C++14 184 template <class T> 185 using make_unsigned_t = typename make_unsigned<T>::type; // C++14 186 187 // array modifications: 188 template <class T> 189 using remove_extent_t = typename remove_extent<T>::type; // C++14 190 template <class T> 191 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14 192 193 // pointer modifications: 194 template <class T> 195 using remove_pointer_t = typename remove_pointer<T>::type; // C++14 196 template <class T> 197 using add_pointer_t = typename add_pointer<T>::type; // C++14 198 199 // other transformations: 200 template <size_t Len, std::size_t Align=default-alignment> 201 using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14 202 template <std::size_t Len, class... Types> 203 using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14 204 template <class T> 205 using decay_t = typename decay<T>::type; // C++14 206 template <bool b, class T=void> 207 using enable_if_t = typename enable_if<b,T>::type; // C++14 208 template <bool b, class T, class F> 209 using conditional_t = typename conditional<b,T,F>::type; // C++14 210 template <class... T> 211 using common_type_t = typename common_type<T...>::type; // C++14 212 template <class T> 213 using underlying_type_t = typename underlying_type<T>::type; // C++14 214 template <class F, class... ArgTypes> 215 using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14 216 217 template <class...> 218 using void_t = void; // C++17 219 220 // See C++14 20.10.4.1, primary type categories 221 template <class T> constexpr bool is_void_v 222 = is_void<T>::value; // C++17 223 template <class T> constexpr bool is_null_pointer_v 224 = is_null_pointer<T>::value; // C++17 225 template <class T> constexpr bool is_integral_v 226 = is_integral<T>::value; // C++17 227 template <class T> constexpr bool is_floating_point_v 228 = is_floating_point<T>::value; // C++17 229 template <class T> constexpr bool is_array_v 230 = is_array<T>::value; // C++17 231 template <class T> constexpr bool is_pointer_v 232 = is_pointer<T>::value; // C++17 233 template <class T> constexpr bool is_lvalue_reference_v 234 = is_lvalue_reference<T>::value; // C++17 235 template <class T> constexpr bool is_rvalue_reference_v 236 = is_rvalue_reference<T>::value; // C++17 237 template <class T> constexpr bool is_member_object_pointer_v 238 = is_member_object_pointer<T>::value; // C++17 239 template <class T> constexpr bool is_member_function_pointer_v 240 = is_member_function_pointer<T>::value; // C++17 241 template <class T> constexpr bool is_enum_v 242 = is_enum<T>::value; // C++17 243 template <class T> constexpr bool is_union_v 244 = is_union<T>::value; // C++17 245 template <class T> constexpr bool is_class_v 246 = is_class<T>::value; // C++17 247 template <class T> constexpr bool is_function_v 248 = is_function<T>::value; // C++17 249 250 // See C++14 20.10.4.2, composite type categories 251 template <class T> constexpr bool is_reference_v 252 = is_reference<T>::value; // C++17 253 template <class T> constexpr bool is_arithmetic_v 254 = is_arithmetic<T>::value; // C++17 255 template <class T> constexpr bool is_fundamental_v 256 = is_fundamental<T>::value; // C++17 257 template <class T> constexpr bool is_object_v 258 = is_object<T>::value; // C++17 259 template <class T> constexpr bool is_scalar_v 260 = is_scalar<T>::value; // C++17 261 template <class T> constexpr bool is_compound_v 262 = is_compound<T>::value; // C++17 263 template <class T> constexpr bool is_member_pointer_v 264 = is_member_pointer<T>::value; // C++17 265 266 // See C++14 20.10.4.3, type properties 267 template <class T> constexpr bool is_const_v 268 = is_const<T>::value; // C++17 269 template <class T> constexpr bool is_volatile_v 270 = is_volatile<T>::value; // C++17 271 template <class T> constexpr bool is_trivial_v 272 = is_trivial<T>::value; // C++17 273 template <class T> constexpr bool is_trivially_copyable_v 274 = is_trivially_copyable<T>::value; // C++17 275 template <class T> constexpr bool is_standard_layout_v 276 = is_standard_layout<T>::value; // C++17 277 template <class T> constexpr bool is_pod_v 278 = is_pod<T>::value; // C++17 279 template <class T> constexpr bool is_literal_type_v 280 = is_literal_type<T>::value; // C++17 281 template <class T> constexpr bool is_empty_v 282 = is_empty<T>::value; // C++17 283 template <class T> constexpr bool is_polymorphic_v 284 = is_polymorphic<T>::value; // C++17 285 template <class T> constexpr bool is_abstract_v 286 = is_abstract<T>::value; // C++17 287 template <class T> constexpr bool is_final_v 288 = is_final<T>::value; // C++17 289 template <class T> constexpr bool is_signed_v 290 = is_signed<T>::value; // C++17 291 template <class T> constexpr bool is_unsigned_v 292 = is_unsigned<T>::value; // C++17 293 template <class T, class... Args> constexpr bool is_constructible_v 294 = is_constructible<T, Args...>::value; // C++17 295 template <class T> constexpr bool is_default_constructible_v 296 = is_default_constructible<T>::value; // C++17 297 template <class T> constexpr bool is_copy_constructible_v 298 = is_copy_constructible<T>::value; // C++17 299 template <class T> constexpr bool is_move_constructible_v 300 = is_move_constructible<T>::value; // C++17 301 template <class T, class U> constexpr bool is_assignable_v 302 = is_assignable<T, U>::value; // C++17 303 template <class T> constexpr bool is_copy_assignable_v 304 = is_copy_assignable<T>::value; // C++17 305 template <class T> constexpr bool is_move_assignable_v 306 = is_move_assignable<T>::value; // C++17 307 template <class T, class U> constexpr bool is_swappable_with_v 308 = is_swappable_with<T, U>::value; // C++17 309 template <class T> constexpr bool is_swappable_v 310 = is_swappable<T>::value; // C++17 311 template <class T> constexpr bool is_destructible_v 312 = is_destructible<T>::value; // C++17 313 template <class T, class... Args> constexpr bool is_trivially_constructible_v 314 = is_trivially_constructible<T, Args...>::value; // C++17 315 template <class T> constexpr bool is_trivially_default_constructible_v 316 = is_trivially_default_constructible<T>::value; // C++17 317 template <class T> constexpr bool is_trivially_copy_constructible_v 318 = is_trivially_copy_constructible<T>::value; // C++17 319 template <class T> constexpr bool is_trivially_move_constructible_v 320 = is_trivially_move_constructible<T>::value; // C++17 321 template <class T, class U> constexpr bool is_trivially_assignable_v 322 = is_trivially_assignable<T, U>::value; // C++17 323 template <class T> constexpr bool is_trivially_copy_assignable_v 324 = is_trivially_copy_assignable<T>::value; // C++17 325 template <class T> constexpr bool is_trivially_move_assignable_v 326 = is_trivially_move_assignable<T>::value; // C++17 327 template <class T> constexpr bool is_trivially_destructible_v 328 = is_trivially_destructible<T>::value; // C++17 329 template <class T, class... Args> constexpr bool is_nothrow_constructible_v 330 = is_nothrow_constructible<T, Args...>::value; // C++17 331 template <class T> constexpr bool is_nothrow_default_constructible_v 332 = is_nothrow_default_constructible<T>::value; // C++17 333 template <class T> constexpr bool is_nothrow_copy_constructible_v 334 = is_nothrow_copy_constructible<T>::value; // C++17 335 template <class T> constexpr bool is_nothrow_move_constructible_v 336 = is_nothrow_move_constructible<T>::value; // C++17 337 template <class T, class U> constexpr bool is_nothrow_assignable_v 338 = is_nothrow_assignable<T, U>::value; // C++17 339 template <class T> constexpr bool is_nothrow_copy_assignable_v 340 = is_nothrow_copy_assignable<T>::value; // C++17 341 template <class T> constexpr bool is_nothrow_move_assignable_v 342 = is_nothrow_move_assignable<T>::value; // C++17 343 template <class T, class U> constexpr bool is_nothrow_swappable_with_v 344 = is_nothrow_swappable_with<T, U>::value; // C++17 345 template <class T> constexpr bool is_nothrow_swappable_v 346 = is_nothrow_swappable<T>::value; // C++17 347 template <class T> constexpr bool is_nothrow_destructible_v 348 = is_nothrow_destructible<T>::value; // C++17 349 template <class T> constexpr bool has_virtual_destructor_v 350 = has_virtual_destructor<T>::value; // C++17 351 352 // See C++14 20.10.5, type property queries 353 template <class T> constexpr size_t alignment_of_v 354 = alignment_of<T>::value; // C++17 355 template <class T> constexpr size_t rank_v 356 = rank<T>::value; // C++17 357 template <class T, unsigned I = 0> constexpr size_t extent_v 358 = extent<T, I>::value; // C++17 359 360 // See C++14 20.10.6, type relations 361 template <class T, class U> constexpr bool is_same_v 362 = is_same<T, U>::value; // C++17 363 template <class Base, class Derived> constexpr bool is_base_of_v 364 = is_base_of<Base, Derived>::value; // C++17 365 template <class From, class To> constexpr bool is_convertible_v 366 = is_convertible<From, To>::value; // C++17 367 template <class T, class R = void> constexpr bool is_callable_v 368 = is_callable<T, R>::value; // C++17 369 template <class T, class R = void> constexpr bool is_nothrow_callable_v 370 = is_nothrow_callable<T, R>::value; // C++17 371 372 // [meta.logical], logical operator traits: 373 template<class... B> struct conjunction; // C++17 374 template<class... B> 375 constexpr bool conjunction_v = conjunction<B...>::value; // C++17 376 template<class... B> struct disjunction; // C++17 377 template<class... B> 378 constexpr bool disjunction_v = disjunction<B...>::value; // C++17 379 template<class B> struct negation; // C++17 380 template<class B> 381 constexpr bool negation_v = negation<B>::value; // C++17 382 383} 384 385*/ 386#include <__config> 387#include <cstddef> 388 389#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 390#pragma GCC system_header 391#endif 392 393_LIBCPP_BEGIN_NAMESPACE_STD 394 395template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair; 396template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; 397template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash; 398 399template <class> 400struct __void_t { typedef void type; }; 401 402template <class _Tp> 403struct __identity { typedef _Tp type; }; 404 405template <class _Tp, bool> 406struct _LIBCPP_TYPE_VIS_ONLY __dependent_type : public _Tp {}; 407 408template <bool _Bp, class _If, class _Then> 409 struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;}; 410template <class _If, class _Then> 411 struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;}; 412 413#if _LIBCPP_STD_VER > 11 414template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; 415#endif 416 417template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {}; 418template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;}; 419 420template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {}; 421template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;}; 422 423#if _LIBCPP_STD_VER > 11 424template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; 425#endif 426 427// addressof 428#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF 429 430template <class _Tp> 431inline _LIBCPP_CONSTEXPR_AFTER_CXX14 432_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY 433_Tp* 434addressof(_Tp& __x) _NOEXCEPT 435{ 436 return __builtin_addressof(__x); 437} 438 439#else 440 441template <class _Tp> 442inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY 443_Tp* 444addressof(_Tp& __x) _NOEXCEPT 445{ 446 return (_Tp*)&reinterpret_cast<const volatile char&>(__x); 447} 448 449#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF 450 451#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF) 452// Objective-C++ Automatic Reference Counting uses qualified pointers 453// that require special addressof() signatures. When 454// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler 455// itself is providing these definitions. Otherwise, we provide them. 456template <class _Tp> 457inline _LIBCPP_INLINE_VISIBILITY 458__strong _Tp* 459addressof(__strong _Tp& __x) _NOEXCEPT 460{ 461 return &__x; 462} 463 464#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK 465template <class _Tp> 466inline _LIBCPP_INLINE_VISIBILITY 467__weak _Tp* 468addressof(__weak _Tp& __x) _NOEXCEPT 469{ 470 return &__x; 471} 472#endif 473 474template <class _Tp> 475inline _LIBCPP_INLINE_VISIBILITY 476__autoreleasing _Tp* 477addressof(__autoreleasing _Tp& __x) _NOEXCEPT 478{ 479 return &__x; 480} 481 482template <class _Tp> 483inline _LIBCPP_INLINE_VISIBILITY 484__unsafe_unretained _Tp* 485addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT 486{ 487 return &__x; 488} 489#endif 490 491#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DELETED_FUNCTIONS) 492template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete; 493#endif 494 495struct __two {char __lx[2];}; 496 497// helper class: 498 499template <class _Tp, _Tp __v> 500struct _LIBCPP_TYPE_VIS_ONLY integral_constant 501{ 502 static _LIBCPP_CONSTEXPR const _Tp value = __v; 503 typedef _Tp value_type; 504 typedef integral_constant type; 505 _LIBCPP_INLINE_VISIBILITY 506 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;} 507#if _LIBCPP_STD_VER > 11 508 _LIBCPP_INLINE_VISIBILITY 509 constexpr value_type operator ()() const _NOEXCEPT {return value;} 510#endif 511}; 512 513template <class _Tp, _Tp __v> 514_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; 515 516#if _LIBCPP_STD_VER > 14 517template <bool __b> 518using bool_constant = integral_constant<bool, __b>; 519#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)> 520#else 521#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)> 522#endif 523 524typedef _LIBCPP_BOOL_CONSTANT(true) true_type; 525typedef _LIBCPP_BOOL_CONSTANT(false) false_type; 526 527#if !defined(_LIBCPP_CXX03_LANG) 528 529// __lazy_and 530 531template <bool _Last, class ..._Preds> 532struct __lazy_and_impl; 533 534template <class ..._Preds> 535struct __lazy_and_impl<false, _Preds...> : false_type {}; 536 537template <> 538struct __lazy_and_impl<true> : true_type {}; 539 540template <class _Pred> 541struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {}; 542 543template <class _Hp, class ..._Tp> 544struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {}; 545 546template <class _P1, class ..._Pr> 547struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {}; 548 549// __lazy_or 550 551template <bool _List, class ..._Preds> 552struct __lazy_or_impl; 553 554template <class ..._Preds> 555struct __lazy_or_impl<true, _Preds...> : true_type {}; 556 557template <> 558struct __lazy_or_impl<false> : false_type {}; 559 560template <class _Hp, class ..._Tp> 561struct __lazy_or_impl<false, _Hp, _Tp...> 562 : __lazy_or_impl<_Hp::type::value, _Tp...> {}; 563 564template <class _P1, class ..._Pr> 565struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {}; 566 567// __lazy_not 568 569template <class _Pred> 570struct __lazy_not : integral_constant<bool, !_Pred::type::value> {}; 571 572// __and_ 573template<class...> struct __and_; 574template<> struct __and_<> : true_type {}; 575 576template<class _B0> struct __and_<_B0> : _B0 {}; 577 578template<class _B0, class _B1> 579struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {}; 580 581template<class _B0, class _B1, class _B2, class... _Bn> 582struct __and_<_B0, _B1, _B2, _Bn...> 583 : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {}; 584 585// __or_ 586template<class...> struct __or_; 587template<> struct __or_<> : false_type {}; 588 589template<class _B0> struct __or_<_B0> : _B0 {}; 590 591template<class _B0, class _B1> 592struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {}; 593 594template<class _B0, class _B1, class _B2, class... _Bn> 595struct __or_<_B0, _B1, _B2, _Bn...> 596 : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {}; 597 598// __not_ 599template<class _Tp> 600struct __not_ : conditional<_Tp::value, false_type, true_type>::type {}; 601 602#endif // !defined(_LIBCPP_CXX03_LANG) 603 604// is_const 605 606template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; 607template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; 608 609#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 610template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v 611 = is_const<_Tp>::value; 612#endif 613 614// is_volatile 615 616template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; 617template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; 618 619#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 620template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v 621 = is_volatile<_Tp>::value; 622#endif 623 624// remove_const 625 626template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; 627template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;}; 628#if _LIBCPP_STD_VER > 11 629template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; 630#endif 631 632// remove_volatile 633 634template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;}; 635template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;}; 636#if _LIBCPP_STD_VER > 11 637template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; 638#endif 639 640// remove_cv 641 642template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv 643{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; 644#if _LIBCPP_STD_VER > 11 645template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; 646#endif 647 648// is_void 649 650template <class _Tp> struct __libcpp_is_void : public false_type {}; 651template <> struct __libcpp_is_void<void> : public true_type {}; 652 653template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void 654 : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; 655 656#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 657template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v 658 = is_void<_Tp>::value; 659#endif 660 661// __is_nullptr_t 662 663template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; 664template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; 665 666template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t 667 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 668 669#if _LIBCPP_STD_VER > 11 670template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer 671 : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 672 673#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 674template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v 675 = is_null_pointer<_Tp>::value; 676#endif 677#endif 678 679// is_integral 680 681template <class _Tp> struct __libcpp_is_integral : public false_type {}; 682template <> struct __libcpp_is_integral<bool> : public true_type {}; 683template <> struct __libcpp_is_integral<char> : public true_type {}; 684template <> struct __libcpp_is_integral<signed char> : public true_type {}; 685template <> struct __libcpp_is_integral<unsigned char> : public true_type {}; 686template <> struct __libcpp_is_integral<wchar_t> : public true_type {}; 687#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 688template <> struct __libcpp_is_integral<char16_t> : public true_type {}; 689template <> struct __libcpp_is_integral<char32_t> : public true_type {}; 690#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 691template <> struct __libcpp_is_integral<short> : public true_type {}; 692template <> struct __libcpp_is_integral<unsigned short> : public true_type {}; 693template <> struct __libcpp_is_integral<int> : public true_type {}; 694template <> struct __libcpp_is_integral<unsigned int> : public true_type {}; 695template <> struct __libcpp_is_integral<long> : public true_type {}; 696template <> struct __libcpp_is_integral<unsigned long> : public true_type {}; 697template <> struct __libcpp_is_integral<long long> : public true_type {}; 698template <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; 699#ifndef _LIBCPP_HAS_NO_INT128 700template <> struct __libcpp_is_integral<__int128_t> : public true_type {}; 701template <> struct __libcpp_is_integral<__uint128_t> : public true_type {}; 702#endif 703 704template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral 705 : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; 706 707#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 708template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v 709 = is_integral<_Tp>::value; 710#endif 711 712// is_floating_point 713 714template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; 715template <> struct __libcpp_is_floating_point<float> : public true_type {}; 716template <> struct __libcpp_is_floating_point<double> : public true_type {}; 717template <> struct __libcpp_is_floating_point<long double> : public true_type {}; 718 719template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point 720 : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; 721 722#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 723template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v 724 = is_floating_point<_Tp>::value; 725#endif 726 727// is_array 728 729template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array 730 : public false_type {}; 731template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> 732 : public true_type {}; 733template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> 734 : public true_type {}; 735 736#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 737template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v 738 = is_array<_Tp>::value; 739#endif 740 741// is_pointer 742 743template <class _Tp> struct __libcpp_is_pointer : public false_type {}; 744template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; 745 746template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer 747 : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; 748 749#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 750template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v 751 = is_pointer<_Tp>::value; 752#endif 753 754// is_reference 755 756template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; 757template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {}; 758 759template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {}; 760#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 761template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {}; 762#endif 763 764template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {}; 765template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {}; 766#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 767template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; 768#endif 769 770#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 771template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v 772 = is_reference<_Tp>::value; 773 774template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v 775 = is_lvalue_reference<_Tp>::value; 776 777template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v 778 = is_rvalue_reference<_Tp>::value; 779#endif 780// is_union 781 782#if __has_feature(is_union) || (_GNUC_VER >= 403) 783 784template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 785 : public integral_constant<bool, __is_union(_Tp)> {}; 786 787#else 788 789template <class _Tp> struct __libcpp_union : public false_type {}; 790template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 791 : public __libcpp_union<typename remove_cv<_Tp>::type> {}; 792 793#endif 794 795#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 796template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v 797 = is_union<_Tp>::value; 798#endif 799 800// is_class 801 802#if __has_feature(is_class) || (_GNUC_VER >= 403) 803 804template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 805 : public integral_constant<bool, __is_class(_Tp)> {}; 806 807#else 808 809namespace __is_class_imp 810{ 811template <class _Tp> char __test(int _Tp::*); 812template <class _Tp> __two __test(...); 813} 814 815template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 816 : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; 817 818#endif 819 820#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 821template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v 822 = is_class<_Tp>::value; 823#endif 824 825// is_same 826 827template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; 828template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; 829 830#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 831template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v 832 = is_same<_Tp, _Up>::value; 833#endif 834 835// is_function 836 837namespace __libcpp_is_function_imp 838{ 839struct __dummy_type {}; 840template <class _Tp> char __test(_Tp*); 841template <class _Tp> char __test(__dummy_type); 842template <class _Tp> __two __test(...); 843template <class _Tp> _Tp& __source(int); 844template <class _Tp> __dummy_type __source(...); 845} 846 847template <class _Tp, bool = is_class<_Tp>::value || 848 is_union<_Tp>::value || 849 is_void<_Tp>::value || 850 is_reference<_Tp>::value || 851 __is_nullptr_t<_Tp>::value > 852struct __libcpp_is_function 853 : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1> 854 {}; 855template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; 856 857template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function 858 : public __libcpp_is_function<_Tp> {}; 859 860#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 861template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v 862 = is_function<_Tp>::value; 863#endif 864 865// is_member_function_pointer 866 867// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 868// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 869// 870 871template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> 872struct __member_pointer_traits_imp 873{ // forward declaration; specializations later 874}; 875 876 877template <class _Tp> struct __libcpp_is_member_function_pointer 878 : public false_type {}; 879 880template <class _Ret, class _Class> 881struct __libcpp_is_member_function_pointer<_Ret _Class::*> 882 : public is_function<_Ret> {}; 883 884template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 885 : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {}; 886 887#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 888template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v 889 = is_member_function_pointer<_Tp>::value; 890#endif 891 892// is_member_pointer 893 894template <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 895template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 896 897template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 898 : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 899 900#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 901template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v 902 = is_member_pointer<_Tp>::value; 903#endif 904 905// is_member_object_pointer 906 907template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer 908 : public integral_constant<bool, is_member_pointer<_Tp>::value && 909 !is_member_function_pointer<_Tp>::value> {}; 910 911#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 912template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v 913 = is_member_object_pointer<_Tp>::value; 914#endif 915 916// is_enum 917 918#if __has_feature(is_enum) || (_GNUC_VER >= 403) 919 920template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 921 : public integral_constant<bool, __is_enum(_Tp)> {}; 922 923#else 924 925template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 926 : public integral_constant<bool, !is_void<_Tp>::value && 927 !is_integral<_Tp>::value && 928 !is_floating_point<_Tp>::value && 929 !is_array<_Tp>::value && 930 !is_pointer<_Tp>::value && 931 !is_reference<_Tp>::value && 932 !is_member_pointer<_Tp>::value && 933 !is_union<_Tp>::value && 934 !is_class<_Tp>::value && 935 !is_function<_Tp>::value > {}; 936 937#endif 938 939#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 940template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v 941 = is_enum<_Tp>::value; 942#endif 943 944// is_arithmetic 945 946template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic 947 : public integral_constant<bool, is_integral<_Tp>::value || 948 is_floating_point<_Tp>::value> {}; 949 950#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 951template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v 952 = is_arithmetic<_Tp>::value; 953#endif 954 955// is_fundamental 956 957template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental 958 : public integral_constant<bool, is_void<_Tp>::value || 959 __is_nullptr_t<_Tp>::value || 960 is_arithmetic<_Tp>::value> {}; 961 962#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 963template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v 964 = is_fundamental<_Tp>::value; 965#endif 966 967// is_scalar 968 969template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar 970 : public integral_constant<bool, is_arithmetic<_Tp>::value || 971 is_member_pointer<_Tp>::value || 972 is_pointer<_Tp>::value || 973 __is_nullptr_t<_Tp>::value || 974 is_enum<_Tp>::value > {}; 975 976template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 977 978#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 979template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v 980 = is_scalar<_Tp>::value; 981#endif 982 983// is_object 984 985template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object 986 : public integral_constant<bool, is_scalar<_Tp>::value || 987 is_array<_Tp>::value || 988 is_union<_Tp>::value || 989 is_class<_Tp>::value > {}; 990 991#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 992template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v 993 = is_object<_Tp>::value; 994#endif 995 996// is_compound 997 998template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound 999 : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 1000 1001#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1002template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v 1003 = is_compound<_Tp>::value; 1004#endif 1005 1006 1007// __is_referenceable [defns.referenceable] 1008 1009struct __is_referenceable_impl { 1010 template <class _Tp> static _Tp& __test(int); 1011 template <class _Tp> static __two __test(...); 1012}; 1013 1014template <class _Tp> 1015struct __is_referenceable : integral_constant<bool, 1016 !is_same<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {}; 1017 1018 1019// add_const 1020 1021template <class _Tp, bool = is_reference<_Tp>::value || 1022 is_function<_Tp>::value || 1023 is_const<_Tp>::value > 1024struct __add_const {typedef _Tp type;}; 1025 1026template <class _Tp> 1027struct __add_const<_Tp, false> {typedef const _Tp type;}; 1028 1029template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const 1030 {typedef typename __add_const<_Tp>::type type;}; 1031 1032#if _LIBCPP_STD_VER > 11 1033template <class _Tp> using add_const_t = typename add_const<_Tp>::type; 1034#endif 1035 1036// add_volatile 1037 1038template <class _Tp, bool = is_reference<_Tp>::value || 1039 is_function<_Tp>::value || 1040 is_volatile<_Tp>::value > 1041struct __add_volatile {typedef _Tp type;}; 1042 1043template <class _Tp> 1044struct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 1045 1046template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile 1047 {typedef typename __add_volatile<_Tp>::type type;}; 1048 1049#if _LIBCPP_STD_VER > 11 1050template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; 1051#endif 1052 1053// add_cv 1054 1055template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv 1056 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 1057 1058#if _LIBCPP_STD_VER > 11 1059template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; 1060#endif 1061 1062// remove_reference 1063 1064template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 1065template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 1066#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1067template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;}; 1068#endif 1069 1070#if _LIBCPP_STD_VER > 11 1071template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; 1072#endif 1073 1074// add_lvalue_reference 1075 1076template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _Tp type; }; 1077template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _Tp& type; }; 1078 1079template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference 1080{typedef typename __add_lvalue_reference_impl<_Tp>::type type;}; 1081 1082#if _LIBCPP_STD_VER > 11 1083template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; 1084#endif 1085 1086#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1087 1088template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _Tp type; }; 1089template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _Tp&& type; }; 1090 1091template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference 1092{typedef typename __add_rvalue_reference_impl<_Tp>::type type;}; 1093 1094#if _LIBCPP_STD_VER > 11 1095template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; 1096#endif 1097 1098#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1099 1100#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1101 1102template <class _Tp> _Tp&& __declval(int); 1103template <class _Tp> _Tp __declval(long); 1104 1105template <class _Tp> 1106decltype(_VSTD::__declval<_Tp>(0)) 1107declval() _NOEXCEPT; 1108 1109#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1110 1111template <class _Tp> 1112typename add_lvalue_reference<_Tp>::type 1113declval(); 1114 1115#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1116 1117// __uncvref 1118 1119template <class _Tp> 1120struct __uncvref { 1121 typedef typename remove_cv<typename remove_reference<_Tp>::type>::type type; 1122}; 1123 1124template <class _Tp> 1125struct __unconstref { 1126 typedef typename remove_const<typename remove_reference<_Tp>::type>::type type; 1127}; 1128 1129#ifndef _LIBCPP_CXX03_LANG 1130template <class _Tp> 1131using __uncvref_t = typename __uncvref<_Tp>::type; 1132#endif 1133 1134// __is_same_uncvref 1135 1136template <class _Tp, class _Up> 1137struct __is_same_uncvref : is_same<typename __uncvref<_Tp>::type, 1138 typename __uncvref<_Up>::type> {}; 1139 1140struct __any 1141{ 1142 __any(...); 1143}; 1144 1145// remove_pointer 1146 1147template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 1148template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 1149template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 1150template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 1151template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 1152 1153#if _LIBCPP_STD_VER > 11 1154template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; 1155#endif 1156 1157// add_pointer 1158 1159template <class _Tp, 1160 bool = __is_referenceable<_Tp>::value || 1161 is_same<typename remove_cv<_Tp>::type, void>::value> 1162struct __add_pointer_impl 1163 {typedef typename remove_reference<_Tp>::type* type;}; 1164template <class _Tp> struct __add_pointer_impl<_Tp, false> 1165 {typedef _Tp type;}; 1166 1167template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer 1168 {typedef typename __add_pointer_impl<_Tp>::type type;}; 1169 1170#if _LIBCPP_STD_VER > 11 1171template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 1172#endif 1173 1174// is_signed 1175 1176template <class _Tp, bool = is_integral<_Tp>::value> 1177struct __libcpp_is_signed_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) {}; 1178 1179template <class _Tp> 1180struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point 1181 1182template <class _Tp, bool = is_arithmetic<_Tp>::value> 1183struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; 1184 1185template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 1186 1187template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; 1188 1189#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1190template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v 1191 = is_signed<_Tp>::value; 1192#endif 1193 1194// is_unsigned 1195 1196template <class _Tp, bool = is_integral<_Tp>::value> 1197struct __libcpp_is_unsigned_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) {}; 1198 1199template <class _Tp> 1200struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point 1201 1202template <class _Tp, bool = is_arithmetic<_Tp>::value> 1203struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; 1204 1205template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 1206 1207template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 1208 1209#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1210template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v 1211 = is_unsigned<_Tp>::value; 1212#endif 1213 1214// rank 1215 1216template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 1217 : public integral_constant<size_t, 0> {}; 1218template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 1219 : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 1220template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]> 1221 : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 1222 1223#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1224template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v 1225 = rank<_Tp>::value; 1226#endif 1227 1228// extent 1229 1230template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 1231 : public integral_constant<size_t, 0> {}; 1232template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 1233 : public integral_constant<size_t, 0> {}; 1234template <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 1235 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 1236template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 1237 : public integral_constant<size_t, _Np> {}; 1238template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip> 1239 : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 1240 1241#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1242template <class _Tp, unsigned _Ip = 0> _LIBCPP_CONSTEXPR size_t extent_v 1243 = extent<_Tp, _Ip>::value; 1244#endif 1245 1246// remove_extent 1247 1248template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 1249 {typedef _Tp type;}; 1250template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 1251 {typedef _Tp type;}; 1252template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]> 1253 {typedef _Tp type;}; 1254 1255#if _LIBCPP_STD_VER > 11 1256template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; 1257#endif 1258 1259// remove_all_extents 1260 1261template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 1262 {typedef _Tp type;}; 1263template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 1264 {typedef typename remove_all_extents<_Tp>::type type;}; 1265template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]> 1266 {typedef typename remove_all_extents<_Tp>::type type;}; 1267 1268#if _LIBCPP_STD_VER > 11 1269template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; 1270#endif 1271 1272// decay 1273 1274template <class _Tp> 1275struct _LIBCPP_TYPE_VIS_ONLY decay 1276{ 1277private: 1278 typedef typename remove_reference<_Tp>::type _Up; 1279public: 1280 typedef typename conditional 1281 < 1282 is_array<_Up>::value, 1283 typename remove_extent<_Up>::type*, 1284 typename conditional 1285 < 1286 is_function<_Up>::value, 1287 typename add_pointer<_Up>::type, 1288 typename remove_cv<_Up>::type 1289 >::type 1290 >::type type; 1291}; 1292 1293#if _LIBCPP_STD_VER > 11 1294template <class _Tp> using decay_t = typename decay<_Tp>::type; 1295#endif 1296 1297// is_abstract 1298 1299namespace __is_abstract_imp 1300{ 1301template <class _Tp> char __test(_Tp (*)[1]); 1302template <class _Tp> __two __test(...); 1303} 1304 1305template <class _Tp, bool = is_class<_Tp>::value> 1306struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 1307 1308template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 1309 1310template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 1311 1312#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1313template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v 1314 = is_abstract<_Tp>::value; 1315#endif 1316 1317// is_final 1318 1319#if defined(_LIBCPP_HAS_IS_FINAL) 1320template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 1321__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; 1322#else 1323template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 1324__libcpp_is_final : public false_type {}; 1325#endif 1326 1327#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11 1328template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 1329is_final : public integral_constant<bool, __is_final(_Tp)> {}; 1330#endif 1331 1332#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1333template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v 1334 = is_final<_Tp>::value; 1335#endif 1336 1337// is_base_of 1338 1339#ifdef _LIBCPP_HAS_IS_BASE_OF 1340 1341template <class _Bp, class _Dp> 1342struct _LIBCPP_TYPE_VIS_ONLY is_base_of 1343 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 1344 1345#else // _LIBCPP_HAS_IS_BASE_OF 1346 1347namespace __is_base_of_imp 1348{ 1349template <class _Tp> 1350struct _Dst 1351{ 1352 _Dst(const volatile _Tp &); 1353}; 1354template <class _Tp> 1355struct _Src 1356{ 1357 operator const volatile _Tp &(); 1358 template <class _Up> operator const _Dst<_Up> &(); 1359}; 1360template <size_t> struct __one { typedef char type; }; 1361template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 1362template <class _Bp, class _Dp> __two __test(...); 1363} 1364 1365template <class _Bp, class _Dp> 1366struct _LIBCPP_TYPE_VIS_ONLY is_base_of 1367 : public integral_constant<bool, is_class<_Bp>::value && 1368 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 1369 1370#endif // _LIBCPP_HAS_IS_BASE_OF 1371 1372#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1373template <class _Bp, class _Dp> _LIBCPP_CONSTEXPR bool is_base_of_v 1374 = is_base_of<_Bp, _Dp>::value; 1375#endif 1376 1377// is_convertible 1378 1379#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) 1380 1381template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 1382 : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 1383 !is_abstract<_T2>::value> {}; 1384 1385#else // __has_feature(is_convertible_to) 1386 1387namespace __is_convertible_imp 1388{ 1389template <class _Tp> void __test_convert(_Tp); 1390 1391template <class _From, class _To, class = void> 1392struct __is_convertible_test : public false_type {}; 1393 1394template <class _From, class _To> 1395struct __is_convertible_test<_From, _To, 1396 decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type 1397{}; 1398 1399template <class _Tp, bool _IsArray = is_array<_Tp>::value, 1400 bool _IsFunction = is_function<_Tp>::value, 1401 bool _IsVoid = is_void<_Tp>::value> 1402 struct __is_array_function_or_void {enum {value = 0};}; 1403template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 1404template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 1405template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 1406} 1407 1408template <class _Tp, 1409 unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 1410struct __is_convertible_check 1411{ 1412 static const size_t __v = 0; 1413}; 1414 1415template <class _Tp> 1416struct __is_convertible_check<_Tp, 0> 1417{ 1418 static const size_t __v = sizeof(_Tp); 1419}; 1420 1421template <class _T1, class _T2, 1422 unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 1423 unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 1424struct __is_convertible 1425 : public integral_constant<bool, 1426 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value 1427#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) 1428 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 1429 && (!is_const<typename remove_reference<_T2>::type>::value 1430 || is_volatile<typename remove_reference<_T2>::type>::value) 1431 && (is_same<typename remove_cv<_T1>::type, 1432 typename remove_cv<typename remove_reference<_T2>::type>::type>::value 1433 || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 1434#endif 1435 > 1436{}; 1437 1438template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 1439template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 1440template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 1441template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 1442 1443template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 1444template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 1445template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 1446template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 1447 1448template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 1449template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 1450template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 1451template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 1452 1453template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 1454 : public __is_convertible<_T1, _T2> 1455{ 1456 static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 1457 static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 1458}; 1459 1460#endif // __has_feature(is_convertible_to) 1461 1462#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1463template <class _From, class _To> _LIBCPP_CONSTEXPR bool is_convertible_v 1464 = is_convertible<_From, _To>::value; 1465#endif 1466 1467// is_empty 1468 1469#if __has_feature(is_empty) || (_GNUC_VER >= 407) 1470 1471template <class _Tp> 1472struct _LIBCPP_TYPE_VIS_ONLY is_empty 1473 : public integral_constant<bool, __is_empty(_Tp)> {}; 1474 1475#else // __has_feature(is_empty) 1476 1477template <class _Tp> 1478struct __is_empty1 1479 : public _Tp 1480{ 1481 double __lx; 1482}; 1483 1484struct __is_empty2 1485{ 1486 double __lx; 1487}; 1488 1489template <class _Tp, bool = is_class<_Tp>::value> 1490struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 1491 1492template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 1493 1494template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {}; 1495 1496#endif // __has_feature(is_empty) 1497 1498#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1499template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v 1500 = is_empty<_Tp>::value; 1501#endif 1502 1503// is_polymorphic 1504 1505#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC) 1506 1507template <class _Tp> 1508struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 1509 : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 1510 1511#else 1512 1513template<typename _Tp> char &__is_polymorphic_impl( 1514 typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 1515 int>::type); 1516template<typename _Tp> __two &__is_polymorphic_impl(...); 1517 1518template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 1519 : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 1520 1521#endif // __has_feature(is_polymorphic) 1522 1523#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1524template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v 1525 = is_polymorphic<_Tp>::value; 1526#endif 1527 1528// has_virtual_destructor 1529 1530#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) 1531 1532template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1533 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 1534 1535#else 1536 1537template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1538 : public false_type {}; 1539 1540#endif 1541 1542#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1543template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v 1544 = has_virtual_destructor<_Tp>::value; 1545#endif 1546 1547// alignment_of 1548 1549template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of 1550 : public integral_constant<size_t, __alignof__(_Tp)> {}; 1551 1552#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1553template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v 1554 = alignment_of<_Tp>::value; 1555#endif 1556 1557// aligned_storage 1558 1559template <class _Hp, class _Tp> 1560struct __type_list 1561{ 1562 typedef _Hp _Head; 1563 typedef _Tp _Tail; 1564}; 1565 1566struct __nat 1567{ 1568#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 1569 __nat() = delete; 1570 __nat(const __nat&) = delete; 1571 __nat& operator=(const __nat&) = delete; 1572 ~__nat() = delete; 1573#endif 1574}; 1575 1576template <class _Tp> 1577struct __align_type 1578{ 1579 static const size_t value = alignment_of<_Tp>::value; 1580 typedef _Tp type; 1581}; 1582 1583struct __struct_double {long double __lx;}; 1584struct __struct_double4 {double __lx[4];}; 1585 1586typedef 1587 __type_list<__align_type<unsigned char>, 1588 __type_list<__align_type<unsigned short>, 1589 __type_list<__align_type<unsigned int>, 1590 __type_list<__align_type<unsigned long>, 1591 __type_list<__align_type<unsigned long long>, 1592 __type_list<__align_type<double>, 1593 __type_list<__align_type<long double>, 1594 __type_list<__align_type<__struct_double>, 1595 __type_list<__align_type<__struct_double4>, 1596 __type_list<__align_type<int*>, 1597 __nat 1598 > > > > > > > > > > __all_types; 1599 1600template <class _TL, size_t _Align> struct __find_pod; 1601 1602template <class _Hp, size_t _Align> 1603struct __find_pod<__type_list<_Hp, __nat>, _Align> 1604{ 1605 typedef typename conditional< 1606 _Align == _Hp::value, 1607 typename _Hp::type, 1608 void 1609 >::type type; 1610}; 1611 1612template <class _Hp, class _Tp, size_t _Align> 1613struct __find_pod<__type_list<_Hp, _Tp>, _Align> 1614{ 1615 typedef typename conditional< 1616 _Align == _Hp::value, 1617 typename _Hp::type, 1618 typename __find_pod<_Tp, _Align>::type 1619 >::type type; 1620}; 1621 1622template <class _TL, size_t _Len> struct __find_max_align; 1623 1624template <class _Hp, size_t _Len> 1625struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1626 1627template <size_t _Len, size_t _A1, size_t _A2> 1628struct __select_align 1629{ 1630private: 1631 static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1632 static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1633public: 1634 static const size_t value = _Len < __max ? __min : __max; 1635}; 1636 1637template <class _Hp, class _Tp, size_t _Len> 1638struct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1639 : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1640 1641template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1642struct _LIBCPP_TYPE_VIS_ONLY aligned_storage 1643{ 1644 typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1645 static_assert(!is_void<_Aligner>::value, ""); 1646 union type 1647 { 1648 _Aligner __align; 1649 unsigned char __data[(_Len + _Align - 1)/_Align * _Align]; 1650 }; 1651}; 1652 1653#if _LIBCPP_STD_VER > 11 1654template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1655 using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1656#endif 1657 1658#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1659template <size_t _Len>\ 1660struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\ 1661{\ 1662 struct _ALIGNAS(n) type\ 1663 {\ 1664 unsigned char __lx[(_Len + n - 1)/n * n];\ 1665 };\ 1666} 1667 1668_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1669_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1670_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1671_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1672_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1673_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1674_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1675_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1676_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1677_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1678_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1679_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1680_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1681_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1682// PE/COFF does not support alignment beyond 8192 (=0x2000) 1683#if !defined(_WIN32) 1684_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1685#endif // !_WIN32 1686 1687#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1688 1689#ifndef _LIBCPP_HAS_NO_VARIADICS 1690 1691// aligned_union 1692 1693template <size_t _I0, size_t ..._In> 1694struct __static_max; 1695 1696template <size_t _I0> 1697struct __static_max<_I0> 1698{ 1699 static const size_t value = _I0; 1700}; 1701 1702template <size_t _I0, size_t _I1, size_t ..._In> 1703struct __static_max<_I0, _I1, _In...> 1704{ 1705 static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1706 __static_max<_I1, _In...>::value; 1707}; 1708 1709template <size_t _Len, class _Type0, class ..._Types> 1710struct aligned_union 1711{ 1712 static const size_t alignment_value = __static_max<__alignof__(_Type0), 1713 __alignof__(_Types)...>::value; 1714 static const size_t __len = __static_max<_Len, sizeof(_Type0), 1715 sizeof(_Types)...>::value; 1716 typedef typename aligned_storage<__len, alignment_value>::type type; 1717}; 1718 1719#if _LIBCPP_STD_VER > 11 1720template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1721#endif 1722 1723#endif // _LIBCPP_HAS_NO_VARIADICS 1724 1725template <class _Tp> 1726struct __numeric_type 1727{ 1728 static void __test(...); 1729 static float __test(float); 1730 static double __test(char); 1731 static double __test(int); 1732 static double __test(unsigned); 1733 static double __test(long); 1734 static double __test(unsigned long); 1735 static double __test(long long); 1736 static double __test(unsigned long long); 1737 static double __test(double); 1738 static long double __test(long double); 1739 1740 typedef decltype(__test(declval<_Tp>())) type; 1741 static const bool value = !is_same<type, void>::value; 1742}; 1743 1744template <> 1745struct __numeric_type<void> 1746{ 1747 static const bool value = true; 1748}; 1749 1750// __promote 1751 1752template <class _A1, class _A2 = void, class _A3 = void, 1753 bool = __numeric_type<_A1>::value && 1754 __numeric_type<_A2>::value && 1755 __numeric_type<_A3>::value> 1756class __promote_imp 1757{ 1758public: 1759 static const bool value = false; 1760}; 1761 1762template <class _A1, class _A2, class _A3> 1763class __promote_imp<_A1, _A2, _A3, true> 1764{ 1765private: 1766 typedef typename __promote_imp<_A1>::type __type1; 1767 typedef typename __promote_imp<_A2>::type __type2; 1768 typedef typename __promote_imp<_A3>::type __type3; 1769public: 1770 typedef decltype(__type1() + __type2() + __type3()) type; 1771 static const bool value = true; 1772}; 1773 1774template <class _A1, class _A2> 1775class __promote_imp<_A1, _A2, void, true> 1776{ 1777private: 1778 typedef typename __promote_imp<_A1>::type __type1; 1779 typedef typename __promote_imp<_A2>::type __type2; 1780public: 1781 typedef decltype(__type1() + __type2()) type; 1782 static const bool value = true; 1783}; 1784 1785template <class _A1> 1786class __promote_imp<_A1, void, void, true> 1787{ 1788public: 1789 typedef typename __numeric_type<_A1>::type type; 1790 static const bool value = true; 1791}; 1792 1793template <class _A1, class _A2 = void, class _A3 = void> 1794class __promote : public __promote_imp<_A1, _A2, _A3> {}; 1795 1796// make_signed / make_unsigned 1797 1798typedef 1799 __type_list<signed char, 1800 __type_list<signed short, 1801 __type_list<signed int, 1802 __type_list<signed long, 1803 __type_list<signed long long, 1804#ifndef _LIBCPP_HAS_NO_INT128 1805 __type_list<__int128_t, 1806#endif 1807 __nat 1808#ifndef _LIBCPP_HAS_NO_INT128 1809 > 1810#endif 1811 > > > > > __signed_types; 1812 1813typedef 1814 __type_list<unsigned char, 1815 __type_list<unsigned short, 1816 __type_list<unsigned int, 1817 __type_list<unsigned long, 1818 __type_list<unsigned long long, 1819#ifndef _LIBCPP_HAS_NO_INT128 1820 __type_list<__uint128_t, 1821#endif 1822 __nat 1823#ifndef _LIBCPP_HAS_NO_INT128 1824 > 1825#endif 1826 > > > > > __unsigned_types; 1827 1828template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1829 1830template <class _Hp, class _Tp, size_t _Size> 1831struct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1832{ 1833 typedef _Hp type; 1834}; 1835 1836template <class _Hp, class _Tp, size_t _Size> 1837struct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1838{ 1839 typedef typename __find_first<_Tp, _Size>::type type; 1840}; 1841 1842template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1843 bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1844struct __apply_cv 1845{ 1846 typedef _Up type; 1847}; 1848 1849template <class _Tp, class _Up> 1850struct __apply_cv<_Tp, _Up, true, false> 1851{ 1852 typedef const _Up type; 1853}; 1854 1855template <class _Tp, class _Up> 1856struct __apply_cv<_Tp, _Up, false, true> 1857{ 1858 typedef volatile _Up type; 1859}; 1860 1861template <class _Tp, class _Up> 1862struct __apply_cv<_Tp, _Up, true, true> 1863{ 1864 typedef const volatile _Up type; 1865}; 1866 1867template <class _Tp, class _Up> 1868struct __apply_cv<_Tp&, _Up, false, false> 1869{ 1870 typedef _Up& type; 1871}; 1872 1873template <class _Tp, class _Up> 1874struct __apply_cv<_Tp&, _Up, true, false> 1875{ 1876 typedef const _Up& type; 1877}; 1878 1879template <class _Tp, class _Up> 1880struct __apply_cv<_Tp&, _Up, false, true> 1881{ 1882 typedef volatile _Up& type; 1883}; 1884 1885template <class _Tp, class _Up> 1886struct __apply_cv<_Tp&, _Up, true, true> 1887{ 1888 typedef const volatile _Up& type; 1889}; 1890 1891template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1892struct __make_signed {}; 1893 1894template <class _Tp> 1895struct __make_signed<_Tp, true> 1896{ 1897 typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1898}; 1899 1900template <> struct __make_signed<bool, true> {}; 1901template <> struct __make_signed< signed short, true> {typedef short type;}; 1902template <> struct __make_signed<unsigned short, true> {typedef short type;}; 1903template <> struct __make_signed< signed int, true> {typedef int type;}; 1904template <> struct __make_signed<unsigned int, true> {typedef int type;}; 1905template <> struct __make_signed< signed long, true> {typedef long type;}; 1906template <> struct __make_signed<unsigned long, true> {typedef long type;}; 1907template <> struct __make_signed< signed long long, true> {typedef long long type;}; 1908template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1909#ifndef _LIBCPP_HAS_NO_INT128 1910template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; 1911template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; 1912#endif 1913 1914template <class _Tp> 1915struct _LIBCPP_TYPE_VIS_ONLY make_signed 1916{ 1917 typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1918}; 1919 1920#if _LIBCPP_STD_VER > 11 1921template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1922#endif 1923 1924template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1925struct __make_unsigned {}; 1926 1927template <class _Tp> 1928struct __make_unsigned<_Tp, true> 1929{ 1930 typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1931}; 1932 1933template <> struct __make_unsigned<bool, true> {}; 1934template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1935template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1936template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1937template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1938template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1939template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1940template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1941template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1942#ifndef _LIBCPP_HAS_NO_INT128 1943template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; 1944template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; 1945#endif 1946 1947template <class _Tp> 1948struct _LIBCPP_TYPE_VIS_ONLY make_unsigned 1949{ 1950 typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1951}; 1952 1953#if _LIBCPP_STD_VER > 11 1954template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1955#endif 1956 1957#ifdef _LIBCPP_HAS_NO_VARIADICS 1958 1959template <class _Tp, class _Up = void, class _Vp = void> 1960struct _LIBCPP_TYPE_VIS_ONLY common_type 1961{ 1962public: 1963 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type; 1964}; 1965 1966template <class _Tp> 1967struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1968{ 1969public: 1970 typedef typename decay<_Tp>::type type; 1971}; 1972 1973template <class _Tp, class _Up> 1974struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void> 1975{ 1976 typedef typename decay<decltype( 1977 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 1978 )>::type type; 1979}; 1980 1981#else // _LIBCPP_HAS_NO_VARIADICS 1982 1983// bullet 1 - sizeof...(Tp) == 0 1984 1985template <class ..._Tp> 1986struct _LIBCPP_TYPE_VIS_ONLY common_type {}; 1987 1988// bullet 2 - sizeof...(Tp) == 1 1989 1990template <class _Tp> 1991struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1992{ 1993 typedef typename decay<_Tp>::type type; 1994}; 1995 1996// bullet 3 - sizeof...(Tp) == 2 1997 1998template <class _Tp, class _Up, class = void> 1999struct __common_type2 {}; 2000 2001template <class _Tp, class _Up> 2002struct __common_type2<_Tp, _Up, 2003 typename __void_t<decltype( 2004 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 2005 )>::type> 2006{ 2007 typedef typename decay<decltype( 2008 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 2009 )>::type type; 2010}; 2011 2012template <class _Tp, class _Up> 2013struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 2014 : __common_type2<_Tp, _Up> {}; 2015 2016// bullet 4 - sizeof...(Tp) > 2 2017 2018template <class ...Tp> struct __common_types; 2019 2020template <class, class = void> 2021struct __common_type_impl {}; 2022 2023template <class _Tp, class _Up, class ..._Vp> 2024struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>, 2025 typename __void_t<typename common_type<_Tp, _Up>::type>::type> 2026{ 2027 typedef typename common_type< 2028 typename common_type<_Tp, _Up>::type, _Vp... 2029 >::type type; 2030}; 2031 2032template <class _Tp, class _Up, class ..._Vp> 2033struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...> 2034 : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {}; 2035 2036#if _LIBCPP_STD_VER > 11 2037template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 2038#endif 2039 2040#endif // _LIBCPP_HAS_NO_VARIADICS 2041 2042// is_assignable 2043 2044template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 2045 2046template <class _Tp, class _Arg> 2047typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 2048__is_assignable_test(int); 2049 2050template <class, class> 2051false_type __is_assignable_test(...); 2052 2053 2054template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 2055struct __is_assignable_imp 2056 : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; 2057 2058template <class _Tp, class _Arg> 2059struct __is_assignable_imp<_Tp, _Arg, true> 2060 : public false_type 2061{ 2062}; 2063 2064template <class _Tp, class _Arg> 2065struct is_assignable 2066 : public __is_assignable_imp<_Tp, _Arg> {}; 2067 2068#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2069template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_assignable_v 2070 = is_assignable<_Tp, _Arg>::value; 2071#endif 2072 2073// is_copy_assignable 2074 2075template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable 2076 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 2077 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2078 2079#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2080template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v 2081 = is_copy_assignable<_Tp>::value; 2082#endif 2083 2084// is_move_assignable 2085 2086template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable 2087#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2088 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 2089 typename add_rvalue_reference<_Tp>::type> {}; 2090#else 2091 : public is_copy_assignable<_Tp> {}; 2092#endif 2093 2094#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2095template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v 2096 = is_move_assignable<_Tp>::value; 2097#endif 2098 2099// is_destructible 2100 2101// if it's a reference, return true 2102// if it's a function, return false 2103// if it's void, return false 2104// if it's an array of unknown bound, return false 2105// Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed 2106// where _Up is remove_all_extents<_Tp>::type 2107 2108template <class> 2109struct __is_destructible_apply { typedef int type; }; 2110 2111template <typename _Tp> 2112struct __is_destructor_wellformed { 2113 template <typename _Tp1> 2114 static char __test ( 2115 typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type 2116 ); 2117 2118 template <typename _Tp1> 2119 static __two __test (...); 2120 2121 static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); 2122}; 2123 2124template <class _Tp, bool> 2125struct __destructible_imp; 2126 2127template <class _Tp> 2128struct __destructible_imp<_Tp, false> 2129 : public _VSTD::integral_constant<bool, 2130 __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {}; 2131 2132template <class _Tp> 2133struct __destructible_imp<_Tp, true> 2134 : public _VSTD::true_type {}; 2135 2136template <class _Tp, bool> 2137struct __destructible_false; 2138 2139template <class _Tp> 2140struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {}; 2141 2142template <class _Tp> 2143struct __destructible_false<_Tp, true> : public _VSTD::false_type {}; 2144 2145template <class _Tp> 2146struct is_destructible 2147 : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {}; 2148 2149template <class _Tp> 2150struct is_destructible<_Tp[]> 2151 : public _VSTD::false_type {}; 2152 2153template <> 2154struct is_destructible<void> 2155 : public _VSTD::false_type {}; 2156 2157#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2158template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v 2159 = is_destructible<_Tp>::value; 2160#endif 2161 2162// move 2163 2164#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2165 2166template <class _Tp> 2167inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2168typename remove_reference<_Tp>::type&& 2169move(_Tp&& __t) _NOEXCEPT 2170{ 2171 typedef typename remove_reference<_Tp>::type _Up; 2172 return static_cast<_Up&&>(__t); 2173} 2174 2175template <class _Tp> 2176inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2177_Tp&& 2178forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT 2179{ 2180 return static_cast<_Tp&&>(__t); 2181} 2182 2183template <class _Tp> 2184inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2185_Tp&& 2186forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT 2187{ 2188 static_assert(!is_lvalue_reference<_Tp>::value, 2189 "can not forward an rvalue as an lvalue"); 2190 return static_cast<_Tp&&>(__t); 2191} 2192 2193#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2194 2195template <class _Tp> 2196inline _LIBCPP_INLINE_VISIBILITY 2197_Tp& 2198move(_Tp& __t) 2199{ 2200 return __t; 2201} 2202 2203template <class _Tp> 2204inline _LIBCPP_INLINE_VISIBILITY 2205const _Tp& 2206move(const _Tp& __t) 2207{ 2208 return __t; 2209} 2210 2211template <class _Tp> 2212inline _LIBCPP_INLINE_VISIBILITY 2213_Tp& 2214forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT 2215{ 2216 return __t; 2217} 2218 2219 2220template <class _Tp> 2221class __rv 2222{ 2223 typedef typename remove_reference<_Tp>::type _Trr; 2224 _Trr& t_; 2225public: 2226 _LIBCPP_INLINE_VISIBILITY 2227 _Trr* operator->() {return &t_;} 2228 _LIBCPP_INLINE_VISIBILITY 2229 explicit __rv(_Trr& __t) : t_(__t) {} 2230}; 2231 2232#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2233 2234#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2235 2236template <class _Tp> 2237inline _LIBCPP_INLINE_VISIBILITY 2238typename decay<_Tp>::type 2239__decay_copy(_Tp&& __t) 2240{ 2241 return _VSTD::forward<_Tp>(__t); 2242} 2243 2244#else 2245 2246template <class _Tp> 2247inline _LIBCPP_INLINE_VISIBILITY 2248typename decay<_Tp>::type 2249__decay_copy(const _Tp& __t) 2250{ 2251 return _VSTD::forward<_Tp>(__t); 2252} 2253 2254#endif 2255 2256#ifndef _LIBCPP_HAS_NO_VARIADICS 2257 2258template <class _Rp, class _Class, class ..._Param> 2259struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 2260{ 2261 typedef _Class _ClassType; 2262 typedef _Rp _ReturnType; 2263 typedef _Rp (_FnType) (_Param...); 2264}; 2265 2266template <class _Rp, class _Class, class ..._Param> 2267struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> 2268{ 2269 typedef _Class _ClassType; 2270 typedef _Rp _ReturnType; 2271 typedef _Rp (_FnType) (_Param..., ...); 2272}; 2273 2274template <class _Rp, class _Class, class ..._Param> 2275struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 2276{ 2277 typedef _Class const _ClassType; 2278 typedef _Rp _ReturnType; 2279 typedef _Rp (_FnType) (_Param...); 2280}; 2281 2282template <class _Rp, class _Class, class ..._Param> 2283struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> 2284{ 2285 typedef _Class const _ClassType; 2286 typedef _Rp _ReturnType; 2287 typedef _Rp (_FnType) (_Param..., ...); 2288}; 2289 2290template <class _Rp, class _Class, class ..._Param> 2291struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 2292{ 2293 typedef _Class volatile _ClassType; 2294 typedef _Rp _ReturnType; 2295 typedef _Rp (_FnType) (_Param...); 2296}; 2297 2298template <class _Rp, class _Class, class ..._Param> 2299struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> 2300{ 2301 typedef _Class volatile _ClassType; 2302 typedef _Rp _ReturnType; 2303 typedef _Rp (_FnType) (_Param..., ...); 2304}; 2305 2306template <class _Rp, class _Class, class ..._Param> 2307struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 2308{ 2309 typedef _Class const volatile _ClassType; 2310 typedef _Rp _ReturnType; 2311 typedef _Rp (_FnType) (_Param...); 2312}; 2313 2314template <class _Rp, class _Class, class ..._Param> 2315struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> 2316{ 2317 typedef _Class const volatile _ClassType; 2318 typedef _Rp _ReturnType; 2319 typedef _Rp (_FnType) (_Param..., ...); 2320}; 2321 2322#if __has_feature(cxx_reference_qualified_functions) || \ 2323 (defined(_GNUC_VER) && _GNUC_VER >= 409) 2324 2325template <class _Rp, class _Class, class ..._Param> 2326struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 2327{ 2328 typedef _Class& _ClassType; 2329 typedef _Rp _ReturnType; 2330 typedef _Rp (_FnType) (_Param...); 2331}; 2332 2333template <class _Rp, class _Class, class ..._Param> 2334struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> 2335{ 2336 typedef _Class& _ClassType; 2337 typedef _Rp _ReturnType; 2338 typedef _Rp (_FnType) (_Param..., ...); 2339}; 2340 2341template <class _Rp, class _Class, class ..._Param> 2342struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 2343{ 2344 typedef _Class const& _ClassType; 2345 typedef _Rp _ReturnType; 2346 typedef _Rp (_FnType) (_Param...); 2347}; 2348 2349template <class _Rp, class _Class, class ..._Param> 2350struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> 2351{ 2352 typedef _Class const& _ClassType; 2353 typedef _Rp _ReturnType; 2354 typedef _Rp (_FnType) (_Param..., ...); 2355}; 2356 2357template <class _Rp, class _Class, class ..._Param> 2358struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 2359{ 2360 typedef _Class volatile& _ClassType; 2361 typedef _Rp _ReturnType; 2362 typedef _Rp (_FnType) (_Param...); 2363}; 2364 2365template <class _Rp, class _Class, class ..._Param> 2366struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> 2367{ 2368 typedef _Class volatile& _ClassType; 2369 typedef _Rp _ReturnType; 2370 typedef _Rp (_FnType) (_Param..., ...); 2371}; 2372 2373template <class _Rp, class _Class, class ..._Param> 2374struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 2375{ 2376 typedef _Class const volatile& _ClassType; 2377 typedef _Rp _ReturnType; 2378 typedef _Rp (_FnType) (_Param...); 2379}; 2380 2381template <class _Rp, class _Class, class ..._Param> 2382struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> 2383{ 2384 typedef _Class const volatile& _ClassType; 2385 typedef _Rp _ReturnType; 2386 typedef _Rp (_FnType) (_Param..., ...); 2387}; 2388 2389template <class _Rp, class _Class, class ..._Param> 2390struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 2391{ 2392 typedef _Class&& _ClassType; 2393 typedef _Rp _ReturnType; 2394 typedef _Rp (_FnType) (_Param...); 2395}; 2396 2397template <class _Rp, class _Class, class ..._Param> 2398struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> 2399{ 2400 typedef _Class&& _ClassType; 2401 typedef _Rp _ReturnType; 2402 typedef _Rp (_FnType) (_Param..., ...); 2403}; 2404 2405template <class _Rp, class _Class, class ..._Param> 2406struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 2407{ 2408 typedef _Class const&& _ClassType; 2409 typedef _Rp _ReturnType; 2410 typedef _Rp (_FnType) (_Param...); 2411}; 2412 2413template <class _Rp, class _Class, class ..._Param> 2414struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> 2415{ 2416 typedef _Class const&& _ClassType; 2417 typedef _Rp _ReturnType; 2418 typedef _Rp (_FnType) (_Param..., ...); 2419}; 2420 2421template <class _Rp, class _Class, class ..._Param> 2422struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 2423{ 2424 typedef _Class volatile&& _ClassType; 2425 typedef _Rp _ReturnType; 2426 typedef _Rp (_FnType) (_Param...); 2427}; 2428 2429template <class _Rp, class _Class, class ..._Param> 2430struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> 2431{ 2432 typedef _Class volatile&& _ClassType; 2433 typedef _Rp _ReturnType; 2434 typedef _Rp (_FnType) (_Param..., ...); 2435}; 2436 2437template <class _Rp, class _Class, class ..._Param> 2438struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 2439{ 2440 typedef _Class const volatile&& _ClassType; 2441 typedef _Rp _ReturnType; 2442 typedef _Rp (_FnType) (_Param...); 2443}; 2444 2445template <class _Rp, class _Class, class ..._Param> 2446struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> 2447{ 2448 typedef _Class const volatile&& _ClassType; 2449 typedef _Rp _ReturnType; 2450 typedef _Rp (_FnType) (_Param..., ...); 2451}; 2452 2453#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409 2454 2455#else // _LIBCPP_HAS_NO_VARIADICS 2456 2457template <class _Rp, class _Class> 2458struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 2459{ 2460 typedef _Class _ClassType; 2461 typedef _Rp _ReturnType; 2462 typedef _Rp (_FnType) (); 2463}; 2464 2465template <class _Rp, class _Class> 2466struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false> 2467{ 2468 typedef _Class _ClassType; 2469 typedef _Rp _ReturnType; 2470 typedef _Rp (_FnType) (...); 2471}; 2472 2473template <class _Rp, class _Class, class _P0> 2474struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 2475{ 2476 typedef _Class _ClassType; 2477 typedef _Rp _ReturnType; 2478 typedef _Rp (_FnType) (_P0); 2479}; 2480 2481template <class _Rp, class _Class, class _P0> 2482struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false> 2483{ 2484 typedef _Class _ClassType; 2485 typedef _Rp _ReturnType; 2486 typedef _Rp (_FnType) (_P0, ...); 2487}; 2488 2489template <class _Rp, class _Class, class _P0, class _P1> 2490struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 2491{ 2492 typedef _Class _ClassType; 2493 typedef _Rp _ReturnType; 2494 typedef _Rp (_FnType) (_P0, _P1); 2495}; 2496 2497template <class _Rp, class _Class, class _P0, class _P1> 2498struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false> 2499{ 2500 typedef _Class _ClassType; 2501 typedef _Rp _ReturnType; 2502 typedef _Rp (_FnType) (_P0, _P1, ...); 2503}; 2504 2505template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2506struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 2507{ 2508 typedef _Class _ClassType; 2509 typedef _Rp _ReturnType; 2510 typedef _Rp (_FnType) (_P0, _P1, _P2); 2511}; 2512 2513template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2514struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false> 2515{ 2516 typedef _Class _ClassType; 2517 typedef _Rp _ReturnType; 2518 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2519}; 2520 2521template <class _Rp, class _Class> 2522struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 2523{ 2524 typedef _Class const _ClassType; 2525 typedef _Rp _ReturnType; 2526 typedef _Rp (_FnType) (); 2527}; 2528 2529template <class _Rp, class _Class> 2530struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false> 2531{ 2532 typedef _Class const _ClassType; 2533 typedef _Rp _ReturnType; 2534 typedef _Rp (_FnType) (...); 2535}; 2536 2537template <class _Rp, class _Class, class _P0> 2538struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 2539{ 2540 typedef _Class const _ClassType; 2541 typedef _Rp _ReturnType; 2542 typedef _Rp (_FnType) (_P0); 2543}; 2544 2545template <class _Rp, class _Class, class _P0> 2546struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false> 2547{ 2548 typedef _Class const _ClassType; 2549 typedef _Rp _ReturnType; 2550 typedef _Rp (_FnType) (_P0, ...); 2551}; 2552 2553template <class _Rp, class _Class, class _P0, class _P1> 2554struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 2555{ 2556 typedef _Class const _ClassType; 2557 typedef _Rp _ReturnType; 2558 typedef _Rp (_FnType) (_P0, _P1); 2559}; 2560 2561template <class _Rp, class _Class, class _P0, class _P1> 2562struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false> 2563{ 2564 typedef _Class const _ClassType; 2565 typedef _Rp _ReturnType; 2566 typedef _Rp (_FnType) (_P0, _P1, ...); 2567}; 2568 2569template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2570struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 2571{ 2572 typedef _Class const _ClassType; 2573 typedef _Rp _ReturnType; 2574 typedef _Rp (_FnType) (_P0, _P1, _P2); 2575}; 2576 2577template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2578struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false> 2579{ 2580 typedef _Class const _ClassType; 2581 typedef _Rp _ReturnType; 2582 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2583}; 2584 2585template <class _Rp, class _Class> 2586struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 2587{ 2588 typedef _Class volatile _ClassType; 2589 typedef _Rp _ReturnType; 2590 typedef _Rp (_FnType) (); 2591}; 2592 2593template <class _Rp, class _Class> 2594struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false> 2595{ 2596 typedef _Class volatile _ClassType; 2597 typedef _Rp _ReturnType; 2598 typedef _Rp (_FnType) (...); 2599}; 2600 2601template <class _Rp, class _Class, class _P0> 2602struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 2603{ 2604 typedef _Class volatile _ClassType; 2605 typedef _Rp _ReturnType; 2606 typedef _Rp (_FnType) (_P0); 2607}; 2608 2609template <class _Rp, class _Class, class _P0> 2610struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false> 2611{ 2612 typedef _Class volatile _ClassType; 2613 typedef _Rp _ReturnType; 2614 typedef _Rp (_FnType) (_P0, ...); 2615}; 2616 2617template <class _Rp, class _Class, class _P0, class _P1> 2618struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 2619{ 2620 typedef _Class volatile _ClassType; 2621 typedef _Rp _ReturnType; 2622 typedef _Rp (_FnType) (_P0, _P1); 2623}; 2624 2625template <class _Rp, class _Class, class _P0, class _P1> 2626struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false> 2627{ 2628 typedef _Class volatile _ClassType; 2629 typedef _Rp _ReturnType; 2630 typedef _Rp (_FnType) (_P0, _P1, ...); 2631}; 2632 2633template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2634struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 2635{ 2636 typedef _Class volatile _ClassType; 2637 typedef _Rp _ReturnType; 2638 typedef _Rp (_FnType) (_P0, _P1, _P2); 2639}; 2640 2641template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2642struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false> 2643{ 2644 typedef _Class volatile _ClassType; 2645 typedef _Rp _ReturnType; 2646 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2647}; 2648 2649template <class _Rp, class _Class> 2650struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 2651{ 2652 typedef _Class const volatile _ClassType; 2653 typedef _Rp _ReturnType; 2654 typedef _Rp (_FnType) (); 2655}; 2656 2657template <class _Rp, class _Class> 2658struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false> 2659{ 2660 typedef _Class const volatile _ClassType; 2661 typedef _Rp _ReturnType; 2662 typedef _Rp (_FnType) (...); 2663}; 2664 2665template <class _Rp, class _Class, class _P0> 2666struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 2667{ 2668 typedef _Class const volatile _ClassType; 2669 typedef _Rp _ReturnType; 2670 typedef _Rp (_FnType) (_P0); 2671}; 2672 2673template <class _Rp, class _Class, class _P0> 2674struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false> 2675{ 2676 typedef _Class const volatile _ClassType; 2677 typedef _Rp _ReturnType; 2678 typedef _Rp (_FnType) (_P0, ...); 2679}; 2680 2681template <class _Rp, class _Class, class _P0, class _P1> 2682struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 2683{ 2684 typedef _Class const volatile _ClassType; 2685 typedef _Rp _ReturnType; 2686 typedef _Rp (_FnType) (_P0, _P1); 2687}; 2688 2689template <class _Rp, class _Class, class _P0, class _P1> 2690struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false> 2691{ 2692 typedef _Class const volatile _ClassType; 2693 typedef _Rp _ReturnType; 2694 typedef _Rp (_FnType) (_P0, _P1, ...); 2695}; 2696 2697template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2698struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 2699{ 2700 typedef _Class const volatile _ClassType; 2701 typedef _Rp _ReturnType; 2702 typedef _Rp (_FnType) (_P0, _P1, _P2); 2703}; 2704 2705template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2706struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false> 2707{ 2708 typedef _Class const volatile _ClassType; 2709 typedef _Rp _ReturnType; 2710 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2711}; 2712 2713#endif // _LIBCPP_HAS_NO_VARIADICS 2714 2715template <class _Rp, class _Class> 2716struct __member_pointer_traits_imp<_Rp _Class::*, false, true> 2717{ 2718 typedef _Class _ClassType; 2719 typedef _Rp _ReturnType; 2720}; 2721 2722template <class _MP> 2723struct __member_pointer_traits 2724 : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 2725 is_member_function_pointer<_MP>::value, 2726 is_member_object_pointer<_MP>::value> 2727{ 2728// typedef ... _ClassType; 2729// typedef ... _ReturnType; 2730// typedef ... _FnType; 2731}; 2732 2733 2734template <class _DecayedFp> 2735struct __member_pointer_class_type {}; 2736 2737template <class _Ret, class _ClassType> 2738struct __member_pointer_class_type<_Ret _ClassType::*> { 2739 typedef _ClassType type; 2740}; 2741 2742// result_of 2743 2744template <class _Callable> class result_of; 2745 2746#ifdef _LIBCPP_HAS_NO_VARIADICS 2747 2748template <class _Fn, bool, bool> 2749class __result_of 2750{ 2751}; 2752 2753template <class _Fn> 2754class __result_of<_Fn(), true, false> 2755{ 2756public: 2757 typedef decltype(declval<_Fn>()()) type; 2758}; 2759 2760template <class _Fn, class _A0> 2761class __result_of<_Fn(_A0), true, false> 2762{ 2763public: 2764 typedef decltype(declval<_Fn>()(declval<_A0>())) type; 2765}; 2766 2767template <class _Fn, class _A0, class _A1> 2768class __result_of<_Fn(_A0, _A1), true, false> 2769{ 2770public: 2771 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 2772}; 2773 2774template <class _Fn, class _A0, class _A1, class _A2> 2775class __result_of<_Fn(_A0, _A1, _A2), true, false> 2776{ 2777public: 2778 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 2779}; 2780 2781template <class _MP, class _Tp, bool _IsMemberFunctionPtr> 2782struct __result_of_mp; 2783 2784// member function pointer 2785 2786template <class _MP, class _Tp> 2787struct __result_of_mp<_MP, _Tp, true> 2788 : public __identity<typename __member_pointer_traits<_MP>::_ReturnType> 2789{ 2790}; 2791 2792// member data pointer 2793 2794template <class _MP, class _Tp, bool> 2795struct __result_of_mdp; 2796 2797template <class _Rp, class _Class, class _Tp> 2798struct __result_of_mdp<_Rp _Class::*, _Tp, false> 2799{ 2800 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 2801}; 2802 2803template <class _Rp, class _Class, class _Tp> 2804struct __result_of_mdp<_Rp _Class::*, _Tp, true> 2805{ 2806 typedef typename __apply_cv<_Tp, _Rp>::type& type; 2807}; 2808 2809template <class _Rp, class _Class, class _Tp> 2810struct __result_of_mp<_Rp _Class::*, _Tp, false> 2811 : public __result_of_mdp<_Rp _Class::*, _Tp, 2812 is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 2813{ 2814}; 2815 2816 2817 2818template <class _Fn, class _Tp> 2819class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 2820 : public __result_of_mp<typename remove_reference<_Fn>::type, 2821 _Tp, 2822 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2823{ 2824}; 2825 2826template <class _Fn, class _Tp, class _A0> 2827class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 2828 : public __result_of_mp<typename remove_reference<_Fn>::type, 2829 _Tp, 2830 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2831{ 2832}; 2833 2834template <class _Fn, class _Tp, class _A0, class _A1> 2835class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 2836 : public __result_of_mp<typename remove_reference<_Fn>::type, 2837 _Tp, 2838 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2839{ 2840}; 2841 2842template <class _Fn, class _Tp, class _A0, class _A1, class _A2> 2843class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 2844 : public __result_of_mp<typename remove_reference<_Fn>::type, 2845 _Tp, 2846 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2847{ 2848}; 2849 2850// result_of 2851 2852template <class _Fn> 2853class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()> 2854 : public __result_of<_Fn(), 2855 is_class<typename remove_reference<_Fn>::type>::value || 2856 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, 2857 is_member_pointer<typename remove_reference<_Fn>::type>::value 2858 > 2859{ 2860}; 2861 2862template <class _Fn, class _A0> 2863class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)> 2864 : public __result_of<_Fn(_A0), 2865 is_class<typename remove_reference<_Fn>::type>::value || 2866 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, 2867 is_member_pointer<typename remove_reference<_Fn>::type>::value 2868 > 2869{ 2870}; 2871 2872template <class _Fn, class _A0, class _A1> 2873class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)> 2874 : public __result_of<_Fn(_A0, _A1), 2875 is_class<typename remove_reference<_Fn>::type>::value || 2876 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, 2877 is_member_pointer<typename remove_reference<_Fn>::type>::value 2878 > 2879{ 2880}; 2881 2882template <class _Fn, class _A0, class _A1, class _A2> 2883class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> 2884 : public __result_of<_Fn(_A0, _A1, _A2), 2885 is_class<typename remove_reference<_Fn>::type>::value || 2886 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, 2887 is_member_pointer<typename remove_reference<_Fn>::type>::value 2888 > 2889{ 2890}; 2891 2892#endif // _LIBCPP_HAS_NO_VARIADICS 2893 2894// template <class T, class... Args> struct is_constructible; 2895 2896namespace __is_construct 2897{ 2898struct __nat {}; 2899} 2900 2901#if !defined(_LIBCPP_CXX03_LANG) && (!__has_feature(is_constructible) || \ 2902 defined(_LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE)) 2903 2904template <class _Tp, class... _Args> 2905struct __libcpp_is_constructible; 2906 2907template <class _To, class _From> 2908struct __is_invalid_base_to_derived_cast { 2909 static_assert(is_reference<_To>::value, "Wrong specialization"); 2910 using _RawFrom = __uncvref_t<_From>; 2911 using _RawTo = __uncvref_t<_To>; 2912 static const bool value = __lazy_and< 2913 __lazy_not<is_same<_RawFrom, _RawTo>>, 2914 is_base_of<_RawFrom, _RawTo>, 2915 __lazy_not<__libcpp_is_constructible<_RawTo, _From>> 2916 >::value; 2917}; 2918 2919template <class _To, class _From> 2920struct __is_invalid_lvalue_to_rvalue_cast : false_type { 2921 static_assert(is_reference<_To>::value, "Wrong specialization"); 2922}; 2923 2924template <class _ToRef, class _FromRef> 2925struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> { 2926 using _RawFrom = __uncvref_t<_FromRef>; 2927 using _RawTo = __uncvref_t<_ToRef>; 2928 static const bool value = __lazy_and< 2929 __lazy_not<is_function<_RawTo>>, 2930 __lazy_or< 2931 is_same<_RawFrom, _RawTo>, 2932 is_base_of<_RawTo, _RawFrom>> 2933 >::value; 2934}; 2935 2936struct __is_constructible_helper 2937{ 2938 template <class _To> 2939 static void __eat(_To); 2940 2941 // This overload is needed to work around a Clang bug that disallows 2942 // static_cast<T&&>(e) for non-reference-compatible types. 2943 // Example: static_cast<int&&>(declval<double>()); 2944 // NOTE: The static_cast implementation below is required to support 2945 // classes with explicit conversion operators. 2946 template <class _To, class _From, 2947 class = decltype(__eat<_To>(_VSTD::declval<_From>()))> 2948 static true_type __test_cast(int); 2949 2950 template <class _To, class _From, 2951 class = decltype(static_cast<_To>(_VSTD::declval<_From>()))> 2952 static integral_constant<bool, 2953 !__is_invalid_base_to_derived_cast<_To, _From>::value && 2954 !__is_invalid_lvalue_to_rvalue_cast<_To, _From>::value 2955 > __test_cast(long); 2956 2957 template <class, class> 2958 static false_type __test_cast(...); 2959 2960 template <class _Tp, class ..._Args, 2961 class = decltype(_Tp(_VSTD::declval<_Args>()...))> 2962 static true_type __test_nary(int); 2963 template <class _Tp, class...> 2964 static false_type __test_nary(...); 2965 2966 template <class _Tp, class _A0, class = decltype(::new _Tp(_VSTD::declval<_A0>()))> 2967 static is_destructible<_Tp> __test_unary(int); 2968 template <class, class> 2969 static false_type __test_unary(...); 2970}; 2971 2972template <class _Tp, bool = is_void<_Tp>::value> 2973struct __is_default_constructible 2974 : decltype(__is_constructible_helper::__test_nary<_Tp>(0)) 2975{}; 2976 2977template <class _Tp> 2978struct __is_default_constructible<_Tp, true> : false_type {}; 2979 2980template <class _Tp> 2981struct __is_default_constructible<_Tp[], false> : false_type {}; 2982 2983template <class _Tp, size_t _Nx> 2984struct __is_default_constructible<_Tp[_Nx], false> 2985 : __is_default_constructible<typename remove_all_extents<_Tp>::type> {}; 2986 2987template <class _Tp, class... _Args> 2988struct __libcpp_is_constructible 2989{ 2990 static_assert(sizeof...(_Args) > 1, "Wrong specialization"); 2991 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0)) 2992 type; 2993}; 2994 2995template <class _Tp> 2996struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {}; 2997 2998template <class _Tp, class _A0> 2999struct __libcpp_is_constructible<_Tp, _A0> 3000 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0)) 3001{}; 3002 3003template <class _Tp, class _A0> 3004struct __libcpp_is_constructible<_Tp&, _A0> 3005 : public decltype(__is_constructible_helper:: 3006 __test_cast<_Tp&, _A0>(0)) 3007{}; 3008 3009template <class _Tp, class _A0> 3010struct __libcpp_is_constructible<_Tp&&, _A0> 3011 : public decltype(__is_constructible_helper:: 3012 __test_cast<_Tp&&, _A0>(0)) 3013{}; 3014 3015#endif 3016 3017#if __has_feature(is_constructible) 3018template <class _Tp, class ..._Args> 3019struct _LIBCPP_TYPE_VIS_ONLY is_constructible 3020 : public integral_constant<bool, __is_constructible(_Tp, _Args...)> 3021 {}; 3022#elif !defined(_LIBCPP_CXX03_LANG) 3023template <class _Tp, class... _Args> 3024struct _LIBCPP_TYPE_VIS_ONLY is_constructible 3025 : public __libcpp_is_constructible<_Tp, _Args...>::type {}; 3026#else 3027// template <class T> struct is_constructible0; 3028 3029// main is_constructible0 test 3030 3031template <class _Tp> 3032decltype((_Tp(), true_type())) 3033__is_constructible0_test(_Tp&); 3034 3035false_type 3036__is_constructible0_test(__any); 3037 3038template <class _Tp, class _A0> 3039decltype((_Tp(_VSTD::declval<_A0>()), true_type())) 3040__is_constructible1_test(_Tp&, _A0&); 3041 3042template <class _A0> 3043false_type 3044__is_constructible1_test(__any, _A0&); 3045 3046template <class _Tp, class _A0, class _A1> 3047decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 3048__is_constructible2_test(_Tp&, _A0&, _A1&); 3049 3050template <class _A0, class _A1> 3051false_type 3052__is_constructible2_test(__any, _A0&, _A1&); 3053 3054template <bool, class _Tp> 3055struct __is_constructible0_imp // false, _Tp is not a scalar 3056 : public common_type 3057 < 3058 decltype(__is_constructible0_test(declval<_Tp&>())) 3059 >::type 3060 {}; 3061 3062template <bool, class _Tp, class _A0> 3063struct __is_constructible1_imp // false, _Tp is not a scalar 3064 : public common_type 3065 < 3066 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 3067 >::type 3068 {}; 3069 3070template <bool, class _Tp, class _A0, class _A1> 3071struct __is_constructible2_imp // false, _Tp is not a scalar 3072 : public common_type 3073 < 3074 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 3075 >::type 3076 {}; 3077 3078// handle scalars and reference types 3079 3080// Scalars are default constructible, references are not 3081 3082template <class _Tp> 3083struct __is_constructible0_imp<true, _Tp> 3084 : public is_scalar<_Tp> 3085 {}; 3086 3087template <class _Tp, class _A0> 3088struct __is_constructible1_imp<true, _Tp, _A0> 3089 : public is_convertible<_A0, _Tp> 3090 {}; 3091 3092template <class _Tp, class _A0, class _A1> 3093struct __is_constructible2_imp<true, _Tp, _A0, _A1> 3094 : public false_type 3095 {}; 3096 3097// Treat scalars and reference types separately 3098 3099template <bool, class _Tp> 3100struct __is_constructible0_void_check 3101 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3102 _Tp> 3103 {}; 3104 3105template <bool, class _Tp, class _A0> 3106struct __is_constructible1_void_check 3107 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3108 _Tp, _A0> 3109 {}; 3110 3111template <bool, class _Tp, class _A0, class _A1> 3112struct __is_constructible2_void_check 3113 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3114 _Tp, _A0, _A1> 3115 {}; 3116 3117// If any of T or Args is void, is_constructible should be false 3118 3119template <class _Tp> 3120struct __is_constructible0_void_check<true, _Tp> 3121 : public false_type 3122 {}; 3123 3124template <class _Tp, class _A0> 3125struct __is_constructible1_void_check<true, _Tp, _A0> 3126 : public false_type 3127 {}; 3128 3129template <class _Tp, class _A0, class _A1> 3130struct __is_constructible2_void_check<true, _Tp, _A0, _A1> 3131 : public false_type 3132 {}; 3133 3134// is_constructible entry point 3135 3136template <class _Tp, class _A0 = __is_construct::__nat, 3137 class _A1 = __is_construct::__nat> 3138struct _LIBCPP_TYPE_VIS_ONLY is_constructible 3139 : public __is_constructible2_void_check<is_void<_Tp>::value 3140 || is_abstract<_Tp>::value 3141 || is_function<_Tp>::value 3142 || is_void<_A0>::value 3143 || is_void<_A1>::value, 3144 _Tp, _A0, _A1> 3145 {}; 3146 3147template <class _Tp> 3148struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 3149 : public __is_constructible0_void_check<is_void<_Tp>::value 3150 || is_abstract<_Tp>::value 3151 || is_function<_Tp>::value, 3152 _Tp> 3153 {}; 3154 3155template <class _Tp, class _A0> 3156struct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 3157 : public __is_constructible1_void_check<is_void<_Tp>::value 3158 || is_abstract<_Tp>::value 3159 || is_function<_Tp>::value 3160 || is_void<_A0>::value, 3161 _Tp, _A0> 3162 {}; 3163 3164// Array types are default constructible if their element type 3165// is default constructible 3166 3167template <class _Ap, size_t _Np> 3168struct __is_constructible0_imp<false, _Ap[_Np]> 3169 : public is_constructible<typename remove_all_extents<_Ap>::type> 3170 {}; 3171 3172template <class _Ap, size_t _Np, class _A0> 3173struct __is_constructible1_imp<false, _Ap[_Np], _A0> 3174 : public false_type 3175 {}; 3176 3177template <class _Ap, size_t _Np, class _A0, class _A1> 3178struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 3179 : public false_type 3180 {}; 3181 3182// Incomplete array types are not constructible 3183 3184template <class _Ap> 3185struct __is_constructible0_imp<false, _Ap[]> 3186 : public false_type 3187 {}; 3188 3189template <class _Ap, class _A0> 3190struct __is_constructible1_imp<false, _Ap[], _A0> 3191 : public false_type 3192 {}; 3193 3194template <class _Ap, class _A0, class _A1> 3195struct __is_constructible2_imp<false, _Ap[], _A0, _A1> 3196 : public false_type 3197 {}; 3198 3199#endif // __has_feature(is_constructible) 3200 3201 3202#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3203template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_constructible_v 3204 = is_constructible<_Tp, _Args...>::value; 3205#endif 3206 3207// is_default_constructible 3208 3209template <class _Tp> 3210struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 3211 : public is_constructible<_Tp> 3212 {}; 3213 3214#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3215template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v 3216 = is_default_constructible<_Tp>::value; 3217#endif 3218 3219// is_copy_constructible 3220 3221template <class _Tp> 3222struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 3223 : public is_constructible<_Tp, 3224 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3225 3226#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3227template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v 3228 = is_copy_constructible<_Tp>::value; 3229#endif 3230 3231// is_move_constructible 3232 3233template <class _Tp> 3234struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 3235#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3236 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3237#else 3238 : public is_copy_constructible<_Tp> 3239#endif 3240 {}; 3241 3242#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3243template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v 3244 = is_move_constructible<_Tp>::value; 3245#endif 3246 3247// is_trivially_constructible 3248 3249#ifndef _LIBCPP_HAS_NO_VARIADICS 3250 3251#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501 3252 3253template <class _Tp, class... _Args> 3254struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 3255 : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 3256{ 3257}; 3258 3259#else // !__has_feature(is_trivially_constructible) 3260 3261template <class _Tp, class... _Args> 3262struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 3263 : false_type 3264{ 3265}; 3266 3267template <class _Tp> 3268struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 3269#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) 3270 : integral_constant<bool, __has_trivial_constructor(_Tp)> 3271#else 3272 : integral_constant<bool, is_scalar<_Tp>::value> 3273#endif 3274{ 3275}; 3276 3277template <class _Tp> 3278#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3279struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 3280#else 3281struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 3282#endif 3283 : integral_constant<bool, is_scalar<_Tp>::value> 3284{ 3285}; 3286 3287template <class _Tp> 3288struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 3289 : integral_constant<bool, is_scalar<_Tp>::value> 3290{ 3291}; 3292 3293template <class _Tp> 3294struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 3295 : integral_constant<bool, is_scalar<_Tp>::value> 3296{ 3297}; 3298 3299#endif // !__has_feature(is_trivially_constructible) 3300 3301#else // _LIBCPP_HAS_NO_VARIADICS 3302 3303template <class _Tp, class _A0 = __is_construct::__nat, 3304 class _A1 = __is_construct::__nat> 3305struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 3306 : false_type 3307{ 3308}; 3309 3310#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501 3311 3312template <class _Tp> 3313struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 3314 __is_construct::__nat> 3315 : integral_constant<bool, __is_trivially_constructible(_Tp)> 3316{ 3317}; 3318 3319template <class _Tp> 3320struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 3321 __is_construct::__nat> 3322 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 3323{ 3324}; 3325 3326template <class _Tp> 3327struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 3328 __is_construct::__nat> 3329 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 3330{ 3331}; 3332 3333template <class _Tp> 3334struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 3335 __is_construct::__nat> 3336 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 3337{ 3338}; 3339 3340#else // !__has_feature(is_trivially_constructible) 3341 3342template <class _Tp> 3343struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 3344 __is_construct::__nat> 3345 : integral_constant<bool, is_scalar<_Tp>::value> 3346{ 3347}; 3348 3349template <class _Tp> 3350struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 3351 __is_construct::__nat> 3352 : integral_constant<bool, is_scalar<_Tp>::value> 3353{ 3354}; 3355 3356template <class _Tp> 3357struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 3358 __is_construct::__nat> 3359 : integral_constant<bool, is_scalar<_Tp>::value> 3360{ 3361}; 3362 3363template <class _Tp> 3364struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 3365 __is_construct::__nat> 3366 : integral_constant<bool, is_scalar<_Tp>::value> 3367{ 3368}; 3369 3370#endif // !__has_feature(is_trivially_constructible) 3371 3372#endif // _LIBCPP_HAS_NO_VARIADICS 3373 3374#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3375template <class _Tp, class... _Args> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v 3376 = is_trivially_constructible<_Tp, _Args...>::value; 3377#endif 3378 3379// is_trivially_default_constructible 3380 3381template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 3382 : public is_trivially_constructible<_Tp> 3383 {}; 3384 3385#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3386template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v 3387 = is_trivially_default_constructible<_Tp>::value; 3388#endif 3389 3390// is_trivially_copy_constructible 3391 3392template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 3393 : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 3394 {}; 3395 3396#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3397template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v 3398 = is_trivially_copy_constructible<_Tp>::value; 3399#endif 3400 3401// is_trivially_move_constructible 3402 3403template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 3404#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3405 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3406#else 3407 : public is_trivially_copy_constructible<_Tp> 3408#endif 3409 {}; 3410 3411#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3412template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v 3413 = is_trivially_move_constructible<_Tp>::value; 3414#endif 3415 3416// is_trivially_assignable 3417 3418#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501 3419 3420template <class _Tp, class _Arg> 3421struct is_trivially_assignable 3422 : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 3423{ 3424}; 3425 3426#else // !__has_feature(is_trivially_assignable) 3427 3428template <class _Tp, class _Arg> 3429struct is_trivially_assignable 3430 : public false_type {}; 3431 3432template <class _Tp> 3433struct is_trivially_assignable<_Tp&, _Tp> 3434 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3435 3436template <class _Tp> 3437struct is_trivially_assignable<_Tp&, _Tp&> 3438 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3439 3440template <class _Tp> 3441struct is_trivially_assignable<_Tp&, const _Tp&> 3442 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3443 3444#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3445 3446template <class _Tp> 3447struct is_trivially_assignable<_Tp&, _Tp&&> 3448 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3449 3450#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3451 3452#endif // !__has_feature(is_trivially_assignable) 3453 3454#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3455template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v 3456 = is_trivially_assignable<_Tp, _Arg>::value; 3457#endif 3458 3459// is_trivially_copy_assignable 3460 3461template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 3462 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 3463 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3464 3465#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3466template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v 3467 = is_trivially_copy_assignable<_Tp>::value; 3468#endif 3469 3470// is_trivially_move_assignable 3471 3472template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 3473 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 3474#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3475 typename add_rvalue_reference<_Tp>::type> 3476#else 3477 typename add_lvalue_reference<_Tp>::type> 3478#endif 3479 {}; 3480 3481#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3482template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v 3483 = is_trivially_move_assignable<_Tp>::value; 3484#endif 3485 3486// is_trivially_destructible 3487 3488#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) 3489 3490template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 3491 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; 3492 3493#else 3494 3495template <class _Tp> struct __libcpp_trivial_destructor 3496 : public integral_constant<bool, is_scalar<_Tp>::value || 3497 is_reference<_Tp>::value> {}; 3498 3499template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 3500 : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 3501 3502template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible<_Tp[]> 3503 : public false_type {}; 3504 3505#endif 3506 3507#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3508template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v 3509 = is_trivially_destructible<_Tp>::value; 3510#endif 3511 3512// is_nothrow_constructible 3513 3514#if 0 3515template <class _Tp, class... _Args> 3516struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 3517 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 3518{ 3519}; 3520 3521#else 3522 3523#ifndef _LIBCPP_HAS_NO_VARIADICS 3524 3525#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3526 3527template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; 3528 3529template <class _Tp, class... _Args> 3530struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...> 3531 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 3532{ 3533}; 3534 3535template <class _Tp> 3536void __implicit_conversion_to(_Tp) noexcept { } 3537 3538template <class _Tp, class _Arg> 3539struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> 3540 : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))> 3541{ 3542}; 3543 3544template <class _Tp, bool _IsReference, class... _Args> 3545struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...> 3546 : public false_type 3547{ 3548}; 3549 3550template <class _Tp, class... _Args> 3551struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 3552 : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...> 3553{ 3554}; 3555 3556template <class _Tp, size_t _Ns> 3557struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 3558 : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> 3559{ 3560}; 3561 3562#else // __has_feature(cxx_noexcept) 3563 3564template <class _Tp, class... _Args> 3565struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 3566 : false_type 3567{ 3568}; 3569 3570template <class _Tp> 3571struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 3572#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3573 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3574#else 3575 : integral_constant<bool, is_scalar<_Tp>::value> 3576#endif 3577{ 3578}; 3579 3580template <class _Tp> 3581#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3582struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 3583#else 3584struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 3585#endif 3586#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3587 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3588#else 3589 : integral_constant<bool, is_scalar<_Tp>::value> 3590#endif 3591{ 3592}; 3593 3594template <class _Tp> 3595struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 3596#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3597 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3598#else 3599 : integral_constant<bool, is_scalar<_Tp>::value> 3600#endif 3601{ 3602}; 3603 3604template <class _Tp> 3605struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 3606#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3607 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3608#else 3609 : integral_constant<bool, is_scalar<_Tp>::value> 3610#endif 3611{ 3612}; 3613 3614#endif // __has_feature(cxx_noexcept) 3615 3616#else // _LIBCPP_HAS_NO_VARIADICS 3617 3618template <class _Tp, class _A0 = __is_construct::__nat, 3619 class _A1 = __is_construct::__nat> 3620struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 3621 : false_type 3622{ 3623}; 3624 3625template <class _Tp> 3626struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 3627 __is_construct::__nat> 3628#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3629 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3630#else 3631 : integral_constant<bool, is_scalar<_Tp>::value> 3632#endif 3633{ 3634}; 3635 3636template <class _Tp> 3637struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 3638 __is_construct::__nat> 3639#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3640 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3641#else 3642 : integral_constant<bool, is_scalar<_Tp>::value> 3643#endif 3644{ 3645}; 3646 3647template <class _Tp> 3648struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 3649 __is_construct::__nat> 3650#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3651 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3652#else 3653 : integral_constant<bool, is_scalar<_Tp>::value> 3654#endif 3655{ 3656}; 3657 3658template <class _Tp> 3659struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 3660 __is_construct::__nat> 3661#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3662 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3663#else 3664 : integral_constant<bool, is_scalar<_Tp>::value> 3665#endif 3666{ 3667}; 3668 3669#endif // _LIBCPP_HAS_NO_VARIADICS 3670#endif // __has_feature(is_nothrow_constructible) 3671 3672#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3673template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v 3674 = is_nothrow_constructible<_Tp, _Args...>::value; 3675#endif 3676 3677// is_nothrow_default_constructible 3678 3679template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 3680 : public is_nothrow_constructible<_Tp> 3681 {}; 3682 3683#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3684template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v 3685 = is_nothrow_default_constructible<_Tp>::value; 3686#endif 3687 3688// is_nothrow_copy_constructible 3689 3690template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 3691 : public is_nothrow_constructible<_Tp, 3692 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3693 3694#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3695template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v 3696 = is_nothrow_copy_constructible<_Tp>::value; 3697#endif 3698 3699// is_nothrow_move_constructible 3700 3701template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 3702#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3703 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3704#else 3705 : public is_nothrow_copy_constructible<_Tp> 3706#endif 3707 {}; 3708 3709#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3710template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v 3711 = is_nothrow_move_constructible<_Tp>::value; 3712#endif 3713 3714// is_nothrow_assignable 3715 3716#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3717 3718template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; 3719 3720template <class _Tp, class _Arg> 3721struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> 3722 : public false_type 3723{ 3724}; 3725 3726template <class _Tp, class _Arg> 3727struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> 3728 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 3729{ 3730}; 3731 3732template <class _Tp, class _Arg> 3733struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3734 : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 3735{ 3736}; 3737 3738#else // __has_feature(cxx_noexcept) 3739 3740template <class _Tp, class _Arg> 3741struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3742 : public false_type {}; 3743 3744template <class _Tp> 3745struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 3746#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3747 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3748#else 3749 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3750#endif 3751 3752template <class _Tp> 3753struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> 3754#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3755 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3756#else 3757 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3758#endif 3759 3760template <class _Tp> 3761struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> 3762#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3763 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3764#else 3765 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3766#endif 3767 3768#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3769 3770template <class _Tp> 3771struct is_nothrow_assignable<_Tp&, _Tp&&> 3772#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3773 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3774#else 3775 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3776#endif 3777 3778#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3779 3780#endif // __has_feature(cxx_noexcept) 3781 3782#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3783template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v 3784 = is_nothrow_assignable<_Tp, _Arg>::value; 3785#endif 3786 3787// is_nothrow_copy_assignable 3788 3789template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 3790 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3791 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3792 3793#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3794template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v 3795 = is_nothrow_copy_assignable<_Tp>::value; 3796#endif 3797 3798// is_nothrow_move_assignable 3799 3800template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 3801 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3802#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3803 typename add_rvalue_reference<_Tp>::type> 3804#else 3805 typename add_lvalue_reference<_Tp>::type> 3806#endif 3807 {}; 3808 3809#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3810template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v 3811 = is_nothrow_move_assignable<_Tp>::value; 3812#endif 3813 3814// is_nothrow_destructible 3815 3816#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3817 3818template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; 3819 3820template <class _Tp> 3821struct __libcpp_is_nothrow_destructible<false, _Tp> 3822 : public false_type 3823{ 3824}; 3825 3826template <class _Tp> 3827struct __libcpp_is_nothrow_destructible<true, _Tp> 3828 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 3829{ 3830}; 3831 3832template <class _Tp> 3833struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3834 : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 3835{ 3836}; 3837 3838template <class _Tp, size_t _Ns> 3839struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 3840 : public is_nothrow_destructible<_Tp> 3841{ 3842}; 3843 3844template <class _Tp> 3845struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 3846 : public true_type 3847{ 3848}; 3849 3850#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3851 3852template <class _Tp> 3853struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 3854 : public true_type 3855{ 3856}; 3857 3858#endif 3859 3860#else 3861 3862template <class _Tp> struct __libcpp_nothrow_destructor 3863 : public integral_constant<bool, is_scalar<_Tp>::value || 3864 is_reference<_Tp>::value> {}; 3865 3866template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3867 : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 3868 3869template <class _Tp> 3870struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[]> 3871 : public false_type {}; 3872 3873#endif 3874 3875#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3876template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v 3877 = is_nothrow_destructible<_Tp>::value; 3878#endif 3879 3880// is_pod 3881 3882#if __has_feature(is_pod) || (_GNUC_VER >= 403) 3883 3884template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3885 : public integral_constant<bool, __is_pod(_Tp)> {}; 3886 3887#else 3888 3889template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3890 : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 3891 is_trivially_copy_constructible<_Tp>::value && 3892 is_trivially_copy_assignable<_Tp>::value && 3893 is_trivially_destructible<_Tp>::value> {}; 3894 3895#endif 3896 3897#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3898template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v 3899 = is_pod<_Tp>::value; 3900#endif 3901 3902// is_literal_type; 3903 3904template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 3905#ifdef _LIBCPP_IS_LITERAL 3906 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)> 3907#else 3908 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 3909 is_reference<typename remove_all_extents<_Tp>::type>::value> 3910#endif 3911 {}; 3912 3913#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3914template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v 3915 = is_literal_type<_Tp>::value; 3916#endif 3917 3918// is_standard_layout; 3919 3920template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 3921#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) 3922 : public integral_constant<bool, __is_standard_layout(_Tp)> 3923#else 3924 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3925#endif 3926 {}; 3927 3928#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3929template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v 3930 = is_standard_layout<_Tp>::value; 3931#endif 3932 3933// is_trivially_copyable; 3934 3935template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 3936#if __has_feature(is_trivially_copyable) 3937 : public integral_constant<bool, __is_trivially_copyable(_Tp)> 3938#elif _GNUC_VER >= 501 3939 : public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)> 3940#else 3941 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3942#endif 3943 {}; 3944 3945#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3946template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v 3947 = is_trivially_copyable<_Tp>::value; 3948#endif 3949 3950// is_trivial; 3951 3952template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 3953#if __has_feature(is_trivial) || _GNUC_VER >= 407 3954 : public integral_constant<bool, __is_trivial(_Tp)> 3955#else 3956 : integral_constant<bool, is_trivially_copyable<_Tp>::value && 3957 is_trivially_default_constructible<_Tp>::value> 3958#endif 3959 {}; 3960 3961#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3962template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v 3963 = is_trivial<_Tp>::value; 3964#endif 3965 3966template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; 3967template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; 3968template <class _Tp> struct __is_reference_wrapper 3969 : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; 3970 3971#ifndef _LIBCPP_CXX03_LANG 3972 3973// Check for complete types 3974 3975template <class ..._Tp> struct __check_complete; 3976 3977template <> 3978struct __check_complete<> 3979{ 3980}; 3981 3982template <class _Hp, class _T0, class ..._Tp> 3983struct __check_complete<_Hp, _T0, _Tp...> 3984 : private __check_complete<_Hp>, 3985 private __check_complete<_T0, _Tp...> 3986{ 3987}; 3988 3989template <class _Hp> 3990struct __check_complete<_Hp, _Hp> 3991 : private __check_complete<_Hp> 3992{ 3993}; 3994 3995template <class _Tp> 3996struct __check_complete<_Tp> 3997{ 3998 static_assert(sizeof(_Tp) > 0, "Type must be complete."); 3999}; 4000 4001template <class _Tp> 4002struct __check_complete<_Tp&> 4003 : private __check_complete<_Tp> 4004{ 4005}; 4006 4007template <class _Tp> 4008struct __check_complete<_Tp&&> 4009 : private __check_complete<_Tp> 4010{ 4011}; 4012 4013template <class _Rp, class ..._Param> 4014struct __check_complete<_Rp (*)(_Param...)> 4015 : private __check_complete<_Rp> 4016{ 4017}; 4018 4019template <class ..._Param> 4020struct __check_complete<void (*)(_Param...)> 4021{ 4022}; 4023 4024template <class _Rp, class ..._Param> 4025struct __check_complete<_Rp (_Param...)> 4026 : private __check_complete<_Rp> 4027{ 4028}; 4029 4030template <class ..._Param> 4031struct __check_complete<void (_Param...)> 4032{ 4033}; 4034 4035template <class _Rp, class _Class, class ..._Param> 4036struct __check_complete<_Rp (_Class::*)(_Param...)> 4037 : private __check_complete<_Class> 4038{ 4039}; 4040 4041template <class _Rp, class _Class, class ..._Param> 4042struct __check_complete<_Rp (_Class::*)(_Param...) const> 4043 : private __check_complete<_Class> 4044{ 4045}; 4046 4047template <class _Rp, class _Class, class ..._Param> 4048struct __check_complete<_Rp (_Class::*)(_Param...) volatile> 4049 : private __check_complete<_Class> 4050{ 4051}; 4052 4053template <class _Rp, class _Class, class ..._Param> 4054struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 4055 : private __check_complete<_Class> 4056{ 4057}; 4058 4059template <class _Rp, class _Class, class ..._Param> 4060struct __check_complete<_Rp (_Class::*)(_Param...) &> 4061 : private __check_complete<_Class> 4062{ 4063}; 4064 4065template <class _Rp, class _Class, class ..._Param> 4066struct __check_complete<_Rp (_Class::*)(_Param...) const&> 4067 : private __check_complete<_Class> 4068{ 4069}; 4070 4071template <class _Rp, class _Class, class ..._Param> 4072struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 4073 : private __check_complete<_Class> 4074{ 4075}; 4076 4077template <class _Rp, class _Class, class ..._Param> 4078struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 4079 : private __check_complete<_Class> 4080{ 4081}; 4082 4083template <class _Rp, class _Class, class ..._Param> 4084struct __check_complete<_Rp (_Class::*)(_Param...) &&> 4085 : private __check_complete<_Class> 4086{ 4087}; 4088 4089template <class _Rp, class _Class, class ..._Param> 4090struct __check_complete<_Rp (_Class::*)(_Param...) const&&> 4091 : private __check_complete<_Class> 4092{ 4093}; 4094 4095template <class _Rp, class _Class, class ..._Param> 4096struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 4097 : private __check_complete<_Class> 4098{ 4099}; 4100 4101template <class _Rp, class _Class, class ..._Param> 4102struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 4103 : private __check_complete<_Class> 4104{ 4105}; 4106 4107template <class _Rp, class _Class> 4108struct __check_complete<_Rp _Class::*> 4109 : private __check_complete<_Class> 4110{ 4111}; 4112 4113 4114template <class _Fp, class _A0, 4115 class _DecayFp = typename decay<_Fp>::type, 4116 class _DecayA0 = typename decay<_A0>::type, 4117 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4118using __enable_if_bullet1 = typename enable_if 4119 < 4120 is_member_function_pointer<_DecayFp>::value 4121 && is_base_of<_ClassT, _DecayA0>::value 4122 >::type; 4123 4124template <class _Fp, class _A0, 4125 class _DecayFp = typename decay<_Fp>::type, 4126 class _DecayA0 = typename decay<_A0>::type> 4127using __enable_if_bullet2 = typename enable_if 4128 < 4129 is_member_function_pointer<_DecayFp>::value 4130 && __is_reference_wrapper<_DecayA0>::value 4131 >::type; 4132 4133template <class _Fp, class _A0, 4134 class _DecayFp = typename decay<_Fp>::type, 4135 class _DecayA0 = typename decay<_A0>::type, 4136 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4137using __enable_if_bullet3 = typename enable_if 4138 < 4139 is_member_function_pointer<_DecayFp>::value 4140 && !is_base_of<_ClassT, _DecayA0>::value 4141 && !__is_reference_wrapper<_DecayA0>::value 4142 >::type; 4143 4144template <class _Fp, class _A0, 4145 class _DecayFp = typename decay<_Fp>::type, 4146 class _DecayA0 = typename decay<_A0>::type, 4147 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4148using __enable_if_bullet4 = typename enable_if 4149 < 4150 is_member_object_pointer<_DecayFp>::value 4151 && is_base_of<_ClassT, _DecayA0>::value 4152 >::type; 4153 4154template <class _Fp, class _A0, 4155 class _DecayFp = typename decay<_Fp>::type, 4156 class _DecayA0 = typename decay<_A0>::type> 4157using __enable_if_bullet5 = typename enable_if 4158 < 4159 is_member_object_pointer<_DecayFp>::value 4160 && __is_reference_wrapper<_DecayA0>::value 4161 >::type; 4162 4163template <class _Fp, class _A0, 4164 class _DecayFp = typename decay<_Fp>::type, 4165 class _DecayA0 = typename decay<_A0>::type, 4166 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4167using __enable_if_bullet6 = typename enable_if 4168 < 4169 is_member_object_pointer<_DecayFp>::value 4170 && !is_base_of<_ClassT, _DecayA0>::value 4171 && !__is_reference_wrapper<_DecayA0>::value 4172 >::type; 4173 4174// __invoke forward declarations 4175 4176// fall back - none of the bullets 4177 4178#define _LIBCPP_INVOKE_RETURN(...) \ 4179 noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \ 4180 { return __VA_ARGS__; } 4181 4182template <class ..._Args> 4183auto __invoke(__any, _Args&& ...__args) -> __nat; 4184 4185template <class ..._Args> 4186auto __invoke_constexpr(__any, _Args&& ...__args) -> __nat; 4187 4188// bullets 1, 2 and 3 4189 4190template <class _Fp, class _A0, class ..._Args, 4191 class = __enable_if_bullet1<_Fp, _A0>> 4192inline _LIBCPP_INLINE_VISIBILITY 4193auto 4194__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4195_LIBCPP_INVOKE_RETURN((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) 4196 4197template <class _Fp, class _A0, class ..._Args, 4198 class = __enable_if_bullet1<_Fp, _A0>> 4199inline _LIBCPP_INLINE_VISIBILITY 4200_LIBCPP_CONSTEXPR auto 4201__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4202_LIBCPP_INVOKE_RETURN((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) 4203 4204template <class _Fp, class _A0, class ..._Args, 4205 class = __enable_if_bullet2<_Fp, _A0>> 4206inline _LIBCPP_INLINE_VISIBILITY 4207auto 4208__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4209_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)) 4210 4211template <class _Fp, class _A0, class ..._Args, 4212 class = __enable_if_bullet2<_Fp, _A0>> 4213inline _LIBCPP_INLINE_VISIBILITY 4214_LIBCPP_CONSTEXPR auto 4215__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4216_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)) 4217 4218template <class _Fp, class _A0, class ..._Args, 4219 class = __enable_if_bullet3<_Fp, _A0>> 4220inline _LIBCPP_INLINE_VISIBILITY 4221auto 4222__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4223_LIBCPP_INVOKE_RETURN(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) 4224 4225template <class _Fp, class _A0, class ..._Args, 4226 class = __enable_if_bullet3<_Fp, _A0>> 4227inline _LIBCPP_INLINE_VISIBILITY 4228_LIBCPP_CONSTEXPR auto 4229__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4230_LIBCPP_INVOKE_RETURN(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) 4231 4232// bullets 4, 5 and 6 4233 4234template <class _Fp, class _A0, 4235 class = __enable_if_bullet4<_Fp, _A0>> 4236inline _LIBCPP_INLINE_VISIBILITY 4237auto 4238__invoke(_Fp&& __f, _A0&& __a0) 4239_LIBCPP_INVOKE_RETURN(_VSTD::forward<_A0>(__a0).*__f) 4240 4241template <class _Fp, class _A0, 4242 class = __enable_if_bullet4<_Fp, _A0>> 4243inline _LIBCPP_INLINE_VISIBILITY 4244_LIBCPP_CONSTEXPR auto 4245__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4246_LIBCPP_INVOKE_RETURN(_VSTD::forward<_A0>(__a0).*__f) 4247 4248template <class _Fp, class _A0, 4249 class = __enable_if_bullet5<_Fp, _A0>> 4250inline _LIBCPP_INLINE_VISIBILITY 4251auto 4252__invoke(_Fp&& __f, _A0&& __a0) 4253_LIBCPP_INVOKE_RETURN(__a0.get().*__f) 4254 4255template <class _Fp, class _A0, 4256 class = __enable_if_bullet5<_Fp, _A0>> 4257inline _LIBCPP_INLINE_VISIBILITY 4258_LIBCPP_CONSTEXPR auto 4259__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4260_LIBCPP_INVOKE_RETURN(__a0.get().*__f) 4261 4262template <class _Fp, class _A0, 4263 class = __enable_if_bullet6<_Fp, _A0>> 4264inline _LIBCPP_INLINE_VISIBILITY 4265auto 4266__invoke(_Fp&& __f, _A0&& __a0) 4267_LIBCPP_INVOKE_RETURN((*_VSTD::forward<_A0>(__a0)).*__f) 4268 4269template <class _Fp, class _A0, 4270 class = __enable_if_bullet6<_Fp, _A0>> 4271inline _LIBCPP_INLINE_VISIBILITY 4272_LIBCPP_CONSTEXPR auto 4273__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4274_LIBCPP_INVOKE_RETURN((*_VSTD::forward<_A0>(__a0)).*__f) 4275 4276// bullet 7 4277 4278template <class _Fp, class ..._Args> 4279inline _LIBCPP_INLINE_VISIBILITY 4280auto 4281__invoke(_Fp&& __f, _Args&& ...__args) 4282_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) 4283 4284template <class _Fp, class ..._Args> 4285inline _LIBCPP_INLINE_VISIBILITY 4286_LIBCPP_CONSTEXPR auto 4287__invoke_constexpr(_Fp&& __f, _Args&& ...__args) 4288_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) 4289 4290#undef _LIBCPP_INVOKE_RETURN 4291 4292// __invokable 4293 4294template <class _Ret, class _Fp, class ..._Args> 4295struct __invokable_r 4296 : private __check_complete<_Fp> 4297{ 4298 using _Result = decltype( 4299 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); 4300 4301 static const bool value = 4302 conditional< 4303 !is_same<_Result, __nat>::value, 4304 typename conditional< 4305 is_void<_Ret>::value, 4306 true_type, 4307 is_convertible<_Result, _Ret> 4308 >::type, 4309 false_type 4310 >::type::value; 4311}; 4312 4313template <class _Fp, class ..._Args> 4314using __invokable = __invokable_r<void, _Fp, _Args...>; 4315 4316template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> 4317struct __nothrow_invokable_r_imp { 4318 static const bool value = false; 4319}; 4320 4321template <class _Ret, class _Fp, class ..._Args> 4322struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> 4323{ 4324 typedef __nothrow_invokable_r_imp _ThisT; 4325 4326 template <class _Tp> 4327 static void __test_noexcept(_Tp) noexcept; 4328 4329 static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( 4330 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...))); 4331}; 4332 4333template <class _Ret, class _Fp, class ..._Args> 4334struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> 4335{ 4336 static const bool value = noexcept( 4337 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); 4338}; 4339 4340template <class _Ret, class _Fp, class ..._Args> 4341using __nothrow_invokable_r = 4342 __nothrow_invokable_r_imp< 4343 __invokable_r<_Ret, _Fp, _Args...>::value, 4344 is_void<_Ret>::value, 4345 _Ret, _Fp, _Args... 4346 >; 4347 4348template <class _Fp, class ..._Args> 4349struct __invoke_of 4350 : public enable_if< 4351 __invokable<_Fp, _Args...>::value, 4352 typename __invokable_r<void, _Fp, _Args...>::_Result> 4353{ 4354}; 4355 4356// result_of 4357 4358template <class _Fp, class ..._Args> 4359class _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 4360 : public __invoke_of<_Fp, _Args...> 4361{ 4362}; 4363 4364#if _LIBCPP_STD_VER > 11 4365template <class _Tp> using result_of_t = typename result_of<_Tp>::type; 4366#endif 4367 4368#if _LIBCPP_STD_VER > 14 4369 4370// is_callable 4371 4372template <class _Fn, class _Ret = void> 4373struct _LIBCPP_TYPE_VIS_ONLY is_callable; 4374 4375template <class _Fn, class ..._Args, class _Ret> 4376struct _LIBCPP_TYPE_VIS_ONLY is_callable<_Fn(_Args...), _Ret> 4377 : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; 4378 4379template <class _Fn, class _Ret = void> 4380constexpr bool is_callable_v = is_callable<_Fn, _Ret>::value; 4381 4382// is_nothrow_callable 4383 4384template <class _Fn, class _Ret = void> 4385struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_callable; 4386 4387template <class _Fn, class ..._Args, class _Ret> 4388struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_callable<_Fn(_Args...), _Ret> 4389 : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> 4390{}; 4391 4392template <class _Fn, class _Ret = void> 4393constexpr bool is_nothrow_callable_v = is_nothrow_callable<_Fn, _Ret>::value; 4394 4395#endif // _LIBCPP_STD_VER > 14 4396 4397#endif // !defined(_LIBCPP_CXX03_LANG) 4398 4399template <class _Tp> struct __is_swappable; 4400template <class _Tp> struct __is_nothrow_swappable; 4401 4402template <class _Tp> 4403inline _LIBCPP_INLINE_VISIBILITY 4404#ifndef _LIBCPP_CXX03_LANG 4405typename enable_if 4406< 4407 is_move_constructible<_Tp>::value && 4408 is_move_assignable<_Tp>::value 4409>::type 4410#else 4411void 4412#endif 4413swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 4414 is_nothrow_move_assignable<_Tp>::value) 4415{ 4416 _Tp __t(_VSTD::move(__x)); 4417 __x = _VSTD::move(__y); 4418 __y = _VSTD::move(__t); 4419} 4420 4421template<class _Tp, size_t _Np> 4422inline _LIBCPP_INLINE_VISIBILITY 4423typename enable_if< 4424 __is_swappable<_Tp>::value 4425>::type 4426swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); 4427 4428template <class _ForwardIterator1, class _ForwardIterator2> 4429inline _LIBCPP_INLINE_VISIBILITY 4430void 4431iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 4432 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 4433 _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 4434 *_VSTD::declval<_ForwardIterator2>()))) 4435{ 4436 swap(*__a, *__b); 4437} 4438 4439// __swappable 4440 4441namespace __detail 4442{ 4443// ALL generic swap overloads MUST already have a declaration available at this point. 4444 4445template <class _Tp, class _Up = _Tp, 4446 bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value> 4447struct __swappable_with 4448{ 4449 template <class _LHS, class _RHS> 4450 static decltype(swap(_VSTD::declval<_LHS>(), _VSTD::declval<_RHS>())) 4451 __test_swap(int); 4452 template <class, class> 4453 static __nat __test_swap(long); 4454 4455 // Extra parens are needed for the C++03 definition of decltype. 4456 typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; 4457 typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; 4458 4459 static const bool value = !is_same<__swap1, __nat>::value 4460 && !is_same<__swap2, __nat>::value; 4461}; 4462 4463template <class _Tp, class _Up> 4464struct __swappable_with<_Tp, _Up, false> : false_type {}; 4465 4466template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value> 4467struct __nothrow_swappable_with { 4468 static const bool value = 4469#ifndef _LIBCPP_HAS_NO_NOEXCEPT 4470 noexcept(swap(_VSTD::declval<_Tp>(), _VSTD::declval<_Up>())) 4471 && noexcept(swap(_VSTD::declval<_Up>(), _VSTD::declval<_Tp>())); 4472#else 4473 false; 4474#endif 4475}; 4476 4477template <class _Tp, class _Up> 4478struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; 4479 4480} // __detail 4481 4482template <class _Tp> 4483struct __is_swappable 4484 : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> 4485{ 4486}; 4487 4488template <class _Tp> 4489struct __is_nothrow_swappable 4490 : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> 4491{ 4492}; 4493 4494#if _LIBCPP_STD_VER > 14 4495 4496template <class _Tp, class _Up> 4497struct _LIBCPP_TYPE_VIS_ONLY is_swappable_with 4498 : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> 4499{ 4500}; 4501 4502template <class _Tp> 4503struct _LIBCPP_TYPE_VIS_ONLY is_swappable 4504 : public conditional< 4505 __is_referenceable<_Tp>::value, 4506 is_swappable_with< 4507 typename add_lvalue_reference<_Tp>::type, 4508 typename add_lvalue_reference<_Tp>::type>, 4509 false_type 4510 >::type 4511{ 4512}; 4513 4514template <class _Tp, class _Up> 4515struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_swappable_with 4516 : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> 4517{ 4518}; 4519 4520template <class _Tp> 4521struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_swappable 4522 : public conditional< 4523 __is_referenceable<_Tp>::value, 4524 is_nothrow_swappable_with< 4525 typename add_lvalue_reference<_Tp>::type, 4526 typename add_lvalue_reference<_Tp>::type>, 4527 false_type 4528 >::type 4529{ 4530}; 4531 4532template <class _Tp, class _Up> 4533constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; 4534 4535template <class _Tp> 4536constexpr bool is_swappable_v = is_swappable<_Tp>::value; 4537 4538template <class _Tp, class _Up> 4539constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; 4540 4541template <class _Tp> 4542constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; 4543 4544#endif // _LIBCPP_STD_VER > 14 4545 4546#ifdef _LIBCPP_UNDERLYING_TYPE 4547 4548template <class _Tp> 4549struct underlying_type 4550{ 4551 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; 4552}; 4553 4554#if _LIBCPP_STD_VER > 11 4555template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 4556#endif 4557 4558#else // _LIBCPP_UNDERLYING_TYPE 4559 4560template <class _Tp, bool _Support = false> 4561struct underlying_type 4562{ 4563 static_assert(_Support, "The underyling_type trait requires compiler " 4564 "support. Either no such support exists or " 4565 "libc++ does not know how to use it."); 4566}; 4567 4568#endif // _LIBCPP_UNDERLYING_TYPE 4569 4570 4571template <class _Tp, bool = is_enum<_Tp>::value> 4572struct __sfinae_underlying_type 4573{ 4574 typedef typename underlying_type<_Tp>::type type; 4575 typedef decltype(((type)1) + 0) __promoted_type; 4576}; 4577 4578template <class _Tp> 4579struct __sfinae_underlying_type<_Tp, false> {}; 4580 4581inline _LIBCPP_INLINE_VISIBILITY 4582int __convert_to_integral(int __val) { return __val; } 4583 4584inline _LIBCPP_INLINE_VISIBILITY 4585unsigned __convert_to_integral(unsigned __val) { return __val; } 4586 4587inline _LIBCPP_INLINE_VISIBILITY 4588long __convert_to_integral(long __val) { return __val; } 4589 4590inline _LIBCPP_INLINE_VISIBILITY 4591unsigned long __convert_to_integral(unsigned long __val) { return __val; } 4592 4593inline _LIBCPP_INLINE_VISIBILITY 4594long long __convert_to_integral(long long __val) { return __val; } 4595 4596inline _LIBCPP_INLINE_VISIBILITY 4597unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } 4598 4599#ifndef _LIBCPP_HAS_NO_INT128 4600inline _LIBCPP_INLINE_VISIBILITY 4601__int128_t __convert_to_integral(__int128_t __val) { return __val; } 4602 4603inline _LIBCPP_INLINE_VISIBILITY 4604__uint128_t __convert_to_integral(__uint128_t __val) { return __val; } 4605#endif 4606 4607template <class _Tp> 4608inline _LIBCPP_INLINE_VISIBILITY 4609typename __sfinae_underlying_type<_Tp>::__promoted_type 4610__convert_to_integral(_Tp __val) { return __val; } 4611 4612#ifndef _LIBCPP_CXX03_LANG 4613 4614template <class _Tp> 4615struct __has_operator_addressof_member_imp 4616{ 4617 template <class _Up> 4618 static auto __test(int) 4619 -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type; 4620 template <class> 4621 static auto __test(long) -> false_type; 4622 4623 static const bool value = decltype(__test<_Tp>(0))::value; 4624}; 4625 4626template <class _Tp> 4627struct __has_operator_addressof_free_imp 4628{ 4629 template <class _Up> 4630 static auto __test(int) 4631 -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type; 4632 template <class> 4633 static auto __test(long) -> false_type; 4634 4635 static const bool value = decltype(__test<_Tp>(0))::value; 4636}; 4637 4638template <class _Tp> 4639struct __has_operator_addressof 4640 : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value 4641 || __has_operator_addressof_free_imp<_Tp>::value> 4642{}; 4643 4644#endif // _LIBCPP_CXX03_LANG 4645 4646#if _LIBCPP_STD_VER > 14 4647 4648#define __cpp_lib_void_t 201411 4649template <class...> using void_t = void; 4650 4651# ifndef _LIBCPP_HAS_NO_VARIADICS 4652template <class... _Args> 4653struct conjunction : __and_<_Args...> {}; 4654template<class... _Args> constexpr bool conjunction_v = conjunction<_Args...>::value; 4655 4656template <class... _Args> 4657struct disjunction : __or_<_Args...> {}; 4658template<class... _Args> constexpr bool disjunction_v = disjunction<_Args...>::value; 4659 4660template <class _Tp> 4661struct negation : __not_<_Tp> {}; 4662template<class _Tp> constexpr bool negation_v = negation<_Tp>::value; 4663# endif // _LIBCPP_HAS_NO_VARIADICS 4664#endif // _LIBCPP_STD_VER > 14 4665 4666// These traits are used in __tree and __hash_table 4667#ifndef _LIBCPP_CXX03_LANG 4668struct __extract_key_fail_tag {}; 4669struct __extract_key_self_tag {}; 4670struct __extract_key_first_tag {}; 4671 4672template <class _ValTy, class _Key, 4673 class _RawValTy = typename __unconstref<_ValTy>::type> 4674struct __can_extract_key 4675 : conditional<is_same<_RawValTy, _Key>::value, __extract_key_self_tag, 4676 __extract_key_fail_tag>::type {}; 4677 4678template <class _Pair, class _Key, class _First, class _Second> 4679struct __can_extract_key<_Pair, _Key, pair<_First, _Second>> 4680 : conditional<is_same<typename remove_const<_First>::type, _Key>::value, 4681 __extract_key_first_tag, __extract_key_fail_tag>::type {}; 4682 4683// __can_extract_map_key uses true_type/false_type instead of the tags. 4684// It returns true if _Key != _ContainerValueTy (the container is a map not a set) 4685// and _ValTy == _Key. 4686template <class _ValTy, class _Key, class _ContainerValueTy, 4687 class _RawValTy = typename __unconstref<_ValTy>::type> 4688struct __can_extract_map_key 4689 : integral_constant<bool, is_same<_RawValTy, _Key>::value> {}; 4690 4691// This specialization returns __extract_key_fail_tag for non-map containers 4692// because _Key == _ContainerValueTy 4693template <class _ValTy, class _Key, class _RawValTy> 4694struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> 4695 : false_type {}; 4696 4697#endif 4698 4699_LIBCPP_END_NAMESPACE_STD 4700 4701#endif // _LIBCPP_TYPE_TRAITS 4702