| author | |
| committer | |
| log | 2289036a40082eb5316e2a46fb2f3a78a8be0c7d |
| tree | 9ddbafeeec6b9166667f82f0334e74a7b97fcf2b |
| parent | 74619cc04586866013e40228f001e3fa79932d8e |
| signature |
66 files changed, 2284 insertions(+), 1453 deletions(-)
lib/libcxx/include/__bit_reference+18-8| ... | ... | @@ -47,6 +47,9 @@ class __bit_reference |
| 47 | 47 | friend class __bit_const_reference<_Cp>; |
| 48 | 48 | friend class __bit_iterator<_Cp, false>; |
| 49 | 49 | public: |
| 50 | _LIBCPP_INLINE_VISIBILITY | |
| 51 | __bit_reference(const __bit_reference&) = default; | |
| 52 | ||
| 50 | 53 | _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT |
| 51 | 54 | {return static_cast<bool>(*__seg_ & __mask_);} |
| 52 | 55 | _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT |
| ... | ... | @@ -132,6 +135,9 @@ class __bit_const_reference |
| 132 | 135 | friend typename _Cp::__self; |
| 133 | 136 | friend class __bit_iterator<_Cp, true>; |
| 134 | 137 | public: |
| 138 | _LIBCPP_INLINE_VISIBILITY | |
| 139 | __bit_const_reference(const __bit_const_reference&) = default; | |
| 140 | ||
| 135 | 141 | _LIBCPP_INLINE_VISIBILITY |
| 136 | 142 | __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT |
| 137 | 143 | : __seg_(__x.__seg_), __mask_(__x.__mask_) {} |
| ... | ... | @@ -147,7 +153,7 @@ private: |
| 147 | 153 | __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT |
| 148 | 154 | : __seg_(__s), __mask_(__m) {} |
| 149 | 155 | |
| 150 | __bit_const_reference& operator=(const __bit_const_reference& __x); | |
| 156 | __bit_const_reference& operator=(const __bit_const_reference&) = delete; | |
| 151 | 157 | }; |
| 152 | 158 | |
| 153 | 159 | // find |
| ... | ... | @@ -332,7 +338,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 332 | 338 | } |
| 333 | 339 | // do middle whole words |
| 334 | 340 | __storage_type __nw = __n / __bits_per_word; |
| 335 | _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type)); | |
| 341 | _VSTD::memset(_VSTD::__to_address(__first.__seg_), 0, __nw * sizeof(__storage_type)); | |
| 336 | 342 | __n -= __nw * __bits_per_word; |
| 337 | 343 | // do last partial word |
| 338 | 344 | if (__n > 0) |
| ... | ... | @@ -362,7 +368,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) |
| 362 | 368 | } |
| 363 | 369 | // do middle whole words |
| 364 | 370 | __storage_type __nw = __n / __bits_per_word; |
| 365 | _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type)); | |
| 371 | _VSTD::memset(_VSTD::__to_address(__first.__seg_), -1, __nw * sizeof(__storage_type)); | |
| 366 | 372 | __n -= __nw * __bits_per_word; |
| 367 | 373 | // do last partial word |
| 368 | 374 | if (__n > 0) |
| ... | ... | @@ -429,8 +435,8 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon |
| 429 | 435 | // __first.__ctz_ == 0; |
| 430 | 436 | // do middle words |
| 431 | 437 | __storage_type __nw = __n / __bits_per_word; |
| 432 | _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), | |
| 433 | _VSTD::__to_raw_pointer(__first.__seg_), | |
| 438 | _VSTD::memmove(_VSTD::__to_address(__result.__seg_), | |
| 439 | _VSTD::__to_address(__first.__seg_), | |
| 434 | 440 | __nw * sizeof(__storage_type)); |
| 435 | 441 | __n -= __nw * __bits_per_word; |
| 436 | 442 | __result.__seg_ += __nw; |
| ... | ... | @@ -570,8 +576,8 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C |
| 570 | 576 | __storage_type __nw = __n / __bits_per_word; |
| 571 | 577 | __result.__seg_ -= __nw; |
| 572 | 578 | __last.__seg_ -= __nw; |
| 573 | _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_), | |
| 574 | _VSTD::__to_raw_pointer(__last.__seg_), | |
| 579 | _VSTD::memmove(_VSTD::__to_address(__result.__seg_), | |
| 580 | _VSTD::__to_address(__last.__seg_), | |
| 575 | 581 | __nw * sizeof(__storage_type)); |
| 576 | 582 | __n -= __nw * __bits_per_word; |
| 577 | 583 | // do last word |
| ... | ... | @@ -1108,8 +1114,12 @@ public: |
| 1108 | 1114 | #endif |
| 1109 | 1115 | {} |
| 1110 | 1116 | |
| 1117 | // avoid re-declaring a copy constructor for the non-const version. | |
| 1118 | using __type_for_copy_to_const = | |
| 1119 | _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>; | |
| 1120 | ||
| 1111 | 1121 | _LIBCPP_INLINE_VISIBILITY |
| 1112 | __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT | |
| 1122 | __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT | |
| 1113 | 1123 | : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} |
| 1114 | 1124 | |
| 1115 | 1125 | _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT |
lib/libcxx/include/__config+127-20| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | # define _GNUC_VER_NEW 0 |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #define _LIBCPP_VERSION 9000 | |
| 35 | #define _LIBCPP_VERSION 10000 | |
| 36 | 36 | |
| 37 | 37 | #ifndef _LIBCPP_ABI_VERSION |
| 38 | 38 | # define _LIBCPP_ABI_VERSION 1 |
| ... | ... | @@ -183,10 +183,6 @@ |
| 183 | 183 | # define _LIBCPP_COMPILER_IBM |
| 184 | 184 | #endif |
| 185 | 185 | |
| 186 | #ifndef _LIBCPP_CLANG_VER | |
| 187 | #define _LIBCPP_CLANG_VER 0 | |
| 188 | #endif | |
| 189 | ||
| 190 | 186 | #if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L |
| 191 | 187 | #error "libc++ does not support using GCC with C++03. Please enable C++11" |
| 192 | 188 | #endif |
| ... | ... | @@ -246,6 +242,7 @@ |
| 246 | 242 | |
| 247 | 243 | #ifdef __FreeBSD__ |
| 248 | 244 | # include <sys/endian.h> |
| 245 | # include <osreldate.h> | |
| 249 | 246 | # if _BYTE_ORDER == _LITTLE_ENDIAN |
| 250 | 247 | # define _LIBCPP_LITTLE_ENDIAN |
| 251 | 248 | # else // _BYTE_ORDER == _LITTLE_ENDIAN |
| ... | ... | @@ -263,7 +260,6 @@ |
| 263 | 260 | # else // _BYTE_ORDER == _LITTLE_ENDIAN |
| 264 | 261 | # define _LIBCPP_BIG_ENDIAN |
| 265 | 262 | # endif // _BYTE_ORDER == _LITTLE_ENDIAN |
| 266 | # define _LIBCPP_HAS_QUICK_EXIT | |
| 267 | 263 | #endif // __NetBSD__ |
| 268 | 264 | |
| 269 | 265 | #if defined(_WIN32) |
| ... | ... | @@ -343,9 +339,26 @@ |
| 343 | 339 | |
| 344 | 340 | #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L |
| 345 | 341 | # if defined(__FreeBSD__) |
| 342 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 346 | 343 | # define _LIBCPP_HAS_QUICK_EXIT |
| 347 | 344 | # define _LIBCPP_HAS_C11_FEATURES |
| 348 | # elif defined(__Fuchsia__) || defined(__wasi__) | |
| 345 | # if __FreeBSD_version >= 1300064 || \ | |
| 346 | (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000) | |
| 347 | # define _LIBCPP_HAS_TIMESPEC_GET | |
| 348 | # endif | |
| 349 | # elif defined(__BIONIC__) | |
| 350 | # define _LIBCPP_HAS_C11_FEATURES | |
| 351 | # if __ANDROID_API__ >= 21 | |
| 352 | # define _LIBCPP_HAS_QUICK_EXIT | |
| 353 | # endif | |
| 354 | # if __ANDROID_API__ >= 28 | |
| 355 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 356 | # endif | |
| 357 | # if __ANDROID_API__ >= 29 | |
| 358 | # define _LIBCPP_HAS_TIMESPEC_GET | |
| 359 | # endif | |
| 360 | # elif defined(__Fuchsia__) || defined(__wasi__) || defined(__NetBSD__) | |
| 361 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 349 | 362 | # define _LIBCPP_HAS_QUICK_EXIT |
| 350 | 363 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 351 | 364 | # define _LIBCPP_HAS_C11_FEATURES |
| ... | ... | @@ -355,10 +368,12 @@ |
| 355 | 368 | # define _LIBCPP_HAS_QUICK_EXIT |
| 356 | 369 | # endif |
| 357 | 370 | # if _LIBCPP_GLIBC_PREREQ(2, 17) |
| 371 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 358 | 372 | # define _LIBCPP_HAS_C11_FEATURES |
| 359 | 373 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 360 | 374 | # endif |
| 361 | 375 | # else // defined(_LIBCPP_HAS_MUSL_LIBC) |
| 376 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 362 | 377 | # define _LIBCPP_HAS_QUICK_EXIT |
| 363 | 378 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 364 | 379 | # define _LIBCPP_HAS_C11_FEATURES |
| ... | ... | @@ -483,11 +498,14 @@ typedef __char32_t char32_t; |
| 483 | 498 | |
| 484 | 499 | #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) |
| 485 | 500 | |
| 486 | // No apple compilers support ""d and ""y at this time. | |
| 487 | #if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__) | |
| 488 | #define	_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS | |
| 501 | // Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1 | |
| 502 | #if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \ | |
| 503 | (defined(__apple_build_version__) && __apple_build_version__ < 10010000) | |
| 504 | #define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS | |
| 489 | 505 | #endif |
| 490 | 506 | |
| 507 | #define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ | |
| 508 | ||
| 491 | 509 | #elif defined(_LIBCPP_COMPILER_GCC) |
| 492 | 510 | |
| 493 | 511 | #define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| ... | ... | @@ -523,6 +541,8 @@ typedef __char32_t char32_t; |
| 523 | 541 | |
| 524 | 542 | #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) |
| 525 | 543 | |
| 544 | #define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ | |
| 545 | ||
| 526 | 546 | #elif defined(_LIBCPP_COMPILER_MSVC) |
| 527 | 547 | |
| 528 | 548 | #define _LIBCPP_TOSTRING2(x) #x |
| ... | ... | @@ -548,6 +568,8 @@ typedef __char32_t char32_t; |
| 548 | 568 | |
| 549 | 569 | #define _LIBCPP_HAS_NO_VECTOR_EXTENSION |
| 550 | 570 | |
| 571 | #define _LIBCPP_DISABLE_EXTENSION_WARNING | |
| 572 | ||
| 551 | 573 | #elif defined(_LIBCPP_COMPILER_IBM) |
| 552 | 574 | |
| 553 | 575 | #define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| ... | ... | @@ -568,6 +590,8 @@ typedef __char32_t char32_t; |
| 568 | 590 | |
| 569 | 591 | #define _LIBCPP_HAS_NO_VECTOR_EXTENSION |
| 570 | 592 | |
| 593 | #define _LIBCPP_DISABLE_EXTENSION_WARNING | |
| 594 | ||
| 571 | 595 | #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] |
| 572 | 596 | |
| 573 | 597 | #if defined(_LIBCPP_OBJECT_FORMAT_COFF) |
| ... | ... | @@ -860,6 +884,10 @@ typedef unsigned int char32_t; |
| 860 | 884 | # endif |
| 861 | 885 | #endif |
| 862 | 886 | |
| 887 | #ifndef _LIBCPP_DEBUG_LEVEL | |
| 888 | # define _LIBCPP_DEBUG_LEVEL 0 | |
| 889 | #endif | |
| 890 | ||
| 863 | 891 | #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE |
| 864 | 892 | #define _LIBCPP_EXTERN_TEMPLATE(...) |
| 865 | 893 | #define _LIBCPP_EXTERN_TEMPLATE2(...) |
| ... | ... | @@ -958,6 +986,20 @@ typedef unsigned int char32_t; |
| 958 | 986 | # define _LIBCPP_DEPRECATED_IN_CXX17 |
| 959 | 987 | #endif |
| 960 | 988 | |
| 989 | // Macros to enter and leave a state where deprecation warnings are suppressed. | |
| 990 | #if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \ | |
| 991 | (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC)) | |
| 992 | # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ | |
| 993 | _Pragma("GCC diagnostic push") \ | |
| 994 | _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") | |
| 995 | # define _LIBCPP_SUPPRESS_DEPRECATED_POP \ | |
| 996 | _Pragma("GCC diagnostic pop") | |
| 997 | #endif | |
| 998 | #if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) | |
| 999 | # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1000 | # define _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1001 | #endif | |
| 1002 | ||
| 961 | 1003 | #if _LIBCPP_STD_VER <= 11 |
| 962 | 1004 | # define _LIBCPP_EXPLICIT_AFTER_CXX11 |
| 963 | 1005 | #else |
| ... | ... | @@ -982,6 +1024,14 @@ typedef unsigned int char32_t; |
| 982 | 1024 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 983 | 1025 | #endif |
| 984 | 1026 | |
| 1027 | #if _LIBCPP_STD_VER > 17 && \ | |
| 1028 | !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \ | |
| 1029 | !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) | |
| 1030 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr | |
| 1031 | #else | |
| 1032 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1033 | #endif | |
| 1034 | ||
| 985 | 1035 | // The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other |
| 986 | 1036 | // NODISCARD macros to the correct attribute. |
| 987 | 1037 | #if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) |
| ... | ... | @@ -1065,7 +1115,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1065 | 1115 | !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ |
| 1066 | 1116 | !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) |
| 1067 | 1117 | # if defined(__FreeBSD__) || \ |
| 1068 | defined(__Fuchsia__) || \ | |
| 1069 | 1118 | defined(__wasi__) || \ |
| 1070 | 1119 | defined(__NetBSD__) || \ |
| 1071 | 1120 | defined(__linux__) || \ |
| ... | ... | @@ -1075,6 +1124,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1075 | 1124 | defined(__sun__) || \ |
| 1076 | 1125 | (defined(__MINGW32__) && __has_include(<pthread.h>)) |
| 1077 | 1126 | # define _LIBCPP_HAS_THREAD_API_PTHREAD |
| 1127 | # elif defined(__Fuchsia__) | |
| 1128 | # define _LIBCPP_HAS_THREAD_API_C11 | |
| 1078 | 1129 | # elif defined(_LIBCPP_WIN32API) |
| 1079 | 1130 | # define _LIBCPP_HAS_THREAD_API_WIN32 |
| 1080 | 1131 | # else |
| ... | ... | @@ -1082,6 +1133,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1082 | 1133 | # endif // _LIBCPP_HAS_THREAD_API |
| 1083 | 1134 | #endif // _LIBCPP_HAS_NO_THREADS |
| 1084 | 1135 | |
| 1136 | #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) | |
| 1137 | #if defined(__ANDROID__) && __ANDROID_API__ >= 30 | |
| 1138 | #define _LIBCPP_HAS_COND_CLOCKWAIT | |
| 1139 | #elif defined(_LIBCPP_GLIBC_PREREQ) | |
| 1140 | #if _LIBCPP_GLIBC_PREREQ(2, 30) | |
| 1141 | #define _LIBCPP_HAS_COND_CLOCKWAIT | |
| 1142 | #endif | |
| 1143 | #endif | |
| 1144 | #endif | |
| 1145 | ||
| 1085 | 1146 | #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) |
| 1086 | 1147 | #error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ |
| 1087 | 1148 | _LIBCPP_HAS_NO_THREADS is not defined. |
| ... | ... | @@ -1097,20 +1158,40 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1097 | 1158 | _LIBCPP_HAS_NO_THREADS is defined. |
| 1098 | 1159 | #endif |
| 1099 | 1160 | |
| 1100 | // The Apple, glibc, and Bionic implementation of pthreads implements | |
| 1161 | #if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS) | |
| 1162 | #error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set. | |
| 1163 | #endif | |
| 1164 | ||
| 1165 | #if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) | |
| 1166 | #define __STDCPP_THREADS__ 1 | |
| 1167 | #endif | |
| 1168 | ||
| 1169 | // The glibc and Bionic implementation of pthreads implements | |
| 1101 | 1170 | // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 |
| 1102 | 1171 | // mutexes have no destroy mechanism. |
| 1103 | // TODO(EricWF): Enable this optimization on Apple and Bionic platforms after | |
| 1104 | // speaking to their respective stakeholders. | |
| 1172 | // | |
| 1173 | // This optimization can't be performed on Apple platforms, where | |
| 1174 | // pthread_mutex_destroy can allow the kernel to release resources. | |
| 1175 | // See https://llvm.org/D64298 for details. | |
| 1176 | // | |
| 1177 | // TODO(EricWF): Enable this optimization on Bionic after speaking to their | |
| 1178 | // respective stakeholders. | |
| 1105 | 1179 | #if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ |
| 1180 | || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \ | |
| 1106 | 1181 | || defined(_LIBCPP_HAS_THREAD_API_WIN32) |
| 1107 | 1182 | # define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION |
| 1108 | 1183 | #endif |
| 1109 | 1184 | |
| 1110 | 1185 | // Destroying a condvar is a nop on Windows. |
| 1186 | // | |
| 1187 | // This optimization can't be performed on Apple platforms, where | |
| 1188 | // pthread_cond_destroy can allow the kernel to release resources. | |
| 1189 | // See https://llvm.org/D64298 for details. | |
| 1190 | // | |
| 1111 | 1191 | // TODO(EricWF): This is potentially true for some pthread implementations |
| 1112 | 1192 | // as well. |
| 1113 | #if defined(_LIBCPP_HAS_THREAD_API_WIN32) | |
| 1193 | #if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ | |
| 1194 | defined(_LIBCPP_HAS_THREAD_API_WIN32) | |
| 1114 | 1195 | # define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION |
| 1115 | 1196 | #endif |
| 1116 | 1197 | |
| ... | ... | @@ -1129,6 +1210,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1129 | 1210 | #define _LIBCPP_HAS_NO_STDOUT |
| 1130 | 1211 | #endif |
| 1131 | 1212 | |
| 1213 | // Some systems do not provide gets() in their C library, for security reasons. | |
| 1214 | #ifndef _LIBCPP_C_HAS_NO_GETS | |
| 1215 | # if defined(_LIBCPP_MSVCRT) || \ | |
| 1216 | (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) | |
| 1217 | # define _LIBCPP_C_HAS_NO_GETS | |
| 1218 | # endif | |
| 1219 | #endif | |
| 1220 | ||
| 1132 | 1221 | #if defined(__BIONIC__) || defined(__CloudABI__) || \ |
| 1133 | 1222 | defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
| 1134 | 1223 | #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE |
| ... | ... | @@ -1175,6 +1264,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1175 | 1264 | # endif |
| 1176 | 1265 | #endif |
| 1177 | 1266 | |
| 1267 | #ifndef _LIBCPP_THREAD_SAFETY_ANNOTATION | |
| 1268 | # ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS | |
| 1269 | # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) | |
| 1270 | # else | |
| 1271 | # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) | |
| 1272 | # endif | |
| 1273 | #endif // _LIBCPP_THREAD_SAFETY_ANNOTATION | |
| 1274 | ||
| 1178 | 1275 | #if __has_attribute(require_constant_initialization) |
| 1179 | 1276 | # define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) |
| 1180 | 1277 | #else |
| ... | ... | @@ -1210,7 +1307,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1210 | 1307 | # define _LIBCPP_FALLTHROUGH() [[fallthrough]] |
| 1211 | 1308 | #elif __has_cpp_attribute(clang::fallthrough) |
| 1212 | 1309 | # define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]] |
| 1213 | #elif __has_attribute(fallthough) || _GNUC_VER >= 700 | |
| 1310 | #elif __has_attribute(fallthrough) || _GNUC_VER >= 700 | |
| 1214 | 1311 | # define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) |
| 1215 | 1312 | #else |
| 1216 | 1313 | # define _LIBCPP_FALLTHROUGH() ((void)0) |
| ... | ... | @@ -1224,7 +1321,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1224 | 1321 | |
| 1225 | 1322 | #ifndef _LIBCPP_NODEBUG_TYPE |
| 1226 | 1323 | #if __has_attribute(__nodebug__) && \ |
| 1227 | (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900) | |
| 1324 | (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900) | |
| 1228 | 1325 | #define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug)) |
| 1229 | 1326 | #else |
| 1230 | 1327 | #define _LIBCPP_NODEBUG_TYPE |
| ... | ... | @@ -1257,10 +1354,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1257 | 1354 | #define _LIBCPP_HAS_NO_COROUTINES |
| 1258 | 1355 | #endif |
| 1259 | 1356 | |
| 1260 | // FIXME: Correct this macro when either (A) a feature test macro for the | |
| 1261 | // spaceship operator is provided, or (B) a compiler provides a complete | |
| 1262 | // implementation. | |
| 1357 | #if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L | |
| 1263 | 1358 | #define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR |
| 1359 | #endif | |
| 1264 | 1360 | |
| 1265 | 1361 | // Decide whether to use availability macros. |
| 1266 | 1362 | #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ |
| ... | ... | @@ -1411,6 +1507,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1411 | 1507 | |
| 1412 | 1508 | #define _LIBCPP_UNUSED_VAR(x) ((void)(x)) |
| 1413 | 1509 | |
| 1510 | // Configures the fopen close-on-exec mode character, if any. This string will | |
| 1511 | // be appended to any mode string used by fstream for fopen/fdopen. | |
| 1512 | // | |
| 1513 | // Not all platforms support this, but it helps avoid fd-leaks on platforms that | |
| 1514 | // do. | |
| 1515 | #if defined(__BIONIC__) | |
| 1516 | # define _LIBCPP_FOPEN_CLOEXEC_MODE "e" | |
| 1517 | #else | |
| 1518 | # define _LIBCPP_FOPEN_CLOEXEC_MODE | |
| 1519 | #endif | |
| 1520 | ||
| 1414 | 1521 | #endif // __cplusplus |
| 1415 | 1522 | |
| 1416 | 1523 | #endif // _LIBCPP_CONFIG |
lib/libcxx/include/__config_site.in+1| ... | ... | @@ -29,6 +29,7 @@ |
| 29 | 29 | #cmakedefine _LIBCPP_NO_VCRUNTIME |
| 30 | 30 | #cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT |
| 31 | 31 | #cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ |
| 32 | #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS | |
| 32 | 33 | |
| 33 | 34 | @_LIBCPP_ABI_DEFINES@ |
| 34 | 35 |
lib/libcxx/include/__debug-1| ... | ... | @@ -276,4 +276,3 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); |
| 276 | 276 | _LIBCPP_END_NAMESPACE_STD |
| 277 | 277 | |
| 278 | 278 | #endif // _LIBCPP_DEBUG_H |
| 279 |
lib/libcxx/include/__functional_03+4-4| ... | ... | @@ -104,7 +104,7 @@ class __func<_Fp, _Alloc, _Rp()> |
| 104 | 104 | { |
| 105 | 105 | __compressed_pair<_Fp, _Alloc> __f_; |
| 106 | 106 | public: |
| 107 | explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} | |
| 107 | explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 108 | 108 | explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} |
| 109 | 109 | virtual __base<_Rp()>* __clone() const; |
| 110 | 110 | virtual void __clone(__base<_Rp()>*) const; |
| ... | ... | @@ -189,7 +189,7 @@ class __func<_Fp, _Alloc, _Rp(_A0)> |
| 189 | 189 | { |
| 190 | 190 | __compressed_pair<_Fp, _Alloc> __f_; |
| 191 | 191 | public: |
| 192 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} | |
| 192 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 193 | 193 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) |
| 194 | 194 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} |
| 195 | 195 | virtual __base<_Rp(_A0)>* __clone() const; |
| ... | ... | @@ -275,7 +275,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1)> |
| 275 | 275 | { |
| 276 | 276 | __compressed_pair<_Fp, _Alloc> __f_; |
| 277 | 277 | public: |
| 278 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} | |
| 278 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 279 | 279 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) |
| 280 | 280 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} |
| 281 | 281 | virtual __base<_Rp(_A0, _A1)>* __clone() const; |
| ... | ... | @@ -361,7 +361,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> |
| 361 | 361 | { |
| 362 | 362 | __compressed_pair<_Fp, _Alloc> __f_; |
| 363 | 363 | public: |
| 364 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {} | |
| 364 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 365 | 365 | _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a) |
| 366 | 366 | : __f_(_VSTD::move(__f), _VSTD::move(__a)) {} |
| 367 | 367 | virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const; |
lib/libcxx/include/__functional_base+1-1| ... | ... | @@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up, |
| 558 | 558 | |
| 559 | 559 | // allocator_arg_t |
| 560 | 560 | |
| 561 | struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; | |
| 561 | struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; | |
| 562 | 562 | |
| 563 | 563 | #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) |
| 564 | 564 | extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; |
lib/libcxx/include/__hash_table+14-12| ... | ... | @@ -776,7 +776,7 @@ public: |
| 776 | 776 | _LIBCPP_INLINE_VISIBILITY |
| 777 | 777 | __bucket_list_deallocator() |
| 778 | 778 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 779 | : __data_(0) {} | |
| 779 | : __data_(0, __default_init_tag()) {} | |
| 780 | 780 | |
| 781 | 781 | _LIBCPP_INLINE_VISIBILITY |
| 782 | 782 | __bucket_list_deallocator(const allocator_type& __a, size_type __size) |
| ... | ... | @@ -825,11 +825,13 @@ private: |
| 825 | 825 | |
| 826 | 826 | allocator_type& __na_; |
| 827 | 827 | |
| 828 | __hash_node_destructor& operator=(const __hash_node_destructor&); | |
| 829 | ||
| 830 | 828 | public: |
| 831 | 829 | bool __value_constructed; |
| 832 | 830 | |
| 831 | __hash_node_destructor(__hash_node_destructor const&) = default; | |
| 832 | __hash_node_destructor& operator=(const __hash_node_destructor&) = delete; | |
| 833 | ||
| 834 | ||
| 833 | 835 | _LIBCPP_INLINE_VISIBILITY |
| 834 | 836 | explicit __hash_node_destructor(allocator_type& __na, |
| 835 | 837 | bool __constructed = false) _NOEXCEPT |
| ... | ... | @@ -1416,8 +1418,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() |
| 1416 | 1418 | is_nothrow_default_constructible<__node_allocator>::value && |
| 1417 | 1419 | is_nothrow_default_constructible<hasher>::value && |
| 1418 | 1420 | is_nothrow_default_constructible<key_equal>::value) |
| 1419 | : __p2_(0), | |
| 1420 | __p3_(1.0f) | |
| 1421 | : __p2_(0, __default_init_tag()), | |
| 1422 | __p3_(1.0f, __default_init_tag()) | |
| 1421 | 1423 | { |
| 1422 | 1424 | } |
| 1423 | 1425 | |
| ... | ... | @@ -1437,7 +1439,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, |
| 1437 | 1439 | const key_equal& __eql, |
| 1438 | 1440 | const allocator_type& __a) |
| 1439 | 1441 | : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), |
| 1440 | __p1_(__second_tag(), __node_allocator(__a)), | |
| 1442 | __p1_(__default_init_tag(), __node_allocator(__a)), | |
| 1441 | 1443 | __p2_(0, __hf), |
| 1442 | 1444 | __p3_(1.0f, __eql) |
| 1443 | 1445 | { |
| ... | ... | @@ -1446,9 +1448,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, |
| 1446 | 1448 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1447 | 1449 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) |
| 1448 | 1450 | : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), |
| 1449 | __p1_(__second_tag(), __node_allocator(__a)), | |
| 1450 | __p2_(0), | |
| 1451 | __p3_(1.0f) | |
| 1451 | __p1_(__default_init_tag(), __node_allocator(__a)), | |
| 1452 | __p2_(0, __default_init_tag()), | |
| 1453 | __p3_(1.0f, __default_init_tag()) | |
| 1452 | 1454 | { |
| 1453 | 1455 | } |
| 1454 | 1456 | |
| ... | ... | @@ -1458,7 +1460,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) |
| 1458 | 1460 | __bucket_list_deleter(allocator_traits<__pointer_allocator>:: |
| 1459 | 1461 | select_on_container_copy_construction( |
| 1460 | 1462 | __u.__bucket_list_.get_deleter().__alloc()), 0)), |
| 1461 | __p1_(__second_tag(), allocator_traits<__node_allocator>:: | |
| 1463 | __p1_(__default_init_tag(), allocator_traits<__node_allocator>:: | |
| 1462 | 1464 | select_on_container_copy_construction(__u.__node_alloc())), |
| 1463 | 1465 | __p2_(0, __u.hash_function()), |
| 1464 | 1466 | __p3_(__u.__p3_) |
| ... | ... | @@ -1469,7 +1471,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1469 | 1471 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, |
| 1470 | 1472 | const allocator_type& __a) |
| 1471 | 1473 | : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), |
| 1472 | __p1_(__second_tag(), __node_allocator(__a)), | |
| 1474 | __p1_(__default_init_tag(), __node_allocator(__a)), | |
| 1473 | 1475 | __p2_(0, __u.hash_function()), |
| 1474 | 1476 | __p3_(__u.__p3_) |
| 1475 | 1477 | { |
| ... | ... | @@ -1503,7 +1505,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1503 | 1505 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, |
| 1504 | 1506 | const allocator_type& __a) |
| 1505 | 1507 | : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), |
| 1506 | __p1_(__second_tag(), __node_allocator(__a)), | |
| 1508 | __p1_(__default_init_tag(), __node_allocator(__a)), | |
| 1507 | 1509 | __p2_(0, _VSTD::move(__u.hash_function())), |
| 1508 | 1510 | __p3_(_VSTD::move(__u.__p3_)) |
| 1509 | 1511 | { |
lib/libcxx/include/__libcpp_version+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | 9000 | |
| 1 | 10000 |
lib/libcxx/include/__locale+1-1| ... | ... | @@ -409,7 +409,7 @@ public: |
| 409 | 409 | static const mask xdigit = _ISxdigit; |
| 410 | 410 | static const mask blank = _ISblank; |
| 411 | 411 | #if defined(__mips__) |
| 412 | static const mask __regex_word = static_cast<char_class_type>(_ISbit(15)); | |
| 412 | static const mask __regex_word = static_cast<mask>(_ISbit(15)); | |
| 413 | 413 | #else |
| 414 | 414 | static const mask __regex_word = 0x80; |
| 415 | 415 | #endif |
lib/libcxx/include/__mutex_base+134-31| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | #include <system_error> |
| 16 | 16 | #include <__threading_support> |
| 17 | 17 | |
| 18 | #include <time.h> | |
| 18 | 19 | |
| 19 | 20 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | 21 | #pragma GCC system_header |
| ... | ... | @@ -28,15 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 28 | 29 | |
| 29 | 30 | #ifndef _LIBCPP_HAS_NO_THREADS |
| 30 | 31 | |
| 31 | #ifndef _LIBCPP_THREAD_SAFETY_ANNOTATION | |
| 32 | # ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS | |
| 33 | # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) | |
| 34 | # else | |
| 35 | # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) | |
| 36 | # endif | |
| 37 | #endif // _LIBCPP_THREAD_SAFETY_ANNOTATION | |
| 38 | ||
| 39 | ||
| 40 | 32 | class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex |
| 41 | 33 | { |
| 42 | 34 | __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; |
| ... | ... | @@ -65,9 +57,9 @@ public: |
| 65 | 57 | static_assert(is_nothrow_default_constructible<mutex>::value, |
| 66 | 58 | "the default constructor for std::mutex must be nothrow"); |
| 67 | 59 | |
| 68 | struct _LIBCPP_TYPE_VIS defer_lock_t {}; | |
| 69 | struct _LIBCPP_TYPE_VIS try_to_lock_t {}; | |
| 70 | struct _LIBCPP_TYPE_VIS adopt_lock_t {}; | |
| 60 | struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; }; | |
| 61 | struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; }; | |
| 62 | struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; }; | |
| 71 | 63 | |
| 72 | 64 | #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) |
| 73 | 65 | |
| ... | ... | @@ -94,10 +86,11 @@ private: |
| 94 | 86 | mutex_type& __m_; |
| 95 | 87 | public: |
| 96 | 88 | |
| 97 | _LIBCPP_INLINE_VISIBILITY | |
| 89 | _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY | |
| 98 | 90 | explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) |
| 99 | 91 | : __m_(__m) {__m_.lock();} |
| 100 | _LIBCPP_INLINE_VISIBILITY | |
| 92 | ||
| 93 | _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY | |
| 101 | 94 | lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) |
| 102 | 95 | : __m_(__m) {} |
| 103 | 96 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -336,23 +329,75 @@ public: |
| 336 | 329 | private: |
| 337 | 330 | void __do_timed_wait(unique_lock<mutex>& __lk, |
| 338 | 331 | chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT; |
| 332 | #if defined(_LIBCPP_HAS_COND_CLOCKWAIT) | |
| 333 | void __do_timed_wait(unique_lock<mutex>& __lk, | |
| 334 | chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT; | |
| 335 | #endif | |
| 336 | template <class _Clock> | |
| 337 | void __do_timed_wait(unique_lock<mutex>& __lk, | |
| 338 | chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT; | |
| 339 | 339 | }; |
| 340 | 340 | #endif // !_LIBCPP_HAS_NO_THREADS |
| 341 | 341 | |
| 342 | template <class _To, class _Rep, class _Period> | |
| 342 | template <class _Rep, class _Period> | |
| 343 | 343 | inline _LIBCPP_INLINE_VISIBILITY |
| 344 | 344 | typename enable_if |
| 345 | 345 | < |
| 346 | chrono::__is_duration<_To>::value, | |
| 347 | _To | |
| 346 | is_floating_point<_Rep>::value, | |
| 347 | chrono::nanoseconds | |
| 348 | 348 | >::type |
| 349 | __ceil(chrono::duration<_Rep, _Period> __d) | |
| 349 | __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) | |
| 350 | 350 | { |
| 351 | 351 | using namespace chrono; |
| 352 | _To __r = duration_cast<_To>(__d); | |
| 353 | if (__r < __d) | |
| 354 | ++__r; | |
| 355 | return __r; | |
| 352 | using __ratio = ratio_divide<_Period, nano>; | |
| 353 | using __ns_rep = nanoseconds::rep; | |
| 354 | _Rep __result_float = __d.count() * __ratio::num / __ratio::den; | |
| 355 | ||
| 356 | _Rep __result_max = numeric_limits<__ns_rep>::max(); | |
| 357 | if (__result_float >= __result_max) { | |
| 358 | return nanoseconds::max(); | |
| 359 | } | |
| 360 | ||
| 361 | _Rep __result_min = numeric_limits<__ns_rep>::min(); | |
| 362 | if (__result_float <= __result_min) { | |
| 363 | return nanoseconds::min(); | |
| 364 | } | |
| 365 | ||
| 366 | return nanoseconds(static_cast<__ns_rep>(__result_float)); | |
| 367 | } | |
| 368 | ||
| 369 | template <class _Rep, class _Period> | |
| 370 | inline _LIBCPP_INLINE_VISIBILITY | |
| 371 | typename enable_if | |
| 372 | < | |
| 373 | !is_floating_point<_Rep>::value, | |
| 374 | chrono::nanoseconds | |
| 375 | >::type | |
| 376 | __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) | |
| 377 | { | |
| 378 | using namespace chrono; | |
| 379 | if (__d.count() == 0) { | |
| 380 | return nanoseconds(0); | |
| 381 | } | |
| 382 | ||
| 383 | using __ratio = ratio_divide<_Period, nano>; | |
| 384 | using __ns_rep = nanoseconds::rep; | |
| 385 | __ns_rep __result_max = std::numeric_limits<__ns_rep>::max(); | |
| 386 | if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { | |
| 387 | return nanoseconds::max(); | |
| 388 | } | |
| 389 | ||
| 390 | __ns_rep __result_min = std::numeric_limits<__ns_rep>::min(); | |
| 391 | if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { | |
| 392 | return nanoseconds::min(); | |
| 393 | } | |
| 394 | ||
| 395 | __ns_rep __result = __d.count() * __ratio::num / __ratio::den; | |
| 396 | if (__result == 0) { | |
| 397 | return nanoseconds(1); | |
| 398 | } | |
| 399 | ||
| 400 | return nanoseconds(__result); | |
| 356 | 401 | } |
| 357 | 402 | |
| 358 | 403 | #ifndef _LIBCPP_HAS_NO_THREADS |
| ... | ... | @@ -370,7 +415,15 @@ condition_variable::wait_until(unique_lock<mutex>& __lk, |
| 370 | 415 | const chrono::time_point<_Clock, _Duration>& __t) |
| 371 | 416 | { |
| 372 | 417 | using namespace chrono; |
| 373 | wait_for(__lk, __t - _Clock::now()); | |
| 418 | using __clock_tp_ns = time_point<_Clock, nanoseconds>; | |
| 419 | ||
| 420 | typename _Clock::time_point __now = _Clock::now(); | |
| 421 | if (__t <= __now) | |
| 422 | return cv_status::timeout; | |
| 423 | ||
| 424 | __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch())); | |
| 425 | ||
| 426 | __do_timed_wait(__lk, __t_ns); | |
| 374 | 427 | return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; |
| 375 | 428 | } |
| 376 | 429 | |
| ... | ... | @@ -396,15 +449,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk, |
| 396 | 449 | using namespace chrono; |
| 397 | 450 | if (__d <= __d.zero()) |
| 398 | 451 | return cv_status::timeout; |
| 399 | typedef time_point<system_clock, duration<long double, nano> > __sys_tpf; | |
| 400 | typedef time_point<system_clock, nanoseconds> __sys_tpi; | |
| 401 | __sys_tpf _Max = __sys_tpi::max(); | |
| 452 | using __ns_rep = nanoseconds::rep; | |
| 402 | 453 | steady_clock::time_point __c_now = steady_clock::now(); |
| 403 | system_clock::time_point __s_now = system_clock::now(); | |
| 404 | if (_Max - __d > __s_now) | |
| 405 | __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d)); | |
| 406 | else | |
| 407 | __do_timed_wait(__lk, __sys_tpi::max()); | |
| 454 | ||
| 455 | #if defined(_LIBCPP_HAS_COND_CLOCKWAIT) | |
| 456 | using __clock_tp_ns = time_point<steady_clock, nanoseconds>; | |
| 457 | __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count(); | |
| 458 | #else | |
| 459 | using __clock_tp_ns = time_point<system_clock, nanoseconds>; | |
| 460 | __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); | |
| 461 | #endif | |
| 462 | ||
| 463 | __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count(); | |
| 464 | ||
| 465 | if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { | |
| 466 | __do_timed_wait(__lk, __clock_tp_ns::max()); | |
| 467 | } else { | |
| 468 | __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); | |
| 469 | } | |
| 470 | ||
| 408 | 471 | return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : |
| 409 | 472 | cv_status::timeout; |
| 410 | 473 | } |
| ... | ... | @@ -420,6 +483,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk, |
| 420 | 483 | _VSTD::move(__pred)); |
| 421 | 484 | } |
| 422 | 485 | |
| 486 | #if defined(_LIBCPP_HAS_COND_CLOCKWAIT) | |
| 487 | inline | |
| 488 | void | |
| 489 | condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, | |
| 490 | chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT | |
| 491 | { | |
| 492 | using namespace chrono; | |
| 493 | if (!__lk.owns_lock()) | |
| 494 | __throw_system_error(EPERM, | |
| 495 | "condition_variable::timed wait: mutex not locked"); | |
| 496 | nanoseconds __d = __tp.time_since_epoch(); | |
| 497 | timespec __ts; | |
| 498 | seconds __s = duration_cast<seconds>(__d); | |
| 499 | using __ts_sec = decltype(__ts.tv_sec); | |
| 500 | const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); | |
| 501 | if (__s.count() < __ts_sec_max) | |
| 502 | { | |
| 503 | __ts.tv_sec = static_cast<__ts_sec>(__s.count()); | |
| 504 | __ts.tv_nsec = (__d - __s).count(); | |
| 505 | } | |
| 506 | else | |
| 507 | { | |
| 508 | __ts.tv_sec = __ts_sec_max; | |
| 509 | __ts.tv_nsec = giga::num - 1; | |
| 510 | } | |
| 511 | int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); | |
| 512 | if (__ec != 0 && __ec != ETIMEDOUT) | |
| 513 | __throw_system_error(__ec, "condition_variable timed_wait failed"); | |
| 514 | } | |
| 515 | #endif // _LIBCPP_HAS_COND_CLOCKWAIT | |
| 516 | ||
| 517 | template <class _Clock> | |
| 518 | inline | |
| 519 | void | |
| 520 | condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, | |
| 521 | chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT | |
| 522 | { | |
| 523 | wait_for(__lk, __tp - _Clock::now()); | |
| 524 | } | |
| 525 | ||
| 423 | 526 | #endif // !_LIBCPP_HAS_NO_THREADS |
| 424 | 527 | |
| 425 | 528 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__split_buffer+43-36| ... | ... | @@ -116,15 +116,15 @@ public: |
| 116 | 116 | template <class _InputIter> |
| 117 | 117 | typename enable_if |
| 118 | 118 | < |
| 119 | __is_input_iterator<_InputIter>::value && | |
| 120 | !__is_forward_iterator<_InputIter>::value, | |
| 119 | __is_cpp17_input_iterator<_InputIter>::value && | |
| 120 | !__is_cpp17_forward_iterator<_InputIter>::value, | |
| 121 | 121 | void |
| 122 | 122 | >::type |
| 123 | 123 | __construct_at_end(_InputIter __first, _InputIter __last); |
| 124 | 124 | template <class _ForwardIterator> |
| 125 | 125 | typename enable_if |
| 126 | 126 | < |
| 127 | __is_forward_iterator<_ForwardIterator>::value, | |
| 127 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 128 | 128 | void |
| 129 | 129 | >::type |
| 130 | 130 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -161,6 +161,19 @@ private: |
| 161 | 161 | _LIBCPP_INLINE_VISIBILITY |
| 162 | 162 | void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT |
| 163 | 163 | {} |
| 164 | ||
| 165 | struct _ConstructTransaction { | |
| 166 | explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT | |
| 167 | : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { | |
| 168 | } | |
| 169 | ~_ConstructTransaction() { | |
| 170 | *__dest_ = __pos_; | |
| 171 | } | |
| 172 | pointer __pos_; | |
| 173 | const pointer __end_; | |
| 174 | private: | |
| 175 | pointer *__dest_; | |
| 176 | }; | |
| 164 | 177 | }; |
| 165 | 178 | |
| 166 | 179 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -197,13 +210,10 @@ template <class _Tp, class _Allocator> |
| 197 | 210 | void |
| 198 | 211 | __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 199 | 212 | { |
| 200 | __alloc_rr& __a = this->__alloc(); | |
| 201 | do | |
| 202 | { | |
| 203 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); | |
| 204 | ++this->__end_; | |
| 205 | --__n; | |
| 206 | } while (__n > 0); | |
| 213 | _ConstructTransaction __tx(&this->__end_, __n); | |
| 214 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { | |
| 215 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_)); | |
| 216 | } | |
| 207 | 217 | } |
| 208 | 218 | |
| 209 | 219 | // Copy constructs __n objects starting at __end_ from __x |
| ... | ... | @@ -216,21 +226,19 @@ template <class _Tp, class _Allocator> |
| 216 | 226 | void |
| 217 | 227 | __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| 218 | 228 | { |
| 219 | __alloc_rr& __a = this->__alloc(); | |
| 220 | do | |
| 221 | { | |
| 222 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); | |
| 223 | ++this->__end_; | |
| 224 | --__n; | |
| 225 | } while (__n > 0); | |
| 229 | _ConstructTransaction __tx(&this->__end_, __n); | |
| 230 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { | |
| 231 | __alloc_traits::construct(this->__alloc(), | |
| 232 | _VSTD::__to_address(__tx.__pos_), __x); | |
| 233 | } | |
| 226 | 234 | } |
| 227 | 235 | |
| 228 | 236 | template <class _Tp, class _Allocator> |
| 229 | 237 | template <class _InputIter> |
| 230 | 238 | typename enable_if |
| 231 | 239 | < |
| 232 | __is_input_iterator<_InputIter>::value && | |
| 233 | !__is_forward_iterator<_InputIter>::value, | |
| 240 | __is_cpp17_input_iterator<_InputIter>::value && | |
| 241 | !__is_cpp17_forward_iterator<_InputIter>::value, | |
| 234 | 242 | void |
| 235 | 243 | >::type |
| 236 | 244 | __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) |
| ... | ... | @@ -245,10 +253,10 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt |
| 245 | 253 | __split_buffer __buf(__new_cap, 0, __a); |
| 246 | 254 | for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_) |
| 247 | 255 | __alloc_traits::construct(__buf.__alloc(), |
| 248 | _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p)); | |
| 256 | _VSTD::__to_address(__buf.__end_), _VSTD::move(*__p)); | |
| 249 | 257 | swap(__buf); |
| 250 | 258 | } |
| 251 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); | |
| 259 | __alloc_traits::construct(__a, _VSTD::__to_address(this->__end_), *__first); | |
| 252 | 260 | ++this->__end_; |
| 253 | 261 | } |
| 254 | 262 | } |
| ... | ... | @@ -257,16 +265,15 @@ template <class _Tp, class _Allocator> |
| 257 | 265 | template <class _ForwardIterator> |
| 258 | 266 | typename enable_if |
| 259 | 267 | < |
| 260 | __is_forward_iterator<_ForwardIterator>::value, | |
| 268 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 261 | 269 | void |
| 262 | 270 | >::type |
| 263 | 271 | __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) |
| 264 | 272 | { |
| 265 | __alloc_rr& __a = this->__alloc(); | |
| 266 | for (; __first != __last; ++__first) | |
| 267 | { | |
| 268 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); | |
| 269 | ++this->__end_; | |
| 273 | _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last)); | |
| 274 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) { | |
| 275 | __alloc_traits::construct(this->__alloc(), | |
| 276 | _VSTD::__to_address(__tx.__pos_), *__first); | |
| 270 | 277 | } |
| 271 | 278 | } |
| 272 | 279 | |
| ... | ... | @@ -276,7 +283,7 @@ void |
| 276 | 283 | __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) |
| 277 | 284 | { |
| 278 | 285 | while (__begin_ != __new_begin) |
| 279 | __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++)); | |
| 286 | __alloc_traits::destroy(__alloc(), __to_address(__begin_++)); | |
| 280 | 287 | } |
| 281 | 288 | |
| 282 | 289 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -293,7 +300,7 @@ void |
| 293 | 300 | __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT |
| 294 | 301 | { |
| 295 | 302 | while (__new_last != __end_) |
| 296 | __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_)); | |
| 303 | __alloc_traits::destroy(__alloc(), __to_address(--__end_)); | |
| 297 | 304 | } |
| 298 | 305 | |
| 299 | 306 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -317,7 +324,7 @@ template <class _Tp, class _Allocator> |
| 317 | 324 | inline |
| 318 | 325 | __split_buffer<_Tp, _Allocator>::__split_buffer() |
| 319 | 326 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 320 | : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr) | |
| 327 | : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag()) | |
| 321 | 328 | { |
| 322 | 329 | } |
| 323 | 330 | |
| ... | ... | @@ -361,7 +368,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) |
| 361 | 368 | |
| 362 | 369 | template <class _Tp, class _Allocator> |
| 363 | 370 | __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) |
| 364 | : __end_cap_(__second_tag(), __a) | |
| 371 | : __end_cap_(nullptr, __a) | |
| 365 | 372 | { |
| 366 | 373 | if (__a == __c.__alloc()) |
| 367 | 374 | { |
| ... | ... | @@ -488,7 +495,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) |
| 488 | 495 | _VSTD::swap(__end_cap(), __t.__end_cap()); |
| 489 | 496 | } |
| 490 | 497 | } |
| 491 | __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x); | |
| 498 | __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1), __x); | |
| 492 | 499 | --__begin_; |
| 493 | 500 | } |
| 494 | 501 | |
| ... | ... | @@ -519,7 +526,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| 519 | 526 | _VSTD::swap(__end_cap(), __t.__end_cap()); |
| 520 | 527 | } |
| 521 | 528 | } |
| 522 | __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), | |
| 529 | __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1), | |
| 523 | 530 | _VSTD::move(__x)); |
| 524 | 531 | --__begin_; |
| 525 | 532 | } |
| ... | ... | @@ -552,7 +559,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) |
| 552 | 559 | _VSTD::swap(__end_cap(), __t.__end_cap()); |
| 553 | 560 | } |
| 554 | 561 | } |
| 555 | __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x); | |
| 562 | __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_), __x); | |
| 556 | 563 | ++__end_; |
| 557 | 564 | } |
| 558 | 565 | |
| ... | ... | @@ -583,7 +590,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) |
| 583 | 590 | _VSTD::swap(__end_cap(), __t.__end_cap()); |
| 584 | 591 | } |
| 585 | 592 | } |
| 586 | __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), | |
| 593 | __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_), | |
| 587 | 594 | _VSTD::move(__x)); |
| 588 | 595 | ++__end_; |
| 589 | 596 | } |
| ... | ... | @@ -614,7 +621,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 614 | 621 | _VSTD::swap(__end_cap(), __t.__end_cap()); |
| 615 | 622 | } |
| 616 | 623 | } |
| 617 | __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), | |
| 624 | __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_), | |
| 618 | 625 | _VSTD::forward<_Args>(__args)...); |
| 619 | 626 | ++__end_; |
| 620 | 627 | } |
lib/libcxx/include/__string+140-52| ... | ... | @@ -31,11 +31,12 @@ struct char_traits |
| 31 | 31 | |
| 32 | 32 | static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); |
| 33 | 33 | static constexpr size_t length(const char_type* s); |
| 34 | static constexpr const char_type* | |
| 34 | static constexpr const char_type* | |
| 35 | 35 | find(const char_type* s, size_t n, const char_type& a); |
| 36 | static char_type* move(char_type* s1, const char_type* s2, size_t n); | |
| 37 | static char_type* copy(char_type* s1, const char_type* s2, size_t n); | |
| 38 | static char_type* assign(char_type* s, size_t n, char_type a); | |
| 36 | ||
| 37 | static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20 | |
| 38 | static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20 | |
| 39 | static constexpr char_type* assign(char_type* s, size_t n, char_type a); // constexpr in C++20 | |
| 39 | 40 | |
| 40 | 41 | static constexpr int_type not_eof(int_type c) noexcept; |
| 41 | 42 | static constexpr char_type to_char_type(int_type c) noexcept; |
| ... | ... | @@ -93,11 +94,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits |
| 93 | 94 | size_t length(const char_type* __s); |
| 94 | 95 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 95 | 96 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a); |
| 96 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); | |
| 97 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 98 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n); | |
| 97 | 99 | _LIBCPP_INLINE_VISIBILITY |
| 98 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); | |
| 100 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 101 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); | |
| 99 | 102 | _LIBCPP_INLINE_VISIBILITY |
| 100 | static char_type* assign(char_type* __s, size_t __n, char_type __a); | |
| 103 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 104 | char_type* assign(char_type* __s, size_t __n, char_type __a); | |
| 101 | 105 | |
| 102 | 106 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| 103 | 107 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| ... | ... | @@ -151,9 +155,10 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a |
| 151 | 155 | } |
| 152 | 156 | |
| 153 | 157 | template <class _CharT> |
| 154 | _CharT* | |
| 158 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT* | |
| 155 | 159 | char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) |
| 156 | 160 | { |
| 161 | if (__n == 0) return __s1; | |
| 157 | 162 | char_type* __r = __s1; |
| 158 | 163 | if (__s1 < __s2) |
| 159 | 164 | { |
| ... | ... | @@ -171,7 +176,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) |
| 171 | 176 | } |
| 172 | 177 | |
| 173 | 178 | template <class _CharT> |
| 174 | inline | |
| 179 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 175 | 180 | _CharT* |
| 176 | 181 | char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) |
| 177 | 182 | { |
| ... | ... | @@ -183,7 +188,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) |
| 183 | 188 | } |
| 184 | 189 | |
| 185 | 190 | template <class _CharT> |
| 186 | inline | |
| 191 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 187 | 192 | _CharT* |
| 188 | 193 | char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) |
| 189 | 194 | { |
| ... | ... | @@ -193,6 +198,37 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) |
| 193 | 198 | return __r; |
| 194 | 199 | } |
| 195 | 200 | |
| 201 | // constexpr versions of move/copy/assign. | |
| 202 | ||
| 203 | template <class _CharT> | |
| 204 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 205 | _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT | |
| 206 | { | |
| 207 | if (__n == 0) return __s1; | |
| 208 | if (__s1 < __s2) { | |
| 209 | _VSTD::copy(__s2, __s2 + __n, __s1); | |
| 210 | } else if (__s2 < __s1) { | |
| 211 | _VSTD::copy_backward(__s2, __s2 + __n, __s1 + __n); | |
| 212 | } | |
| 213 | return __s1; | |
| 214 | } | |
| 215 | ||
| 216 | template <class _CharT> | |
| 217 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 218 | _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT | |
| 219 | { | |
| 220 | _VSTD::copy_n(__s2, __n, __s1); | |
| 221 | return __s1; | |
| 222 | } | |
| 223 | ||
| 224 | template <class _CharT> | |
| 225 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 226 | _CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT | |
| 227 | { | |
| 228 | _VSTD::fill_n(__s, __n, __a); | |
| 229 | return __s; | |
| 230 | } | |
| 231 | ||
| 196 | 232 | // char_traits<char> |
| 197 | 233 | |
| 198 | 234 | template <> |
| ... | ... | @@ -217,15 +253,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> |
| 217 | 253 | length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);} |
| 218 | 254 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 219 | 255 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 220 | static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 221 | {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} | |
| 222 | static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 256 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 257 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 258 | { | |
| 259 | return __libcpp_is_constant_evaluated() | |
| 260 | ? __move_constexpr(__s1, __s2, __n) | |
| 261 | : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); | |
| 262 | } | |
| 263 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 264 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 223 | 265 | { |
| 224 | 266 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 225 | return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 267 | return __libcpp_is_constant_evaluated() | |
| 268 | ? __copy_constexpr(__s1, __s2, __n) | |
| 269 | : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 270 | } | |
| 271 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 272 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 273 | { | |
| 274 | return __libcpp_is_constant_evaluated() | |
| 275 | ? __assign_constexpr(__s, __n, __a) | |
| 276 | : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); | |
| 226 | 277 | } |
| 227 | static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 228 | {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} | |
| 229 | 278 | |
| 230 | 279 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| 231 | 280 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| ... | ... | @@ -307,16 +356,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> |
| 307 | 356 | size_t length(const char_type* __s) _NOEXCEPT; |
| 308 | 357 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 309 | 358 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 310 | static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 311 | {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);} | |
| 312 | static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 359 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 360 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 361 | { | |
| 362 | return __libcpp_is_constant_evaluated() | |
| 363 | ? __move_constexpr(__s1, __s2, __n) | |
| 364 | : __n == 0 ? __s1 : wmemmove(__s1, __s2, __n); | |
| 365 | } | |
| 366 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 367 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 313 | 368 | { |
| 314 | 369 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 315 | return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n); | |
| 370 | return __libcpp_is_constant_evaluated() | |
| 371 | ? __copy_constexpr(__s1, __s2, __n) | |
| 372 | : __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n); | |
| 373 | } | |
| 374 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 375 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 376 | { | |
| 377 | return __libcpp_is_constant_evaluated() | |
| 378 | ? __assign_constexpr(__s, __n, __a) | |
| 379 | : __n == 0 ? __s : wmemset(__s, __a, __n); | |
| 316 | 380 | } |
| 317 | static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 318 | {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);} | |
| 319 | ||
| 320 | 381 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| 321 | 382 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| 322 | 383 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT |
| ... | ... | @@ -351,6 +412,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size |
| 351 | 412 | #endif |
| 352 | 413 | } |
| 353 | 414 | |
| 415 | ||
| 416 | template <class _Traits> | |
| 417 | _LIBCPP_INLINE_VISIBILITY | |
| 418 | _LIBCPP_CONSTEXPR | |
| 419 | inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { | |
| 420 | #if _LIBCPP_DEBUG_LEVEL >= 1 | |
| 421 | return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); | |
| 422 | #else | |
| 423 | return _Traits::length(__s); | |
| 424 | #endif | |
| 425 | } | |
| 426 | ||
| 354 | 427 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 355 | 428 | size_t |
| 356 | 429 | char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT |
| ... | ... | @@ -412,21 +485,34 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 412 | 485 | |
| 413 | 486 | static constexpr |
| 414 | 487 | size_t length(const char_type* __s) _NOEXCEPT; |
| 415 | ||
| 488 | ||
| 416 | 489 | _LIBCPP_INLINE_VISIBILITY static constexpr |
| 417 | 490 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 418 | ||
| 419 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 420 | {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} | |
| 421 | ||
| 422 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 491 | ||
| 492 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 493 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 494 | { | |
| 495 | return __libcpp_is_constant_evaluated() | |
| 496 | ? __move_constexpr(__s1, __s2, __n) | |
| 497 | : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); | |
| 498 | } | |
| 499 | ||
| 500 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 501 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | |
| 423 | 502 | { |
| 424 | 503 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 425 | return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 426 | } | |
| 427 | ||
| 428 | static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 429 | {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} | |
| 504 | return __libcpp_is_constant_evaluated() | |
| 505 | ? __copy_constexpr(__s1, __s2, __n) | |
| 506 | : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 507 | } | |
| 508 | ||
| 509 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 510 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | |
| 511 | { | |
| 512 | return __libcpp_is_constant_evaluated() | |
| 513 | ? __assign_constexpr(__s, __n, __a) | |
| 514 | : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); | |
| 515 | } | |
| 430 | 516 | |
| 431 | 517 | static inline constexpr int_type not_eof(int_type __c) noexcept |
| 432 | 518 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| ... | ... | @@ -509,11 +595,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> |
| 509 | 595 | size_t length(const char_type* __s) _NOEXCEPT; |
| 510 | 596 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 511 | 597 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 512 | _LIBCPP_INLINE_VISIBILITY | |
| 598 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 513 | 599 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 514 | _LIBCPP_INLINE_VISIBILITY | |
| 600 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 515 | 601 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 516 | _LIBCPP_INLINE_VISIBILITY | |
| 602 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 517 | 603 | static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; |
| 518 | 604 | |
| 519 | 605 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| ... | ... | @@ -565,10 +651,11 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 565 | 651 | return 0; |
| 566 | 652 | } |
| 567 | 653 | |
| 568 | inline | |
| 654 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 569 | 655 | char16_t* |
| 570 | 656 | char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 571 | 657 | { |
| 658 | if (__n == 0) return __s1; | |
| 572 | 659 | char_type* __r = __s1; |
| 573 | 660 | if (__s1 < __s2) |
| 574 | 661 | { |
| ... | ... | @@ -585,7 +672,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) |
| 585 | 672 | return __r; |
| 586 | 673 | } |
| 587 | 674 | |
| 588 | inline | |
| 675 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 589 | 676 | char16_t* |
| 590 | 677 | char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 591 | 678 | { |
| ... | ... | @@ -596,7 +683,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) |
| 596 | 683 | return __r; |
| 597 | 684 | } |
| 598 | 685 | |
| 599 | inline | |
| 686 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 600 | 687 | char16_t* |
| 601 | 688 | char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT |
| 602 | 689 | { |
| ... | ... | @@ -628,11 +715,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> |
| 628 | 715 | size_t length(const char_type* __s) _NOEXCEPT; |
| 629 | 716 | _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 630 | 717 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 631 | _LIBCPP_INLINE_VISIBILITY | |
| 718 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 632 | 719 | static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 633 | _LIBCPP_INLINE_VISIBILITY | |
| 720 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 634 | 721 | static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; |
| 635 | _LIBCPP_INLINE_VISIBILITY | |
| 722 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 636 | 723 | static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; |
| 637 | 724 | |
| 638 | 725 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| ... | ... | @@ -684,10 +771,11 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 684 | 771 | return 0; |
| 685 | 772 | } |
| 686 | 773 | |
| 687 | inline | |
| 774 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 688 | 775 | char32_t* |
| 689 | 776 | char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 690 | 777 | { |
| 778 | if (__n == 0) return __s1; | |
| 691 | 779 | char_type* __r = __s1; |
| 692 | 780 | if (__s1 < __s2) |
| 693 | 781 | { |
| ... | ... | @@ -704,7 +792,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) |
| 704 | 792 | return __r; |
| 705 | 793 | } |
| 706 | 794 | |
| 707 | inline | |
| 795 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 708 | 796 | char32_t* |
| 709 | 797 | char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 710 | 798 | { |
| ... | ... | @@ -715,7 +803,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) |
| 715 | 803 | return __r; |
| 716 | 804 | } |
| 717 | 805 | |
| 718 | inline | |
| 806 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 719 | 807 | char32_t* |
| 720 | 808 | char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT |
| 721 | 809 | { |
| ... | ... | @@ -732,7 +820,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCE |
| 732 | 820 | // __str_find |
| 733 | 821 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 734 | 822 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY |
| 735 | __str_find(const _CharT *__p, _SizeT __sz, | |
| 823 | __str_find(const _CharT *__p, _SizeT __sz, | |
| 736 | 824 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 737 | 825 | { |
| 738 | 826 | if (__pos >= __sz) |
| ... | ... | @@ -784,7 +872,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1, |
| 784 | 872 | |
| 785 | 873 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 786 | 874 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY |
| 787 | __str_find(const _CharT *__p, _SizeT __sz, | |
| 875 | __str_find(const _CharT *__p, _SizeT __sz, | |
| 788 | 876 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 789 | 877 | { |
| 790 | 878 | if (__pos > __sz) |
| ... | ... | @@ -806,7 +894,7 @@ __str_find(const _CharT *__p, _SizeT __sz, |
| 806 | 894 | |
| 807 | 895 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 808 | 896 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY |
| 809 | __str_rfind(const _CharT *__p, _SizeT __sz, | |
| 897 | __str_rfind(const _CharT *__p, _SizeT __sz, | |
| 810 | 898 | _CharT __c, _SizeT __pos) _NOEXCEPT |
| 811 | 899 | { |
| 812 | 900 | if (__sz < 1) |
| ... | ... | @@ -825,7 +913,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz, |
| 825 | 913 | |
| 826 | 914 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> |
| 827 | 915 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY |
| 828 | __str_rfind(const _CharT *__p, _SizeT __sz, | |
| 916 | __str_rfind(const _CharT *__p, _SizeT __sz, | |
| 829 | 917 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT |
| 830 | 918 | { |
| 831 | 919 | __pos = _VSTD::min(__pos, __sz); |
| ... | ... | @@ -834,7 +922,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz, |
| 834 | 922 | else |
| 835 | 923 | __pos = __sz; |
| 836 | 924 | const _CharT* __r = _VSTD::__find_end( |
| 837 | __p, __p + __pos, __s, __s + __n, _Traits::eq, | |
| 925 | __p, __p + __pos, __s, __s + __n, _Traits::eq, | |
| 838 | 926 | random_access_iterator_tag(), random_access_iterator_tag()); |
| 839 | 927 | if (__n > 0 && __r == __p + __pos) |
| 840 | 928 | return __npos; |
| ... | ... | @@ -963,7 +1051,7 @@ struct __quoted_output_proxy |
| 963 | 1051 | |
| 964 | 1052 | __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) |
| 965 | 1053 | : __first(__f), __last(__l), __delim(__d), __escape(__e) {} |
| 966 | // This would be a nice place for a string_ref | |
| 1054 | // This would be a nice place for a string_ref | |
| 967 | 1055 | }; |
| 968 | 1056 | |
| 969 | 1057 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/__threading_support+236-29| ... | ... | @@ -23,16 +23,13 @@ |
| 23 | 23 | # include <__external_threading> |
| 24 | 24 | #elif !defined(_LIBCPP_HAS_NO_THREADS) |
| 25 | 25 | |
| 26 | typedef ::timespec __libcpp_timespec_t; | |
| 27 | ||
| 28 | 26 | #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) |
| 29 | 27 | # include <pthread.h> |
| 30 | 28 | # include <sched.h> |
| 29 | #elif defined(_LIBCPP_HAS_THREAD_API_C11) | |
| 30 | # include <threads.h> | |
| 31 | 31 | #endif |
| 32 | 32 | |
| 33 | _LIBCPP_PUSH_MACROS | |
| 34 | #include <__undef_macros> | |
| 35 | ||
| 36 | 33 | #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ |
| 37 | 34 | defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \ |
| 38 | 35 | defined(_LIBCPP_HAS_THREAD_API_WIN32) |
| ... | ... | @@ -47,8 +44,16 @@ _LIBCPP_PUSH_MACROS |
| 47 | 44 | #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS |
| 48 | 45 | #endif |
| 49 | 46 | |
| 47 | typedef ::timespec __libcpp_timespec_t; | |
| 48 | #endif // !defined(_LIBCPP_HAS_NO_THREADS) | |
| 49 | ||
| 50 | _LIBCPP_PUSH_MACROS | |
| 51 | #include <__undef_macros> | |
| 52 | ||
| 50 | 53 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 51 | 54 | |
| 55 | #if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 56 | ||
| 52 | 57 | #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) |
| 53 | 58 | // Mutex |
| 54 | 59 | typedef pthread_mutex_t __libcpp_mutex_t; |
| ... | ... | @@ -76,7 +81,36 @@ typedef pthread_t __libcpp_thread_t; |
| 76 | 81 | typedef pthread_key_t __libcpp_tls_key; |
| 77 | 82 | |
| 78 | 83 | #define _LIBCPP_TLS_DESTRUCTOR_CC |
| 79 | #else | |
| 84 | #elif defined(_LIBCPP_HAS_THREAD_API_C11) | |
| 85 | // Mutex | |
| 86 | typedef mtx_t __libcpp_mutex_t; | |
| 87 | // mtx_t is a struct so using {} for initialization is valid. | |
| 88 | #define _LIBCPP_MUTEX_INITIALIZER {} | |
| 89 | ||
| 90 | typedef mtx_t __libcpp_recursive_mutex_t; | |
| 91 | ||
| 92 | // Condition Variable | |
| 93 | typedef cnd_t __libcpp_condvar_t; | |
| 94 | // cnd_t is a struct so using {} for initialization is valid. | |
| 95 | #define _LIBCPP_CONDVAR_INITIALIZER {} | |
| 96 | ||
| 97 | // Execute once | |
| 98 | typedef once_flag __libcpp_exec_once_flag; | |
| 99 | #define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT | |
| 100 | ||
| 101 | // Thread id | |
| 102 | typedef thrd_t __libcpp_thread_id; | |
| 103 | ||
| 104 | // Thread | |
| 105 | #define _LIBCPP_NULL_THREAD 0U | |
| 106 | ||
| 107 | typedef thrd_t __libcpp_thread_t; | |
| 108 | ||
| 109 | // Thread Local Storage | |
| 110 | typedef tss_t __libcpp_tls_key; | |
| 111 | ||
| 112 | #define _LIBCPP_TLS_DESTRUCTOR_CC | |
| 113 | #elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) | |
| 80 | 114 | // Mutex |
| 81 | 115 | typedef void* __libcpp_mutex_t; |
| 82 | 116 | #define _LIBCPP_MUTEX_INITIALIZER 0 |
| ... | ... | @@ -109,8 +143,9 @@ typedef void* __libcpp_thread_t; |
| 109 | 143 | typedef long __libcpp_tls_key; |
| 110 | 144 | |
| 111 | 145 | #define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall |
| 112 | #endif | |
| 146 | #endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) | |
| 113 | 147 | |
| 148 | #if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) | |
| 114 | 149 | // Mutex |
| 115 | 150 | _LIBCPP_THREAD_ABI_VISIBILITY |
| 116 | 151 | int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); |
| ... | ... | @@ -205,9 +240,38 @@ void *__libcpp_tls_get(__libcpp_tls_key __key); |
| 205 | 240 | _LIBCPP_THREAD_ABI_VISIBILITY |
| 206 | 241 | int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); |
| 207 | 242 | |
| 243 | #endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) | |
| 244 | ||
| 208 | 245 | #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ |
| 209 | defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \ | |
| 210 | defined(_LIBCPP_HAS_THREAD_API_PTHREAD) | |
| 246 | defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) | |
| 247 | ||
| 248 | namespace __thread_detail { | |
| 249 | ||
| 250 | inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns) | |
| 251 | { | |
| 252 | using namespace chrono; | |
| 253 | seconds __s = duration_cast<seconds>(__ns); | |
| 254 | __libcpp_timespec_t __ts; | |
| 255 | typedef decltype(__ts.tv_sec) __ts_sec; | |
| 256 | const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); | |
| 257 | ||
| 258 | if (__s.count() < __ts_sec_max) | |
| 259 | { | |
| 260 | __ts.tv_sec = static_cast<__ts_sec>(__s.count()); | |
| 261 | __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count()); | |
| 262 | } | |
| 263 | else | |
| 264 | { | |
| 265 | __ts.tv_sec = __ts_sec_max; | |
| 266 | __ts.tv_nsec = 999999999; // (10^9 - 1) | |
| 267 | } | |
| 268 | ||
| 269 | return __ts; | |
| 270 | } | |
| 271 | ||
| 272 | } | |
| 273 | ||
| 274 | #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) | |
| 211 | 275 | |
| 212 | 276 | int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) |
| 213 | 277 | { |
| ... | ... | @@ -357,23 +421,7 @@ void __libcpp_thread_yield() |
| 357 | 421 | |
| 358 | 422 | void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) |
| 359 | 423 | { |
| 360 | using namespace chrono; | |
| 361 | seconds __s = duration_cast<seconds>(__ns); | |
| 362 | __libcpp_timespec_t __ts; | |
| 363 | typedef decltype(__ts.tv_sec) ts_sec; | |
| 364 | _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max(); | |
| 365 | ||
| 366 | if (__s.count() < __ts_sec_max) | |
| 367 | { | |
| 368 | __ts.tv_sec = static_cast<ts_sec>(__s.count()); | |
| 369 | __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count()); | |
| 370 | } | |
| 371 | else | |
| 372 | { | |
| 373 | __ts.tv_sec = __ts_sec_max; | |
| 374 | __ts.tv_nsec = 999999999; // (10^9 - 1) | |
| 375 | } | |
| 376 | ||
| 424 | __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns); | |
| 377 | 425 | while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR); |
| 378 | 426 | } |
| 379 | 427 | |
| ... | ... | @@ -393,6 +441,165 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) |
| 393 | 441 | return pthread_setspecific(__key, __p); |
| 394 | 442 | } |
| 395 | 443 | |
| 444 | #elif defined(_LIBCPP_HAS_THREAD_API_C11) | |
| 445 | ||
| 446 | int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) | |
| 447 | { | |
| 448 | return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL; | |
| 449 | } | |
| 450 | ||
| 451 | int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m) | |
| 452 | { | |
| 453 | return mtx_lock(__m) == thrd_success ? 0 : EINVAL; | |
| 454 | } | |
| 455 | ||
| 456 | bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m) | |
| 457 | { | |
| 458 | return mtx_trylock(__m) == thrd_success; | |
| 459 | } | |
| 460 | ||
| 461 | int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m) | |
| 462 | { | |
| 463 | return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; | |
| 464 | } | |
| 465 | ||
| 466 | int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m) | |
| 467 | { | |
| 468 | mtx_destroy(__m); | |
| 469 | return 0; | |
| 470 | } | |
| 471 | ||
| 472 | int __libcpp_mutex_lock(__libcpp_mutex_t *__m) | |
| 473 | { | |
| 474 | return mtx_lock(__m) == thrd_success ? 0 : EINVAL; | |
| 475 | } | |
| 476 | ||
| 477 | bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m) | |
| 478 | { | |
| 479 | return mtx_trylock(__m) == thrd_success; | |
| 480 | } | |
| 481 | ||
| 482 | int __libcpp_mutex_unlock(__libcpp_mutex_t *__m) | |
| 483 | { | |
| 484 | return mtx_unlock(__m) == thrd_success ? 0 : EINVAL; | |
| 485 | } | |
| 486 | ||
| 487 | int __libcpp_mutex_destroy(__libcpp_mutex_t *__m) | |
| 488 | { | |
| 489 | mtx_destroy(__m); | |
| 490 | return 0; | |
| 491 | } | |
| 492 | ||
| 493 | // Condition Variable | |
| 494 | int __libcpp_condvar_signal(__libcpp_condvar_t *__cv) | |
| 495 | { | |
| 496 | return cnd_signal(__cv) == thrd_success ? 0 : EINVAL; | |
| 497 | } | |
| 498 | ||
| 499 | int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv) | |
| 500 | { | |
| 501 | return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL; | |
| 502 | } | |
| 503 | ||
| 504 | int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m) | |
| 505 | { | |
| 506 | return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL; | |
| 507 | } | |
| 508 | ||
| 509 | int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, | |
| 510 | timespec *__ts) | |
| 511 | { | |
| 512 | int __ec = cnd_timedwait(__cv, __m, __ts); | |
| 513 | return __ec == thrd_timedout ? ETIMEDOUT : __ec; | |
| 514 | } | |
| 515 | ||
| 516 | int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv) | |
| 517 | { | |
| 518 | cnd_destroy(__cv); | |
| 519 | return 0; | |
| 520 | } | |
| 521 | ||
| 522 | // Execute once | |
| 523 | int __libcpp_execute_once(__libcpp_exec_once_flag *flag, | |
| 524 | void (*init_routine)(void)) { | |
| 525 | ::call_once(flag, init_routine); | |
| 526 | return 0; | |
| 527 | } | |
| 528 | ||
| 529 | // Thread id | |
| 530 | // Returns non-zero if the thread ids are equal, otherwise 0 | |
| 531 | bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) | |
| 532 | { | |
| 533 | return thrd_equal(t1, t2) != 0; | |
| 534 | } | |
| 535 | ||
| 536 | // Returns non-zero if t1 < t2, otherwise 0 | |
| 537 | bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) | |
| 538 | { | |
| 539 | return t1 < t2; | |
| 540 | } | |
| 541 | ||
| 542 | // Thread | |
| 543 | bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) { | |
| 544 | return *__t == 0; | |
| 545 | } | |
| 546 | ||
| 547 | int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), | |
| 548 | void *__arg) | |
| 549 | { | |
| 550 | int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg); | |
| 551 | return __ec == thrd_nomem ? ENOMEM : __ec; | |
| 552 | } | |
| 553 | ||
| 554 | __libcpp_thread_id __libcpp_thread_get_current_id() | |
| 555 | { | |
| 556 | return thrd_current(); | |
| 557 | } | |
| 558 | ||
| 559 | __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) | |
| 560 | { | |
| 561 | return *__t; | |
| 562 | } | |
| 563 | ||
| 564 | int __libcpp_thread_join(__libcpp_thread_t *__t) | |
| 565 | { | |
| 566 | return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL; | |
| 567 | } | |
| 568 | ||
| 569 | int __libcpp_thread_detach(__libcpp_thread_t *__t) | |
| 570 | { | |
| 571 | return thrd_detach(*__t) == thrd_success ? 0 : EINVAL; | |
| 572 | } | |
| 573 | ||
| 574 | void __libcpp_thread_yield() | |
| 575 | { | |
| 576 | thrd_yield(); | |
| 577 | } | |
| 578 | ||
| 579 | void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) | |
| 580 | { | |
| 581 | __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns); | |
| 582 | thrd_sleep(&__ts, nullptr); | |
| 583 | } | |
| 584 | ||
| 585 | // Thread local storage | |
| 586 | int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *)) | |
| 587 | { | |
| 588 | return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL; | |
| 589 | } | |
| 590 | ||
| 591 | void *__libcpp_tls_get(__libcpp_tls_key __key) | |
| 592 | { | |
| 593 | return tss_get(__key); | |
| 594 | } | |
| 595 | ||
| 596 | int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) | |
| 597 | { | |
| 598 | return tss_set(__key, __p) == thrd_success ? 0 : EINVAL; | |
| 599 | } | |
| 600 | ||
| 601 | #endif | |
| 602 | ||
| 396 | 603 | #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL |
| 397 | 604 | |
| 398 | 605 | class _LIBCPP_TYPE_VIS thread; |
| ... | ... | @@ -447,7 +654,7 @@ public: |
| 447 | 654 | |
| 448 | 655 | _LIBCPP_INLINE_VISIBILITY |
| 449 | 656 | void __reset() { __id_ = 0; } |
| 450 | ||
| 657 | ||
| 451 | 658 | template<class _CharT, class _Traits> |
| 452 | 659 | friend |
| 453 | 660 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -475,10 +682,10 @@ get_id() _NOEXCEPT |
| 475 | 682 | |
| 476 | 683 | } // this_thread |
| 477 | 684 | |
| 685 | #endif // !_LIBCPP_HAS_NO_THREADS | |
| 686 | ||
| 478 | 687 | _LIBCPP_END_NAMESPACE_STD |
| 479 | 688 | |
| 480 | 689 | _LIBCPP_POP_MACROS |
| 481 | 690 | |
| 482 | #endif // !_LIBCPP_HAS_NO_THREADS | |
| 483 | ||
| 484 | 691 | #endif // _LIBCPP_THREADING_SUPPORT |
lib/libcxx/include/__tree+10-7| ... | ... | @@ -775,11 +775,14 @@ private: |
| 775 | 775 | typedef __tree_node_types<pointer> _NodeTypes; |
| 776 | 776 | allocator_type& __na_; |
| 777 | 777 | |
| 778 | __tree_node_destructor& operator=(const __tree_node_destructor&); | |
| 779 | 778 | |
| 780 | 779 | public: |
| 781 | 780 | bool __value_constructed; |
| 782 | 781 | |
| 782 | ||
| 783 | __tree_node_destructor(const __tree_node_destructor &) = default; | |
| 784 | __tree_node_destructor& operator=(const __tree_node_destructor&) = delete; | |
| 785 | ||
| 783 | 786 | _LIBCPP_INLINE_VISIBILITY |
| 784 | 787 | explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT |
| 785 | 788 | : __na_(__na), |
| ... | ... | @@ -1574,8 +1577,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) |
| 1574 | 1577 | template <class _Tp, class _Compare, class _Allocator> |
| 1575 | 1578 | __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) |
| 1576 | 1579 | : __begin_node_(__iter_pointer()), |
| 1577 | __pair1_(__second_tag(), __node_allocator(__a)), | |
| 1578 | __pair3_(0) | |
| 1580 | __pair1_(__default_init_tag(), __node_allocator(__a)), | |
| 1581 | __pair3_(0, __default_init_tag()) | |
| 1579 | 1582 | { |
| 1580 | 1583 | __begin_node() = __end_node(); |
| 1581 | 1584 | } |
| ... | ... | @@ -1584,7 +1587,7 @@ template <class _Tp, class _Compare, class _Allocator> |
| 1584 | 1587 | __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, |
| 1585 | 1588 | const allocator_type& __a) |
| 1586 | 1589 | : __begin_node_(__iter_pointer()), |
| 1587 | __pair1_(__second_tag(), __node_allocator(__a)), | |
| 1590 | __pair1_(__default_init_tag(), __node_allocator(__a)), | |
| 1588 | 1591 | __pair3_(0, __comp) |
| 1589 | 1592 | { |
| 1590 | 1593 | __begin_node() = __end_node(); |
| ... | ... | @@ -1656,7 +1659,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _Fo |
| 1656 | 1659 | typedef typename _ITraits::value_type _ItValueType; |
| 1657 | 1660 | static_assert((is_same<_ItValueType, __container_value_type>::value), |
| 1658 | 1661 | "__assign_unique may only be called with the containers value type"); |
| 1659 | static_assert(__is_forward_iterator<_ForwardIterator>::value, | |
| 1662 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 1660 | 1663 | "__assign_unique requires a forward iterator"); |
| 1661 | 1664 | if (size() != 0) |
| 1662 | 1665 | { |
| ... | ... | @@ -1697,7 +1700,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input |
| 1697 | 1700 | template <class _Tp, class _Compare, class _Allocator> |
| 1698 | 1701 | __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) |
| 1699 | 1702 | : __begin_node_(__iter_pointer()), |
| 1700 | __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), | |
| 1703 | __pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), | |
| 1701 | 1704 | __pair3_(0, __t.value_comp()) |
| 1702 | 1705 | { |
| 1703 | 1706 | __begin_node() = __end_node(); |
| ... | ... | @@ -1727,7 +1730,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) |
| 1727 | 1730 | |
| 1728 | 1731 | template <class _Tp, class _Compare, class _Allocator> |
| 1729 | 1732 | __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) |
| 1730 | : __pair1_(__second_tag(), __node_allocator(__a)), | |
| 1733 | : __pair1_(__default_init_tag(), __node_allocator(__a)), | |
| 1731 | 1734 | __pair3_(0, _VSTD::move(__t.value_comp())) |
| 1732 | 1735 | { |
| 1733 | 1736 | if (__a == __t.__alloc()) |
lib/libcxx/include/__tuple+3-2| ... | ... | @@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp< |
| 477 | 477 | >; |
| 478 | 478 | |
| 479 | 479 | struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { |
| 480 | template <class ...> | |
| 481 | static constexpr bool __enable_default() { return false; } | |
| 480 | ||
| 481 | static constexpr bool __enable_explicit_default() { return false; } | |
| 482 | static constexpr bool __enable_implicit_default() { return false; } | |
| 482 | 483 | template <class ...> |
| 483 | 484 | static constexpr bool __enable_explicit() { return false; } |
| 484 | 485 | template <class ...> |
lib/libcxx/include/algorithm+73-41| ... | ... | @@ -167,20 +167,20 @@ template <class ForwardIterator, class Size, class T, class BinaryPredicate> |
| 167 | 167 | Size count, const T& value, BinaryPredicate pred); |
| 168 | 168 | |
| 169 | 169 | template <class InputIterator, class OutputIterator> |
| 170 | OutputIterator | |
| 170 | constexpr OutputIterator // constexpr in C++20 | |
| 171 | 171 | copy(InputIterator first, InputIterator last, OutputIterator result); |
| 172 | 172 | |
| 173 | 173 | template<class InputIterator, class OutputIterator, class Predicate> |
| 174 | OutputIterator | |
| 174 | constexpr OutputIterator // constexpr in C++20 | |
| 175 | 175 | copy_if(InputIterator first, InputIterator last, |
| 176 | 176 | OutputIterator result, Predicate pred); |
| 177 | 177 | |
| 178 | 178 | template<class InputIterator, class Size, class OutputIterator> |
| 179 | OutputIterator | |
| 179 | constexpr OutputIterator // constexpr in C++20 | |
| 180 | 180 | copy_n(InputIterator first, Size n, OutputIterator result); |
| 181 | 181 | |
| 182 | 182 | template <class BidirectionalIterator1, class BidirectionalIterator2> |
| 183 | BidirectionalIterator2 | |
| 183 | constexpr BidirectionalIterator2 // constexpr in C++20 | |
| 184 | 184 | copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, |
| 185 | 185 | BidirectionalIterator2 result); |
| 186 | 186 | |
| ... | ... | @@ -1631,7 +1631,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const |
| 1631 | 1631 | |
| 1632 | 1632 | // copy |
| 1633 | 1633 | template <class _Iter> |
| 1634 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1634 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1635 | 1635 | _Iter |
| 1636 | 1636 | __unwrap_iter(_Iter __i) |
| 1637 | 1637 | { |
| ... | ... | @@ -1639,7 +1639,7 @@ __unwrap_iter(_Iter __i) |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | template <class _Tp> |
| 1642 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1642 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1643 | 1643 | typename enable_if |
| 1644 | 1644 | < |
| 1645 | 1645 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1693,15 +1693,23 @@ __unwrap_iter(__wrap_iter<_Tp*> __i) |
| 1693 | 1693 | #endif // _LIBCPP_DEBUG_LEVEL < 2 |
| 1694 | 1694 | |
| 1695 | 1695 | template <class _InputIterator, class _OutputIterator> |
| 1696 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1696 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1697 | 1697 | _OutputIterator |
| 1698 | __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1698 | __copy_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1699 | 1699 | { |
| 1700 | 1700 | for (; __first != __last; ++__first, (void) ++__result) |
| 1701 | 1701 | *__result = *__first; |
| 1702 | 1702 | return __result; |
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | template <class _InputIterator, class _OutputIterator> | |
| 1706 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1707 | _OutputIterator | |
| 1708 | __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1709 | { | |
| 1710 | return __copy_constexpr(__first, __last, __result); | |
| 1711 | } | |
| 1712 | ||
| 1705 | 1713 | template <class _Tp, class _Up> |
| 1706 | 1714 | inline _LIBCPP_INLINE_VISIBILITY |
| 1707 | 1715 | typename enable_if |
| ... | ... | @@ -1719,25 +1727,39 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result) |
| 1719 | 1727 | } |
| 1720 | 1728 | |
| 1721 | 1729 | template <class _InputIterator, class _OutputIterator> |
| 1722 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1730 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1723 | 1731 | _OutputIterator |
| 1724 | 1732 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 1725 | 1733 | { |
| 1726 | return _VSTD::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1734 | if (__libcpp_is_constant_evaluated()) { | |
| 1735 | return _VSTD::__copy_constexpr( | |
| 1736 | __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1737 | } else { | |
| 1738 | return _VSTD::__copy( | |
| 1739 | __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1740 | } | |
| 1727 | 1741 | } |
| 1728 | 1742 | |
| 1729 | 1743 | // copy_backward |
| 1730 | 1744 | |
| 1731 | 1745 | template <class _BidirectionalIterator, class _OutputIterator> |
| 1732 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1746 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1733 | 1747 | _OutputIterator |
| 1734 | __copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) | |
| 1748 | __copy_backward_constexpr(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) | |
| 1735 | 1749 | { |
| 1736 | 1750 | while (__first != __last) |
| 1737 | 1751 | *--__result = *--__last; |
| 1738 | 1752 | return __result; |
| 1739 | 1753 | } |
| 1740 | 1754 | |
| 1755 | template <class _BidirectionalIterator, class _OutputIterator> | |
| 1756 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1757 | _OutputIterator | |
| 1758 | __copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) | |
| 1759 | { | |
| 1760 | return __copy_backward_constexpr(__first, __last, __result); | |
| 1761 | } | |
| 1762 | ||
| 1741 | 1763 | template <class _Tp, class _Up> |
| 1742 | 1764 | inline _LIBCPP_INLINE_VISIBILITY |
| 1743 | 1765 | typename enable_if |
| ... | ... | @@ -1758,20 +1780,26 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result) |
| 1758 | 1780 | } |
| 1759 | 1781 | |
| 1760 | 1782 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 1761 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1783 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1762 | 1784 | _BidirectionalIterator2 |
| 1763 | 1785 | copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, |
| 1764 | 1786 | _BidirectionalIterator2 __result) |
| 1765 | 1787 | { |
| 1766 | return _VSTD::__copy_backward(__unwrap_iter(__first), | |
| 1767 | __unwrap_iter(__last), | |
| 1768 | __unwrap_iter(__result)); | |
| 1788 | if (__libcpp_is_constant_evaluated()) { | |
| 1789 | return _VSTD::__copy_backward_constexpr(__unwrap_iter(__first), | |
| 1790 | __unwrap_iter(__last), | |
| 1791 | __unwrap_iter(__result)); | |
| 1792 | } else { | |
| 1793 | return _VSTD::__copy_backward(__unwrap_iter(__first), | |
| 1794 | __unwrap_iter(__last), | |
| 1795 | __unwrap_iter(__result)); | |
| 1796 | } | |
| 1769 | 1797 | } |
| 1770 | 1798 | |
| 1771 | 1799 | // copy_if |
| 1772 | 1800 | |
| 1773 | 1801 | template<class _InputIterator, class _OutputIterator, class _Predicate> |
| 1774 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1802 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1775 | 1803 | _OutputIterator |
| 1776 | 1804 | copy_if(_InputIterator __first, _InputIterator __last, |
| 1777 | 1805 | _OutputIterator __result, _Predicate __pred) |
| ... | ... | @@ -1790,11 +1818,11 @@ copy_if(_InputIterator __first, _InputIterator __last, |
| 1790 | 1818 | // copy_n |
| 1791 | 1819 | |
| 1792 | 1820 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 1793 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1821 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1794 | 1822 | typename enable_if |
| 1795 | 1823 | < |
| 1796 | __is_input_iterator<_InputIterator>::value && | |
| 1797 | !__is_random_access_iterator<_InputIterator>::value, | |
| 1824 | __is_cpp17_input_iterator<_InputIterator>::value && | |
| 1825 | !__is_cpp17_random_access_iterator<_InputIterator>::value, | |
| 1798 | 1826 | _OutputIterator |
| 1799 | 1827 | >::type |
| 1800 | 1828 | copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| ... | ... | @@ -1816,10 +1844,10 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| 1816 | 1844 | } |
| 1817 | 1845 | |
| 1818 | 1846 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 1819 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1847 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1820 | 1848 | typename enable_if |
| 1821 | 1849 | < |
| 1822 | __is_random_access_iterator<_InputIterator>::value, | |
| 1850 | __is_cpp17_random_access_iterator<_InputIterator>::value, | |
| 1823 | 1851 | _OutputIterator |
| 1824 | 1852 | >::type |
| 1825 | 1853 | copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| ... | ... | @@ -2492,7 +2520,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 2492 | 2520 | _ForwardIterator |
| 2493 | 2521 | min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 2494 | 2522 | { |
| 2495 | static_assert(__is_forward_iterator<_ForwardIterator>::value, | |
| 2523 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2496 | 2524 | "std::min_element requires a ForwardIterator"); |
| 2497 | 2525 | if (__first != __last) |
| 2498 | 2526 | { |
| ... | ... | @@ -2564,7 +2592,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 2564 | 2592 | _ForwardIterator |
| 2565 | 2593 | max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 2566 | 2594 | { |
| 2567 | static_assert(__is_forward_iterator<_ForwardIterator>::value, | |
| 2595 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2568 | 2596 | "std::max_element requires a ForwardIterator"); |
| 2569 | 2597 | if (__first != __last) |
| 2570 | 2598 | { |
| ... | ... | @@ -2659,7 +2687,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 2659 | 2687 | std::pair<_ForwardIterator, _ForwardIterator> |
| 2660 | 2688 | minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 2661 | 2689 | { |
| 2662 | static_assert(__is_forward_iterator<_ForwardIterator>::value, | |
| 2690 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2663 | 2691 | "std::minmax_element requires a ForwardIterator"); |
| 2664 | 2692 | std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); |
| 2665 | 2693 | if (__first != __last) |
| ... | ... | @@ -3117,10 +3145,10 @@ _SampleIterator __sample(_PopulationIterator __first, |
| 3117 | 3145 | input_iterator_tag) { |
| 3118 | 3146 | |
| 3119 | 3147 | _Distance __k = 0; |
| 3120 | for (; __first != __last && __k < __n; ++__first, (void)++__k) | |
| 3148 | for (; __first != __last && __k < __n; ++__first, (void) ++__k) | |
| 3121 | 3149 | __output_iter[__k] = *__first; |
| 3122 | 3150 | _Distance __sz = __k; |
| 3123 | for (; __first != __last; ++__first, (void)++__k) { | |
| 3151 | for (; __first != __last; ++__first, (void) ++__k) { | |
| 3124 | 3152 | _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g); |
| 3125 | 3153 | if (__r < __sz) |
| 3126 | 3154 | __output_iter[__r] = *__first; |
| ... | ... | @@ -3158,8 +3186,8 @@ _SampleIterator __sample(_PopulationIterator __first, |
| 3158 | 3186 | _PopCategory; |
| 3159 | 3187 | typedef typename iterator_traits<_PopulationIterator>::difference_type |
| 3160 | 3188 | _Difference; |
| 3161 | static_assert(__is_forward_iterator<_PopulationIterator>::value || | |
| 3162 | __is_random_access_iterator<_SampleIterator>::value, | |
| 3189 | static_assert(__is_cpp17_forward_iterator<_PopulationIterator>::value || | |
| 3190 | __is_cpp17_random_access_iterator<_SampleIterator>::value, | |
| 3163 | 3191 | "SampleIterator must meet the requirements of RandomAccessIterator"); |
| 3164 | 3192 | typedef typename common_type<_Distance, _Difference>::type _CommonType; |
| 3165 | 3193 | _LIBCPP_ASSERT(__n >= 0, "N must be a positive number."); |
| ... | ... | @@ -3190,7 +3218,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator> |
| 3190 | 3218 | if (__d > 1) |
| 3191 | 3219 | { |
| 3192 | 3220 | _Dp __uid; |
| 3193 | for (--__last, --__d; __first < __last; ++__first, --__d) | |
| 3221 | for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) | |
| 3194 | 3222 | { |
| 3195 | 3223 | difference_type __i = __uid(__g, _Pp(0, __d)); |
| 3196 | 3224 | if (__i != difference_type(0)) |
| ... | ... | @@ -3373,7 +3401,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3373 | 3401 | // All trues now at start of range, all falses in buffer |
| 3374 | 3402 | // Move falses back into range, but don't mess up __first which points to first false |
| 3375 | 3403 | __i = __first; |
| 3376 | for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i) | |
| 3404 | for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) | |
| 3377 | 3405 | *__i = _VSTD::move(*__t2); |
| 3378 | 3406 | // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer |
| 3379 | 3407 | return __first; |
| ... | ... | @@ -3505,7 +3533,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last |
| 3505 | 3533 | __i = ++__first; |
| 3506 | 3534 | // All trues now at start of range, all falses in buffer |
| 3507 | 3535 | // Move falses back into range, but don't mess up __first which points to first false |
| 3508 | for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i) | |
| 3536 | for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) | |
| 3509 | 3537 | *__i = _VSTD::move(*__t2); |
| 3510 | 3538 | // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer |
| 3511 | 3539 | return __first; |
| ... | ... | @@ -4382,7 +4410,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4382 | 4410 | { |
| 4383 | 4411 | typedef typename iterator_traits<_InputIterator1>::value_type __v1; |
| 4384 | 4412 | typedef typename iterator_traits<_InputIterator2>::value_type __v2; |
| 4385 | return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); | |
| 4413 | return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); | |
| 4386 | 4414 | } |
| 4387 | 4415 | |
| 4388 | 4416 | // inplace_merge |
| ... | ... | @@ -4428,14 +4456,14 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator |
| 4428 | 4456 | if (__len1 <= __len2) |
| 4429 | 4457 | { |
| 4430 | 4458 | value_type* __p = __buff; |
| 4431 | for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p) | |
| 4459 | for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) | |
| 4432 | 4460 | ::new(__p) value_type(_VSTD::move(*__i)); |
| 4433 | 4461 | __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); |
| 4434 | 4462 | } |
| 4435 | 4463 | else |
| 4436 | 4464 | { |
| 4437 | 4465 | value_type* __p = __buff; |
| 4438 | for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p) | |
| 4466 | for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) | |
| 4439 | 4467 | ::new(__p) value_type(_VSTD::move(*__i)); |
| 4440 | 4468 | typedef reverse_iterator<_BidirectionalIterator> _RBi; |
| 4441 | 4469 | typedef reverse_iterator<value_type*> _Rv; |
| ... | ... | @@ -4575,14 +4603,14 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4575 | 4603 | { |
| 4576 | 4604 | if (__first1 == __last1) |
| 4577 | 4605 | { |
| 4578 | for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0)) | |
| 4606 | for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0)) | |
| 4579 | 4607 | ::new (__result) value_type(_VSTD::move(*__first2)); |
| 4580 | 4608 | __h.release(); |
| 4581 | 4609 | return; |
| 4582 | 4610 | } |
| 4583 | 4611 | if (__first2 == __last2) |
| 4584 | 4612 | { |
| 4585 | for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0)) | |
| 4613 | for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0)) | |
| 4586 | 4614 | ::new (__result) value_type(_VSTD::move(*__first1)); |
| 4587 | 4615 | __h.release(); |
| 4588 | 4616 | return; |
| ... | ... | @@ -4612,7 +4640,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4612 | 4640 | { |
| 4613 | 4641 | if (__first2 == __last2) |
| 4614 | 4642 | { |
| 4615 | for (; __first1 != __last1; ++__first1, ++__result) | |
| 4643 | for (; __first1 != __last1; ++__first1, (void) ++__result) | |
| 4616 | 4644 | *__result = _VSTD::move(*__first1); |
| 4617 | 4645 | return; |
| 4618 | 4646 | } |
| ... | ... | @@ -4627,7 +4655,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4627 | 4655 | ++__first1; |
| 4628 | 4656 | } |
| 4629 | 4657 | } |
| 4630 | for (; __first2 != __last2; ++__first2, ++__result) | |
| 4658 | for (; __first2 != __last2; ++__first2, (void) ++__result) | |
| 4631 | 4659 | *__result = _VSTD::move(*__first2); |
| 4632 | 4660 | } |
| 4633 | 4661 | |
| ... | ... | @@ -4995,7 +5023,7 @@ void |
| 4995 | 5023 | __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 4996 | 5024 | { |
| 4997 | 5025 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 4998 | for (difference_type __n = __last - __first; __n > 1; --__last, --__n) | |
| 5026 | for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) | |
| 4999 | 5027 | __pop_heap<_Compare>(__first, __last, __comp, __n); |
| 5000 | 5028 | } |
| 5001 | 5029 | |
| ... | ... | @@ -5065,7 +5093,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 5065 | 5093 | _RandomAccessIterator __r = __result_first; |
| 5066 | 5094 | if (__r != __result_last) |
| 5067 | 5095 | { |
| 5068 | for (; __first != __last && __r != __result_last; (void) ++__first, ++__r) | |
| 5096 | for (; __first != __last && __r != __result_last; ++__first, (void) ++__r) | |
| 5069 | 5097 | *__r = *__first; |
| 5070 | 5098 | __make_heap<_Compare>(__result_first, __r, __comp); |
| 5071 | 5099 | typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; |
| ... | ... | @@ -5678,4 +5706,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 5678 | 5706 | |
| 5679 | 5707 | _LIBCPP_POP_MACROS |
| 5680 | 5708 | |
| 5709 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 | |
| 5710 | # include <__pstl_algorithm> | |
| 5711 | #endif | |
| 5712 | ||
| 5681 | 5713 | #endif // _LIBCPP_ALGORITHM |
lib/libcxx/include/atomic+1-1| ... | ... | @@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl { |
| 920 | 920 | #endif // _LIBCPP_CXX03_LANG |
| 921 | 921 | _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT |
| 922 | 922 | : __a_value(value) {} |
| 923 | _Atomic(_Tp) __a_value; | |
| 923 | _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value; | |
| 924 | 924 | }; |
| 925 | 925 | |
| 926 | 926 | #define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s) |
lib/libcxx/include/bit+22-1| ... | ... | @@ -42,6 +42,13 @@ namespace std { |
| 42 | 42 | template<class T> |
| 43 | 43 | constexpr int popcount(T x) noexcept; // C++20 |
| 44 | 44 | |
| 45 | // 20.15.9, endian | |
| 46 | enum class endian { | |
| 47 | little = see below, // C++20 | |
| 48 | big = see below, // C++20 | |
| 49 | native = see below // C++20 | |
| 50 | }; | |
| 51 | ||
| 45 | 52 | } // namespace std |
| 46 | 53 | |
| 47 | 54 | */ |
| ... | ... | @@ -343,7 +350,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 343 | 350 | bool __ispow2(_Tp __t) _NOEXCEPT |
| 344 | 351 | { |
| 345 | 352 | static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned"); |
| 346 | 	return __t != 0 && (((__t & (__t - 1)) == 0)); | |
| 353 | 	return __t != 0 && (((__t & (__t - 1)) == 0)); | |
| 347 | 354 | } |
| 348 | 355 | |
| 349 | 356 | |
| ... | ... | @@ -456,6 +463,20 @@ log2p1(_Tp __t) noexcept |
| 456 | 463 | return __t == 0 ? 0 : __bit_log2(__t) + 1; |
| 457 | 464 | } |
| 458 | 465 | |
| 466 | ||
| 467 | enum class endian | |
| 468 | { | |
| 469 | little = 0xDEAD, | |
| 470 | big = 0xFACE, | |
| 471 | #if defined(_LIBCPP_LITTLE_ENDIAN) | |
| 472 | native = little | |
| 473 | #elif defined(_LIBCPP_BIG_ENDIAN) | |
| 474 | native = big | |
| 475 | #else | |
| 476 | native = 0xCAFE | |
| 477 | #endif | |
| 478 | }; | |
| 479 | ||
| 459 | 480 | #endif // _LIBCPP_STD_VER > 17 |
| 460 | 481 | |
| 461 | 482 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/include/chrono+131-15| ... | ... | @@ -612,13 +612,43 @@ constexpr year_month_weekday_last |
| 612 | 612 | constexpr year_month_weekday_last |
| 613 | 613 | operator/(const month_weekday_last& mwdl, int y) noexcept; |
| 614 | 614 | |
| 615 | // 25.9, class template time_of_day // C++20 | |
| 616 | template<class Duration> class time_of_day; | |
| 615 | // 26.9, class template hh_mm_ss | |
| 616 | template <class Duration> | |
| 617 | class hh_mm_ss | |
| 618 | { | |
| 619 | bool is_neg; // exposition only | |
| 620 | chrono::hours h; // exposition only | |
| 621 | chrono::minutes m; // exposition only | |
| 622 | chrono::seconds s; // exposition only | |
| 623 | precision ss; // exposition only | |
| 624 | ||
| 625 | public: | |
| 626 | static unsigned constexpr fractional_width = see below; | |
| 627 | using precision = see below; | |
| 628 | ||
| 629 | constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} | |
| 630 | constexpr explicit hh_mm_ss(Duration d) noexcept; | |
| 631 | ||
| 632 | constexpr bool is_negative() const noexcept; | |
| 633 | constexpr chrono::hours hours() const noexcept; | |
| 634 | constexpr chrono::minutes minutes() const noexcept; | |
| 635 | constexpr chrono::seconds seconds() const noexcept; | |
| 636 | constexpr precision subseconds() const noexcept; | |
| 637 | ||
| 638 | constexpr explicit operator precision() const noexcept; | |
| 639 | constexpr precision to_duration() const noexcept; | |
| 640 | }; | |
| 641 | ||
| 642 | template <class charT, class traits, class Duration> | |
| 643 | basic_ostream<charT, traits>& | |
| 644 | operator<<(basic_ostream<charT, traits>& os, hh_mm_ss<Duration> const& hms); | |
| 645 | ||
| 646 | // 26.10, 12/24 hour functions | |
| 647 | constexpr bool is_am(hours const& h) noexcept; | |
| 648 | constexpr bool is_pm(hours const& h) noexcept; | |
| 649 | constexpr hours make12(const hours& h) noexcept; | |
| 650 | constexpr hours make24(const hours& h, bool is_pm) noexcept; | |
| 617 | 651 | |
| 618 | template<> class time_of_day<hours>; | |
| 619 | template<> class time_of_day<minutes>; | |
| 620 | template<> class time_of_day<seconds>; | |
| 621 | template<class Rep, class Period> class time_of_day<duration<Rep, Period>>; | |
| 622 | 652 | |
| 623 | 653 | // 25.10.2, time zone database // C++20 |
| 624 | 654 | struct tzdb; |
| ... | ... | @@ -1428,7 +1458,7 @@ typename enable_if |
| 1428 | 1458 | >::type |
| 1429 | 1459 | abs(duration<_Rep, _Period> __d) |
| 1430 | 1460 | { |
| 1431 | return __d >= __d.zero() ? __d : -__d; | |
| 1461 | return __d >= __d.zero() ? +__d : -__d; | |
| 1432 | 1462 | } |
| 1433 | 1463 | #endif |
| 1434 | 1464 | |
| ... | ... | @@ -1810,7 +1840,7 @@ private: |
| 1810 | 1840 | unsigned char __wd; |
| 1811 | 1841 | public: |
| 1812 | 1842 | weekday() = default; |
| 1813 | inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val)) {} | |
| 1843 | inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {} | |
| 1814 | 1844 | inline constexpr weekday(const sys_days& __sysd) noexcept |
| 1815 | 1845 | : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {} |
| 1816 | 1846 | inline explicit constexpr weekday(const local_days& __locd) noexcept |
| ... | ... | @@ -1822,11 +1852,13 @@ public: |
| 1822 | 1852 | inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; } |
| 1823 | 1853 | constexpr weekday& operator+=(const days& __dd) noexcept; |
| 1824 | 1854 | constexpr weekday& operator-=(const days& __dd) noexcept; |
| 1825 | inline explicit constexpr operator unsigned() const noexcept { return __wd; } | |
| 1855 | inline constexpr unsigned c_encoding() const noexcept { return __wd; } | |
| 1856 | inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; } | |
| 1826 | 1857 | inline constexpr bool ok() const noexcept { return __wd <= 6; } |
| 1827 | 1858 | constexpr weekday_indexed operator[](unsigned __index) const noexcept; |
| 1828 | 1859 | constexpr weekday_last operator[](last_spec) const noexcept; |
| 1829 | 1860 | |
| 1861 | // TODO: Make private? | |
| 1830 | 1862 | static constexpr unsigned char __weekday_from_days(int __days) noexcept; |
| 1831 | 1863 | }; |
| 1832 | 1864 | |
| ... | ... | @@ -1842,7 +1874,7 @@ unsigned char weekday::__weekday_from_days(int __days) noexcept |
| 1842 | 1874 | |
| 1843 | 1875 | inline constexpr |
| 1844 | 1876 | bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept |
| 1845 | { return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); } | |
| 1877 | { return __lhs.c_encoding() == __rhs.c_encoding(); } | |
| 1846 | 1878 | |
| 1847 | 1879 | inline constexpr |
| 1848 | 1880 | bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept |
| ... | ... | @@ -1850,7 +1882,7 @@ bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept |
| 1850 | 1882 | |
| 1851 | 1883 | inline constexpr |
| 1852 | 1884 | bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept |
| 1853 | { return static_cast<unsigned>(__lhs) < static_cast<unsigned>(__rhs); } | |
| 1885 | { return __lhs.c_encoding() < __rhs.c_encoding(); } | |
| 1854 | 1886 | |
| 1855 | 1887 | inline constexpr |
| 1856 | 1888 | bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept |
| ... | ... | @@ -1866,7 +1898,7 @@ bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept |
| 1866 | 1898 | |
| 1867 | 1899 | constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept |
| 1868 | 1900 | { |
| 1869 | auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + __rhs.count(); | |
| 1901 | auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count(); | |
| 1870 | 1902 | auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7; |
| 1871 | 1903 | return weekday{static_cast<unsigned>(__mu - __yr * 7)}; |
| 1872 | 1904 | } |
| ... | ... | @@ -1879,7 +1911,7 @@ constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept |
| 1879 | 1911 | |
| 1880 | 1912 | constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept |
| 1881 | 1913 | { |
| 1882 | const int __wdu = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs); | |
| 1914 | const int __wdu = __lhs.c_encoding() - __rhs.c_encoding(); | |
| 1883 | 1915 | const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7; |
| 1884 | 1916 | return days{__wdu - __wk * 7}; |
| 1885 | 1917 | } |
| ... | ... | @@ -2537,8 +2569,13 @@ public: |
| 2537 | 2569 | inline constexpr bool ok() const noexcept |
| 2538 | 2570 | { |
| 2539 | 2571 | if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false; |
| 2540 | // TODO: make sure it's a valid date | |
| 2541 | return true; | |
| 2572 | if (__wdi.index() <= 4) return true; | |
| 2573 | auto __nth_weekday_day = | |
| 2574 | __wdi.weekday() - | |
| 2575 | chrono::weekday{static_cast<sys_days>(__y / __m / 1)} + | |
| 2576 | days{(__wdi.index() - 1) * 7 + 1}; | |
| 2577 | return static_cast<unsigned>(__nth_weekday_day.count()) <= | |
| 2578 | static_cast<unsigned>((__y / __m / last).day()); | |
| 2542 | 2579 | } |
| 2543 | 2580 | |
| 2544 | 2581 | static constexpr year_month_weekday __from_days(days __d) noexcept; |
| ... | ... | @@ -2715,6 +2752,84 @@ inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(co |
| 2715 | 2752 | inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } |
| 2716 | 2753 | inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } |
| 2717 | 2754 | |
| 2755 | ||
| 2756 | template <class _Duration> | |
| 2757 | class hh_mm_ss | |
| 2758 | { | |
| 2759 | private: | |
| 2760 | static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration"); | |
| 2761 | using __CommonType = common_type_t<_Duration, chrono::seconds>; | |
| 2762 | ||
| 2763 | static constexpr uint64_t __pow10(unsigned __exp) | |
| 2764 | { | |
| 2765 | uint64_t __ret = 1; | |
| 2766 | for (unsigned __i = 0; __i < __exp; ++__i) | |
| 2767 | __ret *= 10U; | |
| 2768 | return __ret; | |
| 2769 | } | |
| 2770 | ||
| 2771 | static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) | |
| 2772 | { | |
| 2773 | if (__n >= 2 && __d != 0 && __w < 19) | |
| 2774 | return 1 + __width(__n, __d % __n * 10, __w+1); | |
| 2775 | return 0; | |
| 2776 | } | |
| 2777 | ||
| 2778 | public: | |
| 2779 | static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ? | |
| 2780 | __width(__CommonType::period::den) : 6u; | |
| 2781 | using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>; | |
| 2782 | ||
| 2783 | constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {} | |
| 2784 | ||
| 2785 | constexpr explicit hh_mm_ss(_Duration __d) noexcept : | |
| 2786 | __is_neg(__d < _Duration(0)), | |
| 2787 | __h(duration_cast<chrono::hours> (abs(__d))), | |
| 2788 | __m(duration_cast<chrono::minutes>(abs(__d) - hours())), | |
| 2789 | __s(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())), | |
| 2790 | __f(duration_cast<precision> (abs(__d) - hours() - minutes() - seconds())) | |
| 2791 | {} | |
| 2792 | ||
| 2793 | constexpr bool is_negative() const noexcept { return __is_neg; } | |
| 2794 | constexpr chrono::hours hours() const noexcept { return __h; } | |
| 2795 | constexpr chrono::minutes minutes() const noexcept { return __m; } | |
| 2796 | constexpr chrono::seconds seconds() const noexcept { return __s; } | |
| 2797 | constexpr precision subseconds() const noexcept { return __f; } | |
| 2798 | ||
| 2799 | constexpr precision to_duration() const noexcept | |
| 2800 | { | |
| 2801 | auto __dur = __h + __m + __s + __f; | |
| 2802 | return __is_neg ? -__dur : __dur; | |
| 2803 | } | |
| 2804 | ||
| 2805 | constexpr explicit operator precision() const noexcept { return to_duration(); } | |
| 2806 | ||
| 2807 | private: | |
| 2808 | bool __is_neg; | |
| 2809 | chrono::hours __h; | |
| 2810 | chrono::minutes __m; | |
| 2811 | chrono::seconds __s; | |
| 2812 | precision __f; | |
| 2813 | }; | |
| 2814 | ||
| 2815 | constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); } | |
| 2816 | constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); } | |
| 2817 | ||
| 2818 | constexpr hours make12(const hours& __h) noexcept | |
| 2819 | { | |
| 2820 | if (__h == hours( 0)) return hours(12); | |
| 2821 | else if (__h <= hours(12)) return __h; | |
| 2822 | else return __h - hours(12); | |
| 2823 | } | |
| 2824 | ||
| 2825 | constexpr hours make24(const hours& __h, bool __is_pm) noexcept | |
| 2826 | { | |
| 2827 | if (__is_pm) | |
| 2828 | return __h == hours(12) ? __h : __h + hours(12); | |
| 2829 | else | |
| 2830 | return __h == hours(12) ? hours(0) : __h; | |
| 2831 | } | |
| 2832 | ||
| 2718 | 2833 | #endif // _LIBCPP_STD_VER > 17 |
| 2719 | 2834 | } // chrono |
| 2720 | 2835 | |
| ... | ... | @@ -2825,6 +2940,7 @@ struct _FilesystemClock { |
| 2825 | 2940 | typedef chrono::duration<rep, period> duration; |
| 2826 | 2941 | typedef chrono::time_point<_FilesystemClock> time_point; |
| 2827 | 2942 | |
| 2943 | _LIBCPP_EXPORTED_FROM_ABI | |
| 2828 | 2944 | static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; |
| 2829 | 2945 | |
| 2830 | 2946 | _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept; |
lib/libcxx/include/cmath+36| ... | ... | @@ -303,11 +303,15 @@ long double truncl(long double x); |
| 303 | 303 | #include <__config> |
| 304 | 304 | #include <math.h> |
| 305 | 305 | #include <version> |
| 306 | #include <type_traits> | |
| 306 | 307 | |
| 307 | 308 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 308 | 309 | #pragma GCC system_header |
| 309 | 310 | #endif |
| 310 | 311 | |
| 312 | _LIBCPP_PUSH_MACROS | |
| 313 | #include <__undef_macros> | |
| 314 | ||
| 311 | 315 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 312 | 316 | |
| 313 | 317 | using ::signbit; |
| ... | ... | @@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __ler |
| 632 | 636 | |
| 633 | 637 | #endif // _LIBCPP_STD_VER > 17 |
| 634 | 638 | |
| 639 | template <class _IntT, class _FloatT, | |
| 640 | bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits), | |
| 641 | int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> | |
| 642 | _LIBCPP_INLINE_VISIBILITY | |
| 643 | _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { | |
| 644 | static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); | |
| 645 | static_assert(is_integral<_IntT>::value, "must be an integral type"); | |
| 646 | static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); | |
| 647 | static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value | |
| 648 | || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); | |
| 649 | return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); | |
| 650 | } | |
| 651 | ||
| 652 | // Convert a floating point number to the specified integral type after | |
| 653 | // clamping to the integral types representable range. | |
| 654 | // | |
| 655 | // The behavior is undefined if `__r` is NaN. | |
| 656 | template <class _IntT, class _RealT> | |
| 657 | _LIBCPP_INLINE_VISIBILITY | |
| 658 | _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { | |
| 659 | using _Lim = std::numeric_limits<_IntT>; | |
| 660 | const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>(); | |
| 661 | if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { | |
| 662 | return _Lim::max(); | |
| 663 | } else if (__r <= _Lim::lowest()) { | |
| 664 | return _Lim::min(); | |
| 665 | } | |
| 666 | return static_cast<_IntT>(__r); | |
| 667 | } | |
| 668 | ||
| 635 | 669 | _LIBCPP_END_NAMESPACE_STD |
| 636 | 670 | |
| 671 | _LIBCPP_POP_MACROS | |
| 672 | ||
| 637 | 673 | #endif // _LIBCPP_CMATH |
lib/libcxx/include/cstdio+1-1| ... | ... | @@ -152,7 +152,7 @@ using ::tmpnam; |
| 152 | 152 | |
| 153 | 153 | #ifndef _LIBCPP_HAS_NO_STDIN |
| 154 | 154 | using ::getchar; |
| 155 | #if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT) | |
| 155 | #if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS) | |
| 156 | 156 | using ::gets; |
| 157 | 157 | #endif |
| 158 | 158 | using ::scanf; |
lib/libcxx/include/cstdlib+1-1| ... | ... | @@ -154,7 +154,7 @@ using ::wcstombs; |
| 154 | 154 | using ::at_quick_exit; |
| 155 | 155 | using ::quick_exit; |
| 156 | 156 | #endif |
| 157 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) | |
| 157 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC) | |
| 158 | 158 | using ::aligned_alloc; |
| 159 | 159 | #endif |
| 160 | 160 |
lib/libcxx/include/ctime+3-3| ... | ... | @@ -18,7 +18,7 @@ Macros: |
| 18 | 18 | NULL |
| 19 | 19 | CLOCKS_PER_SEC |
| 20 | 20 | TIME_UTC // C++17 |
| 21 | ||
| 21 | ||
| 22 | 22 | namespace std |
| 23 | 23 | { |
| 24 | 24 | |
| ... | ... | @@ -29,7 +29,7 @@ Types: |
| 29 | 29 | time_t |
| 30 | 30 | tm |
| 31 | 31 | timespec // C++17 |
| 32 | ||
| 32 | ||
| 33 | 33 | clock_t clock(); |
| 34 | 34 | double difftime(time_t time1, time_t time0); |
| 35 | 35 | time_t mktime(tm* timeptr); |
| ... | ... | @@ -58,7 +58,7 @@ using ::clock_t; |
| 58 | 58 | using ::size_t; |
| 59 | 59 | using ::time_t; |
| 60 | 60 | using ::tm; |
| 61 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) | |
| 61 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) | |
| 62 | 62 | using ::timespec; |
| 63 | 63 | #endif |
| 64 | 64 | using ::clock; |
lib/libcxx/include/deque+182-95| ... | ... | @@ -190,7 +190,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 190 | 190 | copy(_RAIter __f, |
| 191 | 191 | _RAIter __l, |
| 192 | 192 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 193 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 193 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 194 | 194 | |
| 195 | 195 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 196 | 196 | class _OutputIterator> |
| ... | ... | @@ -212,7 +212,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 212 | 212 | copy_backward(_RAIter __f, |
| 213 | 213 | _RAIter __l, |
| 214 | 214 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 215 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 215 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 216 | 216 | |
| 217 | 217 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 218 | 218 | class _OutputIterator> |
| ... | ... | @@ -234,7 +234,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 234 | 234 | move(_RAIter __f, |
| 235 | 235 | _RAIter __l, |
| 236 | 236 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 237 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 237 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 238 | 238 | |
| 239 | 239 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 240 | 240 | class _OutputIterator> |
| ... | ... | @@ -256,7 +256,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 256 | 256 | move_backward(_RAIter __f, |
| 257 | 257 | _RAIter __l, |
| 258 | 258 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 259 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 259 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 260 | 260 | |
| 261 | 261 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 262 | 262 | class _OutputIterator> |
| ... | ... | @@ -450,7 +450,7 @@ private: |
| 450 | 450 | copy(_RAIter __f, |
| 451 | 451 | _RAIter __l, |
| 452 | 452 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 453 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); | |
| 453 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 454 | 454 | |
| 455 | 455 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 456 | 456 | class _OutputIterator> |
| ... | ... | @@ -475,7 +475,7 @@ private: |
| 475 | 475 | copy_backward(_RAIter __f, |
| 476 | 476 | _RAIter __l, |
| 477 | 477 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 478 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); | |
| 478 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 479 | 479 | |
| 480 | 480 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 481 | 481 | class _OutputIterator> |
| ... | ... | @@ -500,7 +500,7 @@ private: |
| 500 | 500 | move(_RAIter __f, |
| 501 | 501 | _RAIter __l, |
| 502 | 502 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 503 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); | |
| 503 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 504 | 504 | |
| 505 | 505 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 506 | 506 | class _OutputIterator> |
| ... | ... | @@ -525,7 +525,7 @@ private: |
| 525 | 525 | move_backward(_RAIter __f, |
| 526 | 526 | _RAIter __l, |
| 527 | 527 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 528 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); | |
| 528 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*); | |
| 529 | 529 | |
| 530 | 530 | template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, |
| 531 | 531 | class _OutputIterator> |
| ... | ... | @@ -558,7 +558,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 558 | 558 | copy(_RAIter __f, |
| 559 | 559 | _RAIter __l, |
| 560 | 560 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 561 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) | |
| 561 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 562 | 562 | { |
| 563 | 563 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; |
| 564 | 564 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; |
| ... | ... | @@ -646,7 +646,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 646 | 646 | copy_backward(_RAIter __f, |
| 647 | 647 | _RAIter __l, |
| 648 | 648 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 649 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) | |
| 649 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 650 | 650 | { |
| 651 | 651 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; |
| 652 | 652 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; |
| ... | ... | @@ -734,7 +734,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 734 | 734 | move(_RAIter __f, |
| 735 | 735 | _RAIter __l, |
| 736 | 736 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 737 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) | |
| 737 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 738 | 738 | { |
| 739 | 739 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; |
| 740 | 740 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; |
| ... | ... | @@ -822,7 +822,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> |
| 822 | 822 | move_backward(_RAIter __f, |
| 823 | 823 | _RAIter __l, |
| 824 | 824 | __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, |
| 825 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) | |
| 825 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 826 | 826 | { |
| 827 | 827 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; |
| 828 | 828 | typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; |
| ... | ... | @@ -934,7 +934,7 @@ public: |
| 934 | 934 | typedef _Allocator allocator_type; |
| 935 | 935 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 936 | 936 | typedef typename __alloc_traits::size_type size_type; |
| 937 | protected: | |
| 937 | ||
| 938 | 938 | typedef _Tp value_type; |
| 939 | 939 | typedef value_type& reference; |
| 940 | 940 | typedef const value_type& const_reference; |
| ... | ... | @@ -956,6 +956,74 @@ protected: |
| 956 | 956 | typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer, |
| 957 | 957 | difference_type> const_iterator; |
| 958 | 958 | |
| 959 | struct __deque_block_range { | |
| 960 | explicit __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {} | |
| 961 | const pointer __begin_; | |
| 962 | const pointer __end_; | |
| 963 | }; | |
| 964 | ||
| 965 | struct __deque_range { | |
| 966 | iterator __pos_; | |
| 967 | const iterator __end_; | |
| 968 | ||
| 969 | __deque_range(iterator __pos, iterator __e) _NOEXCEPT | |
| 970 | : __pos_(__pos), __end_(__e) {} | |
| 971 | ||
| 972 | explicit operator bool() const _NOEXCEPT { | |
| 973 | return __pos_ != __end_; | |
| 974 | } | |
| 975 | ||
| 976 | __deque_range begin() const { | |
| 977 | return *this; | |
| 978 | } | |
| 979 | ||
| 980 | __deque_range end() const { | |
| 981 | return __deque_range(__end_, __end_); | |
| 982 | } | |
| 983 | __deque_block_range operator*() const _NOEXCEPT { | |
| 984 | if (__pos_.__m_iter_ == __end_.__m_iter_) { | |
| 985 | return __deque_block_range(__pos_.__ptr_, __end_.__ptr_); | |
| 986 | } | |
| 987 | return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size); | |
| 988 | } | |
| 989 | ||
| 990 | __deque_range& operator++() _NOEXCEPT { | |
| 991 | if (__pos_.__m_iter_ == __end_.__m_iter_) { | |
| 992 | __pos_ = __end_; | |
| 993 | } else { | |
| 994 | ++__pos_.__m_iter_; | |
| 995 | __pos_.__ptr_ = *__pos_.__m_iter_; | |
| 996 | } | |
| 997 | return *this; | |
| 998 | } | |
| 999 | ||
| 1000 | ||
| 1001 | friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 1002 | return __lhs.__pos_ == __rhs.__pos_; | |
| 1003 | } | |
| 1004 | friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) { | |
| 1005 | return !(__lhs == __rhs); | |
| 1006 | } | |
| 1007 | }; | |
| 1008 | ||
| 1009 | ||
| 1010 | ||
| 1011 | struct _ConstructTransaction { | |
| 1012 | _ConstructTransaction(__deque_base* __db, __deque_block_range& __r) | |
| 1013 | : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {} | |
| 1014 | ||
| 1015 | ||
| 1016 | ~_ConstructTransaction() { | |
| 1017 | __base_->size() += (__pos_ - __begin_); | |
| 1018 | } | |
| 1019 | ||
| 1020 | pointer __pos_; | |
| 1021 | const pointer __end_; | |
| 1022 | private: | |
| 1023 | const pointer __begin_; | |
| 1024 | __deque_base * const __base_; | |
| 1025 | }; | |
| 1026 | ||
| 959 | 1027 | protected: |
| 960 | 1028 | __map __map_; |
| 961 | 1029 | size_type __start_; |
| ... | ... | @@ -1103,7 +1171,7 @@ template <class _Tp, class _Allocator> |
| 1103 | 1171 | inline |
| 1104 | 1172 | __deque_base<_Tp, _Allocator>::__deque_base() |
| 1105 | 1173 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 1106 | : __start_(0), __size_(0) {} | |
| 1174 | : __start_(0), __size_(0, __default_init_tag()) {} | |
| 1107 | 1175 | |
| 1108 | 1176 | template <class _Tp, class _Allocator> |
| 1109 | 1177 | inline |
| ... | ... | @@ -1222,6 +1290,10 @@ public: |
| 1222 | 1290 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; |
| 1223 | 1291 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; |
| 1224 | 1292 | |
| 1293 | using typename __base::__deque_range; | |
| 1294 | using typename __base::__deque_block_range; | |
| 1295 | using typename __base::_ConstructTransaction; | |
| 1296 | ||
| 1225 | 1297 | // construct/copy/destroy: |
| 1226 | 1298 | _LIBCPP_INLINE_VISIBILITY |
| 1227 | 1299 | deque() |
| ... | ... | @@ -1236,10 +1308,10 @@ public: |
| 1236 | 1308 | deque(size_type __n, const value_type& __v, const allocator_type& __a); |
| 1237 | 1309 | template <class _InputIter> |
| 1238 | 1310 | deque(_InputIter __f, _InputIter __l, |
| 1239 | typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); | |
| 1311 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); | |
| 1240 | 1312 | template <class _InputIter> |
| 1241 | 1313 | deque(_InputIter __f, _InputIter __l, const allocator_type& __a, |
| 1242 | typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); | |
| 1314 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); | |
| 1243 | 1315 | deque(const deque& __c); |
| 1244 | 1316 | deque(const deque& __c, const allocator_type& __a); |
| 1245 | 1317 | |
| ... | ... | @@ -1267,11 +1339,11 @@ public: |
| 1267 | 1339 | |
| 1268 | 1340 | template <class _InputIter> |
| 1269 | 1341 | void assign(_InputIter __f, _InputIter __l, |
| 1270 | typename enable_if<__is_input_iterator<_InputIter>::value && | |
| 1271 | !__is_random_access_iterator<_InputIter>::value>::type* = 0); | |
| 1342 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && | |
| 1343 | !__is_cpp17_random_access_iterator<_InputIter>::value>::type* = 0); | |
| 1272 | 1344 | template <class _RAIter> |
| 1273 | 1345 | void assign(_RAIter __f, _RAIter __l, |
| 1274 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 1346 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0); | |
| 1275 | 1347 | void assign(size_type __n, const value_type& __v); |
| 1276 | 1348 | |
| 1277 | 1349 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1371,15 +1443,15 @@ public: |
| 1371 | 1443 | iterator insert(const_iterator __p, size_type __n, const value_type& __v); |
| 1372 | 1444 | template <class _InputIter> |
| 1373 | 1445 | iterator insert(const_iterator __p, _InputIter __f, _InputIter __l, |
| 1374 | typename enable_if<__is_input_iterator<_InputIter>::value | |
| 1375 | &&!__is_forward_iterator<_InputIter>::value>::type* = 0); | |
| 1446 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value | |
| 1447 | &&!__is_cpp17_forward_iterator<_InputIter>::value>::type* = 0); | |
| 1376 | 1448 | template <class _ForwardIterator> |
| 1377 | 1449 | iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, |
| 1378 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value | |
| 1379 | &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0); | |
| 1450 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 1451 | &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type* = 0); | |
| 1380 | 1452 | template <class _BiIter> |
| 1381 | 1453 | iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, |
| 1382 | typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0); | |
| 1454 | typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type* = 0); | |
| 1383 | 1455 | |
| 1384 | 1456 | void pop_front(); |
| 1385 | 1457 | void pop_back(); |
| ... | ... | @@ -1399,7 +1471,7 @@ public: |
| 1399 | 1471 | |
| 1400 | 1472 | _LIBCPP_INLINE_VISIBILITY |
| 1401 | 1473 | bool __invariants() const {return __base::__invariants();} |
| 1402 | private: | |
| 1474 | ||
| 1403 | 1475 | typedef typename __base::__map_const_pointer __map_const_pointer; |
| 1404 | 1476 | |
| 1405 | 1477 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1412,24 +1484,62 @@ private: |
| 1412 | 1484 | { |
| 1413 | 1485 | return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1; |
| 1414 | 1486 | } |
| 1487 | _LIBCPP_INLINE_VISIBILITY | |
| 1488 | size_type __block_count() const | |
| 1489 | { | |
| 1490 | return __base::__map_.size(); | |
| 1491 | } | |
| 1492 | ||
| 1415 | 1493 | _LIBCPP_INLINE_VISIBILITY |
| 1416 | 1494 | size_type __front_spare() const |
| 1417 | 1495 | { |
| 1418 | 1496 | return __base::__start_; |
| 1419 | 1497 | } |
| 1420 | 1498 | _LIBCPP_INLINE_VISIBILITY |
| 1499 | size_type __front_spare_blocks() const { | |
| 1500 | return __front_spare() / __base::__block_size; | |
| 1501 | } | |
| 1502 | _LIBCPP_INLINE_VISIBILITY | |
| 1421 | 1503 | size_type __back_spare() const |
| 1422 | 1504 | { |
| 1423 | 1505 | return __capacity() - (__base::__start_ + __base::size()); |
| 1424 | 1506 | } |
| 1507 | _LIBCPP_INLINE_VISIBILITY | |
| 1508 | size_type __back_spare_blocks() const { | |
| 1509 | return __back_spare() / __base::__block_size; | |
| 1510 | } | |
| 1511 | ||
| 1512 | private: | |
| 1513 | _LIBCPP_INLINE_VISIBILITY | |
| 1514 | bool __maybe_remove_front_spare(bool __keep_one = true) { | |
| 1515 | if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { | |
| 1516 | __alloc_traits::deallocate(__base::__alloc(), __base::__map_.front(), | |
| 1517 | __base::__block_size); | |
| 1518 | __base::__map_.pop_front(); | |
| 1519 | __base::__start_ -= __base::__block_size; | |
| 1520 | return true; | |
| 1521 | } | |
| 1522 | return false; | |
| 1523 | } | |
| 1524 | ||
| 1525 | _LIBCPP_INLINE_VISIBILITY | |
| 1526 | bool __maybe_remove_back_spare(bool __keep_one = true) { | |
| 1527 | if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) { | |
| 1528 | __alloc_traits::deallocate(__base::__alloc(), __base::__map_.back(), | |
| 1529 | __base::__block_size); | |
| 1530 | __base::__map_.pop_back(); | |
| 1531 | return true; | |
| 1532 | } | |
| 1533 | return false; | |
| 1534 | } | |
| 1425 | 1535 | |
| 1426 | 1536 | template <class _InpIter> |
| 1427 | 1537 | void __append(_InpIter __f, _InpIter __l, |
| 1428 | typename enable_if<__is_input_iterator<_InpIter>::value && | |
| 1429 | !__is_forward_iterator<_InpIter>::value>::type* = 0); | |
| 1538 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value && | |
| 1539 | !__is_cpp17_forward_iterator<_InpIter>::value>::type* = 0); | |
| 1430 | 1540 | template <class _ForIter> |
| 1431 | 1541 | void __append(_ForIter __f, _ForIter __l, |
| 1432 | typename enable_if<__is_forward_iterator<_ForIter>::value>::type* = 0); | |
| 1542 | typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type* = 0); | |
| 1433 | 1543 | void __append(size_type __n); |
| 1434 | 1544 | void __append(size_type __n, const value_type& __v); |
| 1435 | 1545 | void __erase_to_end(const_iterator __f); |
| ... | ... | @@ -1524,7 +1634,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const alloca |
| 1524 | 1634 | template <class _Tp, class _Allocator> |
| 1525 | 1635 | template <class _InputIter> |
| 1526 | 1636 | deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, |
| 1527 | typename enable_if<__is_input_iterator<_InputIter>::value>::type*) | |
| 1637 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) | |
| 1528 | 1638 | { |
| 1529 | 1639 | __append(__f, __l); |
| 1530 | 1640 | } |
| ... | ... | @@ -1532,7 +1642,7 @@ deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, |
| 1532 | 1642 | template <class _Tp, class _Allocator> |
| 1533 | 1643 | template <class _InputIter> |
| 1534 | 1644 | deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a, |
| 1535 | typename enable_if<__is_input_iterator<_InputIter>::value>::type*) | |
| 1645 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) | |
| 1536 | 1646 | : __base(__a) |
| 1537 | 1647 | { |
| 1538 | 1648 | __append(__f, __l); |
| ... | ... | @@ -1640,8 +1750,8 @@ template <class _Tp, class _Allocator> |
| 1640 | 1750 | template <class _InputIter> |
| 1641 | 1751 | void |
| 1642 | 1752 | deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l, |
| 1643 | typename enable_if<__is_input_iterator<_InputIter>::value && | |
| 1644 | !__is_random_access_iterator<_InputIter>::value>::type*) | |
| 1753 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value && | |
| 1754 | !__is_cpp17_random_access_iterator<_InputIter>::value>::type*) | |
| 1645 | 1755 | { |
| 1646 | 1756 | iterator __i = __base::begin(); |
| 1647 | 1757 | iterator __e = __base::end(); |
| ... | ... | @@ -1657,7 +1767,7 @@ template <class _Tp, class _Allocator> |
| 1657 | 1767 | template <class _RAIter> |
| 1658 | 1768 | void |
| 1659 | 1769 | deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l, |
| 1660 | typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) | |
| 1770 | typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*) | |
| 1661 | 1771 | { |
| 1662 | 1772 | if (static_cast<size_type>(__l - __f) > __base::size()) |
| 1663 | 1773 | { |
| ... | ... | @@ -1727,17 +1837,8 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT |
| 1727 | 1837 | } |
| 1728 | 1838 | else |
| 1729 | 1839 | { |
| 1730 | if (__front_spare() >= __base::__block_size) | |
| 1731 | { | |
| 1732 | __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size); | |
| 1733 | __base::__map_.pop_front(); | |
| 1734 | __base::__start_ -= __base::__block_size; | |
| 1735 | } | |
| 1736 | if (__back_spare() >= __base::__block_size) | |
| 1737 | { | |
| 1738 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 1739 | __base::__map_.pop_back(); | |
| 1740 | } | |
| 1840 | __maybe_remove_front_spare(/*__keep_one=*/false); | |
| 1841 | __maybe_remove_back_spare(/*__keep_one=*/false); | |
| 1741 | 1842 | } |
| 1742 | 1843 | __base::__map_.shrink_to_fit(); |
| 1743 | 1844 | } |
| ... | ... | @@ -2151,8 +2252,8 @@ template <class _Tp, class _Allocator> |
| 2151 | 2252 | template <class _InputIter> |
| 2152 | 2253 | typename deque<_Tp, _Allocator>::iterator |
| 2153 | 2254 | deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l, |
| 2154 | typename enable_if<__is_input_iterator<_InputIter>::value | |
| 2155 | &&!__is_forward_iterator<_InputIter>::value>::type*) | |
| 2255 | typename enable_if<__is_cpp17_input_iterator<_InputIter>::value | |
| 2256 | &&!__is_cpp17_forward_iterator<_InputIter>::value>::type*) | |
| 2156 | 2257 | { |
| 2157 | 2258 | __split_buffer<value_type, allocator_type&> __buf(__base::__alloc()); |
| 2158 | 2259 | __buf.__construct_at_end(__f, __l); |
| ... | ... | @@ -2164,8 +2265,8 @@ template <class _Tp, class _Allocator> |
| 2164 | 2265 | template <class _ForwardIterator> |
| 2165 | 2266 | typename deque<_Tp, _Allocator>::iterator |
| 2166 | 2267 | deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, |
| 2167 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value | |
| 2168 | &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*) | |
| 2268 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 2269 | &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type*) | |
| 2169 | 2270 | { |
| 2170 | 2271 | size_type __n = _VSTD::distance(__f, __l); |
| 2171 | 2272 | __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc()); |
| ... | ... | @@ -2178,7 +2279,7 @@ template <class _Tp, class _Allocator> |
| 2178 | 2279 | template <class _BiIter> |
| 2179 | 2280 | typename deque<_Tp, _Allocator>::iterator |
| 2180 | 2281 | deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, |
| 2181 | typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type*) | |
| 2282 | typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type*) | |
| 2182 | 2283 | { |
| 2183 | 2284 | size_type __n = _VSTD::distance(__f, __l); |
| 2184 | 2285 | size_type __pos = __p - __base::begin(); |
| ... | ... | @@ -2247,8 +2348,8 @@ template <class _Tp, class _Allocator> |
| 2247 | 2348 | template <class _InpIter> |
| 2248 | 2349 | void |
| 2249 | 2350 | deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l, |
| 2250 | typename enable_if<__is_input_iterator<_InpIter>::value && | |
| 2251 | !__is_forward_iterator<_InpIter>::value>::type*) | |
| 2351 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value && | |
| 2352 | !__is_cpp17_forward_iterator<_InpIter>::value>::type*) | |
| 2252 | 2353 | { |
| 2253 | 2354 | for (; __f != __l; ++__f) |
| 2254 | 2355 | #ifdef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -2262,7 +2363,7 @@ template <class _Tp, class _Allocator> |
| 2262 | 2363 | template <class _ForIter> |
| 2263 | 2364 | void |
| 2264 | 2365 | deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, |
| 2265 | typename enable_if<__is_forward_iterator<_ForIter>::value>::type*) | |
| 2366 | typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type*) | |
| 2266 | 2367 | { |
| 2267 | 2368 | size_type __n = _VSTD::distance(__f, __l); |
| 2268 | 2369 | allocator_type& __a = __base::__alloc(); |
| ... | ... | @@ -2270,8 +2371,12 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, |
| 2270 | 2371 | if (__n > __back_capacity) |
| 2271 | 2372 | __add_back_capacity(__n - __back_capacity); |
| 2272 | 2373 | // __n <= __back_capacity |
| 2273 | for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size()) | |
| 2274 | __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f); | |
| 2374 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 2375 | _ConstructTransaction __tx(this, __br); | |
| 2376 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) { | |
| 2377 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f); | |
| 2378 | } | |
| 2379 | } | |
| 2275 | 2380 | } |
| 2276 | 2381 | |
| 2277 | 2382 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2283,8 +2388,12 @@ deque<_Tp, _Allocator>::__append(size_type __n) |
| 2283 | 2388 | if (__n > __back_capacity) |
| 2284 | 2389 | __add_back_capacity(__n - __back_capacity); |
| 2285 | 2390 | // __n <= __back_capacity |
| 2286 | for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size()) | |
| 2287 | __alloc_traits::construct(__a, _VSTD::addressof(*__i)); | |
| 2391 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 2392 | _ConstructTransaction __tx(this, __br); | |
| 2393 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { | |
| 2394 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_)); | |
| 2395 | } | |
| 2396 | } | |
| 2288 | 2397 | } |
| 2289 | 2398 | |
| 2290 | 2399 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2296,8 +2405,13 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) |
| 2296 | 2405 | if (__n > __back_capacity) |
| 2297 | 2406 | __add_back_capacity(__n - __back_capacity); |
| 2298 | 2407 | // __n <= __back_capacity |
| 2299 | for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size()) | |
| 2300 | __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v); | |
| 2408 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { | |
| 2409 | _ConstructTransaction __tx(this, __br); | |
| 2410 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { | |
| 2411 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v); | |
| 2412 | } | |
| 2413 | } | |
| 2414 | ||
| 2301 | 2415 | } |
| 2302 | 2416 | |
| 2303 | 2417 | // Create front capacity for one block of elements. |
| ... | ... | @@ -2592,16 +2706,12 @@ void |
| 2592 | 2706 | deque<_Tp, _Allocator>::pop_front() |
| 2593 | 2707 | { |
| 2594 | 2708 | allocator_type& __a = __base::__alloc(); |
| 2595 | __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + | |
| 2709 | __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() + | |
| 2596 | 2710 | __base::__start_ / __base::__block_size) + |
| 2597 | 2711 | __base::__start_ % __base::__block_size)); |
| 2598 | 2712 | --__base::size(); |
| 2599 | if (++__base::__start_ >= 2 * __base::__block_size) | |
| 2600 | { | |
| 2601 | __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size); | |
| 2602 | __base::__map_.pop_front(); | |
| 2603 | __base::__start_ -= __base::__block_size; | |
| 2604 | } | |
| 2713 | ++__base::__start_; | |
| 2714 | __maybe_remove_front_spare(); | |
| 2605 | 2715 | } |
| 2606 | 2716 | |
| 2607 | 2717 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2611,15 +2721,11 @@ deque<_Tp, _Allocator>::pop_back() |
| 2611 | 2721 | _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque"); |
| 2612 | 2722 | allocator_type& __a = __base::__alloc(); |
| 2613 | 2723 | size_type __p = __base::size() + __base::__start_ - 1; |
| 2614 | __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + | |
| 2724 | __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() + | |
| 2615 | 2725 | __p / __base::__block_size) + |
| 2616 | 2726 | __p % __base::__block_size)); |
| 2617 | 2727 | --__base::size(); |
| 2618 | if (__back_spare() >= 2 * __base::__block_size) | |
| 2619 | { | |
| 2620 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 2621 | __base::__map_.pop_back(); | |
| 2622 | } | |
| 2728 | __maybe_remove_back_spare(); | |
| 2623 | 2729 | } |
| 2624 | 2730 | |
| 2625 | 2731 | // move assign [__f, __l) to [__r, __r + (__l-__f)). |
| ... | ... | @@ -2768,23 +2874,14 @@ deque<_Tp, _Allocator>::erase(const_iterator __f) |
| 2768 | 2874 | __alloc_traits::destroy(__a, _VSTD::addressof(*__b)); |
| 2769 | 2875 | --__base::size(); |
| 2770 | 2876 | ++__base::__start_; |
| 2771 | if (__front_spare() >= 2 * __base::__block_size) | |
| 2772 | { | |
| 2773 | __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size); | |
| 2774 | __base::__map_.pop_front(); | |
| 2775 | __base::__start_ -= __base::__block_size; | |
| 2776 | } | |
| 2877 | __maybe_remove_front_spare(); | |
| 2777 | 2878 | } |
| 2778 | 2879 | else |
| 2779 | 2880 | { // erase from back |
| 2780 | 2881 | iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p); |
| 2781 | 2882 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); |
| 2782 | 2883 | --__base::size(); |
| 2783 | if (__back_spare() >= 2 * __base::__block_size) | |
| 2784 | { | |
| 2785 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 2786 | __base::__map_.pop_back(); | |
| 2787 | } | |
| 2884 | __maybe_remove_back_spare(); | |
| 2788 | 2885 | } |
| 2789 | 2886 | return __base::begin() + __pos; |
| 2790 | 2887 | } |
| ... | ... | @@ -2807,11 +2904,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) |
| 2807 | 2904 | __alloc_traits::destroy(__a, _VSTD::addressof(*__b)); |
| 2808 | 2905 | __base::size() -= __n; |
| 2809 | 2906 | __base::__start_ += __n; |
| 2810 | while (__front_spare() >= 2 * __base::__block_size) | |
| 2811 | { | |
| 2812 | __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size); | |
| 2813 | __base::__map_.pop_front(); | |
| 2814 | __base::__start_ -= __base::__block_size; | |
| 2907 | while (__maybe_remove_front_spare()) { | |
| 2815 | 2908 | } |
| 2816 | 2909 | } |
| 2817 | 2910 | else |
| ... | ... | @@ -2820,10 +2913,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) |
| 2820 | 2913 | for (iterator __e = __base::end(); __i != __e; ++__i) |
| 2821 | 2914 | __alloc_traits::destroy(__a, _VSTD::addressof(*__i)); |
| 2822 | 2915 | __base::size() -= __n; |
| 2823 | while (__back_spare() >= 2 * __base::__block_size) | |
| 2824 | { | |
| 2825 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 2826 | __base::__map_.pop_back(); | |
| 2916 | while (__maybe_remove_back_spare()) { | |
| 2827 | 2917 | } |
| 2828 | 2918 | } |
| 2829 | 2919 | } |
| ... | ... | @@ -2844,10 +2934,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) |
| 2844 | 2934 | for (iterator __p = __b + __pos; __p != __e; ++__p) |
| 2845 | 2935 | __alloc_traits::destroy(__a, _VSTD::addressof(*__p)); |
| 2846 | 2936 | __base::size() -= __n; |
| 2847 | while (__back_spare() >= 2 * __base::__block_size) | |
| 2848 | { | |
| 2849 | __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); | |
| 2850 | __base::__map_.pop_back(); | |
| 2937 | while (__maybe_remove_back_spare()) { | |
| 2851 | 2938 | } |
| 2852 | 2939 | } |
| 2853 | 2940 | } |
lib/libcxx/include/execution created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===------------------------- execution ---------------------------------===// | |
| 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_EXECUTION | |
| 11 | #define _LIBCPP_EXECUTION | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | ||
| 15 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 | |
| 16 | # include <__pstl_execution> | |
| 17 | #endif | |
| 18 | ||
| 19 | #endif // _LIBCPP_EXECUTION |
lib/libcxx/include/experimental/coroutine-1| ... | ... | @@ -51,7 +51,6 @@ template <class P> struct hash<coroutine_handle<P>>; |
| 51 | 51 | #include <functional> |
| 52 | 52 | #include <memory> // for hash<T*> |
| 53 | 53 | #include <cstddef> |
| 54 | #include <cassert> | |
| 55 | 54 | #include <__debug> |
| 56 | 55 | |
| 57 | 56 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
lib/libcxx/include/experimental/functional+39-39| ... | ... | @@ -112,7 +112,7 @@ template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> |
| 112 | 112 | class _LIBCPP_TYPE_VIS default_searcher { |
| 113 | 113 | public: |
| 114 | 114 | _LIBCPP_INLINE_VISIBILITY |
| 115 | default_searcher(_ForwardIterator __f, _ForwardIterator __l, | |
| 115 | default_searcher(_ForwardIterator __f, _ForwardIterator __l, | |
| 116 | 116 | _BinaryPredicate __p = _BinaryPredicate()) |
| 117 | 117 | : __first_(__f), __last_(__l), __pred_(__p) {} |
| 118 | 118 | |
| ... | ... | @@ -151,12 +151,12 @@ public: // TODO private: |
| 151 | 151 | |
| 152 | 152 | const _Value __default_value_; |
| 153 | 153 | std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table; |
| 154 | ||
| 154 | ||
| 155 | 155 | public: |
| 156 | 156 | _LIBCPP_INLINE_VISIBILITY |
| 157 | 157 | _BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred) |
| 158 | 158 | : __default_value_(__default), __table(__sz, __hf, __pred) {} |
| 159 | ||
| 159 | ||
| 160 | 160 | _LIBCPP_INLINE_VISIBILITY |
| 161 | 161 | void insert(const key_type &__key, value_type __val) |
| 162 | 162 | { |
| ... | ... | @@ -170,7 +170,7 @@ public: |
| 170 | 170 | return __it == __table.end() ? __default_value_ : __it->second; |
| 171 | 171 | } |
| 172 | 172 | }; |
| 173 | ||
| 173 | ||
| 174 | 174 | |
| 175 | 175 | // Special case small numeric values; use an array |
| 176 | 176 | template<class _Key, typename _Value, class _Hash, class _BinaryPredicate> |
| ... | ... | @@ -189,7 +189,7 @@ public: |
| 189 | 189 | { |
| 190 | 190 | std::fill_n(__table.begin(), __table.size(), __default); |
| 191 | 191 | } |
| 192 | ||
| 192 | ||
| 193 | 193 | _LIBCPP_INLINE_VISIBILITY |
| 194 | 194 | void insert(key_type __key, value_type __val) |
| 195 | 195 | { |
| ... | ... | @@ -204,8 +204,8 @@ public: |
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | 206 | |
| 207 | template <class _RandomAccessIterator1, | |
| 208 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, | |
| 207 | template <class _RandomAccessIterator1, | |
| 208 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, | |
| 209 | 209 | class _BinaryPredicate = equal_to<>> |
| 210 | 210 | class _LIBCPP_TYPE_VIS boyer_moore_searcher { |
| 211 | 211 | private: |
| ... | ... | @@ -217,9 +217,9 @@ private: |
| 217 | 217 | is_same<_Hash, hash<value_type>>::value && |
| 218 | 218 | is_same<_BinaryPredicate, equal_to<>>::value |
| 219 | 219 | > skip_table_type; |
| 220 | ||
| 220 | ||
| 221 | 221 | public: |
| 222 | boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 222 | boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 223 | 223 | _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) |
| 224 | 224 | : __first_(__f), __last_(__l), __pred_(__pred), |
| 225 | 225 | __pattern_length_(_VSTD::distance(__first_, __last_)), |
| ... | ... | @@ -232,13 +232,13 @@ public: |
| 232 | 232 | |
| 233 | 233 | this->__build_suffix_table ( __first_, __last_, __pred_ ); |
| 234 | 234 | } |
| 235 | ||
| 235 | ||
| 236 | 236 | template <typename _RandomAccessIterator2> |
| 237 | 237 | pair<_RandomAccessIterator2, _RandomAccessIterator2> |
| 238 | 238 | operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const |
| 239 | 239 | { |
| 240 | 240 | static_assert ( std::is_same< |
| 241 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, | |
| 241 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, | |
| 242 | 242 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type |
| 243 | 243 | >::value, |
| 244 | 244 | "Corpus and Pattern iterators must point to the same type" ); |
| ... | ... | @@ -247,13 +247,13 @@ public: |
| 247 | 247 | if (__first_ == __last_) return make_pair(__f, __f); // empty pattern |
| 248 | 248 | |
| 249 | 249 | // If the pattern is larger than the corpus, we can't find it! |
| 250 | if ( __pattern_length_ > _VSTD::distance (__f, __l)) | |
| 250 | if ( __pattern_length_ > _VSTD::distance (__f, __l)) | |
| 251 | 251 | return make_pair(__l, __l); |
| 252 | 252 | |
| 253 | // Do the search | |
| 253 | // Do the search | |
| 254 | 254 | return this->__search(__f, __l); |
| 255 | 255 | } |
| 256 | ||
| 256 | ||
| 257 | 257 | public: // TODO private: |
| 258 | 258 | _RandomAccessIterator1 __first_; |
| 259 | 259 | _RandomAccessIterator1 __last_; |
| ... | ... | @@ -270,7 +270,7 @@ public: // TODO private: |
| 270 | 270 | const _RandomAccessIterator2 __last = __l - __pattern_length_; |
| 271 | 271 | const skip_table_type & __skip = *__skip_.get(); |
| 272 | 272 | const vector<difference_type> & __suffix = *__suffix_.get(); |
| 273 | ||
| 273 | ||
| 274 | 274 | while (__cur <= __last) |
| 275 | 275 | { |
| 276 | 276 | |
| ... | ... | @@ -282,7 +282,7 @@ public: // TODO private: |
| 282 | 282 | if ( __j == 0 ) |
| 283 | 283 | return make_pair(__cur, __cur + __pattern_length_); |
| 284 | 284 | } |
| 285 | ||
| 285 | ||
| 286 | 286 | // Since we didn't match, figure out how far to skip forward |
| 287 | 287 | difference_type __k = __skip[__cur [ __j - 1 ]]; |
| 288 | 288 | difference_type __m = __j - __k - 1; |
| ... | ... | @@ -291,7 +291,7 @@ public: // TODO private: |
| 291 | 291 | else |
| 292 | 292 | __cur += __suffix[ __j ]; |
| 293 | 293 | } |
| 294 | ||
| 294 | ||
| 295 | 295 | return make_pair(__l, __l); // We didn't find anything |
| 296 | 296 | } |
| 297 | 297 | |
| ... | ... | @@ -300,21 +300,21 @@ public: // TODO private: |
| 300 | 300 | void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix ) |
| 301 | 301 | { |
| 302 | 302 | const std::size_t __count = _VSTD::distance(__f, __l); |
| 303 | ||
| 303 | ||
| 304 | 304 | __prefix[0] = 0; |
| 305 | 305 | std::size_t __k = 0; |
| 306 | 306 | for ( std::size_t __i = 1; __i < __count; ++__i ) |
| 307 | 307 | { |
| 308 | 308 | while ( __k > 0 && !__pred ( __f[__k], __f[__i] )) |
| 309 | 309 | __k = __prefix [ __k - 1 ]; |
| 310 | ||
| 310 | ||
| 311 | 311 | if ( __pred ( __f[__k], __f[__i] )) |
| 312 | 312 | __k++; |
| 313 | 313 | __prefix [ __i ] = __k; |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 317 | void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 318 | 318 | _BinaryPredicate __pred) |
| 319 | 319 | { |
| 320 | 320 | const std::size_t __count = _VSTD::distance(__f, __l); |
| ... | ... | @@ -322,19 +322,19 @@ public: // TODO private: |
| 322 | 322 | if (__count > 0) |
| 323 | 323 | { |
| 324 | 324 | _VSTD::vector<value_type> __scratch(__count); |
| 325 | ||
| 325 | ||
| 326 | 326 | __compute_bm_prefix(__f, __l, __pred, __scratch); |
| 327 | 327 | for ( std::size_t __i = 0; __i <= __count; __i++ ) |
| 328 | 328 | __suffix[__i] = __count - __scratch[__count-1]; |
| 329 | ||
| 329 | ||
| 330 | 330 | typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter; |
| 331 | 331 | __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch); |
| 332 | ||
| 332 | ||
| 333 | 333 | for ( std::size_t __i = 0; __i < __count; __i++ ) |
| 334 | 334 | { |
| 335 | 335 | const std::size_t __j = __count - __scratch[__i]; |
| 336 | 336 | const difference_type __k = __i - __scratch[__i] + 1; |
| 337 | ||
| 337 | ||
| 338 | 338 | if (__suffix[__j] > __k) |
| 339 | 339 | __suffix[__j] = __k; |
| 340 | 340 | } |
| ... | ... | @@ -343,20 +343,20 @@ public: // TODO private: |
| 343 | 343 | |
| 344 | 344 | }; |
| 345 | 345 | |
| 346 | template<class _RandomAccessIterator, | |
| 347 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, | |
| 346 | template<class _RandomAccessIterator, | |
| 347 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, | |
| 348 | 348 | class _BinaryPredicate = equal_to<>> |
| 349 | 349 | _LIBCPP_INLINE_VISIBILITY |
| 350 | 350 | boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> |
| 351 | make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, | |
| 351 | make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, | |
| 352 | 352 | _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) |
| 353 | 353 | { |
| 354 | 354 | return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // boyer-moore-horspool |
| 358 | template <class _RandomAccessIterator1, | |
| 359 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, | |
| 358 | template <class _RandomAccessIterator1, | |
| 359 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, | |
| 360 | 360 | class _BinaryPredicate = equal_to<>> |
| 361 | 361 | class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher { |
| 362 | 362 | private: |
| ... | ... | @@ -370,7 +370,7 @@ private: |
| 370 | 370 | > skip_table_type; |
| 371 | 371 | |
| 372 | 372 | public: |
| 373 | boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 373 | boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, | |
| 374 | 374 | _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) |
| 375 | 375 | : __first_(__f), __last_(__l), __pred_(__pred), |
| 376 | 376 | __pattern_length_(_VSTD::distance(__first_, __last_)), |
| ... | ... | @@ -384,13 +384,13 @@ public: |
| 384 | 384 | __skip_->insert(*__f, __pattern_length_ - 1 - __i); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | ||
| 387 | ||
| 388 | 388 | template <typename _RandomAccessIterator2> |
| 389 | 389 | pair<_RandomAccessIterator2, _RandomAccessIterator2> |
| 390 | 390 | operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const |
| 391 | 391 | { |
| 392 | 392 | static_assert ( std::is_same< |
| 393 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, | |
| 393 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, | |
| 394 | 394 | typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type |
| 395 | 395 | >::value, |
| 396 | 396 | "Corpus and Pattern iterators must point to the same type" ); |
| ... | ... | @@ -399,13 +399,13 @@ public: |
| 399 | 399 | if (__first_ == __last_) return make_pair(__f, __f); // empty pattern |
| 400 | 400 | |
| 401 | 401 | // If the pattern is larger than the corpus, we can't find it! |
| 402 | if ( __pattern_length_ > _VSTD::distance (__f, __l)) | |
| 402 | if ( __pattern_length_ > _VSTD::distance (__f, __l)) | |
| 403 | 403 | return make_pair(__l, __l); |
| 404 | 404 | |
| 405 | // Do the search | |
| 405 | // Do the search | |
| 406 | 406 | return this->__search(__f, __l); |
| 407 | 407 | } |
| 408 | ||
| 408 | ||
| 409 | 409 | private: |
| 410 | 410 | _RandomAccessIterator1 __first_; |
| 411 | 411 | _RandomAccessIterator1 __last_; |
| ... | ... | @@ -433,17 +433,17 @@ private: |
| 433 | 433 | } |
| 434 | 434 | __cur += __skip[__cur[__pattern_length_-1]]; |
| 435 | 435 | } |
| 436 | ||
| 436 | ||
| 437 | 437 | return make_pair(__l, __l); |
| 438 | 438 | } |
| 439 | 439 | }; |
| 440 | 440 | |
| 441 | template<class _RandomAccessIterator, | |
| 442 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, | |
| 441 | template<class _RandomAccessIterator, | |
| 442 | class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, | |
| 443 | 443 | class _BinaryPredicate = equal_to<>> |
| 444 | 444 | _LIBCPP_INLINE_VISIBILITY |
| 445 | 445 | boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> |
| 446 | make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, | |
| 446 | make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, | |
| 447 | 447 | _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) |
| 448 | 448 | { |
| 449 | 449 | return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); |
lib/libcxx/include/experimental/iterator+6-6| ... | ... | @@ -26,19 +26,19 @@ namespace std { |
| 26 | 26 | typedef void difference_type; |
| 27 | 27 | typedef void pointer; |
| 28 | 28 | typedef void reference; |
| 29 | ||
| 29 | ||
| 30 | 30 | ostream_joiner(ostream_type& s, const DelimT& delimiter); |
| 31 | 31 | ostream_joiner(ostream_type& s, DelimT&& delimiter); |
| 32 | 32 | |
| 33 | template<typename T> | |
| 33 | template<typename T> | |
| 34 | 34 | ostream_joiner& operator=(const T& value); |
| 35 | 35 | |
| 36 | 36 | ostream_joiner& operator*() noexcept; |
| 37 | 37 | ostream_joiner& operator++() noexcept; |
| 38 | 38 | ostream_joiner& operator++(int) noexcept; |
| 39 | 39 | private: |
| 40 | ostream_type* out_stream; // exposition only | |
| 41 | DelimT delim; // exposition only | |
| 40 | ostream_type* out_stream; // exposition only | |
| 41 | DelimT delim; // exposition only | |
| 42 | 42 | bool first_element; // exposition only |
| 43 | 43 | }; |
| 44 | 44 | |
| ... | ... | @@ -75,10 +75,10 @@ public: |
| 75 | 75 | |
| 76 | 76 | ostream_joiner(ostream_type& __os, _Delim&& __d) |
| 77 | 77 | : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {} |
| 78 | ||
| 78 | ||
| 79 | 79 | ostream_joiner(ostream_type& __os, const _Delim& __d) |
| 80 | 80 | : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {} |
| 81 | ||
| 81 | ||
| 82 | 82 | |
| 83 | 83 | template<typename _Tp> |
| 84 | 84 | ostream_joiner& operator=(const _Tp& __v) |
lib/libcxx/include/experimental/propagate_const-1| ... | ... | @@ -575,4 +575,3 @@ _LIBCPP_END_NAMESPACE_STD |
| 575 | 575 | |
| 576 | 576 | #endif // _LIBCPP_STD_VER > 11 |
| 577 | 577 | #endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST |
| 578 |
lib/libcxx/include/experimental/type_traits+3-3| ... | ... | @@ -60,7 +60,7 @@ inline namespace fundamentals_v1 { |
| 60 | 60 | using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>; |
| 61 | 61 | template <class To, template<class...> class Op, class... Args> |
| 62 | 62 | constexpr bool is_detected_convertible_v |
| 63 | = is_detected_convertible<To, Op, Args...>::value; | |
| 63 | = is_detected_convertible<To, Op, Args...>::value; | |
| 64 | 64 | |
| 65 | 65 | } // namespace fundamentals_v1 |
| 66 | 66 | } // namespace experimental |
| ... | ... | @@ -122,7 +122,7 @@ struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> { |
| 122 | 122 | using value_t = true_type; |
| 123 | 123 | using type = _Op<_Args...>; |
| 124 | 124 | }; |
| 125 | ||
| 125 | ||
| 126 | 126 | |
| 127 | 127 | template <template<class...> class _Op, class... _Args> |
| 128 | 128 | using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t; |
| ... | ... | @@ -144,7 +144,7 @@ template <class Expected, template<class...> class _Op, class... _Args> |
| 144 | 144 | template <class To, template<class...> class _Op, class... _Args> |
| 145 | 145 | using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>; |
| 146 | 146 | template <class To, template<class...> class _Op, class... _Args> |
| 147 | _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value; | |
| 147 | _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value; | |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | _LIBCPP_END_NAMESPACE_LFTS |
lib/libcxx/include/ext/hash_map+15-13| ... | ... | @@ -39,14 +39,17 @@ public: |
| 39 | 39 | typedef /unspecified/ iterator; |
| 40 | 40 | typedef /unspecified/ const_iterator; |
| 41 | 41 | |
| 42 | explicit hash_map(size_type n = 193, const hasher& hf = hasher(), | |
| 42 | hash_map(); | |
| 43 | explicit hash_map(size_type n, const hasher& hf = hasher(), | |
| 43 | 44 | const key_equal& eql = key_equal(), |
| 44 | 45 | const allocator_type& a = allocator_type()); |
| 45 | 46 | template <class InputIterator> |
| 46 | hash_map(InputIterator f, InputIterator l, | |
| 47 | size_type n = 193, const hasher& hf = hasher(), | |
| 48 | const key_equal& eql = key_equal(), | |
| 49 | const allocator_type& a = allocator_type()); | |
| 47 | hash_map(InputIterator f, InputIterator l); | |
| 48 | template <class InputIterator> | |
| 49 | hash_map(InputIterator f, InputIterator l, | |
| 50 | size_type n, const hasher& hf = hasher(), | |
| 51 | const key_equal& eql = key_equal(), | |
| 52 | const allocator_type& a = allocator_type()); | |
| 50 | 53 | hash_map(const hash_map&); |
| 51 | 54 | ~hash_map(); |
| 52 | 55 | hash_map& operator=(const hash_map&); |
| ... | ... | @@ -315,12 +318,13 @@ private: |
| 315 | 318 | |
| 316 | 319 | allocator_type& __na_; |
| 317 | 320 | |
| 318 | __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); | |
| 319 | ||
| 320 | 321 | public: |
| 321 | 322 | bool __first_constructed; |
| 322 | 323 | bool __second_constructed; |
| 323 | 324 | |
| 325 | __hash_map_node_destructor(__hash_map_node_destructor const&) = default; | |
| 326 | __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete; | |
| 327 | ||
| 324 | 328 | _LIBCPP_INLINE_VISIBILITY |
| 325 | 329 | explicit __hash_map_node_destructor(allocator_type& __na) |
| 326 | 330 | : __na_(__na), |
| ... | ... | @@ -391,10 +395,10 @@ public: |
| 391 | 395 | return __t; |
| 392 | 396 | } |
| 393 | 397 | |
| 394 | friend _LIBCPP_INLINE_VISIBILITY | |
| 398 | friend _LIBCPP_INLINE_VISIBILITY | |
| 395 | 399 | bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) |
| 396 | 400 | {return __x.__i_ == __y.__i_;} |
| 397 | friend _LIBCPP_INLINE_VISIBILITY | |
| 401 | friend _LIBCPP_INLINE_VISIBILITY | |
| 398 | 402 | bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) |
| 399 | 403 | {return __x.__i_ != __y.__i_;} |
| 400 | 404 | |
| ... | ... | @@ -502,7 +506,7 @@ public: |
| 502 | 506 | typedef __hash_map_iterator<typename __table::iterator> iterator; |
| 503 | 507 | typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; |
| 504 | 508 | |
| 505 | _LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);} | |
| 509 | _LIBCPP_INLINE_VISIBILITY hash_map() { } | |
| 506 | 510 | explicit hash_map(size_type __n, const hasher& __hf = hasher(), |
| 507 | 511 | const key_equal& __eql = key_equal()); |
| 508 | 512 | hash_map(size_type __n, const hasher& __hf, |
| ... | ... | @@ -623,7 +627,6 @@ template <class _InputIterator> |
| 623 | 627 | hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map( |
| 624 | 628 | _InputIterator __first, _InputIterator __last) |
| 625 | 629 | { |
| 626 | __table_.rehash(193); | |
| 627 | 630 | insert(__first, __last); |
| 628 | 631 | } |
| 629 | 632 | |
| ... | ... | @@ -775,7 +778,7 @@ public: |
| 775 | 778 | typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; |
| 776 | 779 | |
| 777 | 780 | _LIBCPP_INLINE_VISIBILITY |
| 778 | hash_multimap() {__table_.rehash(193);} | |
| 781 | hash_multimap() { } | |
| 779 | 782 | explicit hash_multimap(size_type __n, const hasher& __hf = hasher(), |
| 780 | 783 | const key_equal& __eql = key_equal()); |
| 781 | 784 | hash_multimap(size_type __n, const hasher& __hf, |
| ... | ... | @@ -890,7 +893,6 @@ template <class _InputIterator> |
| 890 | 893 | hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap( |
| 891 | 894 | _InputIterator __first, _InputIterator __last) |
| 892 | 895 | { |
| 893 | __table_.rehash(193); | |
| 894 | 896 | insert(__first, __last); |
| 895 | 897 | } |
| 896 | 898 |
lib/libcxx/include/ext/hash_set+2-4| ... | ... | @@ -237,7 +237,7 @@ public: |
| 237 | 237 | typedef typename __table::const_iterator const_iterator; |
| 238 | 238 | |
| 239 | 239 | _LIBCPP_INLINE_VISIBILITY |
| 240 | hash_set() {__table_.rehash(193);} | |
| 240 | hash_set() { } | |
| 241 | 241 | explicit hash_set(size_type __n, const hasher& __hf = hasher(), |
| 242 | 242 | const key_equal& __eql = key_equal()); |
| 243 | 243 | hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, |
| ... | ... | @@ -347,7 +347,6 @@ template <class _InputIterator> |
| 347 | 347 | hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set( |
| 348 | 348 | _InputIterator __first, _InputIterator __last) |
| 349 | 349 | { |
| 350 | __table_.rehash(193); | |
| 351 | 350 | insert(__first, __last); |
| 352 | 351 | } |
| 353 | 352 | |
| ... | ... | @@ -459,7 +458,7 @@ public: |
| 459 | 458 | typedef typename __table::const_iterator const_iterator; |
| 460 | 459 | |
| 461 | 460 | _LIBCPP_INLINE_VISIBILITY |
| 462 | hash_multiset() {__table_.rehash(193);} | |
| 461 | hash_multiset() { } | |
| 463 | 462 | explicit hash_multiset(size_type __n, const hasher& __hf = hasher(), |
| 464 | 463 | const key_equal& __eql = key_equal()); |
| 465 | 464 | hash_multiset(size_type __n, const hasher& __hf, |
| ... | ... | @@ -569,7 +568,6 @@ template <class _InputIterator> |
| 569 | 568 | hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset( |
| 570 | 569 | _InputIterator __first, _InputIterator __last) |
| 571 | 570 | { |
| 572 | __table_.rehash(193); | |
| 573 | 571 | insert(__first, __last); |
| 574 | 572 | } |
| 575 | 573 |
lib/libcxx/include/filesystem+4-3| ... | ... | @@ -625,7 +625,7 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> |
| 625 | 625 | static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } |
| 626 | 626 | }; |
| 627 | 627 | |
| 628 | template <class _Iter, bool _IsIt = __is_input_iterator<_Iter>::value, | |
| 628 | template <class _Iter, bool _IsIt = __is_cpp17_input_iterator<_Iter>::value, | |
| 629 | 629 | class = void> |
| 630 | 630 | struct __is_pathable_iter : false_type {}; |
| 631 | 631 | |
| ... | ... | @@ -708,14 +708,14 @@ template <> |
| 708 | 708 | struct _PathCVT<char> { |
| 709 | 709 | |
| 710 | 710 | template <class _Iter> |
| 711 | static typename enable_if<__is_exactly_input_iterator<_Iter>::value>::type | |
| 711 | static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type | |
| 712 | 712 | __append_range(string& __dest, _Iter __b, _Iter __e) { |
| 713 | 713 | for (; __b != __e; ++__b) |
| 714 | 714 | __dest.push_back(*__b); |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | template <class _Iter> |
| 718 | static typename enable_if<__is_forward_iterator<_Iter>::value>::type | |
| 718 | static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type | |
| 719 | 719 | __append_range(string& __dest, _Iter __b, _Iter __e) { |
| 720 | 720 | __dest.__append_forward_unsafe(__b, __e); |
| 721 | 721 | } |
| ... | ... | @@ -2583,6 +2583,7 @@ public: |
| 2583 | 2583 | void disable_recursion_pending() { __rec_ = false; } |
| 2584 | 2584 | |
| 2585 | 2585 | private: |
| 2586 | _LIBCPP_FUNC_VIS | |
| 2586 | 2587 | recursive_directory_iterator(const path& __p, directory_options __opt, |
| 2587 | 2588 | error_code* __ec); |
| 2588 | 2589 |
lib/libcxx/include/forward_list+12-12| ... | ... | @@ -490,7 +490,7 @@ protected: |
| 490 | 490 | _LIBCPP_INLINE_VISIBILITY |
| 491 | 491 | __forward_list_base() |
| 492 | 492 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) |
| 493 | : __before_begin_(__begin_node()) {} | |
| 493 | : __before_begin_(__begin_node(), __default_init_tag()) {} | |
| 494 | 494 | _LIBCPP_INLINE_VISIBILITY |
| 495 | 495 | explicit __forward_list_base(const allocator_type& __a) |
| 496 | 496 | : __before_begin_(__begin_node(), __node_allocator(__a)) {} |
| ... | ... | @@ -670,13 +670,13 @@ public: |
| 670 | 670 | template <class _InputIterator> |
| 671 | 671 | forward_list(_InputIterator __f, _InputIterator __l, |
| 672 | 672 | typename enable_if< |
| 673 | __is_input_iterator<_InputIterator>::value | |
| 673 | __is_cpp17_input_iterator<_InputIterator>::value | |
| 674 | 674 | >::type* = nullptr); |
| 675 | 675 | template <class _InputIterator> |
| 676 | 676 | forward_list(_InputIterator __f, _InputIterator __l, |
| 677 | 677 | const allocator_type& __a, |
| 678 | 678 | typename enable_if< |
| 679 | __is_input_iterator<_InputIterator>::value | |
| 679 | __is_cpp17_input_iterator<_InputIterator>::value | |
| 680 | 680 | >::type* = nullptr); |
| 681 | 681 | forward_list(const forward_list& __x); |
| 682 | 682 | forward_list(const forward_list& __x, const allocator_type& __a); |
| ... | ... | @@ -711,7 +711,7 @@ public: |
| 711 | 711 | template <class _InputIterator> |
| 712 | 712 | typename enable_if |
| 713 | 713 | < |
| 714 | __is_input_iterator<_InputIterator>::value, | |
| 714 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 715 | 715 | void |
| 716 | 716 | >::type |
| 717 | 717 | assign(_InputIterator __f, _InputIterator __l); |
| ... | ... | @@ -792,7 +792,7 @@ public: |
| 792 | 792 | _LIBCPP_INLINE_VISIBILITY |
| 793 | 793 | typename enable_if |
| 794 | 794 | < |
| 795 | __is_input_iterator<_InputIterator>::value, | |
| 795 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 796 | 796 | iterator |
| 797 | 797 | >::type |
| 798 | 798 | insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); |
| ... | ... | @@ -950,7 +950,7 @@ template <class _Tp, class _Alloc> |
| 950 | 950 | template <class _InputIterator> |
| 951 | 951 | forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, |
| 952 | 952 | typename enable_if< |
| 953 | __is_input_iterator<_InputIterator>::value | |
| 953 | __is_cpp17_input_iterator<_InputIterator>::value | |
| 954 | 954 | >::type*) |
| 955 | 955 | { |
| 956 | 956 | insert_after(cbefore_begin(), __f, __l); |
| ... | ... | @@ -961,7 +961,7 @@ template <class _InputIterator> |
| 961 | 961 | forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, |
| 962 | 962 | const allocator_type& __a, |
| 963 | 963 | typename enable_if< |
| 964 | __is_input_iterator<_InputIterator>::value | |
| 964 | __is_cpp17_input_iterator<_InputIterator>::value | |
| 965 | 965 | >::type*) |
| 966 | 966 | : base(__a) |
| 967 | 967 | { |
| ... | ... | @@ -1074,7 +1074,7 @@ template <class _Tp, class _Alloc> |
| 1074 | 1074 | template <class _InputIterator> |
| 1075 | 1075 | typename enable_if |
| 1076 | 1076 | < |
| 1077 | __is_input_iterator<_InputIterator>::value, | |
| 1077 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 1078 | 1078 | void |
| 1079 | 1079 | >::type |
| 1080 | 1080 | forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) |
| ... | ... | @@ -1270,7 +1270,7 @@ template <class _Tp, class _Alloc> |
| 1270 | 1270 | template <class _InputIterator> |
| 1271 | 1271 | typename enable_if |
| 1272 | 1272 | < |
| 1273 | __is_input_iterator<_InputIterator>::value, | |
| 1273 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 1274 | 1274 | typename forward_list<_Tp, _Alloc>::iterator |
| 1275 | 1275 | >::type |
| 1276 | 1276 | forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, |
| ... | ... | @@ -1525,7 +1525,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v) |
| 1525 | 1525 | else |
| 1526 | 1526 | ++__i; |
| 1527 | 1527 | } |
| 1528 | ||
| 1528 | ||
| 1529 | 1529 | return (__remove_return_type) __count_removed; |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| ... | ... | @@ -1553,7 +1553,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) |
| 1553 | 1553 | else |
| 1554 | 1554 | ++__i; |
| 1555 | 1555 | } |
| 1556 | ||
| 1556 | ||
| 1557 | 1557 | return (__remove_return_type) __count_removed; |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| ... | ... | @@ -1573,7 +1573,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) |
| 1573 | 1573 | __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); |
| 1574 | 1574 | __i = __j; |
| 1575 | 1575 | } |
| 1576 | ||
| 1576 | ||
| 1577 | 1577 | return (__remove_return_type) __count_removed; |
| 1578 | 1578 | } |
| 1579 | 1579 |
lib/libcxx/include/fstream+14-15| ... | ... | @@ -508,34 +508,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring( |
| 508 | 508 | switch (__mode & ~ios_base::ate) { |
| 509 | 509 | case ios_base::out: |
| 510 | 510 | case ios_base::out | ios_base::trunc: |
| 511 | return "w"; | |
| 511 | return "w" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 512 | 512 | case ios_base::out | ios_base::app: |
| 513 | 513 | case ios_base::app: |
| 514 | return "a"; | |
| 514 | return "a" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 515 | 515 | case ios_base::in: |
| 516 | return "r"; | |
| 516 | return "r" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 517 | 517 | case ios_base::in | ios_base::out: |
| 518 | return "r+"; | |
| 518 | return "r+" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 519 | 519 | case ios_base::in | ios_base::out | ios_base::trunc: |
| 520 | return "w+"; | |
| 520 | return "w+" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 521 | 521 | case ios_base::in | ios_base::out | ios_base::app: |
| 522 | 522 | case ios_base::in | ios_base::app: |
| 523 | return "a+"; | |
| 523 | return "a+" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 524 | 524 | case ios_base::out | ios_base::binary: |
| 525 | 525 | case ios_base::out | ios_base::trunc | ios_base::binary: |
| 526 | return "wb"; | |
| 526 | return "wb" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 527 | 527 | case ios_base::out | ios_base::app | ios_base::binary: |
| 528 | 528 | case ios_base::app | ios_base::binary: |
| 529 | return "ab"; | |
| 529 | return "ab" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 530 | 530 | case ios_base::in | ios_base::binary: |
| 531 | return "rb"; | |
| 531 | return "rb" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 532 | 532 | case ios_base::in | ios_base::out | ios_base::binary: |
| 533 | return "r+b"; | |
| 533 | return "r+b" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 534 | 534 | case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: |
| 535 | return "w+b"; | |
| 535 | return "w+b" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 536 | 536 | case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: |
| 537 | 537 | case ios_base::in | ios_base::app | ios_base::binary: |
| 538 | return "a+b"; | |
| 538 | return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE; | |
| 539 | 539 | default: |
| 540 | 540 | return nullptr; |
| 541 | 541 | } |
| ... | ... | @@ -697,10 +697,9 @@ basic_filebuf<_CharT, _Traits>::close() |
| 697 | 697 | unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); |
| 698 | 698 | if (sync()) |
| 699 | 699 | __rt = 0; |
| 700 | if (fclose(__h.release()) == 0) | |
| 701 | __file_ = 0; | |
| 702 | else | |
| 700 | if (fclose(__h.release())) | |
| 703 | 701 | __rt = 0; |
| 702 | __file_ = 0; | |
| 704 | 703 | setbuf(0, 0); |
| 705 | 704 | } |
| 706 | 705 | return __rt; |
lib/libcxx/include/functional+54| ... | ... | @@ -440,6 +440,13 @@ public: |
| 440 | 440 | template <typename T> const T* target() const noexcept; |
| 441 | 441 | }; |
| 442 | 442 | |
| 443 | // Deduction guides | |
| 444 | template<class R, class ...Args> | |
| 445 | function(R(*)(Args...)) -> function<R(Args...)>; // since C++17 | |
| 446 | ||
| 447 | template<class F> | |
| 448 | function(F) -> function<see-below>; // since C++17 | |
| 449 | ||
| 443 | 450 | // Null pointer comparisons: |
| 444 | 451 | template <class R, class ... ArgTypes> |
| 445 | 452 | bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept; |
| ... | ... | @@ -2335,6 +2342,53 @@ public: |
| 2335 | 2342 | #endif // _LIBCPP_NO_RTTI |
| 2336 | 2343 | }; |
| 2337 | 2344 | |
| 2345 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 2346 | template<class _Rp, class ..._Ap> | |
| 2347 | function(_Rp(*)(_Ap...)) -> function<_Rp(_Ap...)>; | |
| 2348 | ||
| 2349 | template<class _Fp> | |
| 2350 | struct __strip_signature; | |
| 2351 | ||
| 2352 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2353 | struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); }; | |
| 2354 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2355 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const> { using type = _Rp(_Ap...); }; | |
| 2356 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2357 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile> { using type = _Rp(_Ap...); }; | |
| 2358 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2359 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile> { using type = _Rp(_Ap...); }; | |
| 2360 | ||
| 2361 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2362 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) &> { using type = _Rp(_Ap...); }; | |
| 2363 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2364 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const &> { using type = _Rp(_Ap...); }; | |
| 2365 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2366 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile &> { using type = _Rp(_Ap...); }; | |
| 2367 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2368 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile &> { using type = _Rp(_Ap...); }; | |
| 2369 | ||
| 2370 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2371 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) noexcept> { using type = _Rp(_Ap...); }; | |
| 2372 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2373 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const noexcept> { using type = _Rp(_Ap...); }; | |
| 2374 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2375 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 2376 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2377 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile noexcept> { using type = _Rp(_Ap...); }; | |
| 2378 | ||
| 2379 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2380 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) & noexcept> { using type = _Rp(_Ap...); }; | |
| 2381 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2382 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const & noexcept> { using type = _Rp(_Ap...); }; | |
| 2383 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2384 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 2385 | template<class _Rp, class _Gp, class ..._Ap> | |
| 2386 | struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type = _Rp(_Ap...); }; | |
| 2387 | ||
| 2388 | template<class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type> | |
| 2389 | function(_Fp) -> function<_Stripped>; | |
| 2390 | #endif // !_LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 2391 | ||
| 2338 | 2392 | template<class _Rp, class ..._ArgTypes> |
| 2339 | 2393 | function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {} |
| 2340 | 2394 |
lib/libcxx/include/future+8-8| ... | ... | @@ -611,7 +611,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | template <class _Rp> |
| 614 | class _LIBCPP_AVAILABILITY_FUTURE __assoc_state | |
| 614 | class _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_HIDDEN __assoc_state | |
| 615 | 615 | : public __assoc_sub_state |
| 616 | 616 | { |
| 617 | 617 | typedef __assoc_sub_state base; |
| ... | ... | @@ -1060,7 +1060,7 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future; |
| 1060 | 1060 | template <class _Rp> class _LIBCPP_TEMPLATE_VIS future; |
| 1061 | 1061 | |
| 1062 | 1062 | template <class _Rp, class _Fp> |
| 1063 | future<_Rp> | |
| 1063 | _LIBCPP_INLINE_VISIBILITY future<_Rp> | |
| 1064 | 1064 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 1065 | 1065 | __make_deferred_assoc_state(_Fp&& __f); |
| 1066 | 1066 | #else |
| ... | ... | @@ -1068,7 +1068,7 @@ __make_deferred_assoc_state(_Fp __f); |
| 1068 | 1068 | #endif |
| 1069 | 1069 | |
| 1070 | 1070 | template <class _Rp, class _Fp> |
| 1071 | future<_Rp> | |
| 1071 | _LIBCPP_INLINE_VISIBILITY future<_Rp> | |
| 1072 | 1072 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 1073 | 1073 | __make_async_assoc_state(_Fp&& __f); |
| 1074 | 1074 | #else |
| ... | ... | @@ -1767,9 +1767,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgType |
| 1767 | 1767 | __compressed_pair<_Fp, _Alloc> __f_; |
| 1768 | 1768 | public: |
| 1769 | 1769 | _LIBCPP_INLINE_VISIBILITY |
| 1770 | explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {} | |
| 1770 | explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {} | |
| 1771 | 1771 | _LIBCPP_INLINE_VISIBILITY |
| 1772 | explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {} | |
| 1772 | explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f), __default_init_tag()) {} | |
| 1773 | 1773 | _LIBCPP_INLINE_VISIBILITY |
| 1774 | 1774 | __packaged_task_func(const _Fp& __f, const _Alloc& __a) |
| 1775 | 1775 | : __f_(__f, __a) {} |
| ... | ... | @@ -2266,7 +2266,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc> |
| 2266 | 2266 | : public true_type {}; |
| 2267 | 2267 | |
| 2268 | 2268 | template <class _Rp, class _Fp> |
| 2269 | future<_Rp> | |
| 2269 | _LIBCPP_INLINE_VISIBILITY future<_Rp> | |
| 2270 | 2270 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 2271 | 2271 | __make_deferred_assoc_state(_Fp&& __f) |
| 2272 | 2272 | #else |
| ... | ... | @@ -2279,7 +2279,7 @@ __make_deferred_assoc_state(_Fp __f) |
| 2279 | 2279 | } |
| 2280 | 2280 | |
| 2281 | 2281 | template <class _Rp, class _Fp> |
| 2282 | future<_Rp> | |
| 2282 | _LIBCPP_INLINE_VISIBILITY future<_Rp> | |
| 2283 | 2283 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 2284 | 2284 | __make_async_assoc_state(_Fp&& __f) |
| 2285 | 2285 | #else |
| ... | ... | @@ -2293,7 +2293,7 @@ __make_async_assoc_state(_Fp __f) |
| 2293 | 2293 | } |
| 2294 | 2294 | |
| 2295 | 2295 | template <class _Fp, class... _Args> |
| 2296 | class __async_func | |
| 2296 | class _LIBCPP_HIDDEN __async_func | |
| 2297 | 2297 | { |
| 2298 | 2298 | tuple<_Fp, _Args...> __f_; |
| 2299 | 2299 |
lib/libcxx/include/istream+1-1| ... | ... | @@ -1619,7 +1619,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) |
| 1619 | 1619 | __is.rdbuf()->sbumpc(); |
| 1620 | 1620 | } |
| 1621 | 1621 | __x = bitset<_Size>(__str); |
| 1622 | if (__c == 0) | |
| 1622 | if (_Size > 0 && __c == 0) | |
| 1623 | 1623 | __state |= ios_base::failbit; |
| 1624 | 1624 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1625 | 1625 | } |
lib/libcxx/include/iterator+83-15| ... | ... | @@ -434,12 +434,65 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; |
| 434 | 434 | #endif |
| 435 | 435 | |
| 436 | 436 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 437 | template <class _Iter> | |
| 438 | struct _LIBCPP_TEMPLATE_VIS iterator_traits; | |
| 437 | 439 | |
| 438 | 440 | struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {}; |
| 439 | 441 | struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {}; |
| 440 | 442 | struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {}; |
| 441 | 443 | struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {}; |
| 442 | 444 | struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; |
| 445 | #if _LIBCPP_STD_VER > 17 | |
| 446 | // TODO(EricWF) contiguous_iterator_tag is provided as an extension prior to | |
| 447 | // C++20 to allow optimizations for users providing wrapped iterator types. | |
| 448 | struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag: public random_access_iterator_tag { }; | |
| 449 | #endif | |
| 450 | ||
| 451 | template <class _Iter> | |
| 452 | struct __iter_traits_cache { | |
| 453 | using type = _If< | |
| 454 | __is_primary_template<iterator_traits<_Iter> >::value, | |
| 455 | _Iter, | |
| 456 | iterator_traits<_Iter> | |
| 457 | >; | |
| 458 | }; | |
| 459 | template <class _Iter> | |
| 460 | using _ITER_TRAITS = typename __iter_traits_cache<_Iter>::type; | |
| 461 | ||
| 462 | struct __iter_concept_concept_test { | |
| 463 | template <class _Iter> | |
| 464 | using _Apply = typename _ITER_TRAITS<_Iter>::iterator_concept; | |
| 465 | }; | |
| 466 | struct __iter_concept_category_test { | |
| 467 | template <class _Iter> | |
| 468 | using _Apply = typename _ITER_TRAITS<_Iter>::iterator_category; | |
| 469 | }; | |
| 470 | struct __iter_concept_random_fallback { | |
| 471 | template <class _Iter> | |
| 472 | using _Apply = _EnableIf< | |
| 473 | __is_primary_template<iterator_traits<_Iter> >::value, | |
| 474 | random_access_iterator_tag | |
| 475 | >; | |
| 476 | }; | |
| 477 | ||
| 478 | template <class _Iter, class _Tester> struct __test_iter_concept | |
| 479 | : _IsValidExpansion<_Tester::template _Apply, _Iter>, | |
| 480 | _Tester | |
| 481 | { | |
| 482 | }; | |
| 483 | ||
| 484 | template <class _Iter> | |
| 485 | struct __iter_concept_cache { | |
| 486 | using type = _Or< | |
| 487 | __test_iter_concept<_Iter, __iter_concept_concept_test>, | |
| 488 | __test_iter_concept<_Iter, __iter_concept_category_test>, | |
| 489 | __test_iter_concept<_Iter, __iter_concept_random_fallback> | |
| 490 | >; | |
| 491 | }; | |
| 492 | ||
| 493 | template <class _Iter> | |
| 494 | using _ITER_CONCEPT = typename __iter_concept_cache<_Iter>::type::template _Apply<_Iter>; | |
| 495 | ||
| 443 | 496 | |
| 444 | 497 | template <class _Tp> |
| 445 | 498 | struct __has_iterator_typedefs |
| ... | ... | @@ -500,7 +553,10 @@ struct __iterator_traits<_Iter, true> |
| 500 | 553 | |
| 501 | 554 | template <class _Iter> |
| 502 | 555 | struct _LIBCPP_TEMPLATE_VIS iterator_traits |
| 503 | : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {}; | |
| 556 | : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> { | |
| 557 | ||
| 558 | using __primary_template = iterator_traits; | |
| 559 | }; | |
| 504 | 560 | |
| 505 | 561 | template<class _Tp> |
| 506 | 562 | struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> |
| ... | ... | @@ -510,6 +566,9 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> |
| 510 | 566 | typedef _Tp* pointer; |
| 511 | 567 | typedef _Tp& reference; |
| 512 | 568 | typedef random_access_iterator_tag iterator_category; |
| 569 | #if _LIBCPP_STD_VER > 17 | |
| 570 | typedef contiguous_iterator_tag iterator_concept; | |
| 571 | #endif | |
| 513 | 572 | }; |
| 514 | 573 | |
| 515 | 574 | template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> |
| ... | ... | @@ -521,19 +580,28 @@ template <class _Tp, class _Up> |
| 521 | 580 | struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {}; |
| 522 | 581 | |
| 523 | 582 | template <class _Tp> |
| 524 | struct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {}; | |
| 583 | struct __is_cpp17_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {}; | |
| 525 | 584 | |
| 526 | 585 | template <class _Tp> |
| 527 | struct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {}; | |
| 586 | struct __is_cpp17_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {}; | |
| 528 | 587 | |
| 529 | 588 | template <class _Tp> |
| 530 | struct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {}; | |
| 589 | struct __is_cpp17_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {}; | |
| 531 | 590 | |
| 532 | 591 | template <class _Tp> |
| 533 | struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {}; | |
| 592 | struct __is_cpp17_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {}; | |
| 593 | ||
| 594 | #if _LIBCPP_STD_VER > 17 | |
| 595 | template <class _Tp> | |
| 596 | struct __is_cpp17_contiguous_iterator : public __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag> {}; | |
| 597 | #else | |
| 598 | template <class _Tp> | |
| 599 | struct __is_cpp17_contiguous_iterator : public false_type {}; | |
| 600 | #endif | |
| 601 | ||
| 534 | 602 | |
| 535 | 603 | template <class _Tp> |
| 536 | struct __is_exactly_input_iterator | |
| 604 | struct __is_exactly_cpp17_input_iterator | |
| 537 | 605 | : public integral_constant<bool, |
| 538 | 606 | __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && |
| 539 | 607 | !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; |
| ... | ... | @@ -600,7 +668,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 600 | 668 | void advance(_InputIter& __i, |
| 601 | 669 | typename iterator_traits<_InputIter>::difference_type __n) |
| 602 | 670 | { |
| 603 | _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value, | |
| 671 | _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, | |
| 604 | 672 | "Attempt to advance(it, -n) on a non-bidi iterator"); |
| 605 | 673 | __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); |
| 606 | 674 | } |
| ... | ... | @@ -636,13 +704,13 @@ template <class _InputIter> |
| 636 | 704 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 637 | 705 | typename enable_if |
| 638 | 706 | < |
| 639 | __is_input_iterator<_InputIter>::value, | |
| 707 | __is_cpp17_input_iterator<_InputIter>::value, | |
| 640 | 708 | _InputIter |
| 641 | 709 | >::type |
| 642 | 710 | next(_InputIter __x, |
| 643 | 711 | typename iterator_traits<_InputIter>::difference_type __n = 1) |
| 644 | 712 | { |
| 645 | _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value, | |
| 713 | _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, | |
| 646 | 714 | "Attempt to next(it, -n) on a non-bidi iterator"); |
| 647 | 715 | |
| 648 | 716 | _VSTD::advance(__x, __n); |
| ... | ... | @@ -653,13 +721,13 @@ template <class _InputIter> |
| 653 | 721 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 654 | 722 | typename enable_if |
| 655 | 723 | < |
| 656 | __is_input_iterator<_InputIter>::value, | |
| 724 | __is_cpp17_input_iterator<_InputIter>::value, | |
| 657 | 725 | _InputIter |
| 658 | 726 | >::type |
| 659 | 727 | prev(_InputIter __x, |
| 660 | 728 | typename iterator_traits<_InputIter>::difference_type __n = 1) |
| 661 | 729 | { |
| 662 | _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value, | |
| 730 | _LIBCPP_ASSERT(__n <= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, | |
| 663 | 731 | "Attempt to prev(it, +n) on a non-bidi iterator"); |
| 664 | 732 | _VSTD::advance(__x, -__n); |
| 665 | 733 | return __x; |
| ... | ... | @@ -1304,8 +1372,8 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1304 | 1372 | __wrap_iter<_Iter> |
| 1305 | 1373 | operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; |
| 1306 | 1374 | |
| 1307 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); | |
| 1308 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); | |
| 1375 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op); | |
| 1376 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2); | |
| 1309 | 1377 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); |
| 1310 | 1378 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); |
| 1311 | 1379 | |
| ... | ... | @@ -1515,8 +1583,8 @@ private: |
| 1515 | 1583 | __wrap_iter<_Iter1> |
| 1516 | 1584 | operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; |
| 1517 | 1585 | |
| 1518 | template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); | |
| 1519 | template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); | |
| 1586 | template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op); | |
| 1587 | template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 copy_backward(_B1, _B1, _B2); | |
| 1520 | 1588 | template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); |
| 1521 | 1589 | template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); |
| 1522 | 1590 |
lib/libcxx/include/list+10-10| ... | ... | @@ -715,7 +715,7 @@ template <class _Tp, class _Alloc> |
| 715 | 715 | inline |
| 716 | 716 | __list_imp<_Tp, _Alloc>::__list_imp() |
| 717 | 717 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) |
| 718 | : __size_alloc_(0) | |
| 718 | : __size_alloc_(0, __default_init_tag()) | |
| 719 | 719 | { |
| 720 | 720 | } |
| 721 | 721 | |
| ... | ... | @@ -887,10 +887,10 @@ public: |
| 887 | 887 | list(size_type __n, const value_type& __x, const allocator_type& __a); |
| 888 | 888 | template <class _InpIter> |
| 889 | 889 | list(_InpIter __f, _InpIter __l, |
| 890 | typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); | |
| 890 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); | |
| 891 | 891 | template <class _InpIter> |
| 892 | 892 | list(_InpIter __f, _InpIter __l, const allocator_type& __a, |
| 893 | typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); | |
| 893 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); | |
| 894 | 894 | |
| 895 | 895 | list(const list& __c); |
| 896 | 896 | list(const list& __c, const allocator_type& __a); |
| ... | ... | @@ -922,7 +922,7 @@ public: |
| 922 | 922 | |
| 923 | 923 | template <class _InpIter> |
| 924 | 924 | void assign(_InpIter __f, _InpIter __l, |
| 925 | typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); | |
| 925 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); | |
| 926 | 926 | void assign(size_type __n, const value_type& __x); |
| 927 | 927 | |
| 928 | 928 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1039,7 +1039,7 @@ public: |
| 1039 | 1039 | iterator insert(const_iterator __p, size_type __n, const value_type& __x); |
| 1040 | 1040 | template <class _InpIter> |
| 1041 | 1041 | iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, |
| 1042 | typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); | |
| 1042 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); | |
| 1043 | 1043 | |
| 1044 | 1044 | _LIBCPP_INLINE_VISIBILITY |
| 1045 | 1045 | void swap(list& __c) |
| ... | ... | @@ -1252,7 +1252,7 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_ty |
| 1252 | 1252 | template <class _Tp, class _Alloc> |
| 1253 | 1253 | template <class _InpIter> |
| 1254 | 1254 | list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, |
| 1255 | typename enable_if<__is_input_iterator<_InpIter>::value>::type*) | |
| 1255 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) | |
| 1256 | 1256 | { |
| 1257 | 1257 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1258 | 1258 | __get_db()->__insert_c(this); |
| ... | ... | @@ -1264,7 +1264,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, |
| 1264 | 1264 | template <class _Tp, class _Alloc> |
| 1265 | 1265 | template <class _InpIter> |
| 1266 | 1266 | list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, |
| 1267 | typename enable_if<__is_input_iterator<_InpIter>::value>::type*) | |
| 1267 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) | |
| 1268 | 1268 | : base(__a) |
| 1269 | 1269 | { |
| 1270 | 1270 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -1403,7 +1403,7 @@ template <class _Tp, class _Alloc> |
| 1403 | 1403 | template <class _InpIter> |
| 1404 | 1404 | void |
| 1405 | 1405 | list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l, |
| 1406 | typename enable_if<__is_input_iterator<_InpIter>::value>::type*) | |
| 1406 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) | |
| 1407 | 1407 | { |
| 1408 | 1408 | iterator __i = begin(); |
| 1409 | 1409 | iterator __e = end(); |
| ... | ... | @@ -1532,7 +1532,7 @@ template <class _Tp, class _Alloc> |
| 1532 | 1532 | template <class _InpIter> |
| 1533 | 1533 | typename list<_Tp, _Alloc>::iterator |
| 1534 | 1534 | list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, |
| 1535 | typename enable_if<__is_input_iterator<_InpIter>::value>::type*) | |
| 1535 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) | |
| 1536 | 1536 | { |
| 1537 | 1537 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1538 | 1538 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| ... | ... | @@ -2211,7 +2211,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) |
| 2211 | 2211 | __i = __j; |
| 2212 | 2212 | } |
| 2213 | 2213 | } |
| 2214 | ||
| 2214 | ||
| 2215 | 2215 | return (__remove_return_type) __deleted_nodes.size(); |
| 2216 | 2216 | } |
| 2217 | 2217 |
lib/libcxx/include/map+12-12| ... | ... | @@ -1474,26 +1474,26 @@ private: |
| 1474 | 1474 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 1475 | 1475 | template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>, |
| 1476 | 1476 | class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, |
| 1477 | class = enable_if_t<!__is_allocator<_Compare>::value, void>, | |
| 1478 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 1477 | class = _EnableIf<!__is_allocator<_Compare>::value, void>, | |
| 1478 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1479 | 1479 | map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) |
| 1480 | 1480 | -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; |
| 1481 | 1481 | |
| 1482 | 1482 | template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>, |
| 1483 | 1483 | class _Allocator = allocator<pair<const _Key, _Tp>>, |
| 1484 | class = enable_if_t<!__is_allocator<_Compare>::value, void>, | |
| 1485 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 1484 | class = _EnableIf<!__is_allocator<_Compare>::value, void>, | |
| 1485 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1486 | 1486 | map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator()) |
| 1487 | 1487 | -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>; |
| 1488 | 1488 | |
| 1489 | 1489 | template<class _InputIterator, class _Allocator, |
| 1490 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 1490 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1491 | 1491 | map(_InputIterator, _InputIterator, _Allocator) |
| 1492 | 1492 | -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, |
| 1493 | 1493 | less<__iter_key_type<_InputIterator>>, _Allocator>; |
| 1494 | 1494 | |
| 1495 | 1495 | template<class _Key, class _Tp, class _Allocator, |
| 1496 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 1496 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1497 | 1497 | map(initializer_list<pair<_Key, _Tp>>, _Allocator) |
| 1498 | 1498 | -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>; |
| 1499 | 1499 | #endif |
| ... | ... | @@ -2131,26 +2131,26 @@ private: |
| 2131 | 2131 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 2132 | 2132 | template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>, |
| 2133 | 2133 | class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, |
| 2134 | class = enable_if_t<!__is_allocator<_Compare>::value, void>, | |
| 2135 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 2134 | class = _EnableIf<!__is_allocator<_Compare>::value, void>, | |
| 2135 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 2136 | 2136 | multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) |
| 2137 | 2137 | -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; |
| 2138 | 2138 | |
| 2139 | 2139 | template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>, |
| 2140 | 2140 | class _Allocator = allocator<pair<const _Key, _Tp>>, |
| 2141 | class = enable_if_t<!__is_allocator<_Compare>::value, void>, | |
| 2142 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 2141 | class = _EnableIf<!__is_allocator<_Compare>::value, void>, | |
| 2142 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 2143 | 2143 | multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator()) |
| 2144 | 2144 | -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>; |
| 2145 | 2145 | |
| 2146 | 2146 | template<class _InputIterator, class _Allocator, |
| 2147 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 2147 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 2148 | 2148 | multimap(_InputIterator, _InputIterator, _Allocator) |
| 2149 | 2149 | -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, |
| 2150 | 2150 | less<__iter_key_type<_InputIterator>>, _Allocator>; |
| 2151 | 2151 | |
| 2152 | 2152 | template<class _Key, class _Tp, class _Allocator, |
| 2153 | class = enable_if_t<__is_allocator<_Allocator>::value, void>> | |
| 2153 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 2154 | 2154 | multimap(initializer_list<pair<_Key, _Tp>>, _Allocator) |
| 2155 | 2155 | -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>; |
| 2156 | 2156 | #endif |
lib/libcxx/include/math.h+4| ... | ... | @@ -510,7 +510,11 @@ _LIBCPP_INLINE_VISIBILITY |
| 510 | 510 | bool |
| 511 | 511 | __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT |
| 512 | 512 | { |
| 513 | #if __has_builtin(__builtin_isnan) | |
| 514 | return __builtin_isnan(__lcpp_x); | |
| 515 | #else | |
| 513 | 516 | return isnan(__lcpp_x); |
| 517 | #endif | |
| 514 | 518 | } |
| 515 | 519 | |
| 516 | 520 | #undef isnan |
lib/libcxx/include/memory+142-384| ... | ... | @@ -662,7 +662,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); |
| 662 | 662 | #include <tuple> |
| 663 | 663 | #include <stdexcept> |
| 664 | 664 | #include <cstring> |
| 665 | #include <cassert> | |
| 666 | 665 | #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| 667 | 666 | # include <atomic> |
| 668 | 667 | #endif |
| ... | ... | @@ -1099,40 +1098,51 @@ struct __const_void_pointer<_Ptr, _Alloc, false> |
| 1099 | 1098 | #endif |
| 1100 | 1099 | }; |
| 1101 | 1100 | |
| 1101 | ||
| 1102 | template <bool _UsePointerTraits> struct __to_address_helper; | |
| 1103 | ||
| 1104 | template <> struct __to_address_helper<true> { | |
| 1105 | template <class _Pointer> | |
| 1106 | using __return_type = decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())); | |
| 1107 | ||
| 1108 | template <class _Pointer> | |
| 1109 | _LIBCPP_CONSTEXPR | |
| 1110 | static __return_type<_Pointer> | |
| 1111 | __do_it(const _Pointer &__p) _NOEXCEPT { return pointer_traits<_Pointer>::to_address(__p); } | |
| 1112 | }; | |
| 1113 | ||
| 1114 | template <class _Pointer, bool _Dummy = true> | |
| 1115 | using __choose_to_address = __to_address_helper<_IsValidExpansion<__to_address_helper<_Dummy>::template __return_type, _Pointer>::value>; | |
| 1116 | ||
| 1117 | ||
| 1102 | 1118 | template <class _Tp> |
| 1103 | 1119 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 1104 | 1120 | _Tp* |
| 1105 | __to_raw_pointer(_Tp* __p) _NOEXCEPT | |
| 1121 | __to_address(_Tp* __p) _NOEXCEPT | |
| 1106 | 1122 | { |
| 1123 | static_assert(!is_function<_Tp>::value, "_Tp is a function type"); | |
| 1107 | 1124 | return __p; |
| 1108 | 1125 | } |
| 1109 | 1126 | |
| 1110 | #if _LIBCPP_STD_VER <= 17 | |
| 1111 | template <class _Pointer> | |
| 1112 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1113 | typename pointer_traits<_Pointer>::element_type* | |
| 1114 | __to_raw_pointer(_Pointer __p) _NOEXCEPT | |
| 1115 | { | |
| 1116 | return _VSTD::__to_raw_pointer(__p.operator->()); | |
| 1117 | } | |
| 1118 | #else | |
| 1119 | 1127 | template <class _Pointer> |
| 1120 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1121 | auto | |
| 1122 | __to_raw_pointer(const _Pointer& __p) _NOEXCEPT | |
| 1123 | -> decltype(pointer_traits<_Pointer>::to_address(__p)) | |
| 1124 | { | |
| 1125 | return pointer_traits<_Pointer>::to_address(__p); | |
| 1128 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1129 | typename __choose_to_address<_Pointer>::template __return_type<_Pointer> | |
| 1130 | __to_address(const _Pointer& __p) _NOEXCEPT { | |
| 1131 | return __choose_to_address<_Pointer>::__do_it(__p); | |
| 1126 | 1132 | } |
| 1127 | 1133 | |
| 1128 | template <class _Pointer, class... _None> | |
| 1129 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1130 | auto | |
| 1131 | __to_raw_pointer(const _Pointer& __p, _None...) _NOEXCEPT | |
| 1132 | { | |
| 1133 | return _VSTD::__to_raw_pointer(__p.operator->()); | |
| 1134 | } | |
| 1134 | template <> struct __to_address_helper<false> { | |
| 1135 | template <class _Pointer> | |
| 1136 | using __return_type = typename pointer_traits<_Pointer>::element_type*; | |
| 1135 | 1137 | |
| 1138 | template <class _Pointer> | |
| 1139 | _LIBCPP_CONSTEXPR | |
| 1140 | static __return_type<_Pointer> | |
| 1141 | __do_it(const _Pointer &__p) _NOEXCEPT { return std::__to_address(__p.operator->()); } | |
| 1142 | }; | |
| 1143 | ||
| 1144 | ||
| 1145 | #if _LIBCPP_STD_VER > 17 | |
| 1136 | 1146 | template <class _Tp> |
| 1137 | 1147 | inline _LIBCPP_INLINE_VISIBILITY constexpr |
| 1138 | 1148 | _Tp* |
| ... | ... | @@ -1147,7 +1157,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1147 | 1157 | auto |
| 1148 | 1158 | to_address(const _Pointer& __p) _NOEXCEPT |
| 1149 | 1159 | { |
| 1150 | return _VSTD::__to_raw_pointer(__p); | |
| 1160 | return _VSTD::__to_address(__p); | |
| 1151 | 1161 | } |
| 1152 | 1162 | #endif |
| 1153 | 1163 | |
| ... | ... | @@ -1507,6 +1517,31 @@ struct __is_default_allocator : false_type {}; |
| 1507 | 1517 | template <class _Tp> |
| 1508 | 1518 | struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {}; |
| 1509 | 1519 | |
| 1520 | ||
| 1521 | ||
| 1522 | template <class _Alloc, | |
| 1523 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value | |
| 1524 | > | |
| 1525 | struct __is_cpp17_move_insertable; | |
| 1526 | template <class _Alloc> | |
| 1527 | struct __is_cpp17_move_insertable<_Alloc, true> : std::true_type {}; | |
| 1528 | template <class _Alloc> | |
| 1529 | struct __is_cpp17_move_insertable<_Alloc, false> : std::is_move_constructible<typename _Alloc::value_type> {}; | |
| 1530 | ||
| 1531 | template <class _Alloc, | |
| 1532 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value | |
| 1533 | > | |
| 1534 | struct __is_cpp17_copy_insertable; | |
| 1535 | template <class _Alloc> | |
| 1536 | struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {}; | |
| 1537 | template <class _Alloc> | |
| 1538 | struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool, | |
| 1539 | std::is_copy_constructible<typename _Alloc::value_type>::value && | |
| 1540 | __is_cpp17_move_insertable<_Alloc>::value> | |
| 1541 | {}; | |
| 1542 | ||
| 1543 | ||
| 1544 | ||
| 1510 | 1545 | template <class _Alloc> |
| 1511 | 1546 | struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1512 | 1547 | { |
| ... | ... | @@ -1609,10 +1644,18 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1609 | 1644 | _LIBCPP_INLINE_VISIBILITY |
| 1610 | 1645 | static |
| 1611 | 1646 | void |
| 1612 | __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) | |
| 1647 | __construct_forward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) | |
| 1613 | 1648 | { |
| 1649 | static_assert(__is_cpp17_move_insertable<allocator_type>::value, | |
| 1650 | "The specified type does not meet the requirements of Cpp17MoveInsertible"); | |
| 1614 | 1651 | for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) |
| 1615 | construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1)); | |
| 1652 | construct(__a, _VSTD::__to_address(__begin2), | |
| 1653 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1654 | _VSTD::move(*__begin1) | |
| 1655 | #else | |
| 1656 | _VSTD::move_if_noexcept(*__begin1) | |
| 1657 | #endif | |
| 1658 | ); | |
| 1616 | 1659 | } |
| 1617 | 1660 | |
| 1618 | 1661 | template <class _Tp> |
| ... | ... | @@ -1625,7 +1668,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1625 | 1668 | is_trivially_move_constructible<_Tp>::value, |
| 1626 | 1669 | void |
| 1627 | 1670 | >::type |
| 1628 | __construct_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) | |
| 1671 | __construct_forward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) | |
| 1629 | 1672 | { |
| 1630 | 1673 | ptrdiff_t _Np = __end1 - __begin1; |
| 1631 | 1674 | if (_Np > 0) |
| ... | ... | @@ -1642,7 +1685,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1642 | 1685 | __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) |
| 1643 | 1686 | { |
| 1644 | 1687 | for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) |
| 1645 | construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1); | |
| 1688 | construct(__a, _VSTD::__to_address(__begin2), *__begin1); | |
| 1646 | 1689 | } |
| 1647 | 1690 | |
| 1648 | 1691 | template <class _SourceTp, class _DestTp, |
| ... | ... | @@ -1672,12 +1715,20 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1672 | 1715 | _LIBCPP_INLINE_VISIBILITY |
| 1673 | 1716 | static |
| 1674 | 1717 | void |
| 1675 | __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) | |
| 1718 | __construct_backward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) | |
| 1676 | 1719 | { |
| 1720 | static_assert(__is_cpp17_move_insertable<allocator_type>::value, | |
| 1721 | "The specified type does not meet the requirements of Cpp17MoveInsertable"); | |
| 1677 | 1722 | while (__end1 != __begin1) |
| 1678 | 1723 | { |
| 1679 | construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1)); | |
| 1680 | --__end2; | |
| 1724 | construct(__a, _VSTD::__to_address(__end2 - 1), | |
| 1725 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1726 | _VSTD::move(*--__end1) | |
| 1727 | #else | |
| 1728 | _VSTD::move_if_noexcept(*--__end1) | |
| 1729 | #endif | |
| 1730 | ); | |
| 1731 | --__end2; | |
| 1681 | 1732 | } |
| 1682 | 1733 | } |
| 1683 | 1734 | |
| ... | ... | @@ -1691,7 +1742,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits |
| 1691 | 1742 | is_trivially_move_constructible<_Tp>::value, |
| 1692 | 1743 | void |
| 1693 | 1744 | >::type |
| 1694 | __construct_backward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) | |
| 1745 | __construct_backward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) | |
| 1695 | 1746 | { |
| 1696 | 1747 | ptrdiff_t _Np = __end1 - __begin1; |
| 1697 | 1748 | __end2 -= _Np; |
| ... | ... | @@ -2127,6 +2178,10 @@ public: |
| 2127 | 2178 | }; |
| 2128 | 2179 | #endif |
| 2129 | 2180 | |
| 2181 | // Tag used to default initialize one or both of the pair's elements. | |
| 2182 | struct __default_init_tag {}; | |
| 2183 | struct __value_init_tag {}; | |
| 2184 | ||
| 2130 | 2185 | template <class _Tp, int _Idx, |
| 2131 | 2186 | bool _CanBeEmptyBase = |
| 2132 | 2187 | is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value> |
| ... | ... | @@ -2135,30 +2190,31 @@ struct __compressed_pair_elem { |
| 2135 | 2190 | typedef _Tp& reference; |
| 2136 | 2191 | typedef const _Tp& const_reference; |
| 2137 | 2192 | |
| 2138 | #ifndef _LIBCPP_CXX03_LANG | |
| 2139 | _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {} | |
| 2193 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 2194 | __compressed_pair_elem(__default_init_tag) {} | |
| 2195 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 2196 | __compressed_pair_elem(__value_init_tag) : __value_() {} | |
| 2140 | 2197 | |
| 2141 | 2198 | template <class _Up, class = typename enable_if< |
| 2142 | 2199 | !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value |
| 2143 | 2200 | >::type> |
| 2144 | 2201 | _LIBCPP_INLINE_VISIBILITY |
| 2145 | constexpr explicit | |
| 2202 | _LIBCPP_CONSTEXPR explicit | |
| 2146 | 2203 | __compressed_pair_elem(_Up&& __u) |
| 2147 | 2204 | : __value_(_VSTD::forward<_Up>(__u)) |
| 2148 | 2205 | { |
| 2149 | 2206 | } |
| 2150 | 2207 | |
| 2208 | ||
| 2209 | #ifndef _LIBCPP_CXX03_LANG | |
| 2151 | 2210 | template <class... _Args, size_t... _Indexes> |
| 2152 | 2211 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 2153 | 2212 | __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, |
| 2154 | 2213 | __tuple_indices<_Indexes...>) |
| 2155 | 2214 | : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} |
| 2156 | #else | |
| 2157 | _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_() {} | |
| 2158 | _LIBCPP_INLINE_VISIBILITY | |
| 2159 | __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {} | |
| 2160 | 2215 | #endif |
| 2161 | 2216 | |
| 2217 | ||
| 2162 | 2218 | _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; } |
| 2163 | 2219 | _LIBCPP_INLINE_VISIBILITY |
| 2164 | 2220 | const_reference __get() const _NOEXCEPT { return __value_; } |
| ... | ... | @@ -2174,28 +2230,27 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { |
| 2174 | 2230 | typedef const _Tp& const_reference; |
| 2175 | 2231 | typedef _Tp __value_type; |
| 2176 | 2232 | |
| 2177 | #ifndef _LIBCPP_CXX03_LANG | |
| 2178 | _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default; | |
| 2233 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair_elem() = default; | |
| 2234 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 2235 | __compressed_pair_elem(__default_init_tag) {} | |
| 2236 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 2237 | __compressed_pair_elem(__value_init_tag) : __value_type() {} | |
| 2179 | 2238 | |
| 2180 | 2239 | template <class _Up, class = typename enable_if< |
| 2181 | 2240 | !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value |
| 2182 | 2241 | >::type> |
| 2183 | 2242 | _LIBCPP_INLINE_VISIBILITY |
| 2184 | constexpr explicit | |
| 2243 | _LIBCPP_CONSTEXPR explicit | |
| 2185 | 2244 | __compressed_pair_elem(_Up&& __u) |
| 2186 | 2245 | : __value_type(_VSTD::forward<_Up>(__u)) |
| 2187 | 2246 | {} |
| 2188 | 2247 | |
| 2248 | #ifndef _LIBCPP_CXX03_LANG | |
| 2189 | 2249 | template <class... _Args, size_t... _Indexes> |
| 2190 | 2250 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 2191 | 2251 | __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, |
| 2192 | 2252 | __tuple_indices<_Indexes...>) |
| 2193 | 2253 | : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} |
| 2194 | #else | |
| 2195 | _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_type() {} | |
| 2196 | _LIBCPP_INLINE_VISIBILITY | |
| 2197 | __compressed_pair_elem(_ParamT __p) | |
| 2198 | : __value_type(std::forward<_ParamT>(__p)) {} | |
| 2199 | 2254 | #endif |
| 2200 | 2255 | |
| 2201 | 2256 | _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; } |
| ... | ... | @@ -2203,9 +2258,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { |
| 2203 | 2258 | const_reference __get() const _NOEXCEPT { return *this; } |
| 2204 | 2259 | }; |
| 2205 | 2260 | |
| 2206 | // Tag used to construct the second element of the compressed pair. | |
| 2207 | struct __second_tag {}; | |
| 2208 | ||
| 2209 | 2261 | template <class _T1, class _T2> |
| 2210 | 2262 | class __compressed_pair : private __compressed_pair_elem<_T1, 0>, |
| 2211 | 2263 | private __compressed_pair_elem<_T2, 1> { |
| ... | ... | @@ -2222,33 +2274,21 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, |
| 2222 | 2274 | "implementation for this configuration"); |
| 2223 | 2275 | |
| 2224 | 2276 | public: |
| 2225 | #ifndef _LIBCPP_CXX03_LANG | |
| 2226 | template <bool _Dummy = true, | |
| 2277 | template <bool _Dummy = true, | |
| 2227 | 2278 | class = typename enable_if< |
| 2228 | 2279 | __dependent_type<is_default_constructible<_T1>, _Dummy>::value && |
| 2229 | 2280 | __dependent_type<is_default_constructible<_T2>, _Dummy>::value |
| 2230 | 2281 | >::type |
| 2231 | 2282 | > |
| 2232 | 2283 | _LIBCPP_INLINE_VISIBILITY |
| 2233 | constexpr __compressed_pair() {} | |
| 2234 | ||
| 2235 | template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type, | |
| 2236 | __compressed_pair>::value, | |
| 2237 | bool>::type = true> | |
| 2238 | _LIBCPP_INLINE_VISIBILITY constexpr explicit | |
| 2239 | __compressed_pair(_Tp&& __t) | |
| 2240 | : _Base1(std::forward<_Tp>(__t)), _Base2() {} | |
| 2241 | ||
| 2242 | template <class _Tp> | |
| 2243 | _LIBCPP_INLINE_VISIBILITY constexpr | |
| 2244 | __compressed_pair(__second_tag, _Tp&& __t) | |
| 2245 | : _Base1(), _Base2(std::forward<_Tp>(__t)) {} | |
| 2284 | _LIBCPP_CONSTEXPR __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {} | |
| 2246 | 2285 | |
| 2247 | 2286 | template <class _U1, class _U2> |
| 2248 | _LIBCPP_INLINE_VISIBILITY constexpr | |
| 2287 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 2249 | 2288 | __compressed_pair(_U1&& __t1, _U2&& __t2) |
| 2250 | 2289 | : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} |
| 2251 | 2290 | |
| 2291 | #ifndef _LIBCPP_CXX03_LANG | |
| 2252 | 2292 | template <class... _Args1, class... _Args2> |
| 2253 | 2293 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 2254 | 2294 | __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, |
| ... | ... | @@ -2257,21 +2297,6 @@ public: |
| 2257 | 2297 | typename __make_tuple_indices<sizeof...(_Args1)>::type()), |
| 2258 | 2298 | _Base2(__pc, _VSTD::move(__second_args), |
| 2259 | 2299 | typename __make_tuple_indices<sizeof...(_Args2)>::type()) {} |
| 2260 | ||
| 2261 | #else | |
| 2262 | _LIBCPP_INLINE_VISIBILITY | |
| 2263 | __compressed_pair() {} | |
| 2264 | ||
| 2265 | _LIBCPP_INLINE_VISIBILITY explicit | |
| 2266 | __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {} | |
| 2267 | ||
| 2268 | _LIBCPP_INLINE_VISIBILITY | |
| 2269 | __compressed_pair(__second_tag, _T2 __t2) | |
| 2270 | : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {} | |
| 2271 | ||
| 2272 | _LIBCPP_INLINE_VISIBILITY | |
| 2273 | __compressed_pair(_T1 __t1, _T2 __t2) | |
| 2274 | : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {} | |
| 2275 | 2300 | #endif |
| 2276 | 2301 | |
| 2277 | 2302 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2452,17 +2477,17 @@ public: |
| 2452 | 2477 | template <bool _Dummy = true, |
| 2453 | 2478 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > |
| 2454 | 2479 | _LIBCPP_INLINE_VISIBILITY |
| 2455 | _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {} | |
| 2480 | _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} | |
| 2456 | 2481 | |
| 2457 | 2482 | template <bool _Dummy = true, |
| 2458 | 2483 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > |
| 2459 | 2484 | _LIBCPP_INLINE_VISIBILITY |
| 2460 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {} | |
| 2485 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} | |
| 2461 | 2486 | |
| 2462 | 2487 | template <bool _Dummy = true, |
| 2463 | 2488 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > |
| 2464 | 2489 | _LIBCPP_INLINE_VISIBILITY |
| 2465 | explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {} | |
| 2490 | explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __default_init_tag()) {} | |
| 2466 | 2491 | |
| 2467 | 2492 | template <bool _Dummy = true, |
| 2468 | 2493 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > |
| ... | ... | @@ -2504,7 +2529,7 @@ public: |
| 2504 | 2529 | typename enable_if<is_convertible<_Up*, _Tp*>::value && |
| 2505 | 2530 | is_same<_Dp, default_delete<_Tp> >::value, |
| 2506 | 2531 | __nat>::type = __nat()) _NOEXCEPT |
| 2507 | : __ptr_(__p.release()) {} | |
| 2532 | : __ptr_(__p.release(), __default_init_tag()) {} | |
| 2508 | 2533 | #endif |
| 2509 | 2534 | |
| 2510 | 2535 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2675,19 +2700,19 @@ public: |
| 2675 | 2700 | template <bool _Dummy = true, |
| 2676 | 2701 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > |
| 2677 | 2702 | _LIBCPP_INLINE_VISIBILITY |
| 2678 | _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {} | |
| 2703 | _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} | |
| 2679 | 2704 | |
| 2680 | 2705 | template <bool _Dummy = true, |
| 2681 | 2706 | class = _EnableIfDeleterDefaultConstructible<_Dummy> > |
| 2682 | 2707 | _LIBCPP_INLINE_VISIBILITY |
| 2683 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {} | |
| 2708 | _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} | |
| 2684 | 2709 | |
| 2685 | 2710 | template <class _Pp, bool _Dummy = true, |
| 2686 | 2711 | class = _EnableIfDeleterDefaultConstructible<_Dummy>, |
| 2687 | 2712 | class = _EnableIfPointerConvertible<_Pp> > |
| 2688 | 2713 | _LIBCPP_INLINE_VISIBILITY |
| 2689 | 2714 | explicit unique_ptr(_Pp __p) _NOEXCEPT |
| 2690 | : __ptr_(__p) {} | |
| 2715 | : __ptr_(__p, __default_init_tag()) {} | |
| 2691 | 2716 | |
| 2692 | 2717 | template <class _Pp, bool _Dummy = true, |
| 2693 | 2718 | class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, |
| ... | ... | @@ -3531,24 +3556,20 @@ class __shared_ptr_emplace |
| 3531 | 3556 | { |
| 3532 | 3557 | __compressed_pair<_Alloc, _Tp> __data_; |
| 3533 | 3558 | public: |
| 3534 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 3535 | 3559 | |
| 3536 | 3560 | _LIBCPP_INLINE_VISIBILITY |
| 3537 | 3561 | __shared_ptr_emplace(_Alloc __a) |
| 3538 | : __data_(_VSTD::move(__a)) {} | |
| 3562 | : __data_(_VSTD::move(__a), __value_init_tag()) {} | |
| 3563 | ||
| 3539 | 3564 | |
| 3565 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 3540 | 3566 | template <class ..._Args> |
| 3541 | 3567 | _LIBCPP_INLINE_VISIBILITY |
| 3542 | 3568 | __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) |
| 3543 | 3569 | : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), |
| 3544 | 3570 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {} |
| 3545 | ||
| 3546 | 3571 | #else // _LIBCPP_HAS_NO_VARIADICS |
| 3547 | 3572 | |
| 3548 | _LIBCPP_INLINE_VISIBILITY | |
| 3549 | __shared_ptr_emplace(_Alloc __a) | |
| 3550 | : __data_(__a) {} | |
| 3551 | ||
| 3552 | 3573 | template <class _A0> |
| 3553 | 3574 | _LIBCPP_INLINE_VISIBILITY |
| 3554 | 3575 | __shared_ptr_emplace(_Alloc __a, _A0& __a0) |
| ... | ... | @@ -3831,49 +3852,22 @@ public: |
| 3831 | 3852 | : nullptr);} |
| 3832 | 3853 | #endif // _LIBCPP_NO_RTTI |
| 3833 | 3854 | |
| 3834 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 3835 | ||
| 3836 | template<class ..._Args> | |
| 3837 | static | |
| 3838 | shared_ptr<_Tp> | |
| 3839 | make_shared(_Args&& ...__args); | |
| 3855 | template<class _Yp, class _CntrlBlk> | |
| 3856 | static shared_ptr<_Tp> | |
| 3857 | __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) | |
| 3858 | { | |
| 3859 | shared_ptr<_Tp> __r; | |
| 3860 | __r.__ptr_ = __p; | |
| 3861 | __r.__cntrl_ = __cntrl; | |
| 3862 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 3863 | return __r; | |
| 3864 | } | |
| 3840 | 3865 | |
| 3841 | 3866 | template<class _Alloc, class ..._Args> |
| 3842 | 3867 | static |
| 3843 | 3868 | shared_ptr<_Tp> |
| 3844 | 3869 | allocate_shared(const _Alloc& __a, _Args&& ...__args); |
| 3845 | 3870 | |
| 3846 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 3847 | ||
| 3848 | static shared_ptr<_Tp> make_shared(); | |
| 3849 | ||
| 3850 | template<class _A0> | |
| 3851 | static shared_ptr<_Tp> make_shared(_A0&); | |
| 3852 | ||
| 3853 | template<class _A0, class _A1> | |
| 3854 | static shared_ptr<_Tp> make_shared(_A0&, _A1&); | |
| 3855 | ||
| 3856 | template<class _A0, class _A1, class _A2> | |
| 3857 | static shared_ptr<_Tp> make_shared(_A0&, _A1&, _A2&); | |
| 3858 | ||
| 3859 | template<class _Alloc> | |
| 3860 | static shared_ptr<_Tp> | |
| 3861 | allocate_shared(const _Alloc& __a); | |
| 3862 | ||
| 3863 | template<class _Alloc, class _A0> | |
| 3864 | static shared_ptr<_Tp> | |
| 3865 | allocate_shared(const _Alloc& __a, _A0& __a0); | |
| 3866 | ||
| 3867 | template<class _Alloc, class _A0, class _A1> | |
| 3868 | static shared_ptr<_Tp> | |
| 3869 | allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1); | |
| 3870 | ||
| 3871 | template<class _Alloc, class _A0, class _A1, class _A2> | |
| 3872 | static shared_ptr<_Tp> | |
| 3873 | allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2); | |
| 3874 | ||
| 3875 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 3876 | ||
| 3877 | 3871 | private: |
| 3878 | 3872 | template <class _Yp, bool = is_function<_Yp>::value> |
| 3879 | 3873 | struct __shared_ptr_default_allocator |
| ... | ... | @@ -4186,27 +4180,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, |
| 4186 | 4180 | __r.release(); |
| 4187 | 4181 | } |
| 4188 | 4182 | |
| 4189 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 4190 | ||
| 4191 | template<class _Tp> | |
| 4192 | template<class ..._Args> | |
| 4193 | shared_ptr<_Tp> | |
| 4194 | shared_ptr<_Tp>::make_shared(_Args&& ...__args) | |
| 4195 | { | |
| 4196 | static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared" ); | |
| 4197 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4198 | typedef allocator<_CntrlBlk> _A2; | |
| 4199 | typedef __allocator_destructor<_A2> _D2; | |
| 4200 | _A2 __a2; | |
| 4201 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); | |
| 4202 | ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); | |
| 4203 | shared_ptr<_Tp> __r; | |
| 4204 | __r.__ptr_ = __hold2.get()->get(); | |
| 4205 | __r.__cntrl_ = __hold2.release(); | |
| 4206 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4207 | return __r; | |
| 4208 | } | |
| 4209 | ||
| 4210 | 4183 | template<class _Tp> |
| 4211 | 4184 | template<class _Alloc, class ..._Args> |
| 4212 | 4185 | shared_ptr<_Tp> |
| ... | ... | @@ -4227,165 +4200,6 @@ shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args) |
| 4227 | 4200 | return __r; |
| 4228 | 4201 | } |
| 4229 | 4202 | |
| 4230 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 4231 | ||
| 4232 | template<class _Tp> | |
| 4233 | shared_ptr<_Tp> | |
| 4234 | shared_ptr<_Tp>::make_shared() | |
| 4235 | { | |
| 4236 | static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" ); | |
| 4237 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4238 | typedef allocator<_CntrlBlk> _Alloc2; | |
| 4239 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4240 | _Alloc2 __alloc2; | |
| 4241 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4242 | ::new(__hold2.get()) _CntrlBlk(__alloc2); | |
| 4243 | shared_ptr<_Tp> __r; | |
| 4244 | __r.__ptr_ = __hold2.get()->get(); | |
| 4245 | __r.__cntrl_ = __hold2.release(); | |
| 4246 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4247 | return __r; | |
| 4248 | } | |
| 4249 | ||
| 4250 | template<class _Tp> | |
| 4251 | template<class _A0> | |
| 4252 | shared_ptr<_Tp> | |
| 4253 | shared_ptr<_Tp>::make_shared(_A0& __a0) | |
| 4254 | { | |
| 4255 | static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in make_shared" ); | |
| 4256 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4257 | typedef allocator<_CntrlBlk> _Alloc2; | |
| 4258 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4259 | _Alloc2 __alloc2; | |
| 4260 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4261 | ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0); | |
| 4262 | shared_ptr<_Tp> __r; | |
| 4263 | __r.__ptr_ = __hold2.get()->get(); | |
| 4264 | __r.__cntrl_ = __hold2.release(); | |
| 4265 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4266 | return __r; | |
| 4267 | } | |
| 4268 | ||
| 4269 | template<class _Tp> | |
| 4270 | template<class _A0, class _A1> | |
| 4271 | shared_ptr<_Tp> | |
| 4272 | shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1) | |
| 4273 | { | |
| 4274 | static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in make_shared" ); | |
| 4275 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4276 | typedef allocator<_CntrlBlk> _Alloc2; | |
| 4277 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4278 | _Alloc2 __alloc2; | |
| 4279 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4280 | ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1); | |
| 4281 | shared_ptr<_Tp> __r; | |
| 4282 | __r.__ptr_ = __hold2.get()->get(); | |
| 4283 | __r.__cntrl_ = __hold2.release(); | |
| 4284 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4285 | return __r; | |
| 4286 | } | |
| 4287 | ||
| 4288 | template<class _Tp> | |
| 4289 | template<class _A0, class _A1, class _A2> | |
| 4290 | shared_ptr<_Tp> | |
| 4291 | shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2) | |
| 4292 | { | |
| 4293 | static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); | |
| 4294 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4295 | typedef allocator<_CntrlBlk> _Alloc2; | |
| 4296 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4297 | _Alloc2 __alloc2; | |
| 4298 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4299 | ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2); | |
| 4300 | shared_ptr<_Tp> __r; | |
| 4301 | __r.__ptr_ = __hold2.get()->get(); | |
| 4302 | __r.__cntrl_ = __hold2.release(); | |
| 4303 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4304 | return __r; | |
| 4305 | } | |
| 4306 | ||
| 4307 | template<class _Tp> | |
| 4308 | template<class _Alloc> | |
| 4309 | shared_ptr<_Tp> | |
| 4310 | shared_ptr<_Tp>::allocate_shared(const _Alloc& __a) | |
| 4311 | { | |
| 4312 | static_assert((is_constructible<_Tp>::value), "Can't construct object in allocate_shared" ); | |
| 4313 | typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; | |
| 4314 | typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; | |
| 4315 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4316 | _Alloc2 __alloc2(__a); | |
| 4317 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4318 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 4319 | _CntrlBlk(__a); | |
| 4320 | shared_ptr<_Tp> __r; | |
| 4321 | __r.__ptr_ = __hold2.get()->get(); | |
| 4322 | __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); | |
| 4323 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4324 | return __r; | |
| 4325 | } | |
| 4326 | ||
| 4327 | template<class _Tp> | |
| 4328 | template<class _Alloc, class _A0> | |
| 4329 | shared_ptr<_Tp> | |
| 4330 | shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0) | |
| 4331 | { | |
| 4332 | static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in allocate_shared" ); | |
| 4333 | typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; | |
| 4334 | typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; | |
| 4335 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4336 | _Alloc2 __alloc2(__a); | |
| 4337 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4338 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 4339 | _CntrlBlk(__a, __a0); | |
| 4340 | shared_ptr<_Tp> __r; | |
| 4341 | __r.__ptr_ = __hold2.get()->get(); | |
| 4342 | __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); | |
| 4343 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4344 | return __r; | |
| 4345 | } | |
| 4346 | ||
| 4347 | template<class _Tp> | |
| 4348 | template<class _Alloc, class _A0, class _A1> | |
| 4349 | shared_ptr<_Tp> | |
| 4350 | shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1) | |
| 4351 | { | |
| 4352 | static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in allocate_shared" ); | |
| 4353 | typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; | |
| 4354 | typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; | |
| 4355 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4356 | _Alloc2 __alloc2(__a); | |
| 4357 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4358 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 4359 | _CntrlBlk(__a, __a0, __a1); | |
| 4360 | shared_ptr<_Tp> __r; | |
| 4361 | __r.__ptr_ = __hold2.get()->get(); | |
| 4362 | __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); | |
| 4363 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4364 | return __r; | |
| 4365 | } | |
| 4366 | ||
| 4367 | template<class _Tp> | |
| 4368 | template<class _Alloc, class _A0, class _A1, class _A2> | |
| 4369 | shared_ptr<_Tp> | |
| 4370 | shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2) | |
| 4371 | { | |
| 4372 | static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); | |
| 4373 | typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; | |
| 4374 | typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; | |
| 4375 | typedef __allocator_destructor<_Alloc2> _D2; | |
| 4376 | _Alloc2 __alloc2(__a); | |
| 4377 | unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); | |
| 4378 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 4379 | _CntrlBlk(__a, __a0, __a1, __a2); | |
| 4380 | shared_ptr<_Tp> __r; | |
| 4381 | __r.__ptr_ = __hold2.get()->get(); | |
| 4382 | __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); | |
| 4383 | __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); | |
| 4384 | return __r; | |
| 4385 | } | |
| 4386 | ||
| 4387 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 4388 | ||
| 4389 | 4203 | template<class _Tp> |
| 4390 | 4204 | shared_ptr<_Tp>::~shared_ptr() |
| 4391 | 4205 | { |
| ... | ... | @@ -4567,8 +4381,6 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a) |
| 4567 | 4381 | shared_ptr(__p, __d, __a).swap(*this); |
| 4568 | 4382 | } |
| 4569 | 4383 | |
| 4570 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 4571 | ||
| 4572 | 4384 | template<class _Tp, class ..._Args> |
| 4573 | 4385 | inline _LIBCPP_INLINE_VISIBILITY |
| 4574 | 4386 | typename enable_if |
| ... | ... | @@ -4578,7 +4390,17 @@ typename enable_if |
| 4578 | 4390 | >::type |
| 4579 | 4391 | make_shared(_Args&& ...__args) |
| 4580 | 4392 | { |
| 4581 | return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); | |
| 4393 | static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared"); | |
| 4394 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4395 | typedef allocator<_CntrlBlk> _A2; | |
| 4396 | typedef __allocator_destructor<_A2> _D2; | |
| 4397 | ||
| 4398 | _A2 __a2; | |
| 4399 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); | |
| 4400 | ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); | |
| 4401 | ||
| 4402 | _Tp *__ptr = __hold2.get()->get(); | |
| 4403 | return shared_ptr<_Tp>::__create_with_control_block(__ptr, __hold2.release()); | |
| 4582 | 4404 | } |
| 4583 | 4405 | |
| 4584 | 4406 | template<class _Tp, class _Alloc, class ..._Args> |
| ... | ... | @@ -4593,74 +4415,6 @@ allocate_shared(const _Alloc& __a, _Args&& ...__args) |
| 4593 | 4415 | return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...); |
| 4594 | 4416 | } |
| 4595 | 4417 | |
| 4596 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 4597 | ||
| 4598 | template<class _Tp> | |
| 4599 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4600 | shared_ptr<_Tp> | |
| 4601 | make_shared() | |
| 4602 | { | |
| 4603 | return shared_ptr<_Tp>::make_shared(); | |
| 4604 | } | |
| 4605 | ||
| 4606 | template<class _Tp, class _A0> | |
| 4607 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4608 | shared_ptr<_Tp> | |
| 4609 | make_shared(_A0& __a0) | |
| 4610 | { | |
| 4611 | return shared_ptr<_Tp>::make_shared(__a0); | |
| 4612 | } | |
| 4613 | ||
| 4614 | template<class _Tp, class _A0, class _A1> | |
| 4615 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4616 | shared_ptr<_Tp> | |
| 4617 | make_shared(_A0& __a0, _A1& __a1) | |
| 4618 | { | |
| 4619 | return shared_ptr<_Tp>::make_shared(__a0, __a1); | |
| 4620 | } | |
| 4621 | ||
| 4622 | template<class _Tp, class _A0, class _A1, class _A2> | |
| 4623 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4624 | shared_ptr<_Tp> | |
| 4625 | make_shared(_A0& __a0, _A1& __a1, _A2& __a2) | |
| 4626 | { | |
| 4627 | return shared_ptr<_Tp>::make_shared(__a0, __a1, __a2); | |
| 4628 | } | |
| 4629 | ||
| 4630 | template<class _Tp, class _Alloc> | |
| 4631 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4632 | shared_ptr<_Tp> | |
| 4633 | allocate_shared(const _Alloc& __a) | |
| 4634 | { | |
| 4635 | return shared_ptr<_Tp>::allocate_shared(__a); | |
| 4636 | } | |
| 4637 | ||
| 4638 | template<class _Tp, class _Alloc, class _A0> | |
| 4639 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4640 | shared_ptr<_Tp> | |
| 4641 | allocate_shared(const _Alloc& __a, _A0& __a0) | |
| 4642 | { | |
| 4643 | return shared_ptr<_Tp>::allocate_shared(__a, __a0); | |
| 4644 | } | |
| 4645 | ||
| 4646 | template<class _Tp, class _Alloc, class _A0, class _A1> | |
| 4647 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4648 | shared_ptr<_Tp> | |
| 4649 | allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1) | |
| 4650 | { | |
| 4651 | return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1); | |
| 4652 | } | |
| 4653 | ||
| 4654 | template<class _Tp, class _Alloc, class _A0, class _A1, class _A2> | |
| 4655 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4656 | shared_ptr<_Tp> | |
| 4657 | allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2) | |
| 4658 | { | |
| 4659 | return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1, __a2); | |
| 4660 | } | |
| 4661 | ||
| 4662 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 4663 | ||
| 4664 | 4418 | template<class _Tp, class _Up> |
| 4665 | 4419 | inline _LIBCPP_INLINE_VISIBILITY |
| 4666 | 4420 | bool |
| ... | ... | @@ -5590,4 +5344,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 5590 | 5344 | |
| 5591 | 5345 | _LIBCPP_POP_MACROS |
| 5592 | 5346 | |
| 5347 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 | |
| 5348 | # include <__pstl_memory> | |
| 5349 | #endif | |
| 5350 | ||
| 5593 | 5351 | #endif // _LIBCPP_MEMORY |
lib/libcxx/include/module.modulemap+4| ... | ... | @@ -275,6 +275,10 @@ module std [system] { |
| 275 | 275 | header "exception" |
| 276 | 276 | export * |
| 277 | 277 | } |
| 278 | module execution { | |
| 279 | header "execution" | |
| 280 | export * | |
| 281 | } | |
| 278 | 282 | module filesystem { |
| 279 | 283 | header "filesystem" |
| 280 | 284 | export * |
lib/libcxx/include/mutex+4-4| ... | ... | @@ -86,9 +86,9 @@ public: |
| 86 | 86 | void unlock(); |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | struct defer_lock_t {}; | |
| 90 | struct try_to_lock_t {}; | |
| 91 | struct adopt_lock_t {}; | |
| 89 | struct defer_lock_t { explicit defer_lock_t() = default; }; | |
| 90 | struct try_to_lock_t { explicit try_to_lock_t() = default; }; | |
| 91 | struct adopt_lock_t { explicit adopt_lock_t() = default; }; | |
| 92 | 92 | |
| 93 | 93 | inline constexpr defer_lock_t defer_lock{}; |
| 94 | 94 | inline constexpr try_to_lock_t try_to_lock{}; |
| ... | ... | @@ -650,7 +650,7 @@ public: |
| 650 | 650 | #endif |
| 651 | 651 | |
| 652 | 652 | template <class _Fp> |
| 653 | void | |
| 653 | void _LIBCPP_INLINE_VISIBILITY | |
| 654 | 654 | __call_once_proxy(void* __vp) |
| 655 | 655 | { |
| 656 | 656 | __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); |
lib/libcxx/include/new+2-2| ... | ... | @@ -39,7 +39,7 @@ struct destroying_delete_t { // C++20 |
| 39 | 39 | }; |
| 40 | 40 | inline constexpr destroying_delete_t destroying_delete{}; // C++20 |
| 41 | 41 | |
| 42 | struct nothrow_t {}; | |
| 42 | struct nothrow_t { explicit nothrow_t() = default; }; | |
| 43 | 43 | extern const nothrow_t nothrow; |
| 44 | 44 | typedef void (*new_handler)(); |
| 45 | 45 | new_handler set_new_handler(new_handler new_p) noexcept; |
| ... | ... | @@ -126,7 +126,7 @@ namespace std // purposefully not using versioning namespace |
| 126 | 126 | { |
| 127 | 127 | |
| 128 | 128 | #if !defined(_LIBCPP_ABI_VCRUNTIME) |
| 129 | struct _LIBCPP_TYPE_VIS nothrow_t {}; | |
| 129 | struct _LIBCPP_TYPE_VIS nothrow_t { explicit nothrow_t() = default; }; | |
| 130 | 130 | extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; |
| 131 | 131 | |
| 132 | 132 | class _LIBCPP_EXCEPTION_ABI bad_alloc |
lib/libcxx/include/numeric+12-11| ... | ... | @@ -532,17 +532,14 @@ midpoint(_Tp __a, _Tp __b) noexcept |
| 532 | 532 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 533 | 533 | { |
| 534 | 534 | using _Up = std::make_unsigned_t<_Tp>; |
| 535 | constexpr _Up __bitshift = std::numeric_limits<_Up>::digits - 1; | |
| 535 | 536 | |
| 536 | int __sign = 1; | |
| 537 | _Up __m = __a; | |
| 538 | _Up __M = __b; | |
| 539 | if (__a > __b) | |
| 540 | { | |
| 541 | __sign = -1; | |
| 542 | __m = __b; | |
| 543 | __M = __a; | |
| 544 | } | |
| 545 | return __a + __sign * _Tp(_Up(__M-__m) >> 1); | |
| 537 | _Up __diff = _Up(__b) - _Up(__a); | |
| 538 | _Up __sign_bit = __b < __a; | |
| 539 | ||
| 540 | _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff); | |
| 541 | ||
| 542 | return __a + __half_diff; | |
| 546 | 543 | } |
| 547 | 544 | |
| 548 | 545 | |
| ... | ... | @@ -576,7 +573,7 @@ midpoint(_Fp __a, _Fp __b) noexcept |
| 576 | 573 | return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible |
| 577 | 574 | (__a + __b)/2 : // always correctly rounded |
| 578 | 575 | __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a |
| 579 | __fp_abs(__a) < __lo ? __a/2 + __b : // not safe to halve b | |
| 576 | __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b | |
| 580 | 577 | __a/2 + __b/2; // otherwise correctly rounded |
| 581 | 578 | } |
| 582 | 579 | |
| ... | ... | @@ -586,4 +583,8 @@ _LIBCPP_END_NAMESPACE_STD |
| 586 | 583 | |
| 587 | 584 | _LIBCPP_POP_MACROS |
| 588 | 585 | |
| 586 | #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 | |
| 587 | # include <__pstl_numeric> | |
| 588 | #endif | |
| 589 | ||
| 589 | 590 | #endif // _LIBCPP_NUMERIC |
lib/libcxx/include/ostream+1-1| ... | ... | @@ -1055,7 +1055,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 1055 | 1055 | template<class _CharT, class _Traits> |
| 1056 | 1056 | basic_ostream<_CharT, _Traits>& |
| 1057 | 1057 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 1058 | const basic_string_view<_CharT, _Traits> __sv) | |
| 1058 | basic_string_view<_CharT, _Traits> __sv) | |
| 1059 | 1059 | { |
| 1060 | 1060 | return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); |
| 1061 | 1061 | } |
lib/libcxx/include/queue+1-1| ... | ... | @@ -562,7 +562,7 @@ priority_queue(_Compare, _Container) |
| 562 | 562 | template<class _InputIterator, |
| 563 | 563 | class _Compare = less<typename iterator_traits<_InputIterator>::value_type>, |
| 564 | 564 | class _Container = vector<typename iterator_traits<_InputIterator>::value_type>, |
| 565 | class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type, | |
| 565 | class = typename enable_if< __is_cpp17_input_iterator<_InputIterator>::value, nullptr_t>::type, | |
| 566 | 566 | class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type, |
| 567 | 567 | class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type |
| 568 | 568 | > |
lib/libcxx/include/random+27-22| ... | ... | @@ -3645,7 +3645,7 @@ generate_canonical(_URNG& __g) |
| 3645 | 3645 | const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value; |
| 3646 | 3646 | #endif |
| 3647 | 3647 | const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0); |
| 3648 | const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1); | |
| 3648 | const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1); | |
| 3649 | 3649 | _RealType __base = _Rp; |
| 3650 | 3650 | _RealType _Sp = __g() - _URNG::min(); |
| 3651 | 3651 | for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp) |
| ... | ... | @@ -4592,7 +4592,10 @@ public: |
| 4592 | 4592 | |
| 4593 | 4593 | template<class _IntType> |
| 4594 | 4594 | poisson_distribution<_IntType>::param_type::param_type(double __mean) |
| 4595 | : __mean_(__mean) | |
| 4595 | // According to the standard `inf` is a valid input, but it causes the | |
| 4596 | // distribution to hang, so we replace it with the maximum representable | |
| 4597 | // mean. | |
| 4598 | : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean) | |
| 4596 | 4599 | { |
| 4597 | 4600 | if (__mean_ < 10) |
| 4598 | 4601 | { |
| ... | ... | @@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean) |
| 4610 | 4613 | { |
| 4611 | 4614 | __s_ = _VSTD::sqrt(__mean_); |
| 4612 | 4615 | __d_ = 6 * __mean_ * __mean_; |
| 4613 | __l_ = static_cast<result_type>(__mean_ - 1.1484); | |
| 4616 | __l_ = std::trunc(__mean_ - 1.1484); | |
| 4614 | 4617 | __omega_ = .3989423 / __s_; |
| 4615 | 4618 | double __b1_ = .4166667E-1 / __mean_; |
| 4616 | 4619 | double __b2_ = .3 * __b1_ * __b1_; |
| ... | ... | @@ -4627,12 +4630,12 @@ template<class _URNG> |
| 4627 | 4630 | _IntType |
| 4628 | 4631 | poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) |
| 4629 | 4632 | { |
| 4630 | result_type __x; | |
| 4633 | double __tx; | |
| 4631 | 4634 | uniform_real_distribution<double> __urd; |
| 4632 | 4635 | if (__pr.__mean_ < 10) |
| 4633 | 4636 | { |
| 4634 | __x = 0; | |
| 4635 | for (double __p = __urd(__urng); __p > __pr.__l_; ++__x) | |
| 4637 | __tx = 0; | |
| 4638 | for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx) | |
| 4636 | 4639 | __p *= __urd(__urng); |
| 4637 | 4640 | } |
| 4638 | 4641 | else |
| ... | ... | @@ -4642,19 +4645,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4642 | 4645 | double __u; |
| 4643 | 4646 | if (__g > 0) |
| 4644 | 4647 | { |
| 4645 | __x = static_cast<result_type>(__g); | |
| 4646 | if (__x >= __pr.__l_) | |
| 4647 | return __x; | |
| 4648 | __difmuk = __pr.__mean_ - __x; | |
| 4648 | __tx = std::trunc(__g); | |
| 4649 | if (__tx >= __pr.__l_) | |
| 4650 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4651 | __difmuk = __pr.__mean_ - __tx; | |
| 4649 | 4652 | __u = __urd(__urng); |
| 4650 | 4653 | if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk) |
| 4651 | return __x; | |
| 4654 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4652 | 4655 | } |
| 4653 | 4656 | exponential_distribution<double> __edist; |
| 4654 | 4657 | for (bool __using_exp_dist = false; true; __using_exp_dist = true) |
| 4655 | 4658 | { |
| 4656 | 4659 | double __e; |
| 4657 | if (__using_exp_dist || __g < 0) | |
| 4660 | if (__using_exp_dist || __g <= 0) | |
| 4658 | 4661 | { |
| 4659 | 4662 | double __t; |
| 4660 | 4663 | do |
| ... | ... | @@ -4664,31 +4667,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4664 | 4667 | __u += __u - 1; |
| 4665 | 4668 | __t = 1.8 + (__u < 0 ? -__e : __e); |
| 4666 | 4669 | } while (__t <= -.6744); |
| 4667 | __x = __pr.__mean_ + __pr.__s_ * __t; | |
| 4668 | __difmuk = __pr.__mean_ - __x; | |
| 4670 | __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t); | |
| 4671 | __difmuk = __pr.__mean_ - __tx; | |
| 4669 | 4672 | __using_exp_dist = true; |
| 4670 | 4673 | } |
| 4671 | 4674 | double __px; |
| 4672 | 4675 | double __py; |
| 4673 | if (__x < 10) | |
| 4676 | if (__tx < 10 && __tx >= 0) | |
| 4674 | 4677 | { |
| 4675 | 4678 | const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, |
| 4676 | 4679 | 40320, 362880}; |
| 4677 | 4680 | __px = -__pr.__mean_; |
| 4678 | __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x]; | |
| 4681 | __py = _VSTD::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)]; | |
| 4679 | 4682 | } |
| 4680 | 4683 | else |
| 4681 | 4684 | { |
| 4682 | double __del = .8333333E-1 / __x; | |
| 4685 | double __del = .8333333E-1 / __tx; | |
| 4683 | 4686 | __del -= 4.8 * __del * __del * __del; |
| 4684 | double __v = __difmuk / __x; | |
| 4687 | double __v = __difmuk / __tx; | |
| 4685 | 4688 | if (_VSTD::abs(__v) > 0.25) |
| 4686 | __px = __x * _VSTD::log(1 + __v) - __difmuk - __del; | |
| 4689 | __px = __tx * _VSTD::log(1 + __v) - __difmuk - __del; | |
| 4687 | 4690 | else |
| 4688 | __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) * | |
| 4691 | __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) * | |
| 4689 | 4692 | __v + .1421878) * __v + -.1661269) * __v + .2000118) * |
| 4690 | 4693 | __v + -.2500068) * __v + .3333333) * __v + -.5) - __del; |
| 4691 | __py = .3989423 / _VSTD::sqrt(__x); | |
| 4694 | __py = .3989423 / _VSTD::sqrt(__tx); | |
| 4692 | 4695 | } |
| 4693 | 4696 | double __r = (0.5 - __difmuk) / __pr.__s_; |
| 4694 | 4697 | double __r2 = __r * __r; |
| ... | ... | @@ -4708,7 +4711,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4708 | 4711 | } |
| 4709 | 4712 | } |
| 4710 | 4713 | } |
| 4711 | return __x; | |
| 4714 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4712 | 4715 | } |
| 4713 | 4716 | |
| 4714 | 4717 | template <class _CharT, class _Traits, class _IntType> |
| ... | ... | @@ -6102,6 +6105,7 @@ public: |
| 6102 | 6105 | template<class _UnaryOperation> |
| 6103 | 6106 | param_type(size_t __nw, result_type __xmin, result_type __xmax, |
| 6104 | 6107 | _UnaryOperation __fw); |
| 6108 | param_type(param_type const&) = default; | |
| 6105 | 6109 | param_type & operator=(const param_type& __rhs); |
| 6106 | 6110 | |
| 6107 | 6111 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -6425,6 +6429,7 @@ public: |
| 6425 | 6429 | template<class _UnaryOperation> |
| 6426 | 6430 | param_type(size_t __nw, result_type __xmin, result_type __xmax, |
| 6427 | 6431 | _UnaryOperation __fw); |
| 6432 | param_type(param_type const&) = default; | |
| 6428 | 6433 | param_type & operator=(const param_type& __rhs); |
| 6429 | 6434 | |
| 6430 | 6435 | _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/regex+31-21| ... | ... | @@ -169,15 +169,15 @@ public: |
| 169 | 169 | // assign: |
| 170 | 170 | basic_regex& assign(const basic_regex& that); |
| 171 | 171 | basic_regex& assign(basic_regex&& that) noexcept; |
| 172 | basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); | |
| 173 | basic_regex& assign(const charT* p, size_t len, flag_type f); | |
| 172 | basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); | |
| 173 | basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); | |
| 174 | 174 | template <class string_traits, class A> |
| 175 | 175 | basic_regex& assign(const basic_string<charT, string_traits, A>& s, |
| 176 | flag_type f = regex_constants::ECMAScript); | |
| 176 | flag_type f = regex_constants::ECMAScript); | |
| 177 | 177 | template <class InputIterator> |
| 178 | 178 | basic_regex& assign(InputIterator first, InputIterator last, |
| 179 | flag_type f = regex_constants::ECMAScript); | |
| 180 | basic_regex& assign(initializer_list<charT>, flag_type = regex_constants::ECMAScript); | |
| 179 | flag_type f = regex_constants::ECMAScript); | |
| 180 | basic_regex& assign(initializer_list<charT>, flag_type f = regex_constants::ECMAScript); | |
| 181 | 181 | |
| 182 | 182 | // const operations: |
| 183 | 183 | unsigned mark_count() const; |
| ... | ... | @@ -965,7 +965,8 @@ enum error_type |
| 965 | 965 | error_stack, |
| 966 | 966 | __re_err_grammar, |
| 967 | 967 | __re_err_empty, |
| 968 | __re_err_unknown | |
| 968 | __re_err_unknown, | |
| 969 | __re_err_parse | |
| 969 | 970 | }; |
| 970 | 971 | |
| 971 | 972 | } // regex_constants |
| ... | ... | @@ -2539,8 +2540,7 @@ public: |
| 2539 | 2540 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2540 | 2541 | __end_(0) |
| 2541 | 2542 | { |
| 2542 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 2543 | __parse(__p, __p + __traits_.length(__p)); | |
| 2543 | __init(__p, __p + __traits_.length(__p)); | |
| 2544 | 2544 | } |
| 2545 | 2545 | |
| 2546 | 2546 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2548,8 +2548,7 @@ public: |
| 2548 | 2548 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2549 | 2549 | __end_(0) |
| 2550 | 2550 | { |
| 2551 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 2552 | __parse(__p, __p + __len); | |
| 2551 | __init(__p, __p + __len); | |
| 2553 | 2552 | } |
| 2554 | 2553 | |
| 2555 | 2554 | // basic_regex(const basic_regex&) = default; |
| ... | ... | @@ -2561,8 +2560,7 @@ public: |
| 2561 | 2560 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2562 | 2561 | __end_(0) |
| 2563 | 2562 | { |
| 2564 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 2565 | __parse(__p.begin(), __p.end()); | |
| 2563 | __init(__p.begin(), __p.end()); | |
| 2566 | 2564 | } |
| 2567 | 2565 | |
| 2568 | 2566 | template <class _ForwardIterator> |
| ... | ... | @@ -2572,8 +2570,7 @@ public: |
| 2572 | 2570 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2573 | 2571 | __end_(0) |
| 2574 | 2572 | { |
| 2575 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 2576 | __parse(__first, __last); | |
| 2573 | __init(__first, __last); | |
| 2577 | 2574 | } |
| 2578 | 2575 | #ifndef _LIBCPP_CXX03_LANG |
| 2579 | 2576 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2582,8 +2579,7 @@ public: |
| 2582 | 2579 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2583 | 2580 | __end_(0) |
| 2584 | 2581 | { |
| 2585 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 2586 | __parse(__il.begin(), __il.end()); | |
| 2582 | __init(__il.begin(), __il.end()); | |
| 2587 | 2583 | } |
| 2588 | 2584 | #endif // _LIBCPP_CXX03_LANG |
| 2589 | 2585 | |
| ... | ... | @@ -2617,7 +2613,7 @@ public: |
| 2617 | 2613 | basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) |
| 2618 | 2614 | {return assign(__p, __p + __traits_.length(__p), __f);} |
| 2619 | 2615 | _LIBCPP_INLINE_VISIBILITY |
| 2620 | basic_regex& assign(const value_type* __p, size_t __len, flag_type __f) | |
| 2616 | basic_regex& assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript) | |
| 2621 | 2617 | {return assign(__p, __p + __len, __f);} |
| 2622 | 2618 | template <class _ST, class _SA> |
| 2623 | 2619 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2629,8 +2625,8 @@ public: |
| 2629 | 2625 | _LIBCPP_INLINE_VISIBILITY |
| 2630 | 2626 | typename enable_if |
| 2631 | 2627 | < |
| 2632 | __is_input_iterator <_InputIterator>::value && | |
| 2633 | !__is_forward_iterator<_InputIterator>::value, | |
| 2628 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 2629 | !__is_cpp17_forward_iterator<_InputIterator>::value, | |
| 2634 | 2630 | basic_regex& |
| 2635 | 2631 | >::type |
| 2636 | 2632 | assign(_InputIterator __first, _InputIterator __last, |
| ... | ... | @@ -2656,7 +2652,7 @@ public: |
| 2656 | 2652 | _LIBCPP_INLINE_VISIBILITY |
| 2657 | 2653 | typename enable_if |
| 2658 | 2654 | < |
| 2659 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2655 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2660 | 2656 | basic_regex& |
| 2661 | 2657 | >::type |
| 2662 | 2658 | assign(_ForwardIterator __first, _ForwardIterator __last, |
| ... | ... | @@ -2698,6 +2694,9 @@ private: |
| 2698 | 2694 | _LIBCPP_INLINE_VISIBILITY |
| 2699 | 2695 | unsigned __loop_count() const {return __loop_count_;} |
| 2700 | 2696 | |
| 2697 | template <class _ForwardIterator> | |
| 2698 | void | |
| 2699 | __init(_ForwardIterator __first, _ForwardIterator __last); | |
| 2701 | 2700 | template <class _ForwardIterator> |
| 2702 | 2701 | _ForwardIterator |
| 2703 | 2702 | __parse(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -2953,7 +2952,7 @@ private: |
| 2953 | 2952 | |
| 2954 | 2953 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 2955 | 2954 | template <class _ForwardIterator, |
| 2956 | class = typename enable_if<__is_forward_iterator<_ForwardIterator>::value, nullptr_t>::type | |
| 2955 | class = typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value, nullptr_t>::type | |
| 2957 | 2956 | > |
| 2958 | 2957 | basic_regex(_ForwardIterator, _ForwardIterator, |
| 2959 | 2958 | regex_constants::syntax_option_type = regex_constants::ECMAScript) |
| ... | ... | @@ -3054,6 +3053,17 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const |
| 3054 | 3053 | } |
| 3055 | 3054 | } |
| 3056 | 3055 | |
| 3056 | template <class _CharT, class _Traits> | |
| 3057 | template <class _ForwardIterator> | |
| 3058 | void | |
| 3059 | basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last) | |
| 3060 | { | |
| 3061 | if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript; | |
| 3062 | _ForwardIterator __temp = __parse(__first, __last); | |
| 3063 | if ( __temp != __last) | |
| 3064 | __throw_regex_error<regex_constants::__re_err_parse>(); | |
| 3065 | } | |
| 3066 | ||
| 3057 | 3067 | template <class _CharT, class _Traits> |
| 3058 | 3068 | template <class _ForwardIterator> |
| 3059 | 3069 | _ForwardIterator |
lib/libcxx/include/set+12-12| ... | ... | @@ -852,26 +852,26 @@ public: |
| 852 | 852 | template<class _InputIterator, |
| 853 | 853 | class _Compare = less<typename iterator_traits<_InputIterator>::value_type>, |
| 854 | 854 | class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>, |
| 855 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type, | |
| 856 | class = typename enable_if<!__is_allocator<_Compare>::value, void>::type> | |
| 855 | class = _EnableIf<__is_allocator<_Allocator>::value, void>, | |
| 856 | class = _EnableIf<!__is_allocator<_Compare>::value, void>> | |
| 857 | 857 | set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) |
| 858 | 858 | -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>; |
| 859 | 859 | |
| 860 | 860 | template<class _Key, class _Compare = less<_Key>, |
| 861 | 861 | class _Allocator = allocator<_Key>, |
| 862 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type, | |
| 863 | class = typename enable_if<!__is_allocator<_Compare>::value, void>::type> | |
| 862 | class = _EnableIf<__is_allocator<_Allocator>::value, void>, | |
| 863 | class = _EnableIf<!__is_allocator<_Compare>::value, void>> | |
| 864 | 864 | set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) |
| 865 | 865 | -> set<_Key, _Compare, _Allocator>; |
| 866 | 866 | |
| 867 | 867 | template<class _InputIterator, class _Allocator, |
| 868 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> | |
| 868 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 869 | 869 | set(_InputIterator, _InputIterator, _Allocator) |
| 870 | 870 | -> set<typename iterator_traits<_InputIterator>::value_type, |
| 871 | 871 | less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>; |
| 872 | 872 | |
| 873 | 873 | template<class _Key, class _Allocator, |
| 874 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> | |
| 874 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 875 | 875 | set(initializer_list<_Key>, _Allocator) |
| 876 | 876 | -> set<_Key, less<_Key>, _Allocator>; |
| 877 | 877 | #endif |
| ... | ... | @@ -1377,26 +1377,26 @@ public: |
| 1377 | 1377 | template<class _InputIterator, |
| 1378 | 1378 | class _Compare = less<typename iterator_traits<_InputIterator>::value_type>, |
| 1379 | 1379 | class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>, |
| 1380 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type, | |
| 1381 | class = typename enable_if<!__is_allocator<_Compare>::value, void>::type> | |
| 1380 | class = _EnableIf<__is_allocator<_Allocator>::value, void>, | |
| 1381 | class = _EnableIf<!__is_allocator<_Compare>::value, void>> | |
| 1382 | 1382 | multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) |
| 1383 | 1383 | -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>; |
| 1384 | 1384 | |
| 1385 | 1385 | template<class _Key, class _Compare = less<_Key>, |
| 1386 | 1386 | class _Allocator = allocator<_Key>, |
| 1387 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type, | |
| 1388 | class = typename enable_if<!__is_allocator<_Compare>::value, void>::type> | |
| 1387 | class = _EnableIf<__is_allocator<_Allocator>::value, void>, | |
| 1388 | class = _EnableIf<!__is_allocator<_Compare>::value, void>> | |
| 1389 | 1389 | multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) |
| 1390 | 1390 | -> multiset<_Key, _Compare, _Allocator>; |
| 1391 | 1391 | |
| 1392 | 1392 | template<class _InputIterator, class _Allocator, |
| 1393 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> | |
| 1393 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1394 | 1394 | multiset(_InputIterator, _InputIterator, _Allocator) |
| 1395 | 1395 | -> multiset<typename iterator_traits<_InputIterator>::value_type, |
| 1396 | 1396 | less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>; |
| 1397 | 1397 | |
| 1398 | 1398 | template<class _Key, class _Allocator, |
| 1399 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> | |
| 1399 | class = _EnableIf<__is_allocator<_Allocator>::value, void>> | |
| 1400 | 1400 | multiset(initializer_list<_Key>, _Allocator) |
| 1401 | 1401 | -> multiset<_Key, less<_Key>, _Allocator>; |
| 1402 | 1402 | #endif |
lib/libcxx/include/span+36-36| ... | ... | @@ -39,7 +39,7 @@ public: |
| 39 | 39 | // constants and types |
| 40 | 40 | using element_type = ElementType; |
| 41 | 41 | using value_type = remove_cv_t<ElementType>; |
| 42 | using index_type = size_t; | |
| 42 | using size_type = size_t; | |
| 43 | 43 | using difference_type = ptrdiff_t; |
| 44 | 44 | using pointer = element_type*; |
| 45 | 45 | using const_pointer = const element_type*; |
| ... | ... | @@ -49,11 +49,11 @@ public: |
| 49 | 49 | using const_iterator = implementation-defined; |
| 50 | 50 | using reverse_iterator = std::reverse_iterator<iterator>; |
| 51 | 51 | using const_reverse_iterator = std::reverse_iterator<const_iterator>; |
| 52 | static constexpr index_type extent = Extent; | |
| 52 | static constexpr size_type extent = Extent; | |
| 53 | 53 | |
| 54 | 54 | // [span.cons], span constructors, copy, assignment, and destructor |
| 55 | 55 | constexpr span() noexcept; |
| 56 | constexpr span(pointer ptr, index_type count); | |
| 56 | constexpr span(pointer ptr, size_type count); | |
| 57 | 57 | constexpr span(pointer firstElem, pointer lastElem); |
| 58 | 58 | template <size_t N> |
| 59 | 59 | constexpr span(element_type (&arr)[N]) noexcept; |
| ... | ... | @@ -79,17 +79,17 @@ public: |
| 79 | 79 | template <size_t Offset, size_t Count = dynamic_extent> |
| 80 | 80 | constexpr span<element_type, see below> subspan() const; |
| 81 | 81 | |
| 82 | constexpr span<element_type, dynamic_extent> first(index_type count) const; | |
| 83 | constexpr span<element_type, dynamic_extent> last(index_type count) const; | |
| 84 | constexpr span<element_type, dynamic_extent> subspan(index_type offset, index_type count = dynamic_extent) const; | |
| 82 | constexpr span<element_type, dynamic_extent> first(size_type count) const; | |
| 83 | constexpr span<element_type, dynamic_extent> last(size_type count) const; | |
| 84 | constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const; | |
| 85 | 85 | |
| 86 | 86 | // [span.obs], span observers |
| 87 | constexpr index_type size() const noexcept; | |
| 88 | constexpr index_type size_bytes() const noexcept; | |
| 87 | constexpr size_type size() const noexcept; | |
| 88 | constexpr size_type size_bytes() const noexcept; | |
| 89 | 89 | constexpr bool empty() const noexcept; |
| 90 | 90 | |
| 91 | 91 | // [span.elem], span element access |
| 92 | constexpr reference operator[](index_type idx) const; | |
| 92 | constexpr reference operator[](size_type idx) const; | |
| 93 | 93 | constexpr reference front() const; |
| 94 | 94 | constexpr reference back() const; |
| 95 | 95 | constexpr pointer data() const noexcept; |
| ... | ... | @@ -105,8 +105,8 @@ public: |
| 105 | 105 | constexpr const_reverse_iterator crend() const noexcept; |
| 106 | 106 | |
| 107 | 107 | private: |
| 108 | pointer data_; // exposition only | |
| 109 | index_type size_; // exposition only | |
| 108 | pointer data_; // exposition only | |
| 109 | size_type size_; // exposition only | |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | 112 | template<class T, size_t N> |
| ... | ... | @@ -195,7 +195,7 @@ public: |
| 195 | 195 | // constants and types |
| 196 | 196 | using element_type = _Tp; |
| 197 | 197 | using value_type = remove_cv_t<_Tp>; |
| 198 | using index_type = size_t; | |
| 198 | using size_type = size_t; | |
| 199 | 199 | using difference_type = ptrdiff_t; |
| 200 | 200 | using pointer = _Tp *; |
| 201 | 201 | using const_pointer = const _Tp *; |
| ... | ... | @@ -206,7 +206,7 @@ public: |
| 206 | 206 | using reverse_iterator = _VSTD::reverse_iterator<iterator>; |
| 207 | 207 | using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>; |
| 208 | 208 | |
| 209 | static constexpr index_type extent = _Extent; | |
| 209 | static constexpr size_type extent = _Extent; | |
| 210 | 210 | |
| 211 | 211 | // [span.cons], span constructors, copy, assignment, and destructor |
| 212 | 212 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} |
| ... | ... | @@ -215,7 +215,7 @@ public: |
| 215 | 215 | constexpr span (const span&) noexcept = default; |
| 216 | 216 | constexpr span& operator=(const span&) noexcept = default; |
| 217 | 217 | |
| 218 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr} | |
| 218 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr} | |
| 219 | 219 | { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); } |
| 220 | 220 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f} |
| 221 | 221 | { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); } |
| ... | ... | @@ -260,14 +260,14 @@ public: |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | _LIBCPP_INLINE_VISIBILITY |
| 263 | constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept | |
| 263 | constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept | |
| 264 | 264 | { |
| 265 | 265 | _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); |
| 266 | 266 | return {data(), __count}; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | _LIBCPP_INLINE_VISIBILITY |
| 270 | constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept | |
| 270 | constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept | |
| 271 | 271 | { |
| 272 | 272 | _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); |
| 273 | 273 | return {data() + size() - __count, __count}; |
| ... | ... | @@ -285,7 +285,7 @@ public: |
| 285 | 285 | |
| 286 | 286 | _LIBCPP_INLINE_VISIBILITY |
| 287 | 287 | constexpr span<element_type, dynamic_extent> |
| 288 | subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept | |
| 288 | subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept | |
| 289 | 289 | { |
| 290 | 290 | _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); |
| 291 | 291 | _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)"); |
| ... | ... | @@ -295,11 +295,11 @@ public: |
| 295 | 295 | return {data() + __offset, __count}; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return _Extent; } | |
| 299 | _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } | |
| 300 | _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } | |
| 298 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; } | |
| 299 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); } | |
| 300 | _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; } | |
| 301 | 301 | |
| 302 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept | |
| 302 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept | |
| 303 | 303 | { |
| 304 | 304 | _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds"); |
| 305 | 305 | return __data[__idx]; |
| ... | ... | @@ -356,7 +356,7 @@ public: |
| 356 | 356 | // constants and types |
| 357 | 357 | using element_type = _Tp; |
| 358 | 358 | using value_type = remove_cv_t<_Tp>; |
| 359 | using index_type = size_t; | |
| 359 | using size_type = size_t; | |
| 360 | 360 | using difference_type = ptrdiff_t; |
| 361 | 361 | using pointer = _Tp *; |
| 362 | 362 | using const_pointer = const _Tp *; |
| ... | ... | @@ -367,7 +367,7 @@ public: |
| 367 | 367 | using reverse_iterator = _VSTD::reverse_iterator<iterator>; |
| 368 | 368 | using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>; |
| 369 | 369 | |
| 370 | static constexpr index_type extent = dynamic_extent; | |
| 370 | static constexpr size_type extent = dynamic_extent; | |
| 371 | 371 | |
| 372 | 372 | // [span.cons], span constructors, copy, assignment, and destructor |
| 373 | 373 | _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {} |
| ... | ... | @@ -375,7 +375,7 @@ public: |
| 375 | 375 | constexpr span (const span&) noexcept = default; |
| 376 | 376 | constexpr span& operator=(const span&) noexcept = default; |
| 377 | 377 | |
| 378 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {} | |
| 378 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {} | |
| 379 | 379 | _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {} |
| 380 | 380 | |
| 381 | 381 | template <size_t _Sz> |
| ... | ... | @@ -394,13 +394,13 @@ public: |
| 394 | 394 | _LIBCPP_INLINE_VISIBILITY |
| 395 | 395 | constexpr span( _Container& __c, |
| 396 | 396 | enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) |
| 397 | : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {} | |
| 397 | : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} | |
| 398 | 398 | |
| 399 | 399 | template <class _Container> |
| 400 | 400 | _LIBCPP_INLINE_VISIBILITY |
| 401 | 401 | constexpr span(const _Container& __c, |
| 402 | 402 | enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr) |
| 403 | : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {} | |
| 403 | : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {} | |
| 404 | 404 | |
| 405 | 405 | |
| 406 | 406 | template <class _OtherElementType, size_t _OtherExtent> |
| ... | ... | @@ -430,14 +430,14 @@ public: |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | _LIBCPP_INLINE_VISIBILITY |
| 433 | constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept | |
| 433 | constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept | |
| 434 | 434 | { |
| 435 | 435 | _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)"); |
| 436 | 436 | return {data(), __count}; |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | _LIBCPP_INLINE_VISIBILITY |
| 440 | constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept | |
| 440 | constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept | |
| 441 | 441 | { |
| 442 | 442 | _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)"); |
| 443 | 443 | return {data() + size() - __count, __count}; |
| ... | ... | @@ -454,7 +454,7 @@ public: |
| 454 | 454 | |
| 455 | 455 | constexpr span<element_type, dynamic_extent> |
| 456 | 456 | _LIBCPP_INLINE_VISIBILITY |
| 457 | subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept | |
| 457 | subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept | |
| 458 | 458 | { |
| 459 | 459 | _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)"); |
| 460 | 460 | _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)"); |
| ... | ... | @@ -464,11 +464,11 @@ public: |
| 464 | 464 | return {data() + __offset, __count}; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return __size; } | |
| 468 | _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return __size * sizeof(element_type); } | |
| 469 | _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } | |
| 467 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; } | |
| 468 | _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); } | |
| 469 | _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; } | |
| 470 | 470 | |
| 471 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept | |
| 471 | _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept | |
| 472 | 472 | { |
| 473 | 473 | _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds"); |
| 474 | 474 | return __data[__idx]; |
| ... | ... | @@ -505,7 +505,7 @@ public: |
| 505 | 505 | __data = __other.__data; |
| 506 | 506 | __other.__data = __p; |
| 507 | 507 | |
| 508 | index_type __sz = __size; | |
| 508 | size_type __sz = __size; | |
| 509 | 509 | __size = __other.__size; |
| 510 | 510 | __other.__size = __sz; |
| 511 | 511 | } |
| ... | ... | @@ -517,8 +517,8 @@ public: |
| 517 | 517 | { return {reinterpret_cast<byte *>(data()), size_bytes()}; } |
| 518 | 518 | |
| 519 | 519 | private: |
| 520 | pointer __data; | |
| 521 | index_type __size; | |
| 520 | pointer __data; | |
| 521 | size_type __size; | |
| 522 | 522 | }; |
| 523 | 523 | |
| 524 | 524 | // tuple interface |
lib/libcxx/include/string+96-90| ... | ... | @@ -625,7 +625,7 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {}; |
| 625 | 625 | template <class _Iter> |
| 626 | 626 | struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {}; |
| 627 | 627 | #else |
| 628 | template <class _Iter, bool = __is_forward_iterator<_Iter>::value> | |
| 628 | template <class _Iter, bool = __is_cpp17_forward_iterator<_Iter>::value> | |
| 629 | 629 | struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT(( |
| 630 | 630 | noexcept(++(declval<_Iter&>())) && |
| 631 | 631 | is_nothrow_assignable<_Iter&, _Iter>::value && |
| ... | ... | @@ -812,11 +812,9 @@ public: |
| 812 | 812 | basic_string(basic_string&& __str, const allocator_type& __a); |
| 813 | 813 | #endif // _LIBCPP_CXX03_LANG |
| 814 | 814 | |
| 815 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 816 | 815 | template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> |
| 817 | #endif | |
| 818 | 816 | _LIBCPP_INLINE_VISIBILITY |
| 819 | basic_string(const _CharT* __s) { | |
| 817 | basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { | |
| 820 | 818 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); |
| 821 | 819 | __init(__s, traits_type::length(__s)); |
| 822 | 820 | # if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -824,9 +822,7 @@ public: |
| 824 | 822 | # endif |
| 825 | 823 | } |
| 826 | 824 | |
| 827 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 828 | 825 | template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> |
| 829 | #endif | |
| 830 | 826 | _LIBCPP_INLINE_VISIBILITY |
| 831 | 827 | basic_string(const _CharT* __s, const _Allocator& __a); |
| 832 | 828 | |
| ... | ... | @@ -837,9 +833,7 @@ public: |
| 837 | 833 | _LIBCPP_INLINE_VISIBILITY |
| 838 | 834 | basic_string(size_type __n, _CharT __c); |
| 839 | 835 | |
| 840 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 841 | 836 | template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> |
| 842 | #endif | |
| 843 | 837 | _LIBCPP_INLINE_VISIBILITY |
| 844 | 838 | basic_string(size_type __n, _CharT __c, const _Allocator& __a); |
| 845 | 839 | |
| ... | ... | @@ -862,10 +856,10 @@ public: |
| 862 | 856 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 863 | 857 | explicit basic_string(const _Tp& __t, const allocator_type& __a); |
| 864 | 858 | |
| 865 | template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type> | |
| 859 | template<class _InputIterator, class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value>::type> | |
| 866 | 860 | _LIBCPP_INLINE_VISIBILITY |
| 867 | 861 | basic_string(_InputIterator __first, _InputIterator __last); |
| 868 | template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type> | |
| 862 | template<class _InputIterator, class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value>::type> | |
| 869 | 863 | _LIBCPP_INLINE_VISIBILITY |
| 870 | 864 | basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); |
| 871 | 865 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -1029,7 +1023,7 @@ public: |
| 1029 | 1023 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1030 | 1024 | typename enable_if |
| 1031 | 1025 | < |
| 1032 | __is_exactly_input_iterator<_InputIterator>::value | |
| 1026 | __is_exactly_cpp17_input_iterator<_InputIterator>::value | |
| 1033 | 1027 | || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, |
| 1034 | 1028 | basic_string& |
| 1035 | 1029 | >::type |
| ... | ... | @@ -1043,7 +1037,7 @@ public: |
| 1043 | 1037 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1044 | 1038 | typename enable_if |
| 1045 | 1039 | < |
| 1046 | __is_forward_iterator<_ForwardIterator>::value | |
| 1040 | __is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 1047 | 1041 | && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, |
| 1048 | 1042 | basic_string& |
| 1049 | 1043 | >::type |
| ... | ... | @@ -1097,7 +1091,7 @@ public: |
| 1097 | 1091 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1098 | 1092 | typename enable_if |
| 1099 | 1093 | < |
| 1100 | __is_exactly_input_iterator<_InputIterator>::value | |
| 1094 | __is_exactly_cpp17_input_iterator<_InputIterator>::value | |
| 1101 | 1095 | || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, |
| 1102 | 1096 | basic_string& |
| 1103 | 1097 | >::type |
| ... | ... | @@ -1106,7 +1100,7 @@ public: |
| 1106 | 1100 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1107 | 1101 | typename enable_if |
| 1108 | 1102 | < |
| 1109 | __is_forward_iterator<_ForwardIterator>::value | |
| 1103 | __is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 1110 | 1104 | && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, |
| 1111 | 1105 | basic_string& |
| 1112 | 1106 | >::type |
| ... | ... | @@ -1148,7 +1142,7 @@ public: |
| 1148 | 1142 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1149 | 1143 | typename enable_if |
| 1150 | 1144 | < |
| 1151 | __is_exactly_input_iterator<_InputIterator>::value | |
| 1145 | __is_exactly_cpp17_input_iterator<_InputIterator>::value | |
| 1152 | 1146 | || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, |
| 1153 | 1147 | iterator |
| 1154 | 1148 | >::type |
| ... | ... | @@ -1157,7 +1151,7 @@ public: |
| 1157 | 1151 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1158 | 1152 | typename enable_if |
| 1159 | 1153 | < |
| 1160 | __is_forward_iterator<_ForwardIterator>::value | |
| 1154 | __is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 1161 | 1155 | && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, |
| 1162 | 1156 | iterator |
| 1163 | 1157 | >::type |
| ... | ... | @@ -1219,7 +1213,7 @@ public: |
| 1219 | 1213 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1220 | 1214 | typename enable_if |
| 1221 | 1215 | < |
| 1222 | __is_input_iterator<_InputIterator>::value, | |
| 1216 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 1223 | 1217 | basic_string& |
| 1224 | 1218 | >::type |
| 1225 | 1219 | replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); |
| ... | ... | @@ -1245,10 +1239,10 @@ public: |
| 1245 | 1239 | _LIBCPP_INLINE_VISIBILITY |
| 1246 | 1240 | const value_type* c_str() const _NOEXCEPT {return data();} |
| 1247 | 1241 | _LIBCPP_INLINE_VISIBILITY |
| 1248 | const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());} | |
| 1242 | const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(__get_pointer());} | |
| 1249 | 1243 | #if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY) |
| 1250 | 1244 | _LIBCPP_INLINE_VISIBILITY |
| 1251 | value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());} | |
| 1245 | value_type* data() _NOEXCEPT {return _VSTD::__to_address(__get_pointer());} | |
| 1252 | 1246 | #endif |
| 1253 | 1247 | |
| 1254 | 1248 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1553,7 +1547,7 @@ private: |
| 1553 | 1547 | inline |
| 1554 | 1548 | typename enable_if |
| 1555 | 1549 | < |
| 1556 | __is_exactly_input_iterator<_InputIterator>::value, | |
| 1550 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 1557 | 1551 | void |
| 1558 | 1552 | >::type |
| 1559 | 1553 | __init(_InputIterator __first, _InputIterator __last); |
| ... | ... | @@ -1562,7 +1556,7 @@ private: |
| 1562 | 1556 | inline |
| 1563 | 1557 | typename enable_if |
| 1564 | 1558 | < |
| 1565 | __is_forward_iterator<_ForwardIterator>::value, | |
| 1559 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 1566 | 1560 | void |
| 1567 | 1561 | >::type |
| 1568 | 1562 | __init(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -1658,7 +1652,7 @@ private: |
| 1658 | 1652 | template<class _InputIterator, |
| 1659 | 1653 | class _CharT = typename iterator_traits<_InputIterator>::value_type, |
| 1660 | 1654 | class _Allocator = allocator<_CharT>, |
| 1661 | class = typename enable_if<__is_input_iterator<_InputIterator>::value, void>::type, | |
| 1655 | class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value, void>::type, | |
| 1662 | 1656 | class = typename enable_if<__is_allocator<_Allocator>::value, void>::type |
| 1663 | 1657 | > |
| 1664 | 1658 | basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator()) |
| ... | ... | @@ -1727,6 +1721,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 1727 | 1721 | inline |
| 1728 | 1722 | basic_string<_CharT, _Traits, _Allocator>::basic_string() |
| 1729 | 1723 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 1724 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 1730 | 1725 | { |
| 1731 | 1726 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1732 | 1727 | __get_db()->__insert_c(this); |
| ... | ... | @@ -1742,7 +1737,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ |
| 1742 | 1737 | #else |
| 1743 | 1738 | _NOEXCEPT |
| 1744 | 1739 | #endif |
| 1745 | : __r_(__second_tag(), __a) | |
| 1740 | : __r_(__default_init_tag(), __a) | |
| 1746 | 1741 | { |
| 1747 | 1742 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1748 | 1743 | __get_db()->__insert_c(this); |
| ... | ... | @@ -1771,7 +1766,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, |
| 1771 | 1766 | __set_long_cap(__cap+1); |
| 1772 | 1767 | __set_long_size(__sz); |
| 1773 | 1768 | } |
| 1774 | traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz); | |
| 1769 | traits_type::copy(_VSTD::__to_address(__p), __s, __sz); | |
| 1775 | 1770 | traits_type::assign(__p[__sz], value_type()); |
| 1776 | 1771 | } |
| 1777 | 1772 | |
| ... | ... | @@ -1795,16 +1790,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty |
| 1795 | 1790 | __set_long_cap(__cap+1); |
| 1796 | 1791 | __set_long_size(__sz); |
| 1797 | 1792 | } |
| 1798 | traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz); | |
| 1793 | traits_type::copy(_VSTD::__to_address(__p), __s, __sz); | |
| 1799 | 1794 | traits_type::assign(__p[__sz], value_type()); |
| 1800 | 1795 | } |
| 1801 | 1796 | |
| 1802 | 1797 | template <class _CharT, class _Traits, class _Allocator> |
| 1803 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 1804 | 1798 | template <class> |
| 1805 | #endif | |
| 1806 | 1799 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) |
| 1807 | : __r_(__second_tag(), __a) | |
| 1800 | : __r_(__default_init_tag(), __a) | |
| 1808 | 1801 | { |
| 1809 | 1802 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); |
| 1810 | 1803 | __init(__s, traits_type::length(__s)); |
| ... | ... | @@ -1816,6 +1809,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const |
| 1816 | 1809 | template <class _CharT, class _Traits, class _Allocator> |
| 1817 | 1810 | inline |
| 1818 | 1811 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n) |
| 1812 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 1819 | 1813 | { |
| 1820 | 1814 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); |
| 1821 | 1815 | __init(__s, __n); |
| ... | ... | @@ -1827,7 +1821,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ |
| 1827 | 1821 | template <class _CharT, class _Traits, class _Allocator> |
| 1828 | 1822 | inline |
| 1829 | 1823 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) |
| 1830 | : __r_(__second_tag(), __a) | |
| 1824 | : __r_(__default_init_tag(), __a) | |
| 1831 | 1825 | { |
| 1832 | 1826 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); |
| 1833 | 1827 | __init(__s, __n); |
| ... | ... | @@ -1838,12 +1832,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ |
| 1838 | 1832 | |
| 1839 | 1833 | template <class _CharT, class _Traits, class _Allocator> |
| 1840 | 1834 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) |
| 1841 | : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) | |
| 1835 | : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) | |
| 1842 | 1836 | { |
| 1843 | 1837 | if (!__str.__is_long()) |
| 1844 | 1838 | __r_.first().__r = __str.__r_.first().__r; |
| 1845 | 1839 | else |
| 1846 | __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1840 | __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1847 | 1841 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1848 | 1842 | __get_db()->__insert_c(this); |
| 1849 | 1843 | #endif |
| ... | ... | @@ -1852,12 +1846,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 1852 | 1846 | template <class _CharT, class _Traits, class _Allocator> |
| 1853 | 1847 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 1854 | 1848 | const basic_string& __str, const allocator_type& __a) |
| 1855 | : __r_(__second_tag(), __a) | |
| 1849 | : __r_(__default_init_tag(), __a) | |
| 1856 | 1850 | { |
| 1857 | 1851 | if (!__str.__is_long()) |
| 1858 | 1852 | __r_.first().__r = __str.__r_.first().__r; |
| 1859 | 1853 | else |
| 1860 | __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1854 | __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1861 | 1855 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| 1862 | 1856 | __get_db()->__insert_c(this); |
| 1863 | 1857 | #endif |
| ... | ... | @@ -1886,10 +1880,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) |
| 1886 | 1880 | template <class _CharT, class _Traits, class _Allocator> |
| 1887 | 1881 | inline |
| 1888 | 1882 | basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) |
| 1889 | : __r_(__second_tag(), __a) | |
| 1883 | : __r_(__default_init_tag(), __a) | |
| 1890 | 1884 | { |
| 1891 | 1885 | if (__str.__is_long() && __a != __str.__alloc()) // copy, not move |
| 1892 | __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1886 | __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); | |
| 1893 | 1887 | else |
| 1894 | 1888 | { |
| 1895 | 1889 | __r_.first().__r = __str.__r_.first().__r; |
| ... | ... | @@ -1924,13 +1918,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) |
| 1924 | 1918 | __set_long_cap(__cap+1); |
| 1925 | 1919 | __set_long_size(__n); |
| 1926 | 1920 | } |
| 1927 | traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c); | |
| 1921 | traits_type::assign(_VSTD::__to_address(__p), __n, __c); | |
| 1928 | 1922 | traits_type::assign(__p[__n], value_type()); |
| 1929 | 1923 | } |
| 1930 | 1924 | |
| 1931 | 1925 | template <class _CharT, class _Traits, class _Allocator> |
| 1932 | 1926 | inline |
| 1933 | 1927 | basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c) |
| 1928 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 1934 | 1929 | { |
| 1935 | 1930 | __init(__n, __c); |
| 1936 | 1931 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -1939,11 +1934,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ |
| 1939 | 1934 | } |
| 1940 | 1935 | |
| 1941 | 1936 | template <class _CharT, class _Traits, class _Allocator> |
| 1942 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES | |
| 1943 | 1937 | template <class> |
| 1944 | #endif | |
| 1945 | 1938 | basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) |
| 1946 | : __r_(__second_tag(), __a) | |
| 1939 | : __r_(__default_init_tag(), __a) | |
| 1947 | 1940 | { |
| 1948 | 1941 | __init(__n, __c); |
| 1949 | 1942 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -1955,7 +1948,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 1955 | 1948 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, |
| 1956 | 1949 | size_type __pos, size_type __n, |
| 1957 | 1950 | const _Allocator& __a) |
| 1958 | : __r_(__second_tag(), __a) | |
| 1951 | : __r_(__default_init_tag(), __a) | |
| 1959 | 1952 | { |
| 1960 | 1953 | size_type __str_sz = __str.size(); |
| 1961 | 1954 | if (__pos > __str_sz) |
| ... | ... | @@ -1970,7 +1963,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 1970 | 1963 | inline |
| 1971 | 1964 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, |
| 1972 | 1965 | const _Allocator& __a) |
| 1973 | : __r_(__second_tag(), __a) | |
| 1966 | : __r_(__default_init_tag(), __a) | |
| 1974 | 1967 | { |
| 1975 | 1968 | size_type __str_sz = __str.size(); |
| 1976 | 1969 | if (__pos > __str_sz) |
| ... | ... | @@ -1985,7 +1978,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 1985 | 1978 | template <class _Tp, class> |
| 1986 | 1979 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 1987 | 1980 | const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a) |
| 1988 | : __r_(__second_tag(), __a) | |
| 1981 | : __r_(__default_init_tag(), __a) | |
| 1989 | 1982 | { |
| 1990 | 1983 | __self_view __sv0 = __t; |
| 1991 | 1984 | __self_view __sv = __sv0.substr(__pos, __n); |
| ... | ... | @@ -1998,6 +1991,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 1998 | 1991 | template <class _CharT, class _Traits, class _Allocator> |
| 1999 | 1992 | template <class _Tp, class> |
| 2000 | 1993 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) |
| 1994 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2001 | 1995 | { |
| 2002 | 1996 | __self_view __sv = __t; |
| 2003 | 1997 | __init(__sv.data(), __sv.size()); |
| ... | ... | @@ -2009,7 +2003,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) |
| 2009 | 2003 | template <class _CharT, class _Traits, class _Allocator> |
| 2010 | 2004 | template <class _Tp, class> |
| 2011 | 2005 | basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a) |
| 2012 | : __r_(__second_tag(), __a) | |
| 2006 | : __r_(__default_init_tag(), __a) | |
| 2013 | 2007 | { |
| 2014 | 2008 | __self_view __sv = __t; |
| 2015 | 2009 | __init(__sv.data(), __sv.size()); |
| ... | ... | @@ -2022,7 +2016,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2022 | 2016 | template <class _InputIterator> |
| 2023 | 2017 | typename enable_if |
| 2024 | 2018 | < |
| 2025 | __is_exactly_input_iterator<_InputIterator>::value, | |
| 2019 | __is_exactly_cpp17_input_iterator<_InputIterator>::value, | |
| 2026 | 2020 | void |
| 2027 | 2021 | >::type |
| 2028 | 2022 | basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) |
| ... | ... | @@ -2049,7 +2043,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2049 | 2043 | template <class _ForwardIterator> |
| 2050 | 2044 | typename enable_if |
| 2051 | 2045 | < |
| 2052 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2046 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2053 | 2047 | void |
| 2054 | 2048 | >::type |
| 2055 | 2049 | basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) |
| ... | ... | @@ -2080,6 +2074,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2080 | 2074 | template<class _InputIterator, class> |
| 2081 | 2075 | inline |
| 2082 | 2076 | basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last) |
| 2077 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2083 | 2078 | { |
| 2084 | 2079 | __init(__first, __last); |
| 2085 | 2080 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -2092,7 +2087,7 @@ template<class _InputIterator, class> |
| 2092 | 2087 | inline |
| 2093 | 2088 | basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, |
| 2094 | 2089 | const allocator_type& __a) |
| 2095 | : __r_(__second_tag(), __a) | |
| 2090 | : __r_(__default_init_tag(), __a) | |
| 2096 | 2091 | { |
| 2097 | 2092 | __init(__first, __last); |
| 2098 | 2093 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -2106,6 +2101,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2106 | 2101 | inline |
| 2107 | 2102 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2108 | 2103 | initializer_list<_CharT> __il) |
| 2104 | : __r_(__default_init_tag(), __default_init_tag()) | |
| 2109 | 2105 | { |
| 2110 | 2106 | __init(__il.begin(), __il.end()); |
| 2111 | 2107 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -2118,7 +2114,7 @@ inline |
| 2118 | 2114 | |
| 2119 | 2115 | basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2120 | 2116 | initializer_list<_CharT> __il, const _Allocator& __a) |
| 2121 | : __r_(__second_tag(), __a) | |
| 2117 | : __r_(__default_init_tag(), __a) | |
| 2122 | 2118 | { |
| 2123 | 2119 | __init(__il.begin(), __il.end()); |
| 2124 | 2120 | #if _LIBCPP_DEBUG_LEVEL >= 2 |
| ... | ... | @@ -2154,14 +2150,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace |
| 2154 | 2150 | pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); |
| 2155 | 2151 | __invalidate_all_iterators(); |
| 2156 | 2152 | if (__n_copy != 0) |
| 2157 | traits_type::copy(_VSTD::__to_raw_pointer(__p), | |
| 2158 | _VSTD::__to_raw_pointer(__old_p), __n_copy); | |
| 2153 | traits_type::copy(_VSTD::__to_address(__p), | |
| 2154 | _VSTD::__to_address(__old_p), __n_copy); | |
| 2159 | 2155 | if (__n_add != 0) |
| 2160 | traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add); | |
| 2156 | traits_type::copy(_VSTD::__to_address(__p) + __n_copy, __p_new_stuff, __n_add); | |
| 2161 | 2157 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; |
| 2162 | 2158 | if (__sec_cp_sz != 0) |
| 2163 | traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add, | |
| 2164 | _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz); | |
| 2159 | traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add, | |
| 2160 | _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz); | |
| 2165 | 2161 | if (__old_cap+1 != __min_cap) |
| 2166 | 2162 | __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); |
| 2167 | 2163 | __set_long_pointer(__p); |
| ... | ... | @@ -2186,12 +2182,12 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t |
| 2186 | 2182 | pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); |
| 2187 | 2183 | __invalidate_all_iterators(); |
| 2188 | 2184 | if (__n_copy != 0) |
| 2189 | traits_type::copy(_VSTD::__to_raw_pointer(__p), | |
| 2190 | _VSTD::__to_raw_pointer(__old_p), __n_copy); | |
| 2185 | traits_type::copy(_VSTD::__to_address(__p), | |
| 2186 | _VSTD::__to_address(__old_p), __n_copy); | |
| 2191 | 2187 | size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; |
| 2192 | 2188 | if (__sec_cp_sz != 0) |
| 2193 | traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add, | |
| 2194 | _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, | |
| 2189 | traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add, | |
| 2190 | _VSTD::__to_address(__old_p) + __n_copy + __n_del, | |
| 2195 | 2191 | __sec_cp_sz); |
| 2196 | 2192 | if (__old_cap+1 != __min_cap) |
| 2197 | 2193 | __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); |
| ... | ... | @@ -2209,7 +2205,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty |
| 2209 | 2205 | size_type __cap = capacity(); |
| 2210 | 2206 | if (__cap >= __n) |
| 2211 | 2207 | { |
| 2212 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2208 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2213 | 2209 | traits_type::move(__p, __s, __n); |
| 2214 | 2210 | traits_type::assign(__p[__n], value_type()); |
| 2215 | 2211 | __set_size(__n); |
| ... | ... | @@ -2235,7 +2231,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) |
| 2235 | 2231 | } |
| 2236 | 2232 | else |
| 2237 | 2233 | __invalidate_iterators_past(__n); |
| 2238 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2234 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2239 | 2235 | traits_type::assign(__p, __n, __c); |
| 2240 | 2236 | traits_type::assign(__p[__n], value_type()); |
| 2241 | 2237 | __set_size(__n); |
| ... | ... | @@ -2270,7 +2266,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) |
| 2270 | 2266 | if (this != &__str) |
| 2271 | 2267 | { |
| 2272 | 2268 | __copy_assign_alloc(__str); |
| 2273 | assign(__str.data(), __str.size()); | |
| 2269 | return assign(__str.data(), __str.size()); | |
| 2274 | 2270 | } |
| 2275 | 2271 | return *this; |
| 2276 | 2272 | } |
| ... | ... | @@ -2299,10 +2295,20 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr |
| 2299 | 2295 | _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) |
| 2300 | 2296 | #endif |
| 2301 | 2297 | { |
| 2302 | __clear_and_shrink(); | |
| 2303 | __r_.first() = __str.__r_.first(); | |
| 2304 | __move_assign_alloc(__str); | |
| 2305 | __str.__zero(); | |
| 2298 | if (__is_long()) { | |
| 2299 | __alloc_traits::deallocate(__alloc(), __get_long_pointer(), | |
| 2300 | __get_long_cap()); | |
| 2301 | #if _LIBCPP_STD_VER <= 14 | |
| 2302 | if (!is_nothrow_move_assignable<allocator_type>::value) { | |
| 2303 | __set_short_size(0); | |
| 2304 | traits_type::assign(__get_short_pointer()[0], value_type()); | |
| 2305 | } | |
| 2306 | #endif | |
| 2307 | } | |
| 2308 | __move_assign_alloc(__str); | |
| 2309 | __r_.first() = __str.__r_.first(); | |
| 2310 | __str.__set_short_size(0); | |
| 2311 | traits_type::assign(__str.__get_short_pointer()[0], value_type()); | |
| 2306 | 2312 | } |
| 2307 | 2313 | |
| 2308 | 2314 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -2322,7 +2328,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2322 | 2328 | template<class _InputIterator> |
| 2323 | 2329 | typename enable_if |
| 2324 | 2330 | < |
| 2325 | __is_exactly_input_iterator <_InputIterator>::value | |
| 2331 | __is_exactly_cpp17_input_iterator <_InputIterator>::value | |
| 2326 | 2332 | || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, |
| 2327 | 2333 | basic_string<_CharT, _Traits, _Allocator>& |
| 2328 | 2334 | >::type |
| ... | ... | @@ -2337,7 +2343,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2337 | 2343 | template<class _ForwardIterator> |
| 2338 | 2344 | typename enable_if |
| 2339 | 2345 | < |
| 2340 | __is_forward_iterator<_ForwardIterator>::value | |
| 2346 | __is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 2341 | 2347 | && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, |
| 2342 | 2348 | basic_string<_CharT, _Traits, _Allocator>& |
| 2343 | 2349 | >::type |
| ... | ... | @@ -2408,7 +2414,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty |
| 2408 | 2414 | { |
| 2409 | 2415 | if (__n) |
| 2410 | 2416 | { |
| 2411 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2417 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2412 | 2418 | traits_type::copy(__p + __sz, __s, __n); |
| 2413 | 2419 | __sz += __n; |
| 2414 | 2420 | __set_size(__sz); |
| ... | ... | @@ -2431,7 +2437,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) |
| 2431 | 2437 | if (__cap - __sz < __n) |
| 2432 | 2438 | __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); |
| 2433 | 2439 | pointer __p = __get_pointer(); |
| 2434 | traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c); | |
| 2440 | traits_type::assign(_VSTD::__to_address(__p) + __sz, __n, __c); | |
| 2435 | 2441 | __sz += __n; |
| 2436 | 2442 | __set_size(__sz); |
| 2437 | 2443 | traits_type::assign(__p[__sz], value_type()); |
| ... | ... | @@ -2511,7 +2517,7 @@ basic_string<_CharT, _Traits, _Allocator>& |
| 2511 | 2517 | basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe( |
| 2512 | 2518 | _ForwardIterator __first, _ForwardIterator __last) |
| 2513 | 2519 | { |
| 2514 | static_assert(__is_forward_iterator<_ForwardIterator>::value, | |
| 2520 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2515 | 2521 | "function requires a ForwardIterator"); |
| 2516 | 2522 | size_type __sz = size(); |
| 2517 | 2523 | size_type __cap = capacity(); |
| ... | ... | @@ -2596,7 +2602,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t |
| 2596 | 2602 | { |
| 2597 | 2603 | if (__n) |
| 2598 | 2604 | { |
| 2599 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2605 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2600 | 2606 | size_type __n_move = __sz - __pos; |
| 2601 | 2607 | if (__n_move != 0) |
| 2602 | 2608 | { |
| ... | ... | @@ -2628,7 +2634,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n |
| 2628 | 2634 | value_type* __p; |
| 2629 | 2635 | if (__cap - __sz >= __n) |
| 2630 | 2636 | { |
| 2631 | __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2637 | __p = _VSTD::__to_address(__get_pointer()); | |
| 2632 | 2638 | size_type __n_move = __sz - __pos; |
| 2633 | 2639 | if (__n_move != 0) |
| 2634 | 2640 | traits_type::move(__p + __pos + __n, __p + __pos, __n_move); |
| ... | ... | @@ -2636,7 +2642,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n |
| 2636 | 2642 | else |
| 2637 | 2643 | { |
| 2638 | 2644 | __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n); |
| 2639 | __p = _VSTD::__to_raw_pointer(__get_long_pointer()); | |
| 2645 | __p = _VSTD::__to_address(__get_long_pointer()); | |
| 2640 | 2646 | } |
| 2641 | 2647 | traits_type::assign(__p + __pos, __n, __c); |
| 2642 | 2648 | __sz += __n; |
| ... | ... | @@ -2650,7 +2656,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2650 | 2656 | template<class _InputIterator> |
| 2651 | 2657 | typename enable_if |
| 2652 | 2658 | < |
| 2653 | __is_exactly_input_iterator<_InputIterator>::value | |
| 2659 | __is_exactly_cpp17_input_iterator<_InputIterator>::value | |
| 2654 | 2660 | || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, |
| 2655 | 2661 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 2656 | 2662 | >::type |
| ... | ... | @@ -2669,7 +2675,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2669 | 2675 | template<class _ForwardIterator> |
| 2670 | 2676 | typename enable_if |
| 2671 | 2677 | < |
| 2672 | __is_forward_iterator<_ForwardIterator>::value | |
| 2678 | __is_cpp17_forward_iterator<_ForwardIterator>::value | |
| 2673 | 2679 | && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, |
| 2674 | 2680 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 2675 | 2681 | >::type |
| ... | ... | @@ -2697,7 +2703,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward |
| 2697 | 2703 | value_type* __p; |
| 2698 | 2704 | if (__cap - __sz >= __n) |
| 2699 | 2705 | { |
| 2700 | __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2706 | __p = _VSTD::__to_address(__get_pointer()); | |
| 2701 | 2707 | size_type __n_move = __sz - __ip; |
| 2702 | 2708 | if (__n_move != 0) |
| 2703 | 2709 | traits_type::move(__p + __ip + __n, __p + __ip, __n_move); |
| ... | ... | @@ -2705,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward |
| 2705 | 2711 | else |
| 2706 | 2712 | { |
| 2707 | 2713 | __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n); |
| 2708 | __p = _VSTD::__to_raw_pointer(__get_long_pointer()); | |
| 2714 | __p = _VSTD::__to_address(__get_long_pointer()); | |
| 2709 | 2715 | } |
| 2710 | 2716 | __sz += __n; |
| 2711 | 2717 | __set_size(__sz); |
| ... | ... | @@ -2771,11 +2777,11 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty |
| 2771 | 2777 | if (__cap == __sz) |
| 2772 | 2778 | { |
| 2773 | 2779 | __grow_by(__cap, 1, __sz, __ip, 0, 1); |
| 2774 | __p = _VSTD::__to_raw_pointer(__get_long_pointer()); | |
| 2780 | __p = _VSTD::__to_address(__get_long_pointer()); | |
| 2775 | 2781 | } |
| 2776 | 2782 | else |
| 2777 | 2783 | { |
| 2778 | __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2784 | __p = _VSTD::__to_address(__get_pointer()); | |
| 2779 | 2785 | size_type __n_move = __sz - __ip; |
| 2780 | 2786 | if (__n_move != 0) |
| 2781 | 2787 | traits_type::move(__p + __ip + 1, __p + __ip, __n_move); |
| ... | ... | @@ -2816,7 +2822,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 2816 | 2822 | size_type __cap = capacity(); |
| 2817 | 2823 | if (__cap - __sz + __n1 >= __n2) |
| 2818 | 2824 | { |
| 2819 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2825 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2820 | 2826 | if (__n1 != __n2) |
| 2821 | 2827 | { |
| 2822 | 2828 | size_type __n_move = __sz - __pos - __n1; |
| ... | ... | @@ -2871,7 +2877,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 2871 | 2877 | value_type* __p; |
| 2872 | 2878 | if (__cap - __sz + __n1 >= __n2) |
| 2873 | 2879 | { |
| 2874 | __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 2880 | __p = _VSTD::__to_address(__get_pointer()); | |
| 2875 | 2881 | if (__n1 != __n2) |
| 2876 | 2882 | { |
| 2877 | 2883 | size_type __n_move = __sz - __pos - __n1; |
| ... | ... | @@ -2882,7 +2888,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ |
| 2882 | 2888 | else |
| 2883 | 2889 | { |
| 2884 | 2890 | __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2); |
| 2885 | __p = _VSTD::__to_raw_pointer(__get_long_pointer()); | |
| 2891 | __p = _VSTD::__to_address(__get_long_pointer()); | |
| 2886 | 2892 | } |
| 2887 | 2893 | traits_type::assign(__p + __pos, __n2, __c); |
| 2888 | 2894 | __sz += __n2 - __n1; |
| ... | ... | @@ -2896,7 +2902,7 @@ template <class _CharT, class _Traits, class _Allocator> |
| 2896 | 2902 | template<class _InputIterator> |
| 2897 | 2903 | typename enable_if |
| 2898 | 2904 | < |
| 2899 | __is_input_iterator<_InputIterator>::value, | |
| 2905 | __is_cpp17_input_iterator<_InputIterator>::value, | |
| 2900 | 2906 | basic_string<_CharT, _Traits, _Allocator>& |
| 2901 | 2907 | >::type |
| 2902 | 2908 | basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, |
| ... | ... | @@ -2994,7 +3000,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) |
| 2994 | 3000 | this->__throw_out_of_range(); |
| 2995 | 3001 | if (__n) |
| 2996 | 3002 | { |
| 2997 | value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); | |
| 3003 | value_type* __p = _VSTD::__to_address(__get_pointer()); | |
| 2998 | 3004 | __n = _VSTD::min(__n, __sz - __pos); |
| 2999 | 3005 | size_type __n_move = __sz - __pos - __n; |
| 3000 | 3006 | if (__n_move != 0) |
| ... | ... | @@ -3182,8 +3188,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg) |
| 3182 | 3188 | __was_long = __is_long(); |
| 3183 | 3189 | __p = __get_pointer(); |
| 3184 | 3190 | } |
| 3185 | traits_type::copy(_VSTD::__to_raw_pointer(__new_data), | |
| 3186 | _VSTD::__to_raw_pointer(__p), size()+1); | |
| 3191 | traits_type::copy(_VSTD::__to_address(__new_data), | |
| 3192 | _VSTD::__to_address(__p), size()+1); | |
| 3187 | 3193 | if (__was_long) |
| 3188 | 3194 | __alloc_traits::deallocate(__alloc(), __p, __cap+1); |
| 3189 | 3195 | if (__now_long) |
| ... | ... | @@ -4294,23 +4300,23 @@ template<class _CharT, class _Traits, class _Allocator> |
| 4294 | 4300 | bool |
| 4295 | 4301 | basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const |
| 4296 | 4302 | { |
| 4297 | return this->data() <= _VSTD::__to_raw_pointer(__i->base()) && | |
| 4298 | _VSTD::__to_raw_pointer(__i->base()) < this->data() + this->size(); | |
| 4303 | return this->data() <= _VSTD::__to_address(__i->base()) && | |
| 4304 | _VSTD::__to_address(__i->base()) < this->data() + this->size(); | |
| 4299 | 4305 | } |
| 4300 | 4306 | |
| 4301 | 4307 | template<class _CharT, class _Traits, class _Allocator> |
| 4302 | 4308 | bool |
| 4303 | 4309 | basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const |
| 4304 | 4310 | { |
| 4305 | return this->data() < _VSTD::__to_raw_pointer(__i->base()) && | |
| 4306 | _VSTD::__to_raw_pointer(__i->base()) <= this->data() + this->size(); | |
| 4311 | return this->data() < _VSTD::__to_address(__i->base()) && | |
| 4312 | _VSTD::__to_address(__i->base()) <= this->data() + this->size(); | |
| 4307 | 4313 | } |
| 4308 | 4314 | |
| 4309 | 4315 | template<class _CharT, class _Traits, class _Allocator> |
| 4310 | 4316 | bool |
| 4311 | 4317 | basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const |
| 4312 | 4318 | { |
| 4313 | const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n; | |
| 4319 | const value_type* __p = _VSTD::__to_address(__i->base()) + __n; | |
| 4314 | 4320 | return this->data() <= __p && __p <= this->data() + this->size(); |
| 4315 | 4321 | } |
| 4316 | 4322 | |
| ... | ... | @@ -4318,7 +4324,7 @@ template<class _CharT, class _Traits, class _Allocator> |
| 4318 | 4324 | bool |
| 4319 | 4325 | basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const |
| 4320 | 4326 | { |
| 4321 | const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n; | |
| 4327 | const value_type* __p = _VSTD::__to_address(__i->base()) + __n; | |
| 4322 | 4328 | return this->data() <= __p && __p < this->data() + this->size(); |
| 4323 | 4329 | } |
| 4324 | 4330 |
lib/libcxx/include/string_view+8-1| ... | ... | @@ -173,6 +173,7 @@ namespace std { |
| 173 | 173 | |
| 174 | 174 | #include <__config> |
| 175 | 175 | #include <__string> |
| 176 | #include <iosfwd> | |
| 176 | 177 | #include <algorithm> |
| 177 | 178 | #include <iterator> |
| 178 | 179 | #include <limits> |
| ... | ... | @@ -235,7 +236,7 @@ public: |
| 235 | 236 | |
| 236 | 237 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 237 | 238 | basic_string_view(const _CharT* __s) |
| 238 | : __data(__s), __size(_Traits::length(__s)) {} | |
| 239 | : __data(__s), __size(std::__char_traits_length_checked<_Traits>(__s)) {} | |
| 239 | 240 | |
| 240 | 241 | // [string.view.iterators], iterators |
| 241 | 242 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -767,6 +768,12 @@ bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type |
| 767 | 768 | return __lhs.compare(__rhs) >= 0; |
| 768 | 769 | } |
| 769 | 770 | |
| 771 | ||
| 772 | template<class _CharT, class _Traits> | |
| 773 | basic_ostream<_CharT, _Traits>& | |
| 774 | operator<<(basic_ostream<_CharT, _Traits>& __os, | |
| 775 | basic_string_view<_CharT, _Traits> __str); | |
| 776 | ||
| 770 | 777 | typedef basic_string_view<char> string_view; |
| 771 | 778 | #ifndef _LIBCPP_NO_HAS_CHAR8_T |
| 772 | 779 | typedef basic_string_view<char8_t> u8string_view; |
lib/libcxx/include/support/android/locale_bionic.h+2| ... | ... | @@ -27,7 +27,9 @@ extern "C" { |
| 27 | 27 | |
| 28 | 28 | #include <android/api-level.h> |
| 29 | 29 | #include <android/ndk-version.h> |
| 30 | #if __ANDROID_API__ < 21 | |
| 30 | 31 | #include <support/xlocale/__posix_l_fallback.h> |
| 32 | #endif | |
| 31 | 33 | // In NDK versions later than 16, locale-aware functions are provided by |
| 32 | 34 | // legacy_stdlib_inlines.h |
| 33 | 35 | #if __NDK_MAJOR__ <= 16 |
lib/libcxx/include/support/ibm/xlocale.h+3-3| ... | ... | @@ -87,7 +87,7 @@ int isxdigit_l(int c, locale_t locale) |
| 87 | 87 | static inline |
| 88 | 88 | int iswalnum_l(wchar_t wc, locale_t locale) |
| 89 | 89 | { |
| 90 | return __xiswalnum(locale, wc); | |
| 90 | return __xiswalnum(locale, wc); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | static inline |
| ... | ... | @@ -159,7 +159,7 @@ int iswxdigit_l(wchar_t wc, locale_t locale) |
| 159 | 159 | static inline |
| 160 | 160 | int iswctype_l(wint_t wc, wctype_t desc, locale_t locale) |
| 161 | 161 | { |
| 162 | return __xiswctype(locale, wc, desc); | |
| 162 | return __xiswctype(locale, wc, desc); | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | static inline |
| ... | ... | @@ -261,7 +261,7 @@ int vasprintf(char **strp, const char *fmt, va_list ap) |
| 261 | 261 | str_size = vsnprintf(*strp, str_size + 1, fmt, ap); |
| 262 | 262 | } |
| 263 | 263 | return str_size; |
| 264 | } | |
| 264 | } | |
| 265 | 265 | |
| 266 | 266 | #ifdef __cplusplus |
| 267 | 267 | } |
lib/libcxx/include/support/solaris/wchar.h+1-1| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | #define wctype sun_wctype |
| 27 | 27 | #define _WCHAR_T 1 |
| 28 | 28 | #include_next "wchar.h" |
| 29 | #undef iswalpha | |
| 29 | #undef iswalpha | |
| 30 | 30 | #undef iswupper |
| 31 | 31 | #undef iswlower |
| 32 | 32 | #undef iswdigit |
lib/libcxx/include/support/win32/locale_win32.h+71-5| ... | ... | @@ -28,14 +28,72 @@ |
| 28 | 28 | | LC_NUMERIC_MASK \ |
| 29 | 29 | | LC_TIME_MASK ) |
| 30 | 30 | |
| 31 | class __lconv_storage { | |
| 32 | public: | |
| 33 | __lconv_storage(const lconv *__lc_input) { | |
| 34 | __lc = *__lc_input; | |
| 35 | ||
| 36 | __decimal_point = __lc_input->decimal_point; | |
| 37 | __thousands_sep = __lc_input->thousands_sep; | |
| 38 | __grouping = __lc_input->grouping; | |
| 39 | __int_curr_symbol = __lc_input->int_curr_symbol; | |
| 40 | __currency_symbol = __lc_input->currency_symbol; | |
| 41 | __mon_decimal_point = __lc_input->mon_decimal_point; | |
| 42 | __mon_thousands_sep = __lc_input->mon_thousands_sep; | |
| 43 | __mon_grouping = __lc_input->mon_grouping; | |
| 44 | __positive_sign = __lc_input->positive_sign; | |
| 45 | __negative_sign = __lc_input->negative_sign; | |
| 46 | ||
| 47 | __lc.decimal_point = const_cast<char *>(__decimal_point.c_str()); | |
| 48 | __lc.thousands_sep = const_cast<char *>(__thousands_sep.c_str()); | |
| 49 | __lc.grouping = const_cast<char *>(__grouping.c_str()); | |
| 50 | __lc.int_curr_symbol = const_cast<char *>(__int_curr_symbol.c_str()); | |
| 51 | __lc.currency_symbol = const_cast<char *>(__currency_symbol.c_str()); | |
| 52 | __lc.mon_decimal_point = const_cast<char *>(__mon_decimal_point.c_str()); | |
| 53 | __lc.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep.c_str()); | |
| 54 | __lc.mon_grouping = const_cast<char *>(__mon_grouping.c_str()); | |
| 55 | __lc.positive_sign = const_cast<char *>(__positive_sign.c_str()); | |
| 56 | __lc.negative_sign = const_cast<char *>(__negative_sign.c_str()); | |
| 57 | } | |
| 58 | ||
| 59 | lconv *__get() { | |
| 60 | return &__lc; | |
| 61 | } | |
| 62 | private: | |
| 63 | lconv __lc; | |
| 64 | std::string __decimal_point; | |
| 65 | std::string __thousands_sep; | |
| 66 | std::string __grouping; | |
| 67 | std::string __int_curr_symbol; | |
| 68 | std::string __currency_symbol; | |
| 69 | std::string __mon_decimal_point; | |
| 70 | std::string __mon_thousands_sep; | |
| 71 | std::string __mon_grouping; | |
| 72 | std::string __positive_sign; | |
| 73 | std::string __negative_sign; | |
| 74 | }; | |
| 75 | ||
| 31 | 76 | class locale_t { |
| 32 | 77 | public: |
| 33 | 78 | locale_t() |
| 34 | : __locale(nullptr), __locale_str(nullptr) {} | |
| 79 | : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {} | |
| 35 | 80 | locale_t(std::nullptr_t) |
| 36 | : __locale(nullptr), __locale_str(nullptr) {} | |
| 81 | : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {} | |
| 37 | 82 | locale_t(_locale_t __xlocale, const char* __xlocale_str) |
| 38 | : __locale(__xlocale), __locale_str(__xlocale_str) {} | |
| 83 | : __locale(__xlocale), __locale_str(__xlocale_str), __lc(nullptr) {} | |
| 84 | locale_t(const locale_t &__l) | |
| 85 | : __locale(__l.__locale), __locale_str(__l.__locale_str), __lc(nullptr) {} | |
| 86 | ||
| 87 | ~locale_t() { | |
| 88 | delete __lc; | |
| 89 | } | |
| 90 | ||
| 91 | locale_t &operator =(const locale_t &__l) { | |
| 92 | __locale = __l.__locale; | |
| 93 | __locale_str = __l.__locale_str; | |
| 94 | // __lc not copied | |
| 95 | return *this; | |
| 96 | } | |
| 39 | 97 | |
| 40 | 98 | friend bool operator==(const locale_t& __left, const locale_t& __right) { |
| 41 | 99 | return __left.__locale == __right.__locale; |
| ... | ... | @@ -94,9 +152,16 @@ public: |
| 94 | 152 | operator _locale_t() const { |
| 95 | 153 | return __locale; |
| 96 | 154 | } |
| 155 | ||
| 156 | lconv *__store_lconv(const lconv *__input_lc) { | |
| 157 | delete __lc; | |
| 158 | __lc = new __lconv_storage(__input_lc); | |
| 159 | return __lc->__get(); | |
| 160 | } | |
| 97 | 161 | private: |
| 98 | 162 | _locale_t __locale; |
| 99 | 163 | const char* __locale_str; |
| 164 | __lconv_storage *__lc = nullptr; | |
| 100 | 165 | }; |
| 101 | 166 | |
| 102 | 167 | // Locale management functions |
| ... | ... | @@ -109,7 +174,7 @@ locale_t newlocale( int mask, const char * locale, locale_t base ); |
| 109 | 174 | // We can still implement raii even without uselocale though. |
| 110 | 175 | |
| 111 | 176 | |
| 112 | lconv *localeconv_l( locale_t loc ); | |
| 177 | lconv *localeconv_l( locale_t &loc ); | |
| 113 | 178 | size_t mbrlen_l( const char *__restrict s, size_t n, |
| 114 | 179 | mbstate_t *__restrict ps, locale_t loc); |
| 115 | 180 | size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, |
| ... | ... | @@ -173,7 +238,8 @@ isupper_l(int c, _locale_t loc) |
| 173 | 238 | #define towupper_l _towupper_l |
| 174 | 239 | #define towlower_l _towlower_l |
| 175 | 240 | #if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800 |
| 176 | #define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm ) | |
| 241 | _LIBCPP_FUNC_VIS size_t strftime_l(char *ret, size_t n, const char *format, | |
| 242 | const struct tm *tm, locale_t loc); | |
| 177 | 243 | #else |
| 178 | 244 | #define strftime_l _strftime_l |
| 179 | 245 | #endif |
lib/libcxx/include/thread+1-4| ... | ... | @@ -14,8 +14,6 @@ |
| 14 | 14 | |
| 15 | 15 | thread synopsis |
| 16 | 16 | |
| 17 | #define __STDCPP_THREADS__ __cplusplus | |
| 18 | ||
| 19 | 17 | namespace std |
| 20 | 18 | { |
| 21 | 19 | |
| ... | ... | @@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); |
| 107 | 105 | _LIBCPP_PUSH_MACROS |
| 108 | 106 | #include <__undef_macros> |
| 109 | 107 | |
| 110 | #define __STDCPP_THREADS__ __cplusplus | |
| 111 | ||
| 112 | 108 | #ifdef _LIBCPP_HAS_NO_THREADS |
| 113 | 109 | #error <thread> is not supported on this single threaded system |
| 114 | 110 | #else // !_LIBCPP_HAS_NO_THREADS |
| ... | ... | @@ -278,6 +274,7 @@ __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) |
| 278 | 274 | } |
| 279 | 275 | |
| 280 | 276 | template <class _Fp> |
| 277 | _LIBCPP_INLINE_VISIBILITY | |
| 281 | 278 | void* __thread_proxy(void* __vp) |
| 282 | 279 | { |
| 283 | 280 | // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...> |
lib/libcxx/include/tuple+84-45| ... | ... | @@ -19,40 +19,40 @@ namespace std |
| 19 | 19 | template <class... T> |
| 20 | 20 | class tuple { |
| 21 | 21 | public: |
| 22 | constexpr tuple(); | |
| 23 | explicit tuple(const T&...); // constexpr in C++14 | |
| 22 | explicit(see-below) constexpr tuple(); | |
| 23 | explicit(see-below) tuple(const T&...); // constexpr in C++14 | |
| 24 | 24 | template <class... U> |
| 25 | explicit tuple(U&&...); // constexpr in C++14 | |
| 25 | explicit(see-below) tuple(U&&...); // constexpr in C++14 | |
| 26 | 26 | tuple(const tuple&) = default; |
| 27 | 27 | tuple(tuple&&) = default; |
| 28 | 28 | template <class... U> |
| 29 | tuple(const tuple<U...>&); // constexpr in C++14 | |
| 29 | explicit(see-below) tuple(const tuple<U...>&); // constexpr in C++14 | |
| 30 | 30 | template <class... U> |
| 31 | tuple(tuple<U...>&&); // constexpr in C++14 | |
| 31 | explicit(see-below) tuple(tuple<U...>&&); // constexpr in C++14 | |
| 32 | 32 | template <class U1, class U2> |
| 33 | tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14 | |
| 33 | explicit(see-below) tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14 | |
| 34 | 34 | template <class U1, class U2> |
| 35 | tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14 | |
| 35 | explicit(see-below) tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14 | |
| 36 | 36 | |
| 37 | 37 | // allocator-extended constructors |
| 38 | 38 | template <class Alloc> |
| 39 | 39 | tuple(allocator_arg_t, const Alloc& a); |
| 40 | 40 | template <class Alloc> |
| 41 | tuple(allocator_arg_t, const Alloc& a, const T&...); | |
| 41 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...); | |
| 42 | 42 | template <class Alloc, class... U> |
| 43 | tuple(allocator_arg_t, const Alloc& a, U&&...); | |
| 43 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...); | |
| 44 | 44 | template <class Alloc> |
| 45 | 45 | tuple(allocator_arg_t, const Alloc& a, const tuple&); |
| 46 | 46 | template <class Alloc> |
| 47 | 47 | tuple(allocator_arg_t, const Alloc& a, tuple&&); |
| 48 | 48 | template <class Alloc, class... U> |
| 49 | tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&); | |
| 49 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&); | |
| 50 | 50 | template <class Alloc, class... U> |
| 51 | tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&); | |
| 51 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&); | |
| 52 | 52 | template <class Alloc, class U1, class U2> |
| 53 | tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); | |
| 53 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); | |
| 54 | 54 | template <class Alloc, class U1, class U2> |
| 55 | tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&); | |
| 55 | explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&); | |
| 56 | 56 | |
| 57 | 57 | tuple& operator=(const tuple&); |
| 58 | 58 | tuple& |
| ... | ... | @@ -69,6 +69,17 @@ public: |
| 69 | 69 | void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...)); |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | template <class ...T> | |
| 73 | tuple(T...) -> tuple<T...>; // since C++17 | |
| 74 | template <class T1, class T2> | |
| 75 | tuple(pair<T1, T2>) -> tuple<T1, T2>; // since C++17 | |
| 76 | template <class Alloc, class ...T> | |
| 77 | tuple(allocator_arg_t, Alloc, T...) -> tuple<T...>; // since C++17 | |
| 78 | template <class Alloc, class T1, class T2> | |
| 79 | tuple(allocator_arg_t, Alloc, pair<T1, T2>) -> tuple<T1, T2>; // since C++17 | |
| 80 | template <class Alloc, class ...T> | |
| 81 | tuple(allocator_arg_t, Alloc, tuple<T...>) -> tuple<T...>; // since C++17 | |
| 82 | ||
| 72 | 83 | inline constexpr unspecified ignore; |
| 73 | 84 | |
| 74 | 85 | template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14 |
| ... | ... | @@ -488,11 +499,19 @@ class _LIBCPP_TEMPLATE_VIS tuple |
| 488 | 499 | template <class _Dummy> |
| 489 | 500 | struct _CheckArgsConstructor<true, _Dummy> |
| 490 | 501 | { |
| 491 | template <class ..._Args> | |
| 492 | static constexpr bool __enable_default() { | |
| 493 | return __all<is_default_constructible<_Args>::value...>::value; | |
| 502 | template <int&...> | |
| 503 | static constexpr bool __enable_implicit_default() { | |
| 504 | return __all<__is_implicitly_default_constructible<_Tp>::value... >::value; | |
| 505 | } | |
| 506 | ||
| 507 | template <int&...> | |
| 508 | static constexpr bool __enable_explicit_default() { | |
| 509 | return | |
| 510 | __all<is_default_constructible<_Tp>::value...>::value && | |
| 511 | !__enable_implicit_default< >(); | |
| 494 | 512 | } |
| 495 | 513 | |
| 514 | ||
| 496 | 515 | template <class ..._Args> |
| 497 | 516 | static constexpr bool __enable_explicit() { |
| 498 | 517 | return |
| ... | ... | @@ -630,22 +649,26 @@ class _LIBCPP_TEMPLATE_VIS tuple |
| 630 | 649 | const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; |
| 631 | 650 | public: |
| 632 | 651 | |
| 633 | template <bool _Dummy = true, class = typename enable_if< | |
| 634 | _CheckArgsConstructor<_Dummy>::template __enable_default<_Tp...>() | |
| 635 | >::type> | |
| 636 | _LIBCPP_INLINE_VISIBILITY | |
| 637 | _LIBCPP_CONSTEXPR tuple() | |
| 652 | template <bool _Dummy = true, _EnableIf< | |
| 653 | _CheckArgsConstructor<_Dummy>::__enable_implicit_default() | |
| 654 | , void*> = nullptr> | |
| 655 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 656 | tuple() | |
| 657 | _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} | |
| 658 | ||
| 659 | template <bool _Dummy = true, _EnableIf< | |
| 660 | _CheckArgsConstructor<_Dummy>::__enable_explicit_default() | |
| 661 | , void*> = nullptr> | |
| 662 | explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 663 | tuple() | |
| 638 | 664 | _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} |
| 639 | 665 | |
| 640 | 666 | tuple(tuple const&) = default; |
| 641 | 667 | tuple(tuple&&) = default; |
| 642 | 668 | |
| 643 | template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf< | |
| 644 | _And< | |
| 645 | _IsSame<allocator_arg_t, _AllocArgT>, | |
| 646 | __dependent_type<is_default_constructible<_Tp>, _Dummy>... | |
| 647 | >::value | |
| 648 | > | |
| 669 | template <class _AllocArgT, class _Alloc, _EnableIf< | |
| 670 | _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value >::__enable_implicit_default() | |
| 671 | , void*> = nullptr | |
| 649 | 672 | > |
| 650 | 673 | _LIBCPP_INLINE_VISIBILITY |
| 651 | 674 | tuple(_AllocArgT, _Alloc const& __a) |
| ... | ... | @@ -654,6 +677,17 @@ public: |
| 654 | 677 | typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), |
| 655 | 678 | __tuple_types<_Tp...>()) {} |
| 656 | 679 | |
| 680 | template <class _AllocArgT, class _Alloc, _EnableIf< | |
| 681 | _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value>::__enable_explicit_default() | |
| 682 | , void*> = nullptr | |
| 683 | > | |
| 684 | explicit _LIBCPP_INLINE_VISIBILITY | |
| 685 | tuple(_AllocArgT, _Alloc const& __a) | |
| 686 | : __base_(allocator_arg_t(), __a, | |
| 687 | __tuple_indices<>(), __tuple_types<>(), | |
| 688 | typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), | |
| 689 | __tuple_types<_Tp...>()) {} | |
| 690 | ||
| 657 | 691 | template <bool _Dummy = true, |
| 658 | 692 | typename enable_if |
| 659 | 693 | < |
| ... | ... | @@ -943,13 +977,16 @@ public: |
| 943 | 977 | }; |
| 944 | 978 | |
| 945 | 979 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 946 | // NOTE: These are not yet standardized, but are required to simulate the | |
| 947 | // implicit deduction guide that should be generated had libc++ declared the | |
| 948 | // tuple-like constructors "correctly" | |
| 949 | template <class _Alloc, class ..._Args> | |
| 950 | tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>; | |
| 951 | template <class _Alloc, class ..._Args> | |
| 952 | tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>; | |
| 980 | template <class ..._Tp> | |
| 981 | tuple(_Tp...) -> tuple<_Tp...>; | |
| 982 | template <class _Tp1, class _Tp2> | |
| 983 | tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>; | |
| 984 | template <class _Alloc, class ..._Tp> | |
| 985 | tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>; | |
| 986 | template <class _Alloc, class _Tp1, class _Tp2> | |
| 987 | tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>; | |
| 988 | template <class _Alloc, class ..._Tp> | |
| 989 | tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>; | |
| 953 | 990 | #endif |
| 954 | 991 | |
| 955 | 992 | template <class ..._Tp> |
| ... | ... | @@ -1312,8 +1349,9 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J |
| 1312 | 1349 | typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type |
| 1313 | 1350 | operator()(tuple<_Types...> __t, _Tuple0&& __t0) |
| 1314 | 1351 | { |
| 1315 | return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., | |
| 1316 | _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); | |
| 1352 | return _VSTD::forward_as_tuple( | |
| 1353 | _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., | |
| 1354 | _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); | |
| 1317 | 1355 | } |
| 1318 | 1356 | |
| 1319 | 1357 | template <class _Tuple0, class _Tuple1, class ..._Tuples> |
| ... | ... | @@ -1324,15 +1362,16 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J |
| 1324 | 1362 | typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0; |
| 1325 | 1363 | typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1; |
| 1326 | 1364 | return __tuple_cat< |
| 1327 | tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>, | |
| 1328 | typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type, | |
| 1329 | typename __make_tuple_indices<tuple_size<_T1>::value>::type>() | |
| 1330 | (forward_as_tuple( | |
| 1331 | _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., | |
| 1332 | _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))... | |
| 1333 | ), | |
| 1334 | _VSTD::forward<_Tuple1>(__t1), | |
| 1335 | _VSTD::forward<_Tuples>(__tpls)...); | |
| 1365 | tuple<_Types..., | |
| 1366 | typename __apply_cv<_Tuple0, typename tuple_element< | |
| 1367 | _J0, _T0>::type>::type&&...>, | |
| 1368 | typename __make_tuple_indices<sizeof...(_Types) + | |
| 1369 | tuple_size<_T0>::value>::type, | |
| 1370 | typename __make_tuple_indices<tuple_size<_T1>::value>::type>()( | |
| 1371 | _VSTD::forward_as_tuple( | |
| 1372 | _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., | |
| 1373 | _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...), | |
| 1374 | _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...); | |
| 1336 | 1375 | } |
| 1337 | 1376 | }; |
| 1338 | 1377 |
lib/libcxx/include/type_traits+105-89| ... | ... | @@ -427,7 +427,6 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair; |
| 427 | 427 | template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper; |
| 428 | 428 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash; |
| 429 | 429 | |
| 430 | ||
| 431 | 430 | template <class _Tp, _Tp __v> |
| 432 | 431 | struct _LIBCPP_TEMPLATE_VIS integral_constant |
| 433 | 432 | { |
| ... | ... | @@ -509,8 +508,8 @@ struct _Lazy : _Func<_Args...> {}; |
| 509 | 508 | |
| 510 | 509 | // Member detector base |
| 511 | 510 | |
| 512 | template <template <class...> class _Templ, class ..._Args> | |
| 513 | true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >); | |
| 511 | template <template <class...> class _Templ, class ..._Args, class = _Templ<_Args...> > | |
| 512 | true_type __sfinae_test_impl(int); | |
| 514 | 513 | template <template <class...> class, class ...> |
| 515 | 514 | false_type __sfinae_test_impl(...); |
| 516 | 515 | |
| ... | ... | @@ -526,6 +525,7 @@ struct __identity { typedef _Tp type; }; |
| 526 | 525 | template <class _Tp, bool> |
| 527 | 526 | struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; |
| 528 | 527 | |
| 528 | ||
| 529 | 529 | template <bool _Bp, class _If, class _Then> |
| 530 | 530 | struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;}; |
| 531 | 531 | template <class _If, class _Then> |
| ... | ... | @@ -570,6 +570,17 @@ using _IsNotSame = _BoolConstant< |
| 570 | 570 | !_VSTD::is_same<_Tp, _Up>::value |
| 571 | 571 | #endif |
| 572 | 572 | >; |
| 573 | ||
| 574 | ||
| 575 | template <class _Tp> | |
| 576 | using __test_for_primary_template = _EnableIf< | |
| 577 | _IsSame<_Tp, typename _Tp::__primary_template>::value | |
| 578 | >; | |
| 579 | template <class _Tp> | |
| 580 | using __is_primary_template = _IsValidExpansion< | |
| 581 | __test_for_primary_template, _Tp | |
| 582 | >; | |
| 583 | ||
| 573 | 584 | // addressof |
| 574 | 585 | #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF |
| 575 | 586 | |
| ... | ... | @@ -720,7 +731,7 @@ template <class _Tp> |
| 720 | 731 | _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_null_pointer_v |
| 721 | 732 | = is_null_pointer<_Tp>::value; |
| 722 | 733 | #endif |
| 723 | #endif | |
| 734 | #endif // _LIBCPP_STD_VER > 11 | |
| 724 | 735 | |
| 725 | 736 | // is_integral |
| 726 | 737 | |
| ... | ... | @@ -886,28 +897,15 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v |
| 886 | 897 | |
| 887 | 898 | // is_function |
| 888 | 899 | |
| 889 | namespace __libcpp_is_function_imp | |
| 890 | { | |
| 891 | struct __dummy_type {}; | |
| 892 | template <class _Tp> char __test(_Tp*); | |
| 893 | template <class _Tp> char __test(__dummy_type); | |
| 894 | template <class _Tp> __two __test(...); | |
| 895 | template <class _Tp> _Tp& __source(int); | |
| 896 | template <class _Tp> __dummy_type __source(...); | |
| 897 | } | |
| 898 | ||
| 899 | template <class _Tp, bool = is_class<_Tp>::value || | |
| 900 | is_union<_Tp>::value || | |
| 901 | is_void<_Tp>::value || | |
| 902 | is_reference<_Tp>::value || | |
| 903 | __is_nullptr_t<_Tp>::value > | |
| 904 | struct __libcpp_is_function | |
| 905 | : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1> | |
| 906 | {}; | |
| 907 | template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; | |
| 908 | ||
| 909 | 900 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function |
| 910 | : public __libcpp_is_function<_Tp> {}; | |
| 901 | : public _BoolConstant< | |
| 902 | #ifdef __clang__ | |
| 903 | __is_function(_Tp) | |
| 904 | #else | |
| 905 | !(is_reference<_Tp>::value || is_const<const _Tp>::value) | |
| 906 | #endif | |
| 907 | > {}; | |
| 908 | ||
| 911 | 909 | |
| 912 | 910 | #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) |
| 913 | 911 | template <class _Tp> |
| ... | ... | @@ -915,27 +913,24 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_function_v |
| 915 | 913 | = is_function<_Tp>::value; |
| 916 | 914 | #endif |
| 917 | 915 | |
| 918 | // is_member_function_pointer | |
| 919 | ||
| 920 | // template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; | |
| 921 | // template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; | |
| 922 | // | |
| 923 | ||
| 924 | template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> | |
| 925 | struct __member_pointer_traits_imp | |
| 926 | { // forward declaration; specializations later | |
| 916 | template <class _Tp> struct __libcpp_is_member_pointer { | |
| 917 | enum { | |
| 918 | __is_member = false, | |
| 919 | __is_func = false, | |
| 920 | __is_obj = false | |
| 921 | }; | |
| 922 | }; | |
| 923 | template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> { | |
| 924 | enum { | |
| 925 | __is_member = true, | |
| 926 | __is_func = is_function<_Tp>::value, | |
| 927 | __is_obj = !__is_func, | |
| 928 | }; | |
| 927 | 929 | }; |
| 928 | 930 | |
| 929 | 931 | |
| 930 | template <class _Tp> struct __libcpp_is_member_function_pointer | |
| 931 | : public false_type {}; | |
| 932 | ||
| 933 | template <class _Ret, class _Class> | |
| 934 | struct __libcpp_is_member_function_pointer<_Ret _Class::*> | |
| 935 | : public is_function<_Ret> {}; | |
| 936 | ||
| 937 | 932 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer |
| 938 | : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {}; | |
| 933 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; | |
| 939 | 934 | |
| 940 | 935 | #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) |
| 941 | 936 | template <class _Tp> |
| ... | ... | @@ -945,11 +940,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v |
| 945 | 940 | |
| 946 | 941 | // is_member_pointer |
| 947 | 942 | |
| 948 | template <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; | |
| 949 | template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; | |
| 950 | ||
| 951 | 943 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer |
| 952 | : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; | |
| 944 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; | |
| 953 | 945 | |
| 954 | 946 | #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) |
| 955 | 947 | template <class _Tp> |
| ... | ... | @@ -960,8 +952,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v |
| 960 | 952 | // is_member_object_pointer |
| 961 | 953 | |
| 962 | 954 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer |
| 963 | : public integral_constant<bool, is_member_pointer<_Tp>::value && | |
| 964 | !is_member_function_pointer<_Tp>::value> {}; | |
| 955 | : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; | |
| 965 | 956 | |
| 966 | 957 | #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) |
| 967 | 958 | template <class _Tp> |
| ... | ... | @@ -1080,16 +1071,9 @@ struct __is_referenceable : integral_constant<bool, |
| 1080 | 1071 | |
| 1081 | 1072 | // add_const |
| 1082 | 1073 | |
| 1083 | template <class _Tp, bool = is_reference<_Tp>::value || | |
| 1084 | is_function<_Tp>::value || | |
| 1085 | is_const<_Tp>::value > | |
| 1086 | struct __add_const {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; | |
| 1087 | ||
| 1088 | template <class _Tp> | |
| 1089 | struct __add_const<_Tp, false> {typedef _LIBCPP_NODEBUG_TYPE const _Tp type;}; | |
| 1090 | ||
| 1091 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const | |
| 1092 | {typedef _LIBCPP_NODEBUG_TYPE typename __add_const<_Tp>::type type;}; | |
| 1074 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const { | |
| 1075 | typedef _LIBCPP_NODEBUG_TYPE const _Tp type; | |
| 1076 | }; | |
| 1093 | 1077 | |
| 1094 | 1078 | #if _LIBCPP_STD_VER > 11 |
| 1095 | 1079 | template <class _Tp> using add_const_t = typename add_const<_Tp>::type; |
| ... | ... | @@ -1097,25 +1081,18 @@ template <class _Tp> using add_const_t = typename add_const<_Tp>::type; |
| 1097 | 1081 | |
| 1098 | 1082 | // add_volatile |
| 1099 | 1083 | |
| 1100 | template <class _Tp, bool = is_reference<_Tp>::value || | |
| 1101 | is_function<_Tp>::value || | |
| 1102 | is_volatile<_Tp>::value > | |
| 1103 | struct __add_volatile {typedef _Tp type;}; | |
| 1104 | ||
| 1105 | template <class _Tp> | |
| 1106 | struct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; | |
| 1107 | ||
| 1108 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile | |
| 1109 | {typedef _LIBCPP_NODEBUG_TYPE typename __add_volatile<_Tp>::type type;}; | |
| 1084 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile { | |
| 1085 | typedef _LIBCPP_NODEBUG_TYPE volatile _Tp type; | |
| 1086 | }; | |
| 1110 | 1087 | |
| 1111 | 1088 | #if _LIBCPP_STD_VER > 11 |
| 1112 | 1089 | template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; |
| 1113 | 1090 | #endif |
| 1114 | 1091 | |
| 1115 | 1092 | // add_cv |
| 1116 | ||
| 1117 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv | |
| 1118 | {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;}; | |
| 1093 | template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv { | |
| 1094 | typedef _LIBCPP_NODEBUG_TYPE const volatile _Tp type; | |
| 1095 | }; | |
| 1119 | 1096 | |
| 1120 | 1097 | #if _LIBCPP_STD_VER > 11 |
| 1121 | 1098 | template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; |
| ... | ... | @@ -1153,8 +1130,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference |
| 1153 | 1130 | template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; |
| 1154 | 1131 | #endif |
| 1155 | 1132 | |
| 1133 | // Suppress deprecation notice for volatile-qualified return type resulting | |
| 1134 | // from volatile-qualified types _Tp. | |
| 1135 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1156 | 1136 | template <class _Tp> _Tp&& __declval(int); |
| 1157 | 1137 | template <class _Tp> _Tp __declval(long); |
| 1138 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1158 | 1139 | |
| 1159 | 1140 | template <class _Tp> |
| 1160 | 1141 | decltype(_VSTD::__declval<_Tp>(0)) |
| ... | ... | @@ -1448,8 +1429,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v |
| 1448 | 1429 | #if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) |
| 1449 | 1430 | |
| 1450 | 1431 | template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible |
| 1451 | : public integral_constant<bool, __is_convertible_to(_T1, _T2) && | |
| 1452 | !is_abstract<_T2>::value> {}; | |
| 1432 | : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {}; | |
| 1453 | 1433 | |
| 1454 | 1434 | #else // __has_feature(is_convertible_to) |
| 1455 | 1435 | |
| ... | ... | @@ -2307,6 +2287,11 @@ __decay_copy(_Tp&& __t) |
| 2307 | 2287 | return _VSTD::forward<_Tp>(__t); |
| 2308 | 2288 | } |
| 2309 | 2289 | |
| 2290 | template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> | |
| 2291 | struct __member_pointer_traits_imp | |
| 2292 | { | |
| 2293 | }; | |
| 2294 | ||
| 2310 | 2295 | template <class _Rp, class _Class, class ..._Param> |
| 2311 | 2296 | struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> |
| 2312 | 2297 | { |
| ... | ... | @@ -2836,6 +2821,30 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v |
| 2836 | 2821 | = is_default_constructible<_Tp>::value; |
| 2837 | 2822 | #endif |
| 2838 | 2823 | |
| 2824 | #ifndef _LIBCPP_CXX03_LANG | |
| 2825 | // First of all, we can't implement this check in C++03 mode because the {} | |
| 2826 | // default initialization syntax isn't valid. | |
| 2827 | // Second, we implement the trait in a funny manner with two defaulted template | |
| 2828 | // arguments to workaround Clang's PR43454. | |
| 2829 | template <class _Tp> | |
| 2830 | void __test_implicit_default_constructible(_Tp); | |
| 2831 | ||
| 2832 | template <class _Tp, class = void, bool = is_default_constructible<_Tp>::value> | |
| 2833 | struct __is_implicitly_default_constructible | |
| 2834 | : false_type | |
| 2835 | { }; | |
| 2836 | ||
| 2837 | template <class _Tp> | |
| 2838 | struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true> | |
| 2839 | : true_type | |
| 2840 | { }; | |
| 2841 | ||
| 2842 | template <class _Tp> | |
| 2843 | struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false> | |
| 2844 | : false_type | |
| 2845 | { }; | |
| 2846 | #endif // !C++03 | |
| 2847 | ||
| 2839 | 2848 | // is_copy_constructible |
| 2840 | 2849 | |
| 2841 | 2850 | template <class _Tp> |
| ... | ... | @@ -3681,6 +3690,13 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v |
| 3681 | 3690 | template <class _Tp> struct __is_swappable; |
| 3682 | 3691 | template <class _Tp> struct __is_nothrow_swappable; |
| 3683 | 3692 | |
| 3693 | // swap, swap_ranges | |
| 3694 | ||
| 3695 | template <class _ForwardIterator1, class _ForwardIterator2> | |
| 3696 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3697 | _ForwardIterator2 | |
| 3698 | swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2); | |
| 3699 | ||
| 3684 | 3700 | template <class _Tp> |
| 3685 | 3701 | inline _LIBCPP_INLINE_VISIBILITY |
| 3686 | 3702 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -3706,7 +3722,22 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 3706 | 3722 | typename enable_if< |
| 3707 | 3723 | __is_swappable<_Tp>::value |
| 3708 | 3724 | >::type |
| 3709 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); | |
| 3725 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) | |
| 3726 | { | |
| 3727 | _VSTD::swap_ranges(__a, __a + _Np, __b); | |
| 3728 | } | |
| 3729 | ||
| 3730 | template <class _ForwardIterator1, class _ForwardIterator2> | |
| 3731 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3732 | _ForwardIterator2 | |
| 3733 | swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) | |
| 3734 | { | |
| 3735 | for(; __first1 != __last1; ++__first1, (void) ++__first2) | |
| 3736 | swap(*__first1, *__first2); | |
| 3737 | return __first2; | |
| 3738 | } | |
| 3739 | ||
| 3740 | // iter_swap | |
| 3710 | 3741 | |
| 3711 | 3742 | template <class _ForwardIterator1, class _ForwardIterator2> |
| 3712 | 3743 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| ... | ... | @@ -3985,21 +4016,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> |
| 3985 | 4016 | |
| 3986 | 4017 | #endif |
| 3987 | 4018 | |
| 3988 | #if _LIBCPP_STD_VER > 17 | |
| 3989 | enum class endian | |
| 3990 | { | |
| 3991 | little = 0xDEAD, | |
| 3992 | big = 0xFACE, | |
| 3993 | #if defined(_LIBCPP_LITTLE_ENDIAN) | |
| 3994 | native = little | |
| 3995 | #elif defined(_LIBCPP_BIG_ENDIAN) | |
| 3996 | native = big | |
| 3997 | #else | |
| 3998 | native = 0xCAFE | |
| 3999 | #endif | |
| 4000 | }; | |
| 4001 | #endif | |
| 4002 | ||
| 4003 | 4019 | #ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED |
| 4004 | 4020 | #if _LIBCPP_STD_VER > 17 |
| 4005 | 4021 | _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/utility+30-33| ... | ... | @@ -69,11 +69,11 @@ struct pair |
| 69 | 69 | |
| 70 | 70 | pair(const pair&) = default; |
| 71 | 71 | pair(pair&&) = default; |
| 72 | constexpr pair(); | |
| 73 | pair(const T1& x, const T2& y); // constexpr in C++14 | |
| 74 | template <class U, class V> pair(U&& x, V&& y); // constexpr in C++14 | |
| 75 | template <class U, class V> pair(const pair<U, V>& p); // constexpr in C++14 | |
| 76 | template <class U, class V> pair(pair<U, V>&& p); // constexpr in C++14 | |
| 72 | explicit(see-below) constexpr pair(); | |
| 73 | explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14 | |
| 74 | template <class U, class V> explicit(see-below) pair(U&& x, V&& y); // constexpr in C++14 | |
| 75 | template <class U, class V> explicit(see-below) pair(const pair<U, V>& p); // constexpr in C++14 | |
| 76 | template <class U, class V> explicit(see-below) pair(pair<U, V>&& p); // constexpr in C++14 | |
| 77 | 77 | template <class... Args1, class... Args2> |
| 78 | 78 | pair(piecewise_construct_t, tuple<Args1...> first_args, |
| 79 | 79 | tuple<Args2...> second_args); |
| ... | ... | @@ -99,7 +99,7 @@ template <class T1, class T2> |
| 99 | 99 | void |
| 100 | 100 | swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); |
| 101 | 101 | |
| 102 | struct piecewise_construct_t { }; | |
| 102 | struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; | |
| 103 | 103 | inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); |
| 104 | 104 | |
| 105 | 105 | template <class T> struct tuple_size; |
| ... | ... | @@ -248,29 +248,11 @@ operator>=(const _Tp& __x, const _Tp& __y) |
| 248 | 248 | |
| 249 | 249 | } // rel_ops |
| 250 | 250 | |
| 251 | // swap_ranges | |
| 251 | // swap_ranges is defined in <type_traits>` | |
| 252 | 252 | |
| 253 | // swap is defined in <type_traits> | |
| 253 | 254 | |
| 254 | template <class _ForwardIterator1, class _ForwardIterator2> | |
| 255 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 256 | _ForwardIterator2 | |
| 257 | swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) | |
| 258 | { | |
| 259 | for(; __first1 != __last1; ++__first1, (void) ++__first2) | |
| 260 | swap(*__first1, *__first2); | |
| 261 | return __first2; | |
| 262 | } | |
| 263 | ||
| 264 | // forward declared in <type_traits> | |
| 265 | template<class _Tp, size_t _Np> | |
| 266 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 267 | typename enable_if< | |
| 268 | __is_swappable<_Tp>::value | |
| 269 | >::type | |
| 270 | swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) | |
| 271 | { | |
| 272 | _VSTD::swap_ranges(__a, __a + _Np, __b); | |
| 273 | } | |
| 255 | // move_if_noexcept | |
| 274 | 256 | |
| 275 | 257 | template <class _Tp> |
| 276 | 258 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| ... | ... | @@ -294,7 +276,7 @@ template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { r |
| 294 | 276 | template <class _Tp> void as_const(const _Tp&&) = delete; |
| 295 | 277 | #endif |
| 296 | 278 | |
| 297 | struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { }; | |
| 279 | struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; }; | |
| 298 | 280 | #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) |
| 299 | 281 | extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); |
| 300 | 282 | #else |
| ... | ... | @@ -352,10 +334,17 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 352 | 334 | using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type; |
| 353 | 335 | |
| 354 | 336 | struct _CheckArgs { |
| 355 | template <class _U1, class _U2> | |
| 356 | static constexpr bool __enable_default() { | |
| 357 | return is_default_constructible<_U1>::value | |
| 358 | && is_default_constructible<_U2>::value; | |
| 337 | template <int&...> | |
| 338 | static constexpr bool __enable_explicit_default() { | |
| 339 | return is_default_constructible<_T1>::value | |
| 340 | && is_default_constructible<_T2>::value | |
| 341 | && !__enable_implicit_default<>(); | |
| 342 | } | |
| 343 | ||
| 344 | template <int&...> | |
| 345 | static constexpr bool __enable_implicit_default() { | |
| 346 | return __is_implicitly_default_constructible<_T1>::value | |
| 347 | && __is_implicitly_default_constructible<_T2>::value; | |
| 359 | 348 | } |
| 360 | 349 | |
| 361 | 350 | template <class _U1, class _U2> |
| ... | ... | @@ -406,7 +395,15 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 406 | 395 | >::type; |
| 407 | 396 | |
| 408 | 397 | template<bool _Dummy = true, _EnableB< |
| 409 | _CheckArgsDep<_Dummy>::template __enable_default<_T1, _T2>() | |
| 398 | _CheckArgsDep<_Dummy>::__enable_explicit_default() | |
| 399 | > = false> | |
| 400 | explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 401 | pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && | |
| 402 | is_nothrow_default_constructible<second_type>::value) | |
| 403 | : first(), second() {} | |
| 404 | ||
| 405 | template<bool _Dummy = true, _EnableB< | |
| 406 | _CheckArgsDep<_Dummy>::__enable_implicit_default() | |
| 410 | 407 | > = false> |
| 411 | 408 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 412 | 409 | pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && |
lib/libcxx/include/valarray+7-19| ... | ... | @@ -1256,6 +1256,8 @@ public: |
| 1256 | 1256 | _LIBCPP_INLINE_VISIBILITY |
| 1257 | 1257 | operator>>=(const _Expr& __v) const; |
| 1258 | 1258 | |
| 1259 | slice_array(slice_array const&) = default; | |
| 1260 | ||
| 1259 | 1261 | _LIBCPP_INLINE_VISIBILITY |
| 1260 | 1262 | const slice_array& operator=(const slice_array& __sa) const; |
| 1261 | 1263 | |
| ... | ... | @@ -1505,11 +1507,6 @@ public: |
| 1505 | 1507 | |
| 1506 | 1508 | #endif // _LIBCPP_CXX03_LANG |
| 1507 | 1509 | |
| 1508 | // gslice(const gslice&) = default; | |
| 1509 | // gslice(gslice&&) = default; | |
| 1510 | // gslice& operator=(const gslice&) = default; | |
| 1511 | // gslice& operator=(gslice&&) = default; | |
| 1512 | ||
| 1513 | 1510 | _LIBCPP_INLINE_VISIBILITY |
| 1514 | 1511 | size_t start() const {return __1d_.size() ? __1d_[0] : 0;} |
| 1515 | 1512 | |
| ... | ... | @@ -1645,10 +1642,7 @@ public: |
| 1645 | 1642 | _LIBCPP_INLINE_VISIBILITY |
| 1646 | 1643 | void operator=(const value_type& __x) const; |
| 1647 | 1644 | |
| 1648 | // gslice_array(const gslice_array&) = default; | |
| 1649 | // gslice_array(gslice_array&&) = default; | |
| 1650 | // gslice_array& operator=(const gslice_array&) = default; | |
| 1651 | // gslice_array& operator=(gslice_array&&) = default; | |
| 1645 | gslice_array(const gslice_array&) = default; | |
| 1652 | 1646 | |
| 1653 | 1647 | private: |
| 1654 | 1648 | gslice_array(const gslice& __gs, const valarray<value_type>& __v) |
| ... | ... | @@ -1977,17 +1971,14 @@ public: |
| 1977 | 1971 | _LIBCPP_INLINE_VISIBILITY |
| 1978 | 1972 | operator>>=(const _Expr& __v) const; |
| 1979 | 1973 | |
| 1974 | mask_array(const mask_array&) = default; | |
| 1975 | ||
| 1980 | 1976 | _LIBCPP_INLINE_VISIBILITY |
| 1981 | 1977 | const mask_array& operator=(const mask_array& __ma) const; |
| 1982 | 1978 | |
| 1983 | 1979 | _LIBCPP_INLINE_VISIBILITY |
| 1984 | 1980 | void operator=(const value_type& __x) const; |
| 1985 | 1981 | |
| 1986 | // mask_array(const mask_array&) = default; | |
| 1987 | // mask_array(mask_array&&) = default; | |
| 1988 | // mask_array& operator=(const mask_array&) = default; | |
| 1989 | // mask_array& operator=(mask_array&&) = default; | |
| 1990 | ||
| 1991 | 1982 | private: |
| 1992 | 1983 | _LIBCPP_INLINE_VISIBILITY |
| 1993 | 1984 | mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v) |
| ... | ... | @@ -2336,17 +2327,14 @@ public: |
| 2336 | 2327 | _LIBCPP_INLINE_VISIBILITY |
| 2337 | 2328 | operator>>=(const _Expr& __v) const; |
| 2338 | 2329 | |
| 2330 | indirect_array(const indirect_array&) = default; | |
| 2331 | ||
| 2339 | 2332 | _LIBCPP_INLINE_VISIBILITY |
| 2340 | 2333 | const indirect_array& operator=(const indirect_array& __ia) const; |
| 2341 | 2334 | |
| 2342 | 2335 | _LIBCPP_INLINE_VISIBILITY |
| 2343 | 2336 | void operator=(const value_type& __x) const; |
| 2344 | 2337 | |
| 2345 | // indirect_array(const indirect_array&) = default; | |
| 2346 | // indirect_array(indirect_array&&) = default; | |
| 2347 | // indirect_array& operator=(const indirect_array&) = default; | |
| 2348 | // indirect_array& operator=(indirect_array&&) = default; | |
| 2349 | ||
| 2350 | 2338 | private: |
| 2351 | 2339 | _LIBCPP_INLINE_VISIBILITY |
| 2352 | 2340 | indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v) |
lib/libcxx/include/vector+133-163| ... | ... | @@ -297,7 +297,7 @@ _LIBCPP_PUSH_MACROS |
| 297 | 297 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 298 | 298 | |
| 299 | 299 | template <bool> |
| 300 | class __vector_base_common | |
| 300 | class _LIBCPP_TEMPLATE_VIS __vector_base_common | |
| 301 | 301 | { |
| 302 | 302 | protected: |
| 303 | 303 | _LIBCPP_INLINE_VISIBILITY __vector_base_common() {} |
| ... | ... | @@ -423,7 +423,7 @@ __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT |
| 423 | 423 | { |
| 424 | 424 | pointer __soon_to_be_end = __end_; |
| 425 | 425 | while (__new_last != __soon_to_be_end) |
| 426 | __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); | |
| 426 | __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__soon_to_be_end)); | |
| 427 | 427 | __end_ = __new_last; |
| 428 | 428 | } |
| 429 | 429 | |
| ... | ... | @@ -433,7 +433,7 @@ __vector_base<_Tp, _Allocator>::__vector_base() |
| 433 | 433 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 434 | 434 | : __begin_(nullptr), |
| 435 | 435 | __end_(nullptr), |
| 436 | __end_cap_(nullptr) | |
| 436 | __end_cap_(nullptr, __default_init_tag()) | |
| 437 | 437 | { |
| 438 | 438 | } |
| 439 | 439 | |
| ... | ... | @@ -518,29 +518,29 @@ public: |
| 518 | 518 | vector(size_type __n, const value_type& __x, const allocator_type& __a); |
| 519 | 519 | template <class _InputIterator> |
| 520 | 520 | vector(_InputIterator __first, |
| 521 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 522 | !__is_forward_iterator<_InputIterator>::value && | |
| 521 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 522 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 523 | 523 | is_constructible< |
| 524 | 524 | value_type, |
| 525 | 525 | typename iterator_traits<_InputIterator>::reference>::value, |
| 526 | 526 | _InputIterator>::type __last); |
| 527 | 527 | template <class _InputIterator> |
| 528 | 528 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, |
| 529 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 530 | !__is_forward_iterator<_InputIterator>::value && | |
| 529 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 530 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 531 | 531 | is_constructible< |
| 532 | 532 | value_type, |
| 533 | 533 | typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); |
| 534 | 534 | template <class _ForwardIterator> |
| 535 | 535 | vector(_ForwardIterator __first, |
| 536 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value && | |
| 536 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 537 | 537 | is_constructible< |
| 538 | 538 | value_type, |
| 539 | 539 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| 540 | 540 | _ForwardIterator>::type __last); |
| 541 | 541 | template <class _ForwardIterator> |
| 542 | 542 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, |
| 543 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value && | |
| 543 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 544 | 544 | is_constructible< |
| 545 | 545 | value_type, |
| 546 | 546 | typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); |
| ... | ... | @@ -589,8 +589,8 @@ public: |
| 589 | 589 | template <class _InputIterator> |
| 590 | 590 | typename enable_if |
| 591 | 591 | < |
| 592 | __is_input_iterator <_InputIterator>::value && | |
| 593 | !__is_forward_iterator<_InputIterator>::value && | |
| 592 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 593 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 594 | 594 | is_constructible< |
| 595 | 595 | value_type, |
| 596 | 596 | typename iterator_traits<_InputIterator>::reference>::value, |
| ... | ... | @@ -600,7 +600,7 @@ public: |
| 600 | 600 | template <class _ForwardIterator> |
| 601 | 601 | typename enable_if |
| 602 | 602 | < |
| 603 | __is_forward_iterator<_ForwardIterator>::value && | |
| 603 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 604 | 604 | is_constructible< |
| 605 | 605 | value_type, |
| 606 | 606 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| ... | ... | @@ -692,10 +692,10 @@ public: |
| 692 | 692 | |
| 693 | 693 | _LIBCPP_INLINE_VISIBILITY |
| 694 | 694 | value_type* data() _NOEXCEPT |
| 695 | {return _VSTD::__to_raw_pointer(this->__begin_);} | |
| 695 | {return _VSTD::__to_address(this->__begin_);} | |
| 696 | 696 | _LIBCPP_INLINE_VISIBILITY |
| 697 | 697 | const value_type* data() const _NOEXCEPT |
| 698 | {return _VSTD::__to_raw_pointer(this->__begin_);} | |
| 698 | {return _VSTD::__to_address(this->__begin_);} | |
| 699 | 699 | |
| 700 | 700 | #ifdef _LIBCPP_CXX03_LANG |
| 701 | 701 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -737,8 +737,8 @@ public: |
| 737 | 737 | template <class _InputIterator> |
| 738 | 738 | typename enable_if |
| 739 | 739 | < |
| 740 | __is_input_iterator <_InputIterator>::value && | |
| 741 | !__is_forward_iterator<_InputIterator>::value && | |
| 740 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 741 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 742 | 742 | is_constructible< |
| 743 | 743 | value_type, |
| 744 | 744 | typename iterator_traits<_InputIterator>::reference>::value, |
| ... | ... | @@ -748,7 +748,7 @@ public: |
| 748 | 748 | template <class _ForwardIterator> |
| 749 | 749 | typename enable_if |
| 750 | 750 | < |
| 751 | __is_forward_iterator<_ForwardIterator>::value && | |
| 751 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 752 | 752 | is_constructible< |
| 753 | 753 | value_type, |
| 754 | 754 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| ... | ... | @@ -808,7 +808,7 @@ private: |
| 808 | 808 | template <class _ForwardIterator> |
| 809 | 809 | typename enable_if |
| 810 | 810 | < |
| 811 | __is_forward_iterator<_ForwardIterator>::value, | |
| 811 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 812 | 812 | void |
| 813 | 813 | >::type |
| 814 | 814 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); |
| ... | ... | @@ -864,58 +864,67 @@ private: |
| 864 | 864 | #else |
| 865 | 865 | _LIBCPP_INLINE_VISIBILITY |
| 866 | 866 | void __annotate_contiguous_container(const void*, const void*, const void*, |
| 867 | const void*) const {} | |
| 867 | const void*) const _NOEXCEPT {} | |
| 868 | 868 | #endif |
| 869 | 869 | _LIBCPP_INLINE_VISIBILITY |
| 870 | void __annotate_new(size_type __current_size) const { | |
| 870 | void __annotate_new(size_type __current_size) const _NOEXCEPT { | |
| 871 | 871 | __annotate_contiguous_container(data(), data() + capacity(), |
| 872 | 872 | data() + capacity(), data() + __current_size); |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | _LIBCPP_INLINE_VISIBILITY |
| 876 | void __annotate_delete() const { | |
| 876 | void __annotate_delete() const _NOEXCEPT { | |
| 877 | 877 | __annotate_contiguous_container(data(), data() + capacity(), |
| 878 | 878 | data() + size(), data() + capacity()); |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | _LIBCPP_INLINE_VISIBILITY |
| 882 | void __annotate_increase(size_type __n) const | |
| 882 | void __annotate_increase(size_type __n) const _NOEXCEPT | |
| 883 | 883 | { |
| 884 | 884 | __annotate_contiguous_container(data(), data() + capacity(), |
| 885 | 885 | data() + size(), data() + size() + __n); |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | _LIBCPP_INLINE_VISIBILITY |
| 889 | void __annotate_shrink(size_type __old_size) const | |
| 889 | void __annotate_shrink(size_type __old_size) const _NOEXCEPT | |
| 890 | 890 | { |
| 891 | 891 | __annotate_contiguous_container(data(), data() + capacity(), |
| 892 | 892 | data() + __old_size, data() + size()); |
| 893 | 893 | } |
| 894 | ||
| 895 | struct _ConstructTransaction { | |
| 896 | explicit _ConstructTransaction(vector &__v, size_type __n) | |
| 897 | : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) { | |
| 894 | 898 | #ifndef _LIBCPP_HAS_NO_ASAN |
| 895 | // The annotation for size increase should happen before the actual increase, | |
| 896 | // but if an exception is thrown after that the annotation has to be undone. | |
| 897 | struct __RAII_IncreaseAnnotator { | |
| 898 | __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1) | |
| 899 | : __commit(false), __v(__v), __old_size(__v.size() + __n) { | |
| 900 | __v.__annotate_increase(__n); | |
| 901 | } | |
| 902 | void __done() { __commit = true; } | |
| 903 | ~__RAII_IncreaseAnnotator() { | |
| 904 | if (__commit) return; | |
| 905 | __v.__annotate_shrink(__old_size); | |
| 899 | __v_.__annotate_increase(__n); | |
| 900 | #endif | |
| 901 | } | |
| 902 | ~_ConstructTransaction() { | |
| 903 | __v_.__end_ = __pos_; | |
| 904 | #ifndef _LIBCPP_HAS_NO_ASAN | |
| 905 | if (__pos_ != __new_end_) { | |
| 906 | __v_.__annotate_shrink(__new_end_ - __v_.__begin_); | |
| 906 | 907 | } |
| 907 | bool __commit; | |
| 908 | const vector &__v; | |
| 909 | size_type __old_size; | |
| 910 | }; | |
| 911 | #else | |
| 912 | struct __RAII_IncreaseAnnotator { | |
| 913 | _LIBCPP_INLINE_VISIBILITY | |
| 914 | __RAII_IncreaseAnnotator(const vector &, size_type = 1) {} | |
| 915 | _LIBCPP_INLINE_VISIBILITY void __done() {} | |
| 916 | }; | |
| 917 | 908 | #endif |
| 909 | } | |
| 918 | 910 | |
| 911 | vector &__v_; | |
| 912 | pointer __pos_; | |
| 913 | const_pointer const __new_end_; | |
| 914 | ||
| 915 | private: | |
| 916 | _ConstructTransaction(_ConstructTransaction const&) = delete; | |
| 917 | _ConstructTransaction& operator=(_ConstructTransaction const&) = delete; | |
| 918 | }; | |
| 919 | ||
| 920 | template <class ..._Args> | |
| 921 | _LIBCPP_INLINE_VISIBILITY | |
| 922 | void __construct_one_at_end(_Args&& ...__args) { | |
| 923 | _ConstructTransaction __tx(*this, 1); | |
| 924 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), | |
| 925 | _VSTD::forward<_Args>(__args)...); | |
| 926 | ++__tx.__pos_; | |
| 927 | } | |
| 919 | 928 | }; |
| 920 | 929 | |
| 921 | 930 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| ... | ... | @@ -938,8 +947,10 @@ template <class _Tp, class _Allocator> |
| 938 | 947 | void |
| 939 | 948 | vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) |
| 940 | 949 | { |
| 950 | ||
| 941 | 951 | __annotate_delete(); |
| 942 | __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); | |
| 952 | __alloc_traits::__construct_backward_with_exception_guarantees( | |
| 953 | this->__alloc(), this->__begin_, this->__end_, __v.__begin_); | |
| 943 | 954 | _VSTD::swap(this->__begin_, __v.__begin_); |
| 944 | 955 | _VSTD::swap(this->__end_, __v.__end_); |
| 945 | 956 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); |
| ... | ... | @@ -954,8 +965,10 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 954 | 965 | { |
| 955 | 966 | __annotate_delete(); |
| 956 | 967 | pointer __r = __v.__begin_; |
| 957 | __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_); | |
| 958 | __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_); | |
| 968 | __alloc_traits::__construct_backward_with_exception_guarantees( | |
| 969 | this->__alloc(), this->__begin_, __p, __v.__begin_); | |
| 970 | __alloc_traits::__construct_forward_with_exception_guarantees( | |
| 971 | this->__alloc(), __p, this->__end_, __v.__end_); | |
| 959 | 972 | _VSTD::swap(this->__begin_, __v.__begin_); |
| 960 | 973 | _VSTD::swap(this->__end_, __v.__end_); |
| 961 | 974 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); |
| ... | ... | @@ -1027,15 +1040,10 @@ template <class _Tp, class _Allocator> |
| 1027 | 1040 | void |
| 1028 | 1041 | vector<_Tp, _Allocator>::__construct_at_end(size_type __n) |
| 1029 | 1042 | { |
| 1030 | allocator_type& __a = this->__alloc(); | |
| 1031 | do | |
| 1032 | { | |
| 1033 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1034 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); | |
| 1035 | ++this->__end_; | |
| 1036 | --__n; | |
| 1037 | __annotator.__done(); | |
| 1038 | } while (__n > 0); | |
| 1043 | _ConstructTransaction __tx(*this, __n); | |
| 1044 | for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) { | |
| 1045 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_)); | |
| 1046 | } | |
| 1039 | 1047 | } |
| 1040 | 1048 | |
| 1041 | 1049 | // Copy constructs __n objects starting at __end_ from __x |
| ... | ... | @@ -1049,30 +1057,23 @@ inline |
| 1049 | 1057 | void |
| 1050 | 1058 | vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) |
| 1051 | 1059 | { |
| 1052 | allocator_type& __a = this->__alloc(); | |
| 1053 | do | |
| 1054 | { | |
| 1055 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1056 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); | |
| 1057 | ++this->__end_; | |
| 1058 | --__n; | |
| 1059 | __annotator.__done(); | |
| 1060 | } while (__n > 0); | |
| 1060 | _ConstructTransaction __tx(*this, __n); | |
| 1061 | for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) { | |
| 1062 | __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), __x); | |
| 1063 | } | |
| 1061 | 1064 | } |
| 1062 | 1065 | |
| 1063 | 1066 | template <class _Tp, class _Allocator> |
| 1064 | 1067 | template <class _ForwardIterator> |
| 1065 | 1068 | typename enable_if |
| 1066 | 1069 | < |
| 1067 | __is_forward_iterator<_ForwardIterator>::value, | |
| 1070 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 1068 | 1071 | void |
| 1069 | 1072 | >::type |
| 1070 | 1073 | vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n) |
| 1071 | 1074 | { |
| 1072 | allocator_type& __a = this->__alloc(); | |
| 1073 | __RAII_IncreaseAnnotator __annotator(*this, __n); | |
| 1074 | __alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_); | |
| 1075 | __annotator.__done(); | |
| 1075 | _ConstructTransaction __tx(*this, __n); | |
| 1076 | __alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_); | |
| 1076 | 1077 | } |
| 1077 | 1078 | |
| 1078 | 1079 | // Default constructs __n objects starting at __end_ |
| ... | ... | @@ -1172,8 +1173,8 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allo |
| 1172 | 1173 | template <class _Tp, class _Allocator> |
| 1173 | 1174 | template <class _InputIterator> |
| 1174 | 1175 | vector<_Tp, _Allocator>::vector(_InputIterator __first, |
| 1175 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 1176 | !__is_forward_iterator<_InputIterator>::value && | |
| 1176 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 1177 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 1177 | 1178 | is_constructible< |
| 1178 | 1179 | value_type, |
| 1179 | 1180 | typename iterator_traits<_InputIterator>::reference>::value, |
| ... | ... | @@ -1189,8 +1190,8 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, |
| 1189 | 1190 | template <class _Tp, class _Allocator> |
| 1190 | 1191 | template <class _InputIterator> |
| 1191 | 1192 | vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, |
| 1192 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 1193 | !__is_forward_iterator<_InputIterator>::value && | |
| 1193 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 1194 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 1194 | 1195 | is_constructible< |
| 1195 | 1196 | value_type, |
| 1196 | 1197 | typename iterator_traits<_InputIterator>::reference>::value>::type*) |
| ... | ... | @@ -1206,7 +1207,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c |
| 1206 | 1207 | template <class _Tp, class _Allocator> |
| 1207 | 1208 | template <class _ForwardIterator> |
| 1208 | 1209 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, |
| 1209 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value && | |
| 1210 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1210 | 1211 | is_constructible< |
| 1211 | 1212 | value_type, |
| 1212 | 1213 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| ... | ... | @@ -1226,7 +1227,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, |
| 1226 | 1227 | template <class _Tp, class _Allocator> |
| 1227 | 1228 | template <class _ForwardIterator> |
| 1228 | 1229 | vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, |
| 1229 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value && | |
| 1230 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1230 | 1231 | is_constructible< |
| 1231 | 1232 | value_type, |
| 1232 | 1233 | typename iterator_traits<_ForwardIterator>::reference>::value>::type*) |
| ... | ... | @@ -1409,8 +1410,8 @@ template <class _Tp, class _Allocator> |
| 1409 | 1410 | template <class _InputIterator> |
| 1410 | 1411 | typename enable_if |
| 1411 | 1412 | < |
| 1412 | __is_input_iterator <_InputIterator>::value && | |
| 1413 | !__is_forward_iterator<_InputIterator>::value && | |
| 1413 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 1414 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 1414 | 1415 | is_constructible< |
| 1415 | 1416 | _Tp, |
| 1416 | 1417 | typename iterator_traits<_InputIterator>::reference>::value, |
| ... | ... | @@ -1427,7 +1428,7 @@ template <class _Tp, class _Allocator> |
| 1427 | 1428 | template <class _ForwardIterator> |
| 1428 | 1429 | typename enable_if |
| 1429 | 1430 | < |
| 1430 | __is_forward_iterator<_ForwardIterator>::value && | |
| 1431 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1431 | 1432 | is_constructible< |
| 1432 | 1433 | _Tp, |
| 1433 | 1434 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| ... | ... | @@ -1621,7 +1622,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) |
| 1621 | 1622 | allocator_type& __a = this->__alloc(); |
| 1622 | 1623 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); |
| 1623 | 1624 | // __v.push_back(_VSTD::forward<_Up>(__x)); |
| 1624 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x)); | |
| 1625 | __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Up>(__x)); | |
| 1625 | 1626 | __v.__end_++; |
| 1626 | 1627 | __swap_out_circular_buffer(__v); |
| 1627 | 1628 | } |
| ... | ... | @@ -1633,11 +1634,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) |
| 1633 | 1634 | { |
| 1634 | 1635 | if (this->__end_ != this->__end_cap()) |
| 1635 | 1636 | { |
| 1636 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1637 | __alloc_traits::construct(this->__alloc(), | |
| 1638 | _VSTD::__to_raw_pointer(this->__end_), __x); | |
| 1639 | __annotator.__done(); | |
| 1640 | ++this->__end_; | |
| 1637 | __construct_one_at_end(__x); | |
| 1641 | 1638 | } |
| 1642 | 1639 | else |
| 1643 | 1640 | __push_back_slow_path(__x); |
| ... | ... | @@ -1652,12 +1649,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) |
| 1652 | 1649 | { |
| 1653 | 1650 | if (this->__end_ < this->__end_cap()) |
| 1654 | 1651 | { |
| 1655 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1656 | __alloc_traits::construct(this->__alloc(), | |
| 1657 | _VSTD::__to_raw_pointer(this->__end_), | |
| 1658 | _VSTD::move(__x)); | |
| 1659 | __annotator.__done(); | |
| 1660 | ++this->__end_; | |
| 1652 | __construct_one_at_end(_VSTD::move(__x)); | |
| 1661 | 1653 | } |
| 1662 | 1654 | else |
| 1663 | 1655 | __push_back_slow_path(_VSTD::move(__x)); |
| ... | ... | @@ -1671,7 +1663,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) |
| 1671 | 1663 | allocator_type& __a = this->__alloc(); |
| 1672 | 1664 | __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); |
| 1673 | 1665 | // __v.emplace_back(_VSTD::forward<_Args>(__args)...); |
| 1674 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...); | |
| 1666 | __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Args>(__args)...); | |
| 1675 | 1667 | __v.__end_++; |
| 1676 | 1668 | __swap_out_circular_buffer(__v); |
| 1677 | 1669 | } |
| ... | ... | @@ -1688,12 +1680,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 1688 | 1680 | { |
| 1689 | 1681 | if (this->__end_ < this->__end_cap()) |
| 1690 | 1682 | { |
| 1691 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1692 | __alloc_traits::construct(this->__alloc(), | |
| 1693 | _VSTD::__to_raw_pointer(this->__end_), | |
| 1694 | _VSTD::forward<_Args>(__args)...); | |
| 1695 | __annotator.__done(); | |
| 1696 | ++this->__end_; | |
| 1683 | __construct_one_at_end(_VSTD::forward<_Args>(__args)...); | |
| 1697 | 1684 | } |
| 1698 | 1685 | else |
| 1699 | 1686 | __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...); |
| ... | ... | @@ -1761,10 +1748,15 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe |
| 1761 | 1748 | { |
| 1762 | 1749 | pointer __old_last = this->__end_; |
| 1763 | 1750 | difference_type __n = __old_last - __to; |
| 1764 | for (pointer __i = __from_s + __n; __i < __from_e; ++__i, ++this->__end_) | |
| 1765 | __alloc_traits::construct(this->__alloc(), | |
| 1766 | _VSTD::__to_raw_pointer(this->__end_), | |
| 1767 | _VSTD::move(*__i)); | |
| 1751 | { | |
| 1752 | pointer __i = __from_s + __n; | |
| 1753 | _ConstructTransaction __tx(*this, __from_e - __i); | |
| 1754 | for (; __i < __from_e; ++__i, ++__tx.__pos_) { | |
| 1755 | __alloc_traits::construct(this->__alloc(), | |
| 1756 | _VSTD::__to_address(__tx.__pos_), | |
| 1757 | _VSTD::move(*__i)); | |
| 1758 | } | |
| 1759 | } | |
| 1768 | 1760 | _VSTD::move_backward(__from_s, __from_s + __n, __old_last); |
| 1769 | 1761 | } |
| 1770 | 1762 | |
| ... | ... | @@ -1780,12 +1772,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1780 | 1772 | pointer __p = this->__begin_ + (__position - begin()); |
| 1781 | 1773 | if (this->__end_ < this->__end_cap()) |
| 1782 | 1774 | { |
| 1783 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1784 | 1775 | if (__p == this->__end_) |
| 1785 | 1776 | { |
| 1786 | __alloc_traits::construct(this->__alloc(), | |
| 1787 | _VSTD::__to_raw_pointer(this->__end_), __x); | |
| 1788 | ++this->__end_; | |
| 1777 | __construct_one_at_end(__x); | |
| 1789 | 1778 | } |
| 1790 | 1779 | else |
| 1791 | 1780 | { |
| ... | ... | @@ -1795,7 +1784,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1795 | 1784 | ++__xr; |
| 1796 | 1785 | *__p = *__xr; |
| 1797 | 1786 | } |
| 1798 | __annotator.__done(); | |
| 1799 | 1787 | } |
| 1800 | 1788 | else |
| 1801 | 1789 | { |
| ... | ... | @@ -1821,20 +1809,15 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) |
| 1821 | 1809 | pointer __p = this->__begin_ + (__position - begin()); |
| 1822 | 1810 | if (this->__end_ < this->__end_cap()) |
| 1823 | 1811 | { |
| 1824 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1825 | 1812 | if (__p == this->__end_) |
| 1826 | 1813 | { |
| 1827 | __alloc_traits::construct(this->__alloc(), | |
| 1828 | _VSTD::__to_raw_pointer(this->__end_), | |
| 1829 | _VSTD::move(__x)); | |
| 1830 | ++this->__end_; | |
| 1814 | __construct_one_at_end(_VSTD::move(__x)); | |
| 1831 | 1815 | } |
| 1832 | 1816 | else |
| 1833 | 1817 | { |
| 1834 | 1818 | __move_range(__p, this->__end_, __p + 1); |
| 1835 | 1819 | *__p = _VSTD::move(__x); |
| 1836 | 1820 | } |
| 1837 | __annotator.__done(); | |
| 1838 | 1821 | } |
| 1839 | 1822 | else |
| 1840 | 1823 | { |
| ... | ... | @@ -1859,13 +1842,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) |
| 1859 | 1842 | pointer __p = this->__begin_ + (__position - begin()); |
| 1860 | 1843 | if (this->__end_ < this->__end_cap()) |
| 1861 | 1844 | { |
| 1862 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1863 | 1845 | if (__p == this->__end_) |
| 1864 | 1846 | { |
| 1865 | __alloc_traits::construct(this->__alloc(), | |
| 1866 | _VSTD::__to_raw_pointer(this->__end_), | |
| 1867 | _VSTD::forward<_Args>(__args)...); | |
| 1868 | ++this->__end_; | |
| 1847 | __construct_one_at_end(_VSTD::forward<_Args>(__args)...); | |
| 1869 | 1848 | } |
| 1870 | 1849 | else |
| 1871 | 1850 | { |
| ... | ... | @@ -1873,7 +1852,6 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) |
| 1873 | 1852 | __move_range(__p, this->__end_, __p + 1); |
| 1874 | 1853 | *__p = _VSTD::move(__tmp.get()); |
| 1875 | 1854 | } |
| 1876 | __annotator.__done(); | |
| 1877 | 1855 | } |
| 1878 | 1856 | else |
| 1879 | 1857 | { |
| ... | ... | @@ -1911,9 +1889,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_ |
| 1911 | 1889 | } |
| 1912 | 1890 | if (__n > 0) |
| 1913 | 1891 | { |
| 1914 | __RAII_IncreaseAnnotator __annotator(*this, __n); | |
| 1915 | 1892 | __move_range(__p, __old_last, __p + __old_n); |
| 1916 | __annotator.__done(); | |
| 1917 | 1893 | const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); |
| 1918 | 1894 | if (__p <= __xr && __xr < this->__end_) |
| 1919 | 1895 | __xr += __old_n; |
| ... | ... | @@ -1935,8 +1911,8 @@ template <class _Tp, class _Allocator> |
| 1935 | 1911 | template <class _InputIterator> |
| 1936 | 1912 | typename enable_if |
| 1937 | 1913 | < |
| 1938 | __is_input_iterator <_InputIterator>::value && | |
| 1939 | !__is_forward_iterator<_InputIterator>::value && | |
| 1914 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 1915 | !__is_cpp17_forward_iterator<_InputIterator>::value && | |
| 1940 | 1916 | is_constructible< |
| 1941 | 1917 | _Tp, |
| 1942 | 1918 | typename iterator_traits<_InputIterator>::reference>::value, |
| ... | ... | @@ -1955,11 +1931,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs |
| 1955 | 1931 | pointer __old_last = this->__end_; |
| 1956 | 1932 | for (; this->__end_ != this->__end_cap() && __first != __last; ++__first) |
| 1957 | 1933 | { |
| 1958 | __RAII_IncreaseAnnotator __annotator(*this); | |
| 1959 | __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), | |
| 1960 | *__first); | |
| 1961 | ++this->__end_; | |
| 1962 | __annotator.__done(); | |
| 1934 | __construct_one_at_end(*__first); | |
| 1963 | 1935 | } |
| 1964 | 1936 | __split_buffer<value_type, allocator_type&> __v(__a); |
| 1965 | 1937 | if (__first != __last) |
| ... | ... | @@ -1993,7 +1965,7 @@ template <class _Tp, class _Allocator> |
| 1993 | 1965 | template <class _ForwardIterator> |
| 1994 | 1966 | typename enable_if |
| 1995 | 1967 | < |
| 1996 | __is_forward_iterator<_ForwardIterator>::value && | |
| 1968 | __is_cpp17_forward_iterator<_ForwardIterator>::value && | |
| 1997 | 1969 | is_constructible< |
| 1998 | 1970 | _Tp, |
| 1999 | 1971 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| ... | ... | @@ -2026,9 +1998,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi |
| 2026 | 1998 | } |
| 2027 | 1999 | if (__n > 0) |
| 2028 | 2000 | { |
| 2029 | __RAII_IncreaseAnnotator __annotator(*this, __n); | |
| 2030 | 2001 | __move_range(__p, __old_last, __p + __old_n); |
| 2031 | __annotator.__done(); | |
| 2032 | 2002 | _VSTD::copy(__first, __m, __p); |
| 2033 | 2003 | } |
| 2034 | 2004 | } |
| ... | ... | @@ -2261,18 +2231,18 @@ public: |
| 2261 | 2231 | vector(size_type __n, const value_type& __v, const allocator_type& __a); |
| 2262 | 2232 | template <class _InputIterator> |
| 2263 | 2233 | vector(_InputIterator __first, _InputIterator __last, |
| 2264 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 2265 | !__is_forward_iterator<_InputIterator>::value>::type* = 0); | |
| 2234 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 2235 | !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0); | |
| 2266 | 2236 | template <class _InputIterator> |
| 2267 | 2237 | vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, |
| 2268 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 2269 | !__is_forward_iterator<_InputIterator>::value>::type* = 0); | |
| 2238 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 2239 | !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0); | |
| 2270 | 2240 | template <class _ForwardIterator> |
| 2271 | 2241 | vector(_ForwardIterator __first, _ForwardIterator __last, |
| 2272 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); | |
| 2242 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0); | |
| 2273 | 2243 | template <class _ForwardIterator> |
| 2274 | 2244 | vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, |
| 2275 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); | |
| 2245 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0); | |
| 2276 | 2246 | |
| 2277 | 2247 | vector(const vector& __v); |
| 2278 | 2248 | vector(const vector& __v, const allocator_type& __a); |
| ... | ... | @@ -2303,15 +2273,15 @@ public: |
| 2303 | 2273 | template <class _InputIterator> |
| 2304 | 2274 | typename enable_if |
| 2305 | 2275 | < |
| 2306 | __is_input_iterator<_InputIterator>::value && | |
| 2307 | !__is_forward_iterator<_InputIterator>::value, | |
| 2276 | __is_cpp17_input_iterator<_InputIterator>::value && | |
| 2277 | !__is_cpp17_forward_iterator<_InputIterator>::value, | |
| 2308 | 2278 | void |
| 2309 | 2279 | >::type |
| 2310 | 2280 | assign(_InputIterator __first, _InputIterator __last); |
| 2311 | 2281 | template <class _ForwardIterator> |
| 2312 | 2282 | typename enable_if |
| 2313 | 2283 | < |
| 2314 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2284 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2315 | 2285 | void |
| 2316 | 2286 | >::type |
| 2317 | 2287 | assign(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -2419,15 +2389,15 @@ public: |
| 2419 | 2389 | template <class _InputIterator> |
| 2420 | 2390 | typename enable_if |
| 2421 | 2391 | < |
| 2422 | __is_input_iterator <_InputIterator>::value && | |
| 2423 | !__is_forward_iterator<_InputIterator>::value, | |
| 2392 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 2393 | !__is_cpp17_forward_iterator<_InputIterator>::value, | |
| 2424 | 2394 | iterator |
| 2425 | 2395 | >::type |
| 2426 | 2396 | insert(const_iterator __position, _InputIterator __first, _InputIterator __last); |
| 2427 | 2397 | template <class _ForwardIterator> |
| 2428 | 2398 | typename enable_if |
| 2429 | 2399 | < |
| 2430 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2400 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2431 | 2401 | iterator |
| 2432 | 2402 | >::type |
| 2433 | 2403 | insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -2470,7 +2440,7 @@ private: |
| 2470 | 2440 | template <class _ForwardIterator> |
| 2471 | 2441 | typename enable_if |
| 2472 | 2442 | < |
| 2473 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2443 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2474 | 2444 | void |
| 2475 | 2445 | >::type |
| 2476 | 2446 | __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -2629,7 +2599,7 @@ template <class _Allocator> |
| 2629 | 2599 | template <class _ForwardIterator> |
| 2630 | 2600 | typename enable_if |
| 2631 | 2601 | < |
| 2632 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2602 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 2633 | 2603 | void |
| 2634 | 2604 | >::type |
| 2635 | 2605 | vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) |
| ... | ... | @@ -2652,7 +2622,7 @@ vector<bool, _Allocator>::vector() |
| 2652 | 2622 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 2653 | 2623 | : __begin_(nullptr), |
| 2654 | 2624 | __size_(0), |
| 2655 | __cap_alloc_(0) | |
| 2625 | __cap_alloc_(0, __default_init_tag()) | |
| 2656 | 2626 | { |
| 2657 | 2627 | } |
| 2658 | 2628 | |
| ... | ... | @@ -2674,7 +2644,7 @@ template <class _Allocator> |
| 2674 | 2644 | vector<bool, _Allocator>::vector(size_type __n) |
| 2675 | 2645 | : __begin_(nullptr), |
| 2676 | 2646 | __size_(0), |
| 2677 | __cap_alloc_(0) | |
| 2647 | __cap_alloc_(0, __default_init_tag()) | |
| 2678 | 2648 | { |
| 2679 | 2649 | if (__n > 0) |
| 2680 | 2650 | { |
| ... | ... | @@ -2702,7 +2672,7 @@ template <class _Allocator> |
| 2702 | 2672 | vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) |
| 2703 | 2673 | : __begin_(nullptr), |
| 2704 | 2674 | __size_(0), |
| 2705 | __cap_alloc_(0) | |
| 2675 | __cap_alloc_(0, __default_init_tag()) | |
| 2706 | 2676 | { |
| 2707 | 2677 | if (__n > 0) |
| 2708 | 2678 | { |
| ... | ... | @@ -2727,11 +2697,11 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all |
| 2727 | 2697 | template <class _Allocator> |
| 2728 | 2698 | template <class _InputIterator> |
| 2729 | 2699 | vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2730 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 2731 | !__is_forward_iterator<_InputIterator>::value>::type*) | |
| 2700 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 2701 | !__is_cpp17_forward_iterator<_InputIterator>::value>::type*) | |
| 2732 | 2702 | : __begin_(nullptr), |
| 2733 | 2703 | __size_(0), |
| 2734 | __cap_alloc_(0) | |
| 2704 | __cap_alloc_(0, __default_init_tag()) | |
| 2735 | 2705 | { |
| 2736 | 2706 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2737 | 2707 | try |
| ... | ... | @@ -2754,8 +2724,8 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2754 | 2724 | template <class _Allocator> |
| 2755 | 2725 | template <class _InputIterator> |
| 2756 | 2726 | vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, |
| 2757 | typename enable_if<__is_input_iterator <_InputIterator>::value && | |
| 2758 | !__is_forward_iterator<_InputIterator>::value>::type*) | |
| 2727 | typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && | |
| 2728 | !__is_cpp17_forward_iterator<_InputIterator>::value>::type*) | |
| 2759 | 2729 | : __begin_(nullptr), |
| 2760 | 2730 | __size_(0), |
| 2761 | 2731 | __cap_alloc_(0, static_cast<__storage_allocator>(__a)) |
| ... | ... | @@ -2781,10 +2751,10 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, |
| 2781 | 2751 | template <class _Allocator> |
| 2782 | 2752 | template <class _ForwardIterator> |
| 2783 | 2753 | vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, |
| 2784 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) | |
| 2754 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*) | |
| 2785 | 2755 | : __begin_(nullptr), |
| 2786 | 2756 | __size_(0), |
| 2787 | __cap_alloc_(0) | |
| 2757 | __cap_alloc_(0, __default_init_tag()) | |
| 2788 | 2758 | { |
| 2789 | 2759 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); |
| 2790 | 2760 | if (__n > 0) |
| ... | ... | @@ -2797,7 +2767,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la |
| 2797 | 2767 | template <class _Allocator> |
| 2798 | 2768 | template <class _ForwardIterator> |
| 2799 | 2769 | vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, |
| 2800 | typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) | |
| 2770 | typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*) | |
| 2801 | 2771 | : __begin_(nullptr), |
| 2802 | 2772 | __size_(0), |
| 2803 | 2773 | __cap_alloc_(0, static_cast<__storage_allocator>(__a)) |
| ... | ... | @@ -2816,7 +2786,7 @@ template <class _Allocator> |
| 2816 | 2786 | vector<bool, _Allocator>::vector(initializer_list<value_type> __il) |
| 2817 | 2787 | : __begin_(nullptr), |
| 2818 | 2788 | __size_(0), |
| 2819 | __cap_alloc_(0) | |
| 2789 | __cap_alloc_(0, __default_init_tag()) | |
| 2820 | 2790 | { |
| 2821 | 2791 | size_type __n = static_cast<size_type>(__il.size()); |
| 2822 | 2792 | if (__n > 0) |
| ... | ... | @@ -2998,8 +2968,8 @@ template <class _Allocator> |
| 2998 | 2968 | template <class _InputIterator> |
| 2999 | 2969 | typename enable_if |
| 3000 | 2970 | < |
| 3001 | __is_input_iterator<_InputIterator>::value && | |
| 3002 | !__is_forward_iterator<_InputIterator>::value, | |
| 2971 | __is_cpp17_input_iterator<_InputIterator>::value && | |
| 2972 | !__is_cpp17_forward_iterator<_InputIterator>::value, | |
| 3003 | 2973 | void |
| 3004 | 2974 | >::type |
| 3005 | 2975 | vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) |
| ... | ... | @@ -3013,7 +2983,7 @@ template <class _Allocator> |
| 3013 | 2983 | template <class _ForwardIterator> |
| 3014 | 2984 | typename enable_if |
| 3015 | 2985 | < |
| 3016 | __is_forward_iterator<_ForwardIterator>::value, | |
| 2986 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 3017 | 2987 | void |
| 3018 | 2988 | >::type |
| 3019 | 2989 | vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) |
| ... | ... | @@ -3150,8 +3120,8 @@ template <class _Allocator> |
| 3150 | 3120 | template <class _InputIterator> |
| 3151 | 3121 | typename enable_if |
| 3152 | 3122 | < |
| 3153 | __is_input_iterator <_InputIterator>::value && | |
| 3154 | !__is_forward_iterator<_InputIterator>::value, | |
| 3123 | __is_cpp17_input_iterator <_InputIterator>::value && | |
| 3124 | !__is_cpp17_forward_iterator<_InputIterator>::value, | |
| 3155 | 3125 | typename vector<bool, _Allocator>::iterator |
| 3156 | 3126 | >::type |
| 3157 | 3127 | vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) |
| ... | ... | @@ -3195,7 +3165,7 @@ template <class _Allocator> |
| 3195 | 3165 | template <class _ForwardIterator> |
| 3196 | 3166 | typename enable_if |
| 3197 | 3167 | < |
| 3198 | __is_forward_iterator<_ForwardIterator>::value, | |
| 3168 | __is_cpp17_forward_iterator<_ForwardIterator>::value, | |
| 3199 | 3169 | typename vector<bool, _Allocator>::iterator |
| 3200 | 3170 | >::type |
| 3201 | 3171 | vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) |
lib/libcxx/include/version+2| ... | ... | @@ -43,6 +43,7 @@ __cpp_lib_constexpr_misc 201811L <array> <functio |
| 43 | 43 | __cpp_lib_constexpr_swap_algorithms 201806L <algorithm> |
| 44 | 44 | __cpp_lib_destroying_delete 201806L <new> |
| 45 | 45 | __cpp_lib_enable_shared_from_this 201603L <memory> |
| 46 | __cpp_lib_endian 201907L <bit> | |
| 46 | 47 | __cpp_lib_erase_if 201811L <string> <deque> <forward_list> |
| 47 | 48 | <list> <vector> <map> |
| 48 | 49 | <set> <unordered_map> <unordered_set> |
| ... | ... | @@ -223,6 +224,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 223 | 224 | # if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L |
| 224 | 225 | # define __cpp_lib_destroying_delete 201806L |
| 225 | 226 | # endif |
| 227 | # define __cpp_lib_endian 201907L | |
| 226 | 228 | # define __cpp_lib_erase_if 201811L |
| 227 | 229 | // # define __cpp_lib_generic_unordered_lookup 201811L |
| 228 | 230 | # define __cpp_lib_interpolate 201902L |