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