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