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