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 1300template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract 1301 : public integral_constant<bool, __is_abstract(_Tp)> {}; 1302 1303#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1304template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v 1305 = is_abstract<_Tp>::value; 1306#endif 1307 1308// is_final 1309 1310#if defined(_LIBCPP_HAS_IS_FINAL) 1311template <class _Tp> struct _LIBCPP_TEMPLATE_VIS 1312__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; 1313#else 1314template <class _Tp> struct _LIBCPP_TEMPLATE_VIS 1315__libcpp_is_final : public false_type {}; 1316#endif 1317 1318#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11 1319template <class _Tp> struct _LIBCPP_TEMPLATE_VIS 1320is_final : public integral_constant<bool, __is_final(_Tp)> {}; 1321#endif 1322 1323#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1324template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v 1325 = is_final<_Tp>::value; 1326#endif 1327 1328// is_base_of 1329 1330#ifdef _LIBCPP_HAS_IS_BASE_OF 1331 1332template <class _Bp, class _Dp> 1333struct _LIBCPP_TEMPLATE_VIS is_base_of 1334 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 1335 1336#else // _LIBCPP_HAS_IS_BASE_OF 1337 1338namespace __is_base_of_imp 1339{ 1340template <class _Tp> 1341struct _Dst 1342{ 1343 _Dst(const volatile _Tp &); 1344}; 1345template <class _Tp> 1346struct _Src 1347{ 1348 operator const volatile _Tp &(); 1349 template <class _Up> operator const _Dst<_Up> &(); 1350}; 1351template <size_t> struct __one { typedef char type; }; 1352template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 1353template <class _Bp, class _Dp> __two __test(...); 1354} 1355 1356template <class _Bp, class _Dp> 1357struct _LIBCPP_TEMPLATE_VIS is_base_of 1358 : public integral_constant<bool, is_class<_Bp>::value && 1359 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 1360 1361#endif // _LIBCPP_HAS_IS_BASE_OF 1362 1363#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1364template <class _Bp, class _Dp> _LIBCPP_CONSTEXPR bool is_base_of_v 1365 = is_base_of<_Bp, _Dp>::value; 1366#endif 1367 1368// is_convertible 1369 1370#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) 1371 1372template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible 1373 : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 1374 !is_abstract<_T2>::value> {}; 1375 1376#else // __has_feature(is_convertible_to) 1377 1378namespace __is_convertible_imp 1379{ 1380template <class _Tp> void __test_convert(_Tp); 1381 1382template <class _From, class _To, class = void> 1383struct __is_convertible_test : public false_type {}; 1384 1385template <class _From, class _To> 1386struct __is_convertible_test<_From, _To, 1387 decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type 1388{}; 1389 1390template <class _Tp, bool _IsArray = is_array<_Tp>::value, 1391 bool _IsFunction = is_function<_Tp>::value, 1392 bool _IsVoid = is_void<_Tp>::value> 1393 struct __is_array_function_or_void {enum {value = 0};}; 1394template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 1395template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 1396template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 1397} 1398 1399template <class _Tp, 1400 unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 1401struct __is_convertible_check 1402{ 1403 static const size_t __v = 0; 1404}; 1405 1406template <class _Tp> 1407struct __is_convertible_check<_Tp, 0> 1408{ 1409 static const size_t __v = sizeof(_Tp); 1410}; 1411 1412template <class _T1, class _T2, 1413 unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 1414 unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 1415struct __is_convertible 1416 : public integral_constant<bool, 1417 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value 1418#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) 1419 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 1420 && (!is_const<typename remove_reference<_T2>::type>::value 1421 || is_volatile<typename remove_reference<_T2>::type>::value) 1422 && (is_same<typename remove_cv<_T1>::type, 1423 typename remove_cv<typename remove_reference<_T2>::type>::type>::value 1424 || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 1425#endif 1426 > 1427{}; 1428 1429template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 1430template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 1431template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 1432template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 1433 1434template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 1435template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 1436template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 1437template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 1438 1439template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 1440template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 1441template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 1442template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 1443 1444template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible 1445 : public __is_convertible<_T1, _T2> 1446{ 1447 static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 1448 static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 1449}; 1450 1451#endif // __has_feature(is_convertible_to) 1452 1453#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1454template <class _From, class _To> _LIBCPP_CONSTEXPR bool is_convertible_v 1455 = is_convertible<_From, _To>::value; 1456#endif 1457 1458// is_empty 1459 1460#if __has_feature(is_empty) || (_GNUC_VER >= 407) 1461 1462template <class _Tp> 1463struct _LIBCPP_TEMPLATE_VIS is_empty 1464 : public integral_constant<bool, __is_empty(_Tp)> {}; 1465 1466#else // __has_feature(is_empty) 1467 1468template <class _Tp> 1469struct __is_empty1 1470 : public _Tp 1471{ 1472 double __lx; 1473}; 1474 1475struct __is_empty2 1476{ 1477 double __lx; 1478}; 1479 1480template <class _Tp, bool = is_class<_Tp>::value> 1481struct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 1482 1483template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 1484 1485template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_empty : public __libcpp_empty<_Tp> {}; 1486 1487#endif // __has_feature(is_empty) 1488 1489#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1490template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v 1491 = is_empty<_Tp>::value; 1492#endif 1493 1494// is_polymorphic 1495 1496#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC) 1497 1498template <class _Tp> 1499struct _LIBCPP_TEMPLATE_VIS is_polymorphic 1500 : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 1501 1502#else 1503 1504template<typename _Tp> char &__is_polymorphic_impl( 1505 typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 1506 int>::type); 1507template<typename _Tp> __two &__is_polymorphic_impl(...); 1508 1509template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_polymorphic 1510 : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 1511 1512#endif // __has_feature(is_polymorphic) 1513 1514#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1515template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v 1516 = is_polymorphic<_Tp>::value; 1517#endif 1518 1519// has_virtual_destructor 1520 1521#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) 1522 1523template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor 1524 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 1525 1526#else 1527 1528template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor 1529 : public false_type {}; 1530 1531#endif 1532 1533#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1534template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v 1535 = has_virtual_destructor<_Tp>::value; 1536#endif 1537 1538// alignment_of 1539 1540template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of 1541 : public integral_constant<size_t, __alignof__(_Tp)> {}; 1542 1543#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 1544template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v 1545 = alignment_of<_Tp>::value; 1546#endif 1547 1548// aligned_storage 1549 1550template <class _Hp, class _Tp> 1551struct __type_list 1552{ 1553 typedef _Hp _Head; 1554 typedef _Tp _Tail; 1555}; 1556 1557struct __nat 1558{ 1559#ifndef _LIBCPP_CXX03_LANG 1560 __nat() = delete; 1561 __nat(const __nat&) = delete; 1562 __nat& operator=(const __nat&) = delete; 1563 ~__nat() = delete; 1564#endif 1565}; 1566 1567template <class _Tp> 1568struct __align_type 1569{ 1570 static const size_t value = alignment_of<_Tp>::value; 1571 typedef _Tp type; 1572}; 1573 1574struct __struct_double {long double __lx;}; 1575struct __struct_double4 {double __lx[4];}; 1576 1577typedef 1578 __type_list<__align_type<unsigned char>, 1579 __type_list<__align_type<unsigned short>, 1580 __type_list<__align_type<unsigned int>, 1581 __type_list<__align_type<unsigned long>, 1582 __type_list<__align_type<unsigned long long>, 1583 __type_list<__align_type<double>, 1584 __type_list<__align_type<long double>, 1585 __type_list<__align_type<__struct_double>, 1586 __type_list<__align_type<__struct_double4>, 1587 __type_list<__align_type<int*>, 1588 __nat 1589 > > > > > > > > > > __all_types; 1590 1591template <class _TL, size_t _Align> struct __find_pod; 1592 1593template <class _Hp, size_t _Align> 1594struct __find_pod<__type_list<_Hp, __nat>, _Align> 1595{ 1596 typedef typename conditional< 1597 _Align == _Hp::value, 1598 typename _Hp::type, 1599 void 1600 >::type type; 1601}; 1602 1603template <class _Hp, class _Tp, size_t _Align> 1604struct __find_pod<__type_list<_Hp, _Tp>, _Align> 1605{ 1606 typedef typename conditional< 1607 _Align == _Hp::value, 1608 typename _Hp::type, 1609 typename __find_pod<_Tp, _Align>::type 1610 >::type type; 1611}; 1612 1613template <class _TL, size_t _Len> struct __find_max_align; 1614 1615template <class _Hp, size_t _Len> 1616struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1617 1618template <size_t _Len, size_t _A1, size_t _A2> 1619struct __select_align 1620{ 1621private: 1622 static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1623 static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1624public: 1625 static const size_t value = _Len < __max ? __min : __max; 1626}; 1627 1628template <class _Hp, class _Tp, size_t _Len> 1629struct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1630 : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1631 1632template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1633struct _LIBCPP_TEMPLATE_VIS aligned_storage 1634{ 1635 typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1636 static_assert(!is_void<_Aligner>::value, ""); 1637 union type 1638 { 1639 _Aligner __align; 1640 unsigned char __data[(_Len + _Align - 1)/_Align * _Align]; 1641 }; 1642}; 1643 1644#if _LIBCPP_STD_VER > 11 1645template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1646 using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1647#endif 1648 1649#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1650template <size_t _Len>\ 1651struct _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n>\ 1652{\ 1653 struct _ALIGNAS(n) type\ 1654 {\ 1655 unsigned char __lx[(_Len + n - 1)/n * n];\ 1656 };\ 1657} 1658 1659_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1660_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1661_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1662_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1663_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1664_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1665_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1666_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1667_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1668_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1669_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1670_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1671_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1672_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1673// PE/COFF does not support alignment beyond 8192 (=0x2000) 1674#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) 1675_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1676#endif // !defined(_LIBCPP_OBJECT_FORMAT_COFF) 1677 1678#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1679 1680#ifndef _LIBCPP_HAS_NO_VARIADICS 1681 1682// aligned_union 1683 1684template <size_t _I0, size_t ..._In> 1685struct __static_max; 1686 1687template <size_t _I0> 1688struct __static_max<_I0> 1689{ 1690 static const size_t value = _I0; 1691}; 1692 1693template <size_t _I0, size_t _I1, size_t ..._In> 1694struct __static_max<_I0, _I1, _In...> 1695{ 1696 static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1697 __static_max<_I1, _In...>::value; 1698}; 1699 1700template <size_t _Len, class _Type0, class ..._Types> 1701struct aligned_union 1702{ 1703 static const size_t alignment_value = __static_max<__alignof__(_Type0), 1704 __alignof__(_Types)...>::value; 1705 static const size_t __len = __static_max<_Len, sizeof(_Type0), 1706 sizeof(_Types)...>::value; 1707 typedef typename aligned_storage<__len, alignment_value>::type type; 1708}; 1709 1710#if _LIBCPP_STD_VER > 11 1711template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1712#endif 1713 1714#endif // _LIBCPP_HAS_NO_VARIADICS 1715 1716template <class _Tp> 1717struct __numeric_type 1718{ 1719 static void __test(...); 1720 static float __test(float); 1721 static double __test(char); 1722 static double __test(int); 1723 static double __test(unsigned); 1724 static double __test(long); 1725 static double __test(unsigned long); 1726 static double __test(long long); 1727 static double __test(unsigned long long); 1728 static double __test(double); 1729 static long double __test(long double); 1730 1731 typedef decltype(__test(declval<_Tp>())) type; 1732 static const bool value = !is_same<type, void>::value; 1733}; 1734 1735template <> 1736struct __numeric_type<void> 1737{ 1738 static const bool value = true; 1739}; 1740 1741// __promote 1742 1743template <class _A1, class _A2 = void, class _A3 = void, 1744 bool = __numeric_type<_A1>::value && 1745 __numeric_type<_A2>::value && 1746 __numeric_type<_A3>::value> 1747class __promote_imp 1748{ 1749public: 1750 static const bool value = false; 1751}; 1752 1753template <class _A1, class _A2, class _A3> 1754class __promote_imp<_A1, _A2, _A3, true> 1755{ 1756private: 1757 typedef typename __promote_imp<_A1>::type __type1; 1758 typedef typename __promote_imp<_A2>::type __type2; 1759 typedef typename __promote_imp<_A3>::type __type3; 1760public: 1761 typedef decltype(__type1() + __type2() + __type3()) type; 1762 static const bool value = true; 1763}; 1764 1765template <class _A1, class _A2> 1766class __promote_imp<_A1, _A2, void, true> 1767{ 1768private: 1769 typedef typename __promote_imp<_A1>::type __type1; 1770 typedef typename __promote_imp<_A2>::type __type2; 1771public: 1772 typedef decltype(__type1() + __type2()) type; 1773 static const bool value = true; 1774}; 1775 1776template <class _A1> 1777class __promote_imp<_A1, void, void, true> 1778{ 1779public: 1780 typedef typename __numeric_type<_A1>::type type; 1781 static const bool value = true; 1782}; 1783 1784template <class _A1, class _A2 = void, class _A3 = void> 1785class __promote : public __promote_imp<_A1, _A2, _A3> {}; 1786 1787// make_signed / make_unsigned 1788 1789typedef 1790 __type_list<signed char, 1791 __type_list<signed short, 1792 __type_list<signed int, 1793 __type_list<signed long, 1794 __type_list<signed long long, 1795#ifndef _LIBCPP_HAS_NO_INT128 1796 __type_list<__int128_t, 1797#endif 1798 __nat 1799#ifndef _LIBCPP_HAS_NO_INT128 1800 > 1801#endif 1802 > > > > > __signed_types; 1803 1804typedef 1805 __type_list<unsigned char, 1806 __type_list<unsigned short, 1807 __type_list<unsigned int, 1808 __type_list<unsigned long, 1809 __type_list<unsigned long long, 1810#ifndef _LIBCPP_HAS_NO_INT128 1811 __type_list<__uint128_t, 1812#endif 1813 __nat 1814#ifndef _LIBCPP_HAS_NO_INT128 1815 > 1816#endif 1817 > > > > > __unsigned_types; 1818 1819template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1820 1821template <class _Hp, class _Tp, size_t _Size> 1822struct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1823{ 1824 typedef _Hp type; 1825}; 1826 1827template <class _Hp, class _Tp, size_t _Size> 1828struct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1829{ 1830 typedef typename __find_first<_Tp, _Size>::type type; 1831}; 1832 1833template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1834 bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1835struct __apply_cv 1836{ 1837 typedef _Up type; 1838}; 1839 1840template <class _Tp, class _Up> 1841struct __apply_cv<_Tp, _Up, true, false> 1842{ 1843 typedef const _Up type; 1844}; 1845 1846template <class _Tp, class _Up> 1847struct __apply_cv<_Tp, _Up, false, true> 1848{ 1849 typedef volatile _Up type; 1850}; 1851 1852template <class _Tp, class _Up> 1853struct __apply_cv<_Tp, _Up, true, true> 1854{ 1855 typedef const volatile _Up type; 1856}; 1857 1858template <class _Tp, class _Up> 1859struct __apply_cv<_Tp&, _Up, false, false> 1860{ 1861 typedef _Up& type; 1862}; 1863 1864template <class _Tp, class _Up> 1865struct __apply_cv<_Tp&, _Up, true, false> 1866{ 1867 typedef const _Up& type; 1868}; 1869 1870template <class _Tp, class _Up> 1871struct __apply_cv<_Tp&, _Up, false, true> 1872{ 1873 typedef volatile _Up& type; 1874}; 1875 1876template <class _Tp, class _Up> 1877struct __apply_cv<_Tp&, _Up, true, true> 1878{ 1879 typedef const volatile _Up& type; 1880}; 1881 1882template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1883struct __make_signed {}; 1884 1885template <class _Tp> 1886struct __make_signed<_Tp, true> 1887{ 1888 typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1889}; 1890 1891template <> struct __make_signed<bool, true> {}; 1892template <> struct __make_signed< signed short, true> {typedef short type;}; 1893template <> struct __make_signed<unsigned short, true> {typedef short type;}; 1894template <> struct __make_signed< signed int, true> {typedef int type;}; 1895template <> struct __make_signed<unsigned int, true> {typedef int type;}; 1896template <> struct __make_signed< signed long, true> {typedef long type;}; 1897template <> struct __make_signed<unsigned long, true> {typedef long type;}; 1898template <> struct __make_signed< signed long long, true> {typedef long long type;}; 1899template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1900#ifndef _LIBCPP_HAS_NO_INT128 1901template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; 1902template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; 1903#endif 1904 1905template <class _Tp> 1906struct _LIBCPP_TEMPLATE_VIS make_signed 1907{ 1908 typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1909}; 1910 1911#if _LIBCPP_STD_VER > 11 1912template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1913#endif 1914 1915template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1916struct __make_unsigned {}; 1917 1918template <class _Tp> 1919struct __make_unsigned<_Tp, true> 1920{ 1921 typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1922}; 1923 1924template <> struct __make_unsigned<bool, true> {}; 1925template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1926template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1927template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1928template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1929template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1930template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1931template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1932template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1933#ifndef _LIBCPP_HAS_NO_INT128 1934template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; 1935template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; 1936#endif 1937 1938template <class _Tp> 1939struct _LIBCPP_TEMPLATE_VIS make_unsigned 1940{ 1941 typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1942}; 1943 1944#if _LIBCPP_STD_VER > 11 1945template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1946#endif 1947 1948#ifdef _LIBCPP_HAS_NO_VARIADICS 1949 1950template <class _Tp, class _Up = void, class _Vp = void> 1951struct _LIBCPP_TEMPLATE_VIS common_type 1952{ 1953public: 1954 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type; 1955}; 1956 1957template <class _Tp> 1958struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void> 1959{ 1960public: 1961 typedef typename decay<_Tp>::type type; 1962}; 1963 1964template <class _Tp, class _Up> 1965struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, void> 1966{ 1967 typedef typename decay<decltype( 1968 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 1969 )>::type type; 1970}; 1971 1972#else // _LIBCPP_HAS_NO_VARIADICS 1973 1974// bullet 1 - sizeof...(Tp) == 0 1975 1976template <class ..._Tp> 1977struct _LIBCPP_TEMPLATE_VIS common_type {}; 1978 1979// bullet 2 - sizeof...(Tp) == 1 1980 1981template <class _Tp> 1982struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> 1983{ 1984 typedef typename decay<_Tp>::type type; 1985}; 1986 1987// bullet 3 - sizeof...(Tp) == 2 1988 1989template <class _Tp, class _Up, class = void> 1990struct __common_type2_imp {}; 1991 1992template <class _Tp, class _Up> 1993struct __common_type2_imp<_Tp, _Up, 1994 typename __void_t<decltype( 1995 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 1996 )>::type> 1997{ 1998 typedef typename decay<decltype( 1999 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>() 2000 )>::type type; 2001}; 2002 2003template <class _Tp, class _Up, 2004 class _DTp = typename decay<_Tp>::type, 2005 class _DUp = typename decay<_Up>::type> 2006using __common_type2 = 2007 typename conditional< 2008 is_same<_Tp, _DTp>::value && is_same<_Up, _DUp>::value, 2009 __common_type2_imp<_Tp, _Up>, 2010 common_type<_DTp, _DUp> 2011 >::type; 2012 2013template <class _Tp, class _Up> 2014struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up> 2015 : __common_type2<_Tp, _Up> {}; 2016 2017// bullet 4 - sizeof...(Tp) > 2 2018 2019template <class ...Tp> struct __common_types; 2020 2021template <class, class = void> 2022struct __common_type_impl {}; 2023 2024template <class _Tp, class _Up> 2025struct __common_type_impl< 2026 __common_types<_Tp, _Up>, 2027 typename __void_t<typename common_type<_Tp, _Up>::type>::type> 2028{ 2029 typedef typename common_type<_Tp, _Up>::type type; 2030}; 2031 2032template <class _Tp, class _Up, class ..._Vp> 2033struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>, 2034 typename __void_t<typename common_type<_Tp, _Up>::type>::type> 2035 : __common_type_impl< 2036 __common_types<typename common_type<_Tp, _Up>::type, _Vp...> > 2037{ 2038 2039}; 2040 2041template <class _Tp, class _Up, class ..._Vp> 2042struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, _Vp...> 2043 : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {}; 2044 2045#if _LIBCPP_STD_VER > 11 2046template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 2047#endif 2048 2049#endif // _LIBCPP_HAS_NO_VARIADICS 2050 2051// is_assignable 2052 2053template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 2054 2055template <class _Tp, class _Arg> 2056typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 2057__is_assignable_test(int); 2058 2059template <class, class> 2060false_type __is_assignable_test(...); 2061 2062 2063template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 2064struct __is_assignable_imp 2065 : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; 2066 2067template <class _Tp, class _Arg> 2068struct __is_assignable_imp<_Tp, _Arg, true> 2069 : public false_type 2070{ 2071}; 2072 2073template <class _Tp, class _Arg> 2074struct is_assignable 2075 : public __is_assignable_imp<_Tp, _Arg> {}; 2076 2077#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2078template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_assignable_v 2079 = is_assignable<_Tp, _Arg>::value; 2080#endif 2081 2082// is_copy_assignable 2083 2084template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable 2085 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 2086 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2087 2088#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2089template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v 2090 = is_copy_assignable<_Tp>::value; 2091#endif 2092 2093// is_move_assignable 2094 2095template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable 2096#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2097 : public is_assignable<typename add_lvalue_reference<_Tp>::type, 2098 typename add_rvalue_reference<_Tp>::type> {}; 2099#else 2100 : public is_copy_assignable<_Tp> {}; 2101#endif 2102 2103#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2104template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v 2105 = is_move_assignable<_Tp>::value; 2106#endif 2107 2108// is_destructible 2109 2110// if it's a reference, return true 2111// if it's a function, return false 2112// if it's void, return false 2113// if it's an array of unknown bound, return false 2114// Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed 2115// where _Up is remove_all_extents<_Tp>::type 2116 2117template <class> 2118struct __is_destructible_apply { typedef int type; }; 2119 2120template <typename _Tp> 2121struct __is_destructor_wellformed { 2122 template <typename _Tp1> 2123 static char __test ( 2124 typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type 2125 ); 2126 2127 template <typename _Tp1> 2128 static __two __test (...); 2129 2130 static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); 2131}; 2132 2133template <class _Tp, bool> 2134struct __destructible_imp; 2135 2136template <class _Tp> 2137struct __destructible_imp<_Tp, false> 2138 : public _VSTD::integral_constant<bool, 2139 __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {}; 2140 2141template <class _Tp> 2142struct __destructible_imp<_Tp, true> 2143 : public _VSTD::true_type {}; 2144 2145template <class _Tp, bool> 2146struct __destructible_false; 2147 2148template <class _Tp> 2149struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {}; 2150 2151template <class _Tp> 2152struct __destructible_false<_Tp, true> : public _VSTD::false_type {}; 2153 2154template <class _Tp> 2155struct is_destructible 2156 : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {}; 2157 2158template <class _Tp> 2159struct is_destructible<_Tp[]> 2160 : public _VSTD::false_type {}; 2161 2162template <> 2163struct is_destructible<void> 2164 : public _VSTD::false_type {}; 2165 2166#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 2167template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v 2168 = is_destructible<_Tp>::value; 2169#endif 2170 2171// move 2172 2173#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2174 2175template <class _Tp> 2176inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2177typename remove_reference<_Tp>::type&& 2178move(_Tp&& __t) _NOEXCEPT 2179{ 2180 typedef typename remove_reference<_Tp>::type _Up; 2181 return static_cast<_Up&&>(__t); 2182} 2183 2184template <class _Tp> 2185inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2186_Tp&& 2187forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT 2188{ 2189 return static_cast<_Tp&&>(__t); 2190} 2191 2192template <class _Tp> 2193inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 2194_Tp&& 2195forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT 2196{ 2197 static_assert(!is_lvalue_reference<_Tp>::value, 2198 "can not forward an rvalue as an lvalue"); 2199 return static_cast<_Tp&&>(__t); 2200} 2201 2202#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2203 2204template <class _Tp> 2205inline _LIBCPP_INLINE_VISIBILITY 2206_Tp& 2207move(_Tp& __t) 2208{ 2209 return __t; 2210} 2211 2212template <class _Tp> 2213inline _LIBCPP_INLINE_VISIBILITY 2214const _Tp& 2215move(const _Tp& __t) 2216{ 2217 return __t; 2218} 2219 2220template <class _Tp> 2221inline _LIBCPP_INLINE_VISIBILITY 2222_Tp& 2223forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT 2224{ 2225 return __t; 2226} 2227 2228 2229template <class _Tp> 2230class __rv 2231{ 2232 typedef typename remove_reference<_Tp>::type _Trr; 2233 _Trr& t_; 2234public: 2235 _LIBCPP_INLINE_VISIBILITY 2236 _Trr* operator->() {return &t_;} 2237 _LIBCPP_INLINE_VISIBILITY 2238 explicit __rv(_Trr& __t) : t_(__t) {} 2239}; 2240 2241#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2242 2243#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2244 2245template <class _Tp> 2246inline _LIBCPP_INLINE_VISIBILITY 2247typename decay<_Tp>::type 2248__decay_copy(_Tp&& __t) 2249{ 2250 return _VSTD::forward<_Tp>(__t); 2251} 2252 2253#else 2254 2255template <class _Tp> 2256inline _LIBCPP_INLINE_VISIBILITY 2257typename decay<_Tp>::type 2258__decay_copy(const _Tp& __t) 2259{ 2260 return _VSTD::forward<_Tp>(__t); 2261} 2262 2263#endif 2264 2265#ifndef _LIBCPP_HAS_NO_VARIADICS 2266 2267template <class _Rp, class _Class, class ..._Param> 2268struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 2269{ 2270 typedef _Class _ClassType; 2271 typedef _Rp _ReturnType; 2272 typedef _Rp (_FnType) (_Param...); 2273}; 2274 2275template <class _Rp, class _Class, class ..._Param> 2276struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> 2277{ 2278 typedef _Class _ClassType; 2279 typedef _Rp _ReturnType; 2280 typedef _Rp (_FnType) (_Param..., ...); 2281}; 2282 2283template <class _Rp, class _Class, class ..._Param> 2284struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 2285{ 2286 typedef _Class const _ClassType; 2287 typedef _Rp _ReturnType; 2288 typedef _Rp (_FnType) (_Param...); 2289}; 2290 2291template <class _Rp, class _Class, class ..._Param> 2292struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> 2293{ 2294 typedef _Class const _ClassType; 2295 typedef _Rp _ReturnType; 2296 typedef _Rp (_FnType) (_Param..., ...); 2297}; 2298 2299template <class _Rp, class _Class, class ..._Param> 2300struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 2301{ 2302 typedef _Class volatile _ClassType; 2303 typedef _Rp _ReturnType; 2304 typedef _Rp (_FnType) (_Param...); 2305}; 2306 2307template <class _Rp, class _Class, class ..._Param> 2308struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> 2309{ 2310 typedef _Class volatile _ClassType; 2311 typedef _Rp _ReturnType; 2312 typedef _Rp (_FnType) (_Param..., ...); 2313}; 2314 2315template <class _Rp, class _Class, class ..._Param> 2316struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 2317{ 2318 typedef _Class const volatile _ClassType; 2319 typedef _Rp _ReturnType; 2320 typedef _Rp (_FnType) (_Param...); 2321}; 2322 2323template <class _Rp, class _Class, class ..._Param> 2324struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> 2325{ 2326 typedef _Class const volatile _ClassType; 2327 typedef _Rp _ReturnType; 2328 typedef _Rp (_FnType) (_Param..., ...); 2329}; 2330 2331#if __has_feature(cxx_reference_qualified_functions) || \ 2332 (defined(_GNUC_VER) && _GNUC_VER >= 409) 2333 2334template <class _Rp, class _Class, class ..._Param> 2335struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 2336{ 2337 typedef _Class& _ClassType; 2338 typedef _Rp _ReturnType; 2339 typedef _Rp (_FnType) (_Param...); 2340}; 2341 2342template <class _Rp, class _Class, class ..._Param> 2343struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> 2344{ 2345 typedef _Class& _ClassType; 2346 typedef _Rp _ReturnType; 2347 typedef _Rp (_FnType) (_Param..., ...); 2348}; 2349 2350template <class _Rp, class _Class, class ..._Param> 2351struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 2352{ 2353 typedef _Class const& _ClassType; 2354 typedef _Rp _ReturnType; 2355 typedef _Rp (_FnType) (_Param...); 2356}; 2357 2358template <class _Rp, class _Class, class ..._Param> 2359struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> 2360{ 2361 typedef _Class const& _ClassType; 2362 typedef _Rp _ReturnType; 2363 typedef _Rp (_FnType) (_Param..., ...); 2364}; 2365 2366template <class _Rp, class _Class, class ..._Param> 2367struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 2368{ 2369 typedef _Class volatile& _ClassType; 2370 typedef _Rp _ReturnType; 2371 typedef _Rp (_FnType) (_Param...); 2372}; 2373 2374template <class _Rp, class _Class, class ..._Param> 2375struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> 2376{ 2377 typedef _Class volatile& _ClassType; 2378 typedef _Rp _ReturnType; 2379 typedef _Rp (_FnType) (_Param..., ...); 2380}; 2381 2382template <class _Rp, class _Class, class ..._Param> 2383struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 2384{ 2385 typedef _Class const volatile& _ClassType; 2386 typedef _Rp _ReturnType; 2387 typedef _Rp (_FnType) (_Param...); 2388}; 2389 2390template <class _Rp, class _Class, class ..._Param> 2391struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> 2392{ 2393 typedef _Class const volatile& _ClassType; 2394 typedef _Rp _ReturnType; 2395 typedef _Rp (_FnType) (_Param..., ...); 2396}; 2397 2398template <class _Rp, class _Class, class ..._Param> 2399struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 2400{ 2401 typedef _Class&& _ClassType; 2402 typedef _Rp _ReturnType; 2403 typedef _Rp (_FnType) (_Param...); 2404}; 2405 2406template <class _Rp, class _Class, class ..._Param> 2407struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> 2408{ 2409 typedef _Class&& _ClassType; 2410 typedef _Rp _ReturnType; 2411 typedef _Rp (_FnType) (_Param..., ...); 2412}; 2413 2414template <class _Rp, class _Class, class ..._Param> 2415struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 2416{ 2417 typedef _Class const&& _ClassType; 2418 typedef _Rp _ReturnType; 2419 typedef _Rp (_FnType) (_Param...); 2420}; 2421 2422template <class _Rp, class _Class, class ..._Param> 2423struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> 2424{ 2425 typedef _Class const&& _ClassType; 2426 typedef _Rp _ReturnType; 2427 typedef _Rp (_FnType) (_Param..., ...); 2428}; 2429 2430template <class _Rp, class _Class, class ..._Param> 2431struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 2432{ 2433 typedef _Class volatile&& _ClassType; 2434 typedef _Rp _ReturnType; 2435 typedef _Rp (_FnType) (_Param...); 2436}; 2437 2438template <class _Rp, class _Class, class ..._Param> 2439struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> 2440{ 2441 typedef _Class volatile&& _ClassType; 2442 typedef _Rp _ReturnType; 2443 typedef _Rp (_FnType) (_Param..., ...); 2444}; 2445 2446template <class _Rp, class _Class, class ..._Param> 2447struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 2448{ 2449 typedef _Class const volatile&& _ClassType; 2450 typedef _Rp _ReturnType; 2451 typedef _Rp (_FnType) (_Param...); 2452}; 2453 2454template <class _Rp, class _Class, class ..._Param> 2455struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> 2456{ 2457 typedef _Class const volatile&& _ClassType; 2458 typedef _Rp _ReturnType; 2459 typedef _Rp (_FnType) (_Param..., ...); 2460}; 2461 2462#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409 2463 2464#else // _LIBCPP_HAS_NO_VARIADICS 2465 2466template <class _Rp, class _Class> 2467struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 2468{ 2469 typedef _Class _ClassType; 2470 typedef _Rp _ReturnType; 2471 typedef _Rp (_FnType) (); 2472}; 2473 2474template <class _Rp, class _Class> 2475struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false> 2476{ 2477 typedef _Class _ClassType; 2478 typedef _Rp _ReturnType; 2479 typedef _Rp (_FnType) (...); 2480}; 2481 2482template <class _Rp, class _Class, class _P0> 2483struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 2484{ 2485 typedef _Class _ClassType; 2486 typedef _Rp _ReturnType; 2487 typedef _Rp (_FnType) (_P0); 2488}; 2489 2490template <class _Rp, class _Class, class _P0> 2491struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false> 2492{ 2493 typedef _Class _ClassType; 2494 typedef _Rp _ReturnType; 2495 typedef _Rp (_FnType) (_P0, ...); 2496}; 2497 2498template <class _Rp, class _Class, class _P0, class _P1> 2499struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 2500{ 2501 typedef _Class _ClassType; 2502 typedef _Rp _ReturnType; 2503 typedef _Rp (_FnType) (_P0, _P1); 2504}; 2505 2506template <class _Rp, class _Class, class _P0, class _P1> 2507struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false> 2508{ 2509 typedef _Class _ClassType; 2510 typedef _Rp _ReturnType; 2511 typedef _Rp (_FnType) (_P0, _P1, ...); 2512}; 2513 2514template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2515struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 2516{ 2517 typedef _Class _ClassType; 2518 typedef _Rp _ReturnType; 2519 typedef _Rp (_FnType) (_P0, _P1, _P2); 2520}; 2521 2522template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2523struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false> 2524{ 2525 typedef _Class _ClassType; 2526 typedef _Rp _ReturnType; 2527 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2528}; 2529 2530template <class _Rp, class _Class> 2531struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 2532{ 2533 typedef _Class const _ClassType; 2534 typedef _Rp _ReturnType; 2535 typedef _Rp (_FnType) (); 2536}; 2537 2538template <class _Rp, class _Class> 2539struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false> 2540{ 2541 typedef _Class const _ClassType; 2542 typedef _Rp _ReturnType; 2543 typedef _Rp (_FnType) (...); 2544}; 2545 2546template <class _Rp, class _Class, class _P0> 2547struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 2548{ 2549 typedef _Class const _ClassType; 2550 typedef _Rp _ReturnType; 2551 typedef _Rp (_FnType) (_P0); 2552}; 2553 2554template <class _Rp, class _Class, class _P0> 2555struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false> 2556{ 2557 typedef _Class const _ClassType; 2558 typedef _Rp _ReturnType; 2559 typedef _Rp (_FnType) (_P0, ...); 2560}; 2561 2562template <class _Rp, class _Class, class _P0, class _P1> 2563struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 2564{ 2565 typedef _Class const _ClassType; 2566 typedef _Rp _ReturnType; 2567 typedef _Rp (_FnType) (_P0, _P1); 2568}; 2569 2570template <class _Rp, class _Class, class _P0, class _P1> 2571struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false> 2572{ 2573 typedef _Class const _ClassType; 2574 typedef _Rp _ReturnType; 2575 typedef _Rp (_FnType) (_P0, _P1, ...); 2576}; 2577 2578template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2579struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 2580{ 2581 typedef _Class const _ClassType; 2582 typedef _Rp _ReturnType; 2583 typedef _Rp (_FnType) (_P0, _P1, _P2); 2584}; 2585 2586template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2587struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false> 2588{ 2589 typedef _Class const _ClassType; 2590 typedef _Rp _ReturnType; 2591 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2592}; 2593 2594template <class _Rp, class _Class> 2595struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 2596{ 2597 typedef _Class volatile _ClassType; 2598 typedef _Rp _ReturnType; 2599 typedef _Rp (_FnType) (); 2600}; 2601 2602template <class _Rp, class _Class> 2603struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false> 2604{ 2605 typedef _Class volatile _ClassType; 2606 typedef _Rp _ReturnType; 2607 typedef _Rp (_FnType) (...); 2608}; 2609 2610template <class _Rp, class _Class, class _P0> 2611struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 2612{ 2613 typedef _Class volatile _ClassType; 2614 typedef _Rp _ReturnType; 2615 typedef _Rp (_FnType) (_P0); 2616}; 2617 2618template <class _Rp, class _Class, class _P0> 2619struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false> 2620{ 2621 typedef _Class volatile _ClassType; 2622 typedef _Rp _ReturnType; 2623 typedef _Rp (_FnType) (_P0, ...); 2624}; 2625 2626template <class _Rp, class _Class, class _P0, class _P1> 2627struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 2628{ 2629 typedef _Class volatile _ClassType; 2630 typedef _Rp _ReturnType; 2631 typedef _Rp (_FnType) (_P0, _P1); 2632}; 2633 2634template <class _Rp, class _Class, class _P0, class _P1> 2635struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false> 2636{ 2637 typedef _Class volatile _ClassType; 2638 typedef _Rp _ReturnType; 2639 typedef _Rp (_FnType) (_P0, _P1, ...); 2640}; 2641 2642template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2643struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 2644{ 2645 typedef _Class volatile _ClassType; 2646 typedef _Rp _ReturnType; 2647 typedef _Rp (_FnType) (_P0, _P1, _P2); 2648}; 2649 2650template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2651struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false> 2652{ 2653 typedef _Class volatile _ClassType; 2654 typedef _Rp _ReturnType; 2655 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2656}; 2657 2658template <class _Rp, class _Class> 2659struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 2660{ 2661 typedef _Class const volatile _ClassType; 2662 typedef _Rp _ReturnType; 2663 typedef _Rp (_FnType) (); 2664}; 2665 2666template <class _Rp, class _Class> 2667struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false> 2668{ 2669 typedef _Class const volatile _ClassType; 2670 typedef _Rp _ReturnType; 2671 typedef _Rp (_FnType) (...); 2672}; 2673 2674template <class _Rp, class _Class, class _P0> 2675struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 2676{ 2677 typedef _Class const volatile _ClassType; 2678 typedef _Rp _ReturnType; 2679 typedef _Rp (_FnType) (_P0); 2680}; 2681 2682template <class _Rp, class _Class, class _P0> 2683struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false> 2684{ 2685 typedef _Class const volatile _ClassType; 2686 typedef _Rp _ReturnType; 2687 typedef _Rp (_FnType) (_P0, ...); 2688}; 2689 2690template <class _Rp, class _Class, class _P0, class _P1> 2691struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 2692{ 2693 typedef _Class const volatile _ClassType; 2694 typedef _Rp _ReturnType; 2695 typedef _Rp (_FnType) (_P0, _P1); 2696}; 2697 2698template <class _Rp, class _Class, class _P0, class _P1> 2699struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false> 2700{ 2701 typedef _Class const volatile _ClassType; 2702 typedef _Rp _ReturnType; 2703 typedef _Rp (_FnType) (_P0, _P1, ...); 2704}; 2705 2706template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2707struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 2708{ 2709 typedef _Class const volatile _ClassType; 2710 typedef _Rp _ReturnType; 2711 typedef _Rp (_FnType) (_P0, _P1, _P2); 2712}; 2713 2714template <class _Rp, class _Class, class _P0, class _P1, class _P2> 2715struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false> 2716{ 2717 typedef _Class const volatile _ClassType; 2718 typedef _Rp _ReturnType; 2719 typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2720}; 2721 2722#endif // _LIBCPP_HAS_NO_VARIADICS 2723 2724template <class _Rp, class _Class> 2725struct __member_pointer_traits_imp<_Rp _Class::*, false, true> 2726{ 2727 typedef _Class _ClassType; 2728 typedef _Rp _ReturnType; 2729}; 2730 2731template <class _MP> 2732struct __member_pointer_traits 2733 : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 2734 is_member_function_pointer<_MP>::value, 2735 is_member_object_pointer<_MP>::value> 2736{ 2737// typedef ... _ClassType; 2738// typedef ... _ReturnType; 2739// typedef ... _FnType; 2740}; 2741 2742 2743template <class _DecayedFp> 2744struct __member_pointer_class_type {}; 2745 2746template <class _Ret, class _ClassType> 2747struct __member_pointer_class_type<_Ret _ClassType::*> { 2748 typedef _ClassType type; 2749}; 2750 2751// result_of 2752 2753template <class _Callable> class result_of; 2754 2755#ifdef _LIBCPP_HAS_NO_VARIADICS 2756 2757template <class _Fn, bool, bool> 2758class __result_of 2759{ 2760}; 2761 2762template <class _Fn> 2763class __result_of<_Fn(), true, false> 2764{ 2765public: 2766 typedef decltype(declval<_Fn>()()) type; 2767}; 2768 2769template <class _Fn, class _A0> 2770class __result_of<_Fn(_A0), true, false> 2771{ 2772public: 2773 typedef decltype(declval<_Fn>()(declval<_A0>())) type; 2774}; 2775 2776template <class _Fn, class _A0, class _A1> 2777class __result_of<_Fn(_A0, _A1), true, false> 2778{ 2779public: 2780 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 2781}; 2782 2783template <class _Fn, class _A0, class _A1, class _A2> 2784class __result_of<_Fn(_A0, _A1, _A2), true, false> 2785{ 2786public: 2787 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 2788}; 2789 2790template <class _MP, class _Tp, bool _IsMemberFunctionPtr> 2791struct __result_of_mp; 2792 2793// member function pointer 2794 2795template <class _MP, class _Tp> 2796struct __result_of_mp<_MP, _Tp, true> 2797 : public __identity<typename __member_pointer_traits<_MP>::_ReturnType> 2798{ 2799}; 2800 2801// member data pointer 2802 2803template <class _MP, class _Tp, bool> 2804struct __result_of_mdp; 2805 2806template <class _Rp, class _Class, class _Tp> 2807struct __result_of_mdp<_Rp _Class::*, _Tp, false> 2808{ 2809 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 2810}; 2811 2812template <class _Rp, class _Class, class _Tp> 2813struct __result_of_mdp<_Rp _Class::*, _Tp, true> 2814{ 2815 typedef typename __apply_cv<_Tp, _Rp>::type& type; 2816}; 2817 2818template <class _Rp, class _Class, class _Tp> 2819struct __result_of_mp<_Rp _Class::*, _Tp, false> 2820 : public __result_of_mdp<_Rp _Class::*, _Tp, 2821 is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 2822{ 2823}; 2824 2825 2826 2827template <class _Fn, class _Tp> 2828class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 2829 : public __result_of_mp<typename remove_reference<_Fn>::type, 2830 _Tp, 2831 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2832{ 2833}; 2834 2835template <class _Fn, class _Tp, class _A0> 2836class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 2837 : public __result_of_mp<typename remove_reference<_Fn>::type, 2838 _Tp, 2839 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2840{ 2841}; 2842 2843template <class _Fn, class _Tp, class _A0, class _A1> 2844class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 2845 : public __result_of_mp<typename remove_reference<_Fn>::type, 2846 _Tp, 2847 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2848{ 2849}; 2850 2851template <class _Fn, class _Tp, class _A0, class _A1, class _A2> 2852class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 2853 : public __result_of_mp<typename remove_reference<_Fn>::type, 2854 _Tp, 2855 is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2856{ 2857}; 2858 2859// result_of 2860 2861template <class _Fn> 2862class _LIBCPP_TEMPLATE_VIS result_of<_Fn()> 2863 : public __result_of<_Fn(), 2864 is_class<typename remove_reference<_Fn>::type>::value || 2865 is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, 2866 is_member_pointer<typename remove_reference<_Fn>::type>::value 2867 > 2868{ 2869}; 2870 2871template <class _Fn, class _A0> 2872class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0)> 2873 : public __result_of<_Fn(_A0), 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, class _A1> 2882class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1)> 2883 : public __result_of<_Fn(_A0, _A1), 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, class _A2> 2892class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1, _A2)> 2893 : public __result_of<_Fn(_A0, _A1, _A2), 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 2901#endif // _LIBCPP_HAS_NO_VARIADICS 2902 2903// template <class T, class... Args> struct is_constructible; 2904 2905namespace __is_construct 2906{ 2907struct __nat {}; 2908} 2909 2910#if !defined(_LIBCPP_CXX03_LANG) && (!__has_feature(is_constructible) || \ 2911 defined(_LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE)) 2912 2913template <class _Tp, class... _Args> 2914struct __libcpp_is_constructible; 2915 2916template <class _To, class _From> 2917struct __is_invalid_base_to_derived_cast { 2918 static_assert(is_reference<_To>::value, "Wrong specialization"); 2919 using _RawFrom = __uncvref_t<_From>; 2920 using _RawTo = __uncvref_t<_To>; 2921 static const bool value = __lazy_and< 2922 __lazy_not<is_same<_RawFrom, _RawTo>>, 2923 is_base_of<_RawFrom, _RawTo>, 2924 __lazy_not<__libcpp_is_constructible<_RawTo, _From>> 2925 >::value; 2926}; 2927 2928template <class _To, class _From> 2929struct __is_invalid_lvalue_to_rvalue_cast : false_type { 2930 static_assert(is_reference<_To>::value, "Wrong specialization"); 2931}; 2932 2933template <class _ToRef, class _FromRef> 2934struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> { 2935 using _RawFrom = __uncvref_t<_FromRef>; 2936 using _RawTo = __uncvref_t<_ToRef>; 2937 static const bool value = __lazy_and< 2938 __lazy_not<is_function<_RawTo>>, 2939 __lazy_or< 2940 is_same<_RawFrom, _RawTo>, 2941 is_base_of<_RawTo, _RawFrom>> 2942 >::value; 2943}; 2944 2945struct __is_constructible_helper 2946{ 2947 template <class _To> 2948 static void __eat(_To); 2949 2950 // This overload is needed to work around a Clang bug that disallows 2951 // static_cast<T&&>(e) for non-reference-compatible types. 2952 // Example: static_cast<int&&>(declval<double>()); 2953 // NOTE: The static_cast implementation below is required to support 2954 // classes with explicit conversion operators. 2955 template <class _To, class _From, 2956 class = decltype(__eat<_To>(_VSTD::declval<_From>()))> 2957 static true_type __test_cast(int); 2958 2959 template <class _To, class _From, 2960 class = decltype(static_cast<_To>(_VSTD::declval<_From>()))> 2961 static integral_constant<bool, 2962 !__is_invalid_base_to_derived_cast<_To, _From>::value && 2963 !__is_invalid_lvalue_to_rvalue_cast<_To, _From>::value 2964 > __test_cast(long); 2965 2966 template <class, class> 2967 static false_type __test_cast(...); 2968 2969 template <class _Tp, class ..._Args, 2970 class = decltype(_Tp(_VSTD::declval<_Args>()...))> 2971 static true_type __test_nary(int); 2972 template <class _Tp, class...> 2973 static false_type __test_nary(...); 2974 2975 template <class _Tp, class _A0, class = decltype(::new _Tp(_VSTD::declval<_A0>()))> 2976 static is_destructible<_Tp> __test_unary(int); 2977 template <class, class> 2978 static false_type __test_unary(...); 2979}; 2980 2981template <class _Tp, bool = is_void<_Tp>::value> 2982struct __is_default_constructible 2983 : decltype(__is_constructible_helper::__test_nary<_Tp>(0)) 2984{}; 2985 2986template <class _Tp> 2987struct __is_default_constructible<_Tp, true> : false_type {}; 2988 2989template <class _Tp> 2990struct __is_default_constructible<_Tp[], false> : false_type {}; 2991 2992template <class _Tp, size_t _Nx> 2993struct __is_default_constructible<_Tp[_Nx], false> 2994 : __is_default_constructible<typename remove_all_extents<_Tp>::type> {}; 2995 2996template <class _Tp, class... _Args> 2997struct __libcpp_is_constructible 2998{ 2999 static_assert(sizeof...(_Args) > 1, "Wrong specialization"); 3000 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0)) 3001 type; 3002}; 3003 3004template <class _Tp> 3005struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {}; 3006 3007template <class _Tp, class _A0> 3008struct __libcpp_is_constructible<_Tp, _A0> 3009 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0)) 3010{}; 3011 3012template <class _Tp, class _A0> 3013struct __libcpp_is_constructible<_Tp&, _A0> 3014 : public decltype(__is_constructible_helper:: 3015 __test_cast<_Tp&, _A0>(0)) 3016{}; 3017 3018template <class _Tp, class _A0> 3019struct __libcpp_is_constructible<_Tp&&, _A0> 3020 : public decltype(__is_constructible_helper:: 3021 __test_cast<_Tp&&, _A0>(0)) 3022{}; 3023 3024#endif 3025 3026#if __has_feature(is_constructible) 3027template <class _Tp, class ..._Args> 3028struct _LIBCPP_TEMPLATE_VIS is_constructible 3029 : public integral_constant<bool, __is_constructible(_Tp, _Args...)> 3030 {}; 3031#elif !defined(_LIBCPP_CXX03_LANG) 3032template <class _Tp, class... _Args> 3033struct _LIBCPP_TEMPLATE_VIS is_constructible 3034 : public __libcpp_is_constructible<_Tp, _Args...>::type {}; 3035#else 3036// template <class T> struct is_constructible0; 3037 3038// main is_constructible0 test 3039 3040template <class _Tp> 3041decltype((_Tp(), true_type())) 3042__is_constructible0_test(_Tp&); 3043 3044false_type 3045__is_constructible0_test(__any); 3046 3047template <class _Tp, class _A0> 3048decltype((_Tp(_VSTD::declval<_A0>()), true_type())) 3049__is_constructible1_test(_Tp&, _A0&); 3050 3051template <class _A0> 3052false_type 3053__is_constructible1_test(__any, _A0&); 3054 3055template <class _Tp, class _A0, class _A1> 3056decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 3057__is_constructible2_test(_Tp&, _A0&, _A1&); 3058 3059template <class _A0, class _A1> 3060false_type 3061__is_constructible2_test(__any, _A0&, _A1&); 3062 3063template <bool, class _Tp> 3064struct __is_constructible0_imp // false, _Tp is not a scalar 3065 : public common_type 3066 < 3067 decltype(__is_constructible0_test(declval<_Tp&>())) 3068 >::type 3069 {}; 3070 3071template <bool, class _Tp, class _A0> 3072struct __is_constructible1_imp // false, _Tp is not a scalar 3073 : public common_type 3074 < 3075 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 3076 >::type 3077 {}; 3078 3079template <bool, class _Tp, class _A0, class _A1> 3080struct __is_constructible2_imp // false, _Tp is not a scalar 3081 : public common_type 3082 < 3083 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 3084 >::type 3085 {}; 3086 3087// handle scalars and reference types 3088 3089// Scalars are default constructible, references are not 3090 3091template <class _Tp> 3092struct __is_constructible0_imp<true, _Tp> 3093 : public is_scalar<_Tp> 3094 {}; 3095 3096template <class _Tp, class _A0> 3097struct __is_constructible1_imp<true, _Tp, _A0> 3098 : public is_convertible<_A0, _Tp> 3099 {}; 3100 3101template <class _Tp, class _A0, class _A1> 3102struct __is_constructible2_imp<true, _Tp, _A0, _A1> 3103 : public false_type 3104 {}; 3105 3106// Treat scalars and reference types separately 3107 3108template <bool, class _Tp> 3109struct __is_constructible0_void_check 3110 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3111 _Tp> 3112 {}; 3113 3114template <bool, class _Tp, class _A0> 3115struct __is_constructible1_void_check 3116 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3117 _Tp, _A0> 3118 {}; 3119 3120template <bool, class _Tp, class _A0, class _A1> 3121struct __is_constructible2_void_check 3122 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 3123 _Tp, _A0, _A1> 3124 {}; 3125 3126// If any of T or Args is void, is_constructible should be false 3127 3128template <class _Tp> 3129struct __is_constructible0_void_check<true, _Tp> 3130 : public false_type 3131 {}; 3132 3133template <class _Tp, class _A0> 3134struct __is_constructible1_void_check<true, _Tp, _A0> 3135 : public false_type 3136 {}; 3137 3138template <class _Tp, class _A0, class _A1> 3139struct __is_constructible2_void_check<true, _Tp, _A0, _A1> 3140 : public false_type 3141 {}; 3142 3143// is_constructible entry point 3144 3145template <class _Tp, class _A0 = __is_construct::__nat, 3146 class _A1 = __is_construct::__nat> 3147struct _LIBCPP_TEMPLATE_VIS is_constructible 3148 : public __is_constructible2_void_check<is_void<_Tp>::value 3149 || is_abstract<_Tp>::value 3150 || is_function<_Tp>::value 3151 || is_void<_A0>::value 3152 || is_void<_A1>::value, 3153 _Tp, _A0, _A1> 3154 {}; 3155 3156template <class _Tp> 3157struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 3158 : public __is_constructible0_void_check<is_void<_Tp>::value 3159 || is_abstract<_Tp>::value 3160 || is_function<_Tp>::value, 3161 _Tp> 3162 {}; 3163 3164template <class _Tp, class _A0> 3165struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, __is_construct::__nat> 3166 : public __is_constructible1_void_check<is_void<_Tp>::value 3167 || is_abstract<_Tp>::value 3168 || is_function<_Tp>::value 3169 || is_void<_A0>::value, 3170 _Tp, _A0> 3171 {}; 3172 3173// Array types are default constructible if their element type 3174// is default constructible 3175 3176template <class _Ap, size_t _Np> 3177struct __is_constructible0_imp<false, _Ap[_Np]> 3178 : public is_constructible<typename remove_all_extents<_Ap>::type> 3179 {}; 3180 3181template <class _Ap, size_t _Np, class _A0> 3182struct __is_constructible1_imp<false, _Ap[_Np], _A0> 3183 : public false_type 3184 {}; 3185 3186template <class _Ap, size_t _Np, class _A0, class _A1> 3187struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 3188 : public false_type 3189 {}; 3190 3191// Incomplete array types are not constructible 3192 3193template <class _Ap> 3194struct __is_constructible0_imp<false, _Ap[]> 3195 : public false_type 3196 {}; 3197 3198template <class _Ap, class _A0> 3199struct __is_constructible1_imp<false, _Ap[], _A0> 3200 : public false_type 3201 {}; 3202 3203template <class _Ap, class _A0, class _A1> 3204struct __is_constructible2_imp<false, _Ap[], _A0, _A1> 3205 : public false_type 3206 {}; 3207 3208#endif // __has_feature(is_constructible) 3209 3210 3211#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3212template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_constructible_v 3213 = is_constructible<_Tp, _Args...>::value; 3214#endif 3215 3216// is_default_constructible 3217 3218template <class _Tp> 3219struct _LIBCPP_TEMPLATE_VIS is_default_constructible 3220 : public is_constructible<_Tp> 3221 {}; 3222 3223#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3224template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v 3225 = is_default_constructible<_Tp>::value; 3226#endif 3227 3228// is_copy_constructible 3229 3230template <class _Tp> 3231struct _LIBCPP_TEMPLATE_VIS is_copy_constructible 3232 : public is_constructible<_Tp, 3233 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3234 3235#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3236template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v 3237 = is_copy_constructible<_Tp>::value; 3238#endif 3239 3240// is_move_constructible 3241 3242template <class _Tp> 3243struct _LIBCPP_TEMPLATE_VIS is_move_constructible 3244#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3245 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3246#else 3247 : public is_copy_constructible<_Tp> 3248#endif 3249 {}; 3250 3251#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3252template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v 3253 = is_move_constructible<_Tp>::value; 3254#endif 3255 3256// is_trivially_constructible 3257 3258#ifndef _LIBCPP_HAS_NO_VARIADICS 3259 3260#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501 3261 3262template <class _Tp, class... _Args> 3263struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible 3264 : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 3265{ 3266}; 3267 3268#else // !__has_feature(is_trivially_constructible) 3269 3270template <class _Tp, class... _Args> 3271struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible 3272 : false_type 3273{ 3274}; 3275 3276template <class _Tp> 3277struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp> 3278#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) 3279 : integral_constant<bool, __has_trivial_constructor(_Tp)> 3280#else 3281 : integral_constant<bool, is_scalar<_Tp>::value> 3282#endif 3283{ 3284}; 3285 3286template <class _Tp> 3287#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3288struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&> 3289#else 3290struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp> 3291#endif 3292 : integral_constant<bool, is_scalar<_Tp>::value> 3293{ 3294}; 3295 3296template <class _Tp> 3297struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&> 3298 : integral_constant<bool, is_scalar<_Tp>::value> 3299{ 3300}; 3301 3302template <class _Tp> 3303struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&> 3304 : integral_constant<bool, is_scalar<_Tp>::value> 3305{ 3306}; 3307 3308#endif // !__has_feature(is_trivially_constructible) 3309 3310#else // _LIBCPP_HAS_NO_VARIADICS 3311 3312template <class _Tp, class _A0 = __is_construct::__nat, 3313 class _A1 = __is_construct::__nat> 3314struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible 3315 : false_type 3316{ 3317}; 3318 3319#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501 3320 3321template <class _Tp> 3322struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat, 3323 __is_construct::__nat> 3324 : integral_constant<bool, __is_trivially_constructible(_Tp)> 3325{ 3326}; 3327 3328template <class _Tp> 3329struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp, 3330 __is_construct::__nat> 3331 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 3332{ 3333}; 3334 3335template <class _Tp> 3336struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&, 3337 __is_construct::__nat> 3338 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 3339{ 3340}; 3341 3342template <class _Tp> 3343struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&, 3344 __is_construct::__nat> 3345 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 3346{ 3347}; 3348 3349#else // !__has_feature(is_trivially_constructible) 3350 3351template <class _Tp> 3352struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat, 3353 __is_construct::__nat> 3354 : integral_constant<bool, is_scalar<_Tp>::value> 3355{ 3356}; 3357 3358template <class _Tp> 3359struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp, 3360 __is_construct::__nat> 3361 : integral_constant<bool, is_scalar<_Tp>::value> 3362{ 3363}; 3364 3365template <class _Tp> 3366struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&, 3367 __is_construct::__nat> 3368 : integral_constant<bool, is_scalar<_Tp>::value> 3369{ 3370}; 3371 3372template <class _Tp> 3373struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&, 3374 __is_construct::__nat> 3375 : integral_constant<bool, is_scalar<_Tp>::value> 3376{ 3377}; 3378 3379#endif // !__has_feature(is_trivially_constructible) 3380 3381#endif // _LIBCPP_HAS_NO_VARIADICS 3382 3383#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3384template <class _Tp, class... _Args> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v 3385 = is_trivially_constructible<_Tp, _Args...>::value; 3386#endif 3387 3388// is_trivially_default_constructible 3389 3390template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible 3391 : public is_trivially_constructible<_Tp> 3392 {}; 3393 3394#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3395template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v 3396 = is_trivially_default_constructible<_Tp>::value; 3397#endif 3398 3399// is_trivially_copy_constructible 3400 3401template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible 3402 : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 3403 {}; 3404 3405#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3406template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v 3407 = is_trivially_copy_constructible<_Tp>::value; 3408#endif 3409 3410// is_trivially_move_constructible 3411 3412template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible 3413#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3414 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3415#else 3416 : public is_trivially_copy_constructible<_Tp> 3417#endif 3418 {}; 3419 3420#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3421template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v 3422 = is_trivially_move_constructible<_Tp>::value; 3423#endif 3424 3425// is_trivially_assignable 3426 3427#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501 3428 3429template <class _Tp, class _Arg> 3430struct is_trivially_assignable 3431 : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 3432{ 3433}; 3434 3435#else // !__has_feature(is_trivially_assignable) 3436 3437template <class _Tp, class _Arg> 3438struct is_trivially_assignable 3439 : public false_type {}; 3440 3441template <class _Tp> 3442struct is_trivially_assignable<_Tp&, _Tp> 3443 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3444 3445template <class _Tp> 3446struct is_trivially_assignable<_Tp&, _Tp&> 3447 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3448 3449template <class _Tp> 3450struct is_trivially_assignable<_Tp&, const _Tp&> 3451 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3452 3453#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3454 3455template <class _Tp> 3456struct is_trivially_assignable<_Tp&, _Tp&&> 3457 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3458 3459#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3460 3461#endif // !__has_feature(is_trivially_assignable) 3462 3463#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3464template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v 3465 = is_trivially_assignable<_Tp, _Arg>::value; 3466#endif 3467 3468// is_trivially_copy_assignable 3469 3470template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable 3471 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 3472 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3473 3474#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3475template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v 3476 = is_trivially_copy_assignable<_Tp>::value; 3477#endif 3478 3479// is_trivially_move_assignable 3480 3481template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable 3482 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 3483#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3484 typename add_rvalue_reference<_Tp>::type> 3485#else 3486 typename add_lvalue_reference<_Tp>::type> 3487#endif 3488 {}; 3489 3490#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3491template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v 3492 = is_trivially_move_assignable<_Tp>::value; 3493#endif 3494 3495// is_trivially_destructible 3496 3497#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) 3498 3499template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible 3500 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; 3501 3502#else 3503 3504template <class _Tp> struct __libcpp_trivial_destructor 3505 : public integral_constant<bool, is_scalar<_Tp>::value || 3506 is_reference<_Tp>::value> {}; 3507 3508template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible 3509 : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 3510 3511template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]> 3512 : public false_type {}; 3513 3514#endif 3515 3516#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3517template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v 3518 = is_trivially_destructible<_Tp>::value; 3519#endif 3520 3521// is_nothrow_constructible 3522 3523#if 0 3524template <class _Tp, class... _Args> 3525struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible 3526 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 3527{ 3528}; 3529 3530#else 3531 3532#ifndef _LIBCPP_HAS_NO_VARIADICS 3533 3534#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3535 3536template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; 3537 3538template <class _Tp, class... _Args> 3539struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...> 3540 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 3541{ 3542}; 3543 3544template <class _Tp> 3545void __implicit_conversion_to(_Tp) noexcept { } 3546 3547template <class _Tp, class _Arg> 3548struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> 3549 : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))> 3550{ 3551}; 3552 3553template <class _Tp, bool _IsReference, class... _Args> 3554struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...> 3555 : public false_type 3556{ 3557}; 3558 3559template <class _Tp, class... _Args> 3560struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible 3561 : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...> 3562{ 3563}; 3564 3565template <class _Tp, size_t _Ns> 3566struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> 3567 : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> 3568{ 3569}; 3570 3571#else // __has_feature(cxx_noexcept) 3572 3573template <class _Tp, class... _Args> 3574struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible 3575 : false_type 3576{ 3577}; 3578 3579template <class _Tp> 3580struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp> 3581#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3582 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3583#else 3584 : integral_constant<bool, is_scalar<_Tp>::value> 3585#endif 3586{ 3587}; 3588 3589template <class _Tp> 3590#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3591struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&&> 3592#else 3593struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp> 3594#endif 3595#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3596 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3597#else 3598 : integral_constant<bool, is_scalar<_Tp>::value> 3599#endif 3600{ 3601}; 3602 3603template <class _Tp> 3604struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&> 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, _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 3623#endif // __has_feature(cxx_noexcept) 3624 3625#else // _LIBCPP_HAS_NO_VARIADICS 3626 3627template <class _Tp, class _A0 = __is_construct::__nat, 3628 class _A1 = __is_construct::__nat> 3629struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible 3630 : false_type 3631{ 3632}; 3633 3634template <class _Tp> 3635struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat, 3636 __is_construct::__nat> 3637#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3638 : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3639#else 3640 : integral_constant<bool, is_scalar<_Tp>::value> 3641#endif 3642{ 3643}; 3644 3645template <class _Tp> 3646struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp, 3647 __is_construct::__nat> 3648#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3649 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3650#else 3651 : integral_constant<bool, is_scalar<_Tp>::value> 3652#endif 3653{ 3654}; 3655 3656template <class _Tp> 3657struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&, 3658 __is_construct::__nat> 3659#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3660 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3661#else 3662 : integral_constant<bool, is_scalar<_Tp>::value> 3663#endif 3664{ 3665}; 3666 3667template <class _Tp> 3668struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&, 3669 __is_construct::__nat> 3670#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3671 : integral_constant<bool, __has_nothrow_copy(_Tp)> 3672#else 3673 : integral_constant<bool, is_scalar<_Tp>::value> 3674#endif 3675{ 3676}; 3677 3678#endif // _LIBCPP_HAS_NO_VARIADICS 3679#endif // __has_feature(is_nothrow_constructible) 3680 3681#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS) 3682template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v 3683 = is_nothrow_constructible<_Tp, _Args...>::value; 3684#endif 3685 3686// is_nothrow_default_constructible 3687 3688template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible 3689 : public is_nothrow_constructible<_Tp> 3690 {}; 3691 3692#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3693template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v 3694 = is_nothrow_default_constructible<_Tp>::value; 3695#endif 3696 3697// is_nothrow_copy_constructible 3698 3699template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible 3700 : public is_nothrow_constructible<_Tp, 3701 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3702 3703#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3704template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v 3705 = is_nothrow_copy_constructible<_Tp>::value; 3706#endif 3707 3708// is_nothrow_move_constructible 3709 3710template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible 3711#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3712 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3713#else 3714 : public is_nothrow_copy_constructible<_Tp> 3715#endif 3716 {}; 3717 3718#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3719template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v 3720 = is_nothrow_move_constructible<_Tp>::value; 3721#endif 3722 3723// is_nothrow_assignable 3724 3725#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3726 3727template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; 3728 3729template <class _Tp, class _Arg> 3730struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> 3731 : public false_type 3732{ 3733}; 3734 3735template <class _Tp, class _Arg> 3736struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> 3737 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 3738{ 3739}; 3740 3741template <class _Tp, class _Arg> 3742struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable 3743 : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 3744{ 3745}; 3746 3747#else // __has_feature(cxx_noexcept) 3748 3749template <class _Tp, class _Arg> 3750struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable 3751 : public false_type {}; 3752 3753template <class _Tp> 3754struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp> 3755#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3756 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3757#else 3758 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3759#endif 3760 3761template <class _Tp> 3762struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&> 3763#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3764 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3765#else 3766 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3767#endif 3768 3769template <class _Tp> 3770struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&> 3771#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3772 : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3773#else 3774 : integral_constant<bool, is_scalar<_Tp>::value> {}; 3775#endif 3776 3777#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3778 3779template <class _Tp> 3780struct is_nothrow_assignable<_Tp&, _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#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3788 3789#endif // __has_feature(cxx_noexcept) 3790 3791#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3792template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v 3793 = is_nothrow_assignable<_Tp, _Arg>::value; 3794#endif 3795 3796// is_nothrow_copy_assignable 3797 3798template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable 3799 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3800 typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3801 3802#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3803template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v 3804 = is_nothrow_copy_assignable<_Tp>::value; 3805#endif 3806 3807// is_nothrow_move_assignable 3808 3809template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable 3810 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3811#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3812 typename add_rvalue_reference<_Tp>::type> 3813#else 3814 typename add_lvalue_reference<_Tp>::type> 3815#endif 3816 {}; 3817 3818#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3819template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v 3820 = is_nothrow_move_assignable<_Tp>::value; 3821#endif 3822 3823// is_nothrow_destructible 3824 3825#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3826 3827template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; 3828 3829template <class _Tp> 3830struct __libcpp_is_nothrow_destructible<false, _Tp> 3831 : public false_type 3832{ 3833}; 3834 3835template <class _Tp> 3836struct __libcpp_is_nothrow_destructible<true, _Tp> 3837 : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 3838{ 3839}; 3840 3841template <class _Tp> 3842struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible 3843 : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 3844{ 3845}; 3846 3847template <class _Tp, size_t _Ns> 3848struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[_Ns]> 3849 : public is_nothrow_destructible<_Tp> 3850{ 3851}; 3852 3853template <class _Tp> 3854struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&> 3855 : public true_type 3856{ 3857}; 3858 3859#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3860 3861template <class _Tp> 3862struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> 3863 : public true_type 3864{ 3865}; 3866 3867#endif 3868 3869#else 3870 3871template <class _Tp> struct __libcpp_nothrow_destructor 3872 : public integral_constant<bool, is_scalar<_Tp>::value || 3873 is_reference<_Tp>::value> {}; 3874 3875template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible 3876 : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 3877 3878template <class _Tp> 3879struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> 3880 : public false_type {}; 3881 3882#endif 3883 3884#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3885template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v 3886 = is_nothrow_destructible<_Tp>::value; 3887#endif 3888 3889// is_pod 3890 3891#if __has_feature(is_pod) || (_GNUC_VER >= 403) 3892 3893template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod 3894 : public integral_constant<bool, __is_pod(_Tp)> {}; 3895 3896#else 3897 3898template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod 3899 : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 3900 is_trivially_copy_constructible<_Tp>::value && 3901 is_trivially_copy_assignable<_Tp>::value && 3902 is_trivially_destructible<_Tp>::value> {}; 3903 3904#endif 3905 3906#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3907template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v 3908 = is_pod<_Tp>::value; 3909#endif 3910 3911// is_literal_type; 3912 3913template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_literal_type 3914#ifdef _LIBCPP_IS_LITERAL 3915 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)> 3916#else 3917 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 3918 is_reference<typename remove_all_extents<_Tp>::type>::value> 3919#endif 3920 {}; 3921 3922#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3923template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v 3924 = is_literal_type<_Tp>::value; 3925#endif 3926 3927// is_standard_layout; 3928 3929template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout 3930#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) 3931 : public integral_constant<bool, __is_standard_layout(_Tp)> 3932#else 3933 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3934#endif 3935 {}; 3936 3937#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3938template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v 3939 = is_standard_layout<_Tp>::value; 3940#endif 3941 3942// is_trivially_copyable; 3943 3944template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable 3945#if __has_feature(is_trivially_copyable) 3946 : public integral_constant<bool, __is_trivially_copyable(_Tp)> 3947#elif _GNUC_VER >= 501 3948 : public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)> 3949#else 3950 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3951#endif 3952 {}; 3953 3954#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3955template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v 3956 = is_trivially_copyable<_Tp>::value; 3957#endif 3958 3959// is_trivial; 3960 3961template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial 3962#if __has_feature(is_trivial) || _GNUC_VER >= 407 3963 : public integral_constant<bool, __is_trivial(_Tp)> 3964#else 3965 : integral_constant<bool, is_trivially_copyable<_Tp>::value && 3966 is_trivially_default_constructible<_Tp>::value> 3967#endif 3968 {}; 3969 3970#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) 3971template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v 3972 = is_trivial<_Tp>::value; 3973#endif 3974 3975template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; 3976template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; 3977template <class _Tp> struct __is_reference_wrapper 3978 : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; 3979 3980#ifndef _LIBCPP_CXX03_LANG 3981 3982// Check for complete types 3983 3984template <class ..._Tp> struct __check_complete; 3985 3986template <> 3987struct __check_complete<> 3988{ 3989}; 3990 3991template <class _Hp, class _T0, class ..._Tp> 3992struct __check_complete<_Hp, _T0, _Tp...> 3993 : private __check_complete<_Hp>, 3994 private __check_complete<_T0, _Tp...> 3995{ 3996}; 3997 3998template <class _Hp> 3999struct __check_complete<_Hp, _Hp> 4000 : private __check_complete<_Hp> 4001{ 4002}; 4003 4004template <class _Tp> 4005struct __check_complete<_Tp> 4006{ 4007 static_assert(sizeof(_Tp) > 0, "Type must be complete."); 4008}; 4009 4010template <class _Tp> 4011struct __check_complete<_Tp&> 4012 : private __check_complete<_Tp> 4013{ 4014}; 4015 4016template <class _Tp> 4017struct __check_complete<_Tp&&> 4018 : private __check_complete<_Tp> 4019{ 4020}; 4021 4022template <class _Rp, class ..._Param> 4023struct __check_complete<_Rp (*)(_Param...)> 4024 : private __check_complete<_Rp> 4025{ 4026}; 4027 4028template <class ..._Param> 4029struct __check_complete<void (*)(_Param...)> 4030{ 4031}; 4032 4033template <class _Rp, class ..._Param> 4034struct __check_complete<_Rp (_Param...)> 4035 : private __check_complete<_Rp> 4036{ 4037}; 4038 4039template <class ..._Param> 4040struct __check_complete<void (_Param...)> 4041{ 4042}; 4043 4044template <class _Rp, class _Class, class ..._Param> 4045struct __check_complete<_Rp (_Class::*)(_Param...)> 4046 : private __check_complete<_Class> 4047{ 4048}; 4049 4050template <class _Rp, class _Class, class ..._Param> 4051struct __check_complete<_Rp (_Class::*)(_Param...) const> 4052 : private __check_complete<_Class> 4053{ 4054}; 4055 4056template <class _Rp, class _Class, class ..._Param> 4057struct __check_complete<_Rp (_Class::*)(_Param...) volatile> 4058 : private __check_complete<_Class> 4059{ 4060}; 4061 4062template <class _Rp, class _Class, class ..._Param> 4063struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 4064 : private __check_complete<_Class> 4065{ 4066}; 4067 4068template <class _Rp, class _Class, class ..._Param> 4069struct __check_complete<_Rp (_Class::*)(_Param...) &> 4070 : private __check_complete<_Class> 4071{ 4072}; 4073 4074template <class _Rp, class _Class, class ..._Param> 4075struct __check_complete<_Rp (_Class::*)(_Param...) const&> 4076 : private __check_complete<_Class> 4077{ 4078}; 4079 4080template <class _Rp, class _Class, class ..._Param> 4081struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 4082 : private __check_complete<_Class> 4083{ 4084}; 4085 4086template <class _Rp, class _Class, class ..._Param> 4087struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 4088 : private __check_complete<_Class> 4089{ 4090}; 4091 4092template <class _Rp, class _Class, class ..._Param> 4093struct __check_complete<_Rp (_Class::*)(_Param...) &&> 4094 : private __check_complete<_Class> 4095{ 4096}; 4097 4098template <class _Rp, class _Class, class ..._Param> 4099struct __check_complete<_Rp (_Class::*)(_Param...) const&&> 4100 : private __check_complete<_Class> 4101{ 4102}; 4103 4104template <class _Rp, class _Class, class ..._Param> 4105struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 4106 : private __check_complete<_Class> 4107{ 4108}; 4109 4110template <class _Rp, class _Class, class ..._Param> 4111struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 4112 : private __check_complete<_Class> 4113{ 4114}; 4115 4116template <class _Rp, class _Class> 4117struct __check_complete<_Rp _Class::*> 4118 : private __check_complete<_Class> 4119{ 4120}; 4121 4122 4123template <class _Fp, class _A0, 4124 class _DecayFp = typename decay<_Fp>::type, 4125 class _DecayA0 = typename decay<_A0>::type, 4126 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4127using __enable_if_bullet1 = typename enable_if 4128 < 4129 is_member_function_pointer<_DecayFp>::value 4130 && is_base_of<_ClassT, _DecayA0>::value 4131 >::type; 4132 4133template <class _Fp, class _A0, 4134 class _DecayFp = typename decay<_Fp>::type, 4135 class _DecayA0 = typename decay<_A0>::type> 4136using __enable_if_bullet2 = typename enable_if 4137 < 4138 is_member_function_pointer<_DecayFp>::value 4139 && __is_reference_wrapper<_DecayA0>::value 4140 >::type; 4141 4142template <class _Fp, class _A0, 4143 class _DecayFp = typename decay<_Fp>::type, 4144 class _DecayA0 = typename decay<_A0>::type, 4145 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4146using __enable_if_bullet3 = typename enable_if 4147 < 4148 is_member_function_pointer<_DecayFp>::value 4149 && !is_base_of<_ClassT, _DecayA0>::value 4150 && !__is_reference_wrapper<_DecayA0>::value 4151 >::type; 4152 4153template <class _Fp, class _A0, 4154 class _DecayFp = typename decay<_Fp>::type, 4155 class _DecayA0 = typename decay<_A0>::type, 4156 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4157using __enable_if_bullet4 = typename enable_if 4158 < 4159 is_member_object_pointer<_DecayFp>::value 4160 && is_base_of<_ClassT, _DecayA0>::value 4161 >::type; 4162 4163template <class _Fp, class _A0, 4164 class _DecayFp = typename decay<_Fp>::type, 4165 class _DecayA0 = typename decay<_A0>::type> 4166using __enable_if_bullet5 = typename enable_if 4167 < 4168 is_member_object_pointer<_DecayFp>::value 4169 && __is_reference_wrapper<_DecayA0>::value 4170 >::type; 4171 4172template <class _Fp, class _A0, 4173 class _DecayFp = typename decay<_Fp>::type, 4174 class _DecayA0 = typename decay<_A0>::type, 4175 class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> 4176using __enable_if_bullet6 = typename enable_if 4177 < 4178 is_member_object_pointer<_DecayFp>::value 4179 && !is_base_of<_ClassT, _DecayA0>::value 4180 && !__is_reference_wrapper<_DecayA0>::value 4181 >::type; 4182 4183// __invoke forward declarations 4184 4185// fall back - none of the bullets 4186 4187#define _LIBCPP_INVOKE_RETURN(...) \ 4188 noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \ 4189 { return __VA_ARGS__; } 4190 4191template <class ..._Args> 4192auto __invoke(__any, _Args&& ...__args) -> __nat; 4193 4194template <class ..._Args> 4195auto __invoke_constexpr(__any, _Args&& ...__args) -> __nat; 4196 4197// bullets 1, 2 and 3 4198 4199template <class _Fp, class _A0, class ..._Args, 4200 class = __enable_if_bullet1<_Fp, _A0>> 4201inline _LIBCPP_INLINE_VISIBILITY 4202auto 4203__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4204_LIBCPP_INVOKE_RETURN((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) 4205 4206template <class _Fp, class _A0, class ..._Args, 4207 class = __enable_if_bullet1<_Fp, _A0>> 4208inline _LIBCPP_INLINE_VISIBILITY 4209_LIBCPP_CONSTEXPR auto 4210__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4211_LIBCPP_INVOKE_RETURN((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) 4212 4213template <class _Fp, class _A0, class ..._Args, 4214 class = __enable_if_bullet2<_Fp, _A0>> 4215inline _LIBCPP_INLINE_VISIBILITY 4216auto 4217__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4218_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)) 4219 4220template <class _Fp, class _A0, class ..._Args, 4221 class = __enable_if_bullet2<_Fp, _A0>> 4222inline _LIBCPP_INLINE_VISIBILITY 4223_LIBCPP_CONSTEXPR auto 4224__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4225_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)) 4226 4227template <class _Fp, class _A0, class ..._Args, 4228 class = __enable_if_bullet3<_Fp, _A0>> 4229inline _LIBCPP_INLINE_VISIBILITY 4230auto 4231__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4232_LIBCPP_INVOKE_RETURN(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) 4233 4234template <class _Fp, class _A0, class ..._Args, 4235 class = __enable_if_bullet3<_Fp, _A0>> 4236inline _LIBCPP_INLINE_VISIBILITY 4237_LIBCPP_CONSTEXPR auto 4238__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 4239_LIBCPP_INVOKE_RETURN(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) 4240 4241// bullets 4, 5 and 6 4242 4243template <class _Fp, class _A0, 4244 class = __enable_if_bullet4<_Fp, _A0>> 4245inline _LIBCPP_INLINE_VISIBILITY 4246auto 4247__invoke(_Fp&& __f, _A0&& __a0) 4248_LIBCPP_INVOKE_RETURN(_VSTD::forward<_A0>(__a0).*__f) 4249 4250template <class _Fp, class _A0, 4251 class = __enable_if_bullet4<_Fp, _A0>> 4252inline _LIBCPP_INLINE_VISIBILITY 4253_LIBCPP_CONSTEXPR auto 4254__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4255_LIBCPP_INVOKE_RETURN(_VSTD::forward<_A0>(__a0).*__f) 4256 4257template <class _Fp, class _A0, 4258 class = __enable_if_bullet5<_Fp, _A0>> 4259inline _LIBCPP_INLINE_VISIBILITY 4260auto 4261__invoke(_Fp&& __f, _A0&& __a0) 4262_LIBCPP_INVOKE_RETURN(__a0.get().*__f) 4263 4264template <class _Fp, class _A0, 4265 class = __enable_if_bullet5<_Fp, _A0>> 4266inline _LIBCPP_INLINE_VISIBILITY 4267_LIBCPP_CONSTEXPR auto 4268__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4269_LIBCPP_INVOKE_RETURN(__a0.get().*__f) 4270 4271template <class _Fp, class _A0, 4272 class = __enable_if_bullet6<_Fp, _A0>> 4273inline _LIBCPP_INLINE_VISIBILITY 4274auto 4275__invoke(_Fp&& __f, _A0&& __a0) 4276_LIBCPP_INVOKE_RETURN((*_VSTD::forward<_A0>(__a0)).*__f) 4277 4278template <class _Fp, class _A0, 4279 class = __enable_if_bullet6<_Fp, _A0>> 4280inline _LIBCPP_INLINE_VISIBILITY 4281_LIBCPP_CONSTEXPR auto 4282__invoke_constexpr(_Fp&& __f, _A0&& __a0) 4283_LIBCPP_INVOKE_RETURN((*_VSTD::forward<_A0>(__a0)).*__f) 4284 4285// bullet 7 4286 4287template <class _Fp, class ..._Args> 4288inline _LIBCPP_INLINE_VISIBILITY 4289auto 4290__invoke(_Fp&& __f, _Args&& ...__args) 4291_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) 4292 4293template <class _Fp, class ..._Args> 4294inline _LIBCPP_INLINE_VISIBILITY 4295_LIBCPP_CONSTEXPR auto 4296__invoke_constexpr(_Fp&& __f, _Args&& ...__args) 4297_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) 4298 4299#undef _LIBCPP_INVOKE_RETURN 4300 4301// __invokable 4302 4303template <class _Ret, class _Fp, class ..._Args> 4304struct __invokable_r 4305 : private __check_complete<_Fp> 4306{ 4307 using _Result = decltype( 4308 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); 4309 4310 static const bool value = 4311 conditional< 4312 !is_same<_Result, __nat>::value, 4313 typename conditional< 4314 is_void<_Ret>::value, 4315 true_type, 4316 is_convertible<_Result, _Ret> 4317 >::type, 4318 false_type 4319 >::type::value; 4320}; 4321 4322template <class _Fp, class ..._Args> 4323using __invokable = __invokable_r<void, _Fp, _Args...>; 4324 4325template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> 4326struct __nothrow_invokable_r_imp { 4327 static const bool value = false; 4328}; 4329 4330template <class _Ret, class _Fp, class ..._Args> 4331struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> 4332{ 4333 typedef __nothrow_invokable_r_imp _ThisT; 4334 4335 template <class _Tp> 4336 static void __test_noexcept(_Tp) noexcept; 4337 4338 static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( 4339 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...))); 4340}; 4341 4342template <class _Ret, class _Fp, class ..._Args> 4343struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> 4344{ 4345 static const bool value = noexcept( 4346 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); 4347}; 4348 4349template <class _Ret, class _Fp, class ..._Args> 4350using __nothrow_invokable_r = 4351 __nothrow_invokable_r_imp< 4352 __invokable_r<_Ret, _Fp, _Args...>::value, 4353 is_void<_Ret>::value, 4354 _Ret, _Fp, _Args... 4355 >; 4356 4357template <class _Fp, class ..._Args> 4358struct __invoke_of 4359 : public enable_if< 4360 __invokable<_Fp, _Args...>::value, 4361 typename __invokable_r<void, _Fp, _Args...>::_Result> 4362{ 4363}; 4364 4365// result_of 4366 4367template <class _Fp, class ..._Args> 4368class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> 4369 : public __invoke_of<_Fp, _Args...> 4370{ 4371}; 4372 4373#if _LIBCPP_STD_VER > 11 4374template <class _Tp> using result_of_t = typename result_of<_Tp>::type; 4375#endif 4376 4377#if _LIBCPP_STD_VER > 14 4378 4379// is_callable 4380 4381template <class _Fn, class _Ret = void> 4382struct _LIBCPP_TEMPLATE_VIS is_callable; 4383 4384template <class _Fn, class ..._Args, class _Ret> 4385struct _LIBCPP_TEMPLATE_VIS is_callable<_Fn(_Args...), _Ret> 4386 : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; 4387 4388template <class _Fn, class _Ret = void> 4389constexpr bool is_callable_v = is_callable<_Fn, _Ret>::value; 4390 4391// is_nothrow_callable 4392 4393template <class _Fn, class _Ret = void> 4394struct _LIBCPP_TEMPLATE_VIS is_nothrow_callable; 4395 4396template <class _Fn, class ..._Args, class _Ret> 4397struct _LIBCPP_TEMPLATE_VIS is_nothrow_callable<_Fn(_Args...), _Ret> 4398 : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> 4399{}; 4400 4401template <class _Fn, class _Ret = void> 4402constexpr bool is_nothrow_callable_v = is_nothrow_callable<_Fn, _Ret>::value; 4403 4404#endif // _LIBCPP_STD_VER > 14 4405 4406#endif // !defined(_LIBCPP_CXX03_LANG) 4407 4408template <class _Tp> struct __is_swappable; 4409template <class _Tp> struct __is_nothrow_swappable; 4410 4411template <class _Tp> 4412inline _LIBCPP_INLINE_VISIBILITY 4413#ifndef _LIBCPP_CXX03_LANG 4414typename enable_if 4415< 4416 is_move_constructible<_Tp>::value && 4417 is_move_assignable<_Tp>::value 4418>::type 4419#else 4420void 4421#endif 4422swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 4423 is_nothrow_move_assignable<_Tp>::value) 4424{ 4425 _Tp __t(_VSTD::move(__x)); 4426 __x = _VSTD::move(__y); 4427 __y = _VSTD::move(__t); 4428} 4429 4430template<class _Tp, size_t _Np> 4431inline _LIBCPP_INLINE_VISIBILITY 4432typename enable_if< 4433 __is_swappable<_Tp>::value 4434>::type 4435swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); 4436 4437template <class _ForwardIterator1, class _ForwardIterator2> 4438inline _LIBCPP_INLINE_VISIBILITY 4439void 4440iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 4441 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 4442 _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 4443 *_VSTD::declval<_ForwardIterator2>()))) 4444{ 4445 swap(*__a, *__b); 4446} 4447 4448// __swappable 4449 4450namespace __detail 4451{ 4452// ALL generic swap overloads MUST already have a declaration available at this point. 4453 4454template <class _Tp, class _Up = _Tp, 4455 bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value> 4456struct __swappable_with 4457{ 4458 template <class _LHS, class _RHS> 4459 static decltype(swap(_VSTD::declval<_LHS>(), _VSTD::declval<_RHS>())) 4460 __test_swap(int); 4461 template <class, class> 4462 static __nat __test_swap(long); 4463 4464 // Extra parens are needed for the C++03 definition of decltype. 4465 typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; 4466 typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; 4467 4468 static const bool value = !is_same<__swap1, __nat>::value 4469 && !is_same<__swap2, __nat>::value; 4470}; 4471 4472template <class _Tp, class _Up> 4473struct __swappable_with<_Tp, _Up, false> : false_type {}; 4474 4475template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value> 4476struct __nothrow_swappable_with { 4477 static const bool value = 4478#ifndef _LIBCPP_HAS_NO_NOEXCEPT 4479 noexcept(swap(_VSTD::declval<_Tp>(), _VSTD::declval<_Up>())) 4480 && noexcept(swap(_VSTD::declval<_Up>(), _VSTD::declval<_Tp>())); 4481#else 4482 false; 4483#endif 4484}; 4485 4486template <class _Tp, class _Up> 4487struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; 4488 4489} // __detail 4490 4491template <class _Tp> 4492struct __is_swappable 4493 : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> 4494{ 4495}; 4496 4497template <class _Tp> 4498struct __is_nothrow_swappable 4499 : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> 4500{ 4501}; 4502 4503#if _LIBCPP_STD_VER > 14 4504 4505template <class _Tp, class _Up> 4506struct _LIBCPP_TEMPLATE_VIS is_swappable_with 4507 : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> 4508{ 4509}; 4510 4511template <class _Tp> 4512struct _LIBCPP_TEMPLATE_VIS is_swappable 4513 : public conditional< 4514 __is_referenceable<_Tp>::value, 4515 is_swappable_with< 4516 typename add_lvalue_reference<_Tp>::type, 4517 typename add_lvalue_reference<_Tp>::type>, 4518 false_type 4519 >::type 4520{ 4521}; 4522 4523template <class _Tp, class _Up> 4524struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with 4525 : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> 4526{ 4527}; 4528 4529template <class _Tp> 4530struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable 4531 : public conditional< 4532 __is_referenceable<_Tp>::value, 4533 is_nothrow_swappable_with< 4534 typename add_lvalue_reference<_Tp>::type, 4535 typename add_lvalue_reference<_Tp>::type>, 4536 false_type 4537 >::type 4538{ 4539}; 4540 4541template <class _Tp, class _Up> 4542constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; 4543 4544template <class _Tp> 4545constexpr bool is_swappable_v = is_swappable<_Tp>::value; 4546 4547template <class _Tp, class _Up> 4548constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; 4549 4550template <class _Tp> 4551constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; 4552 4553#endif // _LIBCPP_STD_VER > 14 4554 4555#ifdef _LIBCPP_UNDERLYING_TYPE 4556 4557template <class _Tp> 4558struct underlying_type 4559{ 4560 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; 4561}; 4562 4563#if _LIBCPP_STD_VER > 11 4564template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 4565#endif 4566 4567#else // _LIBCPP_UNDERLYING_TYPE 4568 4569template <class _Tp, bool _Support = false> 4570struct underlying_type 4571{ 4572 static_assert(_Support, "The underyling_type trait requires compiler " 4573 "support. Either no such support exists or " 4574 "libc++ does not know how to use it."); 4575}; 4576 4577#endif // _LIBCPP_UNDERLYING_TYPE 4578 4579 4580template <class _Tp, bool = is_enum<_Tp>::value> 4581struct __sfinae_underlying_type 4582{ 4583 typedef typename underlying_type<_Tp>::type type; 4584 typedef decltype(((type)1) + 0) __promoted_type; 4585}; 4586 4587template <class _Tp> 4588struct __sfinae_underlying_type<_Tp, false> {}; 4589 4590inline _LIBCPP_INLINE_VISIBILITY 4591int __convert_to_integral(int __val) { return __val; } 4592 4593inline _LIBCPP_INLINE_VISIBILITY 4594unsigned __convert_to_integral(unsigned __val) { return __val; } 4595 4596inline _LIBCPP_INLINE_VISIBILITY 4597long __convert_to_integral(long __val) { return __val; } 4598 4599inline _LIBCPP_INLINE_VISIBILITY 4600unsigned long __convert_to_integral(unsigned long __val) { return __val; } 4601 4602inline _LIBCPP_INLINE_VISIBILITY 4603long long __convert_to_integral(long long __val) { return __val; } 4604 4605inline _LIBCPP_INLINE_VISIBILITY 4606unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } 4607 4608#ifndef _LIBCPP_HAS_NO_INT128 4609inline _LIBCPP_INLINE_VISIBILITY 4610__int128_t __convert_to_integral(__int128_t __val) { return __val; } 4611 4612inline _LIBCPP_INLINE_VISIBILITY 4613__uint128_t __convert_to_integral(__uint128_t __val) { return __val; } 4614#endif 4615 4616template <class _Tp> 4617inline _LIBCPP_INLINE_VISIBILITY 4618typename __sfinae_underlying_type<_Tp>::__promoted_type 4619__convert_to_integral(_Tp __val) { return __val; } 4620 4621#ifndef _LIBCPP_CXX03_LANG 4622 4623template <class _Tp> 4624struct __has_operator_addressof_member_imp 4625{ 4626 template <class _Up> 4627 static auto __test(int) 4628 -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type; 4629 template <class> 4630 static auto __test(long) -> false_type; 4631 4632 static const bool value = decltype(__test<_Tp>(0))::value; 4633}; 4634 4635template <class _Tp> 4636struct __has_operator_addressof_free_imp 4637{ 4638 template <class _Up> 4639 static auto __test(int) 4640 -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type; 4641 template <class> 4642 static auto __test(long) -> false_type; 4643 4644 static const bool value = decltype(__test<_Tp>(0))::value; 4645}; 4646 4647template <class _Tp> 4648struct __has_operator_addressof 4649 : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value 4650 || __has_operator_addressof_free_imp<_Tp>::value> 4651{}; 4652 4653#endif // _LIBCPP_CXX03_LANG 4654 4655#if _LIBCPP_STD_VER > 14 4656 4657#define __cpp_lib_void_t 201411 4658template <class...> using void_t = void; 4659 4660# ifndef _LIBCPP_HAS_NO_VARIADICS 4661template <class... _Args> 4662struct conjunction : __and_<_Args...> {}; 4663template<class... _Args> constexpr bool conjunction_v = conjunction<_Args...>::value; 4664 4665template <class... _Args> 4666struct disjunction : __or_<_Args...> {}; 4667template<class... _Args> constexpr bool disjunction_v = disjunction<_Args...>::value; 4668 4669template <class _Tp> 4670struct negation : __not_<_Tp> {}; 4671template<class _Tp> constexpr bool negation_v = negation<_Tp>::value; 4672# endif // _LIBCPP_HAS_NO_VARIADICS 4673#endif // _LIBCPP_STD_VER > 14 4674 4675// These traits are used in __tree and __hash_table 4676#ifndef _LIBCPP_CXX03_LANG 4677struct __extract_key_fail_tag {}; 4678struct __extract_key_self_tag {}; 4679struct __extract_key_first_tag {}; 4680 4681template <class _ValTy, class _Key, 4682 class _RawValTy = typename __unconstref<_ValTy>::type> 4683struct __can_extract_key 4684 : conditional<is_same<_RawValTy, _Key>::value, __extract_key_self_tag, 4685 __extract_key_fail_tag>::type {}; 4686 4687template <class _Pair, class _Key, class _First, class _Second> 4688struct __can_extract_key<_Pair, _Key, pair<_First, _Second>> 4689 : conditional<is_same<typename remove_const<_First>::type, _Key>::value, 4690 __extract_key_first_tag, __extract_key_fail_tag>::type {}; 4691 4692// __can_extract_map_key uses true_type/false_type instead of the tags. 4693// It returns true if _Key != _ContainerValueTy (the container is a map not a set) 4694// and _ValTy == _Key. 4695template <class _ValTy, class _Key, class _ContainerValueTy, 4696 class _RawValTy = typename __unconstref<_ValTy>::type> 4697struct __can_extract_map_key 4698 : integral_constant<bool, is_same<_RawValTy, _Key>::value> {}; 4699 4700// This specialization returns __extract_key_fail_tag for non-map containers 4701// because _Key == _ContainerValueTy 4702template <class _ValTy, class _Key, class _RawValTy> 4703struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> 4704 : false_type {}; 4705 4706#endif 4707 4708_LIBCPP_END_NAMESPACE_STD 4709 4710#endif // _LIBCPP_TYPE_TRAITS 4711