| author | |
| committer | |
| log | f9a11fbfafa7e056c08350f740af8a96a722a235 |
| tree | b58a3c881bd097f8e52d7a18d8b2c57e9c39791b |
| parent | 1e66ac5755ebe8614b8b3a278eabcfca5f78c3c2 |
llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6106 files changed, 5319 insertions(+), 4724 deletions(-)
lib/libcxx/include/__availability created+206| ... | ... | @@ -0,0 +1,206 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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___AVAILABILITY | |
| 11 | #define _LIBCPP___AVAILABILITY | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | ||
| 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 16 | # pragma GCC system_header | |
| 17 | #endif | |
| 18 | ||
| 19 | // Libc++ is shipped by various vendors. In particular, it is used as a system | |
| 20 | // library on macOS, iOS and other Apple platforms. In order for users to be | |
| 21 | // able to compile a binary that is intended to be deployed to an older version | |
| 22 | // of a platform, Clang provides availability attributes [1]. These attributes | |
| 23 | // can be placed on declarations and are used to describe the life cycle of a | |
| 24 | // symbol in the library. | |
| 25 | // | |
| 26 | // The main goal is to ensure a compile-time error if a symbol that hasn't been | |
| 27 | // introduced in a previously released library is used in a program that targets | |
| 28 | // that previously released library. Normally, this would be a load-time error | |
| 29 | // when one tries to launch the program against the older library. | |
| 30 | // | |
| 31 | // For example, the filesystem library was introduced in the dylib in macOS 10.15. | |
| 32 | // If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their | |
| 33 | // program, the compiler would normally not complain (because the required | |
| 34 | // declarations are in the headers), but the dynamic loader would fail to find | |
| 35 | // the symbols when actually trying to launch the program on macOS 10.13. To | |
| 36 | // turn this into a compile-time issue instead, declarations are annotated with | |
| 37 | // when they were introduced, and the compiler can produce a diagnostic if the | |
| 38 | // program references something that isn't available on the deployment target. | |
| 39 | // | |
| 40 | // This mechanism is general in nature, and any vendor can add their markup to | |
| 41 | // the library (see below). Whenever a new feature is added that requires support | |
| 42 | // in the shared library, a macro should be added below to mark this feature | |
| 43 | // as unavailable. When vendors decide to ship the feature as part of their | |
| 44 | // shared library, they can update the markup appropriately. | |
| 45 | // | |
| 46 | // Note that this mechanism is disabled by default in the "upstream" libc++. | |
| 47 | // Availability annotations are only meaningful when shipping libc++ inside | |
| 48 | // a platform (i.e. as a system library), and so vendors that want them should | |
| 49 | // turn those annotations on at CMake configuration time. | |
| 50 | // | |
| 51 | // [1]: https://clang.llvm.org/docs/AttributeReference.html#availability | |
| 52 | ||
| 53 | ||
| 54 | // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY | |
| 55 | // for a while. | |
| 56 | #if defined(_LIBCPP_DISABLE_AVAILABILITY) | |
| 57 | # if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) | |
| 58 | # define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS | |
| 59 | # endif | |
| 60 | #endif | |
| 61 | ||
| 62 | // Availability markup is disabled when building the library, or when the compiler | |
| 63 | // doesn't support the proper attributes. | |
| 64 | #if defined(_LIBCPP_BUILDING_LIBRARY) || \ | |
| 65 | defined(_LIBCXXABI_BUILDING_LIBRARY) || \ | |
| 66 | !__has_feature(attribute_availability_with_strict) || \ | |
| 67 | !__has_feature(attribute_availability_in_templates) || \ | |
| 68 | !__has_extension(pragma_clang_attribute_external_declaration) | |
| 69 | # if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) | |
| 70 | # define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS | |
| 71 | # endif | |
| 72 | #endif | |
| 73 | ||
| 74 | #if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) | |
| 75 | ||
| 76 | // This controls the availability of std::shared_mutex and std::shared_timed_mutex, | |
| 77 | // which were added to the dylib later. | |
| 78 | # define _LIBCPP_AVAILABILITY_SHARED_MUTEX | |
| 79 | ||
| 80 | // These macros control the availability of std::bad_optional_access and | |
| 81 | // other exception types. These were put in the shared library to prevent | |
| 82 | // code bloat from every user program defining the vtable for these exception | |
| 83 | // types. | |
| 84 | # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 85 | # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS | |
| 86 | # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST | |
| 87 | ||
| 88 | // This controls the availability of std::uncaught_exceptions(). | |
| 89 | # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS | |
| 90 | ||
| 91 | // This controls the availability of the sized version of ::operator delete, | |
| 92 | // which was added to the dylib later. | |
| 93 | # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE | |
| 94 | ||
| 95 | // This controls the availability of the std::future_error exception. | |
| 96 | # define _LIBCPP_AVAILABILITY_FUTURE_ERROR | |
| 97 | ||
| 98 | // This controls the availability of std::type_info's vtable. | |
| 99 | // I can't imagine how using std::type_info can work at all if | |
| 100 | // this isn't supported. | |
| 101 | # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE | |
| 102 | ||
| 103 | // This controls the availability of std::locale::category members | |
| 104 | // (e.g. std::locale::collate), which are defined in the dylib. | |
| 105 | # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY | |
| 106 | ||
| 107 | // This controls the availability of atomic operations on std::shared_ptr | |
| 108 | // (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared | |
| 109 | // lock table located in the dylib. | |
| 110 | # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR | |
| 111 | ||
| 112 | // These macros control the availability of all parts of <filesystem> that | |
| 113 | // depend on something in the dylib. | |
| 114 | # define _LIBCPP_AVAILABILITY_FILESYSTEM | |
| 115 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH | |
| 116 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP | |
| 117 | ||
| 118 | // This controls the availability of std::to_chars. | |
| 119 | # define _LIBCPP_AVAILABILITY_TO_CHARS | |
| 120 | ||
| 121 | // This controls the availability of the C++20 synchronization library, | |
| 122 | // which requires shared library support for various operations | |
| 123 | // (see libcxx/src/atomic.cpp). | |
| 124 | # define _LIBCPP_AVAILABILITY_SYNC | |
| 125 | ||
| 126 | #elif defined(__APPLE__) | |
| 127 | ||
| 128 | # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ | |
| 129 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 130 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 131 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 132 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 133 | # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ | |
| 134 | __attribute__((availability(macosx,strict,introduced=10.13))) \ | |
| 135 | __attribute__((availability(ios,strict,introduced=11.0))) \ | |
| 136 | __attribute__((availability(tvos,strict,introduced=11.0))) \ | |
| 137 | __attribute__((availability(watchos,strict,introduced=4.0))) | |
| 138 | # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \ | |
| 139 | _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 140 | # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ | |
| 141 | _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 142 | # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ | |
| 143 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 144 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 145 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 146 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 147 | # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ | |
| 148 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 149 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 150 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 151 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 152 | # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ | |
| 153 | __attribute__((availability(ios,strict,introduced=6.0))) | |
| 154 | # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ | |
| 155 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 156 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 157 | # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ | |
| 158 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 159 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 160 | # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ | |
| 161 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 162 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 163 | # define _LIBCPP_AVAILABILITY_FILESYSTEM \ | |
| 164 | __attribute__((availability(macosx,strict,introduced=10.15))) \ | |
| 165 | __attribute__((availability(ios,strict,introduced=13.0))) \ | |
| 166 | __attribute__((availability(tvos,strict,introduced=13.0))) \ | |
| 167 | __attribute__((availability(watchos,strict,introduced=6.0))) | |
| 168 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \ | |
| 169 | _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \ | |
| 170 | _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ | |
| 171 | _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ | |
| 172 | _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") | |
| 173 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \ | |
| 174 | _Pragma("clang attribute pop") \ | |
| 175 | _Pragma("clang attribute pop") \ | |
| 176 | _Pragma("clang attribute pop") \ | |
| 177 | _Pragma("clang attribute pop") | |
| 178 | # define _LIBCPP_AVAILABILITY_TO_CHARS \ | |
| 179 | _LIBCPP_AVAILABILITY_FILESYSTEM | |
| 180 | # define _LIBCPP_AVAILABILITY_SYNC \ | |
| 181 | __attribute__((unavailable)) | |
| 182 | ||
| 183 | #else | |
| 184 | ||
| 185 | // ...New vendors can add availability markup here... | |
| 186 | ||
| 187 | # error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!" | |
| 188 | ||
| 189 | #endif | |
| 190 | ||
| 191 | // Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS. | |
| 192 | // Those are defined in terms of the availability attributes above, and | |
| 193 | // should not be vendor-specific. | |
| 194 | #if defined(_LIBCPP_NO_EXCEPTIONS) | |
| 195 | # define _LIBCPP_AVAILABILITY_FUTURE | |
| 196 | # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST | |
| 197 | # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS | |
| 198 | # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS | |
| 199 | #else | |
| 200 | # define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR | |
| 201 | # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST | |
| 202 | # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 203 | # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS | |
| 204 | #endif | |
| 205 | ||
| 206 | #endif // _LIBCPP___AVAILABILITY |
lib/libcxx/include/__config+76-197| ... | ... | @@ -32,13 +32,13 @@ |
| 32 | 32 | # define _GNUC_VER_NEW 0 |
| 33 | 33 | #endif |
| 34 | 34 | |
| 35 | #define _LIBCPP_VERSION 11000 | |
| 35 | #define _LIBCPP_VERSION 12000 | |
| 36 | 36 | |
| 37 | 37 | #ifndef _LIBCPP_ABI_VERSION |
| 38 | 38 | # define _LIBCPP_ABI_VERSION 1 |
| 39 | 39 | #endif |
| 40 | 40 | |
| 41 | #ifndef __STDC_HOSTED__ | |
| 41 | #if __STDC_HOSTED__ == 0 | |
| 42 | 42 | # define _LIBCPP_FREESTANDING |
| 43 | 43 | #endif |
| 44 | 44 | |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | #elif defined(__wasm__) |
| 64 | 64 | # define _LIBCPP_OBJECT_FORMAT_WASM 1 |
| 65 | 65 | #else |
| 66 | # error Unknown object file format | |
| 66 | // ... add new file formats here ... | |
| 67 | 67 | #endif |
| 68 | 68 | |
| 69 | 69 | #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 |
| ... | ... | @@ -105,6 +105,10 @@ |
| 105 | 105 | // Re-worked external template instantiations for std::string with a focus on |
| 106 | 106 | // performance and fast-path inlining. |
| 107 | 107 | # define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION |
| 108 | // Enable clang::trivial_abi on std::unique_ptr. | |
| 109 | # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI | |
| 110 | // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr | |
| 111 | # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI | |
| 108 | 112 | #elif _LIBCPP_ABI_VERSION == 1 |
| 109 | 113 | # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) |
| 110 | 114 | // Enable compiling copies of now inline methods into the dylib to support |
| ... | ... | @@ -121,9 +125,11 @@ |
| 121 | 125 | # endif |
| 122 | 126 | #endif |
| 123 | 127 | |
| 124 | #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR | |
| 125 | #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \ | |
| 126 | use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead | |
| 128 | #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 | |
| 129 | // Enable additional explicit instantiations of iostreams components. This | |
| 130 | // reduces the number of weak definitions generated in programs that use | |
| 131 | // iostreams by providing a single strong definition in the shared library. | |
| 132 | # define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 | |
| 127 | 133 | #endif |
| 128 | 134 | |
| 129 | 135 | #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y |
| ... | ... | @@ -344,13 +350,11 @@ |
| 344 | 350 | # if defined(__FreeBSD__) |
| 345 | 351 | # define _LIBCPP_HAS_ALIGNED_ALLOC |
| 346 | 352 | # define _LIBCPP_HAS_QUICK_EXIT |
| 347 | # define _LIBCPP_HAS_C11_FEATURES | |
| 348 | 353 | # if __FreeBSD_version >= 1300064 || \ |
| 349 | 354 | (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000) |
| 350 | 355 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 351 | 356 | # endif |
| 352 | 357 | # elif defined(__BIONIC__) |
| 353 | # define _LIBCPP_HAS_C11_FEATURES | |
| 354 | 358 | # if __ANDROID_API__ >= 21 |
| 355 | 359 | # define _LIBCPP_HAS_QUICK_EXIT |
| 356 | 360 | # endif |
| ... | ... | @@ -364,7 +368,6 @@ |
| 364 | 368 | # define _LIBCPP_HAS_ALIGNED_ALLOC |
| 365 | 369 | # define _LIBCPP_HAS_QUICK_EXIT |
| 366 | 370 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 367 | # define _LIBCPP_HAS_C11_FEATURES | |
| 368 | 371 | # elif defined(__linux__) |
| 369 | 372 | # if !defined(_LIBCPP_HAS_MUSL_LIBC) |
| 370 | 373 | # if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) |
| ... | ... | @@ -372,16 +375,24 @@ |
| 372 | 375 | # endif |
| 373 | 376 | # if _LIBCPP_GLIBC_PREREQ(2, 17) |
| 374 | 377 | # define _LIBCPP_HAS_ALIGNED_ALLOC |
| 375 | # define _LIBCPP_HAS_C11_FEATURES | |
| 376 | 378 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 377 | 379 | # endif |
| 378 | 380 | # else // defined(_LIBCPP_HAS_MUSL_LIBC) |
| 379 | 381 | # define _LIBCPP_HAS_ALIGNED_ALLOC |
| 380 | 382 | # define _LIBCPP_HAS_QUICK_EXIT |
| 381 | 383 | # define _LIBCPP_HAS_TIMESPEC_GET |
| 382 | # define _LIBCPP_HAS_C11_FEATURES | |
| 383 | 384 | # endif |
| 384 | # endif // __linux__ | |
| 385 | # elif defined(__APPLE__) | |
| 386 | // timespec_get and aligned_alloc were introduced in macOS 10.15 and | |
| 387 | // aligned releases | |
| 388 | # if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \ | |
| 389 | __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \ | |
| 390 | __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \ | |
| 391 | __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000) | |
| 392 | # define _LIBCPP_HAS_ALIGNED_ALLOC | |
| 393 | # define _LIBCPP_HAS_TIMESPEC_GET | |
| 394 | # endif | |
| 395 | # endif // __APPLE__ | |
| 385 | 396 | #endif |
| 386 | 397 | |
| 387 | 398 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -389,9 +400,7 @@ |
| 389 | 400 | #elif defined(_LIBCPP_COMPILER_CLANG) |
| 390 | 401 | # define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) |
| 391 | 402 | #else |
| 392 | // This definition is potentially buggy, but it's only taken with GCC in C++03, | |
| 393 | // which we barely support anyway. See llvm.org/PR39713 | |
| 394 | # define _LIBCPP_ALIGNOF(_Tp) __alignof(_Tp) | |
| 403 | # error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang" | |
| 395 | 404 | #endif |
| 396 | 405 | |
| 397 | 406 | #define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) |
| ... | ... | @@ -433,10 +442,6 @@ typedef __char32_t char32_t; |
| 433 | 442 | # define _LIBCPP_NORETURN __attribute__ ((noreturn)) |
| 434 | 443 | #endif |
| 435 | 444 | |
| 436 | #if !(__has_feature(cxx_lambdas)) | |
| 437 | #define _LIBCPP_HAS_NO_LAMBDAS | |
| 438 | #endif | |
| 439 | ||
| 440 | 445 | #if !(__has_feature(cxx_nullptr)) |
| 441 | 446 | # if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) |
| 442 | 447 | # define nullptr __nullptr |
| ... | ... | @@ -445,18 +450,6 @@ typedef __char32_t char32_t; |
| 445 | 450 | # endif |
| 446 | 451 | #endif |
| 447 | 452 | |
| 448 | #if !(__has_feature(cxx_rvalue_references)) | |
| 449 | #define _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 450 | #endif | |
| 451 | ||
| 452 | #if !(__has_feature(cxx_auto_type)) | |
| 453 | #define _LIBCPP_HAS_NO_AUTO_TYPE | |
| 454 | #endif | |
| 455 | ||
| 456 | #if !(__has_feature(cxx_variadic_templates)) | |
| 457 | #define _LIBCPP_HAS_NO_VARIADICS | |
| 458 | #endif | |
| 459 | ||
| 460 | 453 | // Objective-C++ features (opt-in) |
| 461 | 454 | #if __has_feature(objc_arc) |
| 462 | 455 | #define _LIBCPP_HAS_OBJC_ARC |
| ... | ... | @@ -754,16 +747,6 @@ typedef __char32_t char32_t; |
| 754 | 747 | # endif |
| 755 | 748 | #endif |
| 756 | 749 | |
| 757 | #ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION | |
| 758 | # ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos. | |
| 759 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2 | |
| 760 | # else | |
| 761 | // TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398 | |
| 762 | // And we should consider defaulting to OFF. | |
| 763 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1 | |
| 764 | # endif | |
| 765 | #endif | |
| 766 | ||
| 767 | 750 | #ifndef _LIBCPP_HIDE_FROM_ABI |
| 768 | 751 | # if _LIBCPP_HIDE_FROM_ABI_PER_TU |
| 769 | 752 | # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE |
| ... | ... | @@ -838,6 +821,12 @@ typedef unsigned int char32_t; |
| 838 | 821 | # define _LIBCPP_CONSTEXPR constexpr |
| 839 | 822 | #endif |
| 840 | 823 | |
| 824 | #ifndef __cpp_consteval | |
| 825 | # define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR | |
| 826 | #else | |
| 827 | # define _LIBCPP_CONSTEVAL consteval | |
| 828 | #endif | |
| 829 | ||
| 841 | 830 | #ifdef _LIBCPP_CXX03_LANG |
| 842 | 831 | # define _LIBCPP_DEFAULT {} |
| 843 | 832 | #else |
| ... | ... | @@ -863,10 +852,6 @@ typedef unsigned int char32_t; |
| 863 | 852 | # define _LIBCPP_EXPLICIT |
| 864 | 853 | #endif |
| 865 | 854 | |
| 866 | #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) | |
| 867 | #define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE | |
| 868 | #endif | |
| 869 | ||
| 870 | 855 | #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS |
| 871 | 856 | # define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx |
| 872 | 857 | # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ |
| ... | ... | @@ -880,36 +865,33 @@ typedef unsigned int char32_t; |
| 880 | 865 | # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) |
| 881 | 866 | #endif // _LIBCPP_HAS_NO_STRONG_ENUMS |
| 882 | 867 | |
| 883 | #ifdef _LIBCPP_DEBUG | |
| 884 | # if _LIBCPP_DEBUG == 0 | |
| 885 | # define _LIBCPP_DEBUG_LEVEL 1 | |
| 886 | # elif _LIBCPP_DEBUG == 1 | |
| 887 | # define _LIBCPP_DEBUG_LEVEL 2 | |
| 888 | # else | |
| 889 | # error Supported values for _LIBCPP_DEBUG are 0 and 1 | |
| 890 | # endif | |
| 891 | # if !defined(_LIBCPP_BUILDING_LIBRARY) | |
| 892 | # define _LIBCPP_EXTERN_TEMPLATE(...) | |
| 893 | # endif | |
| 868 | // _LIBCPP_DEBUG potential values: | |
| 869 | // - undefined: No assertions. This is the default. | |
| 870 | // - 0: Basic assertions | |
| 871 | // - 1: Basic assertions + iterator validity checks. | |
| 872 | #if !defined(_LIBCPP_DEBUG) | |
| 873 | # define _LIBCPP_DEBUG_LEVEL 0 | |
| 874 | #elif _LIBCPP_DEBUG == 0 | |
| 875 | # define _LIBCPP_DEBUG_LEVEL 1 | |
| 876 | #elif _LIBCPP_DEBUG == 1 | |
| 877 | # define _LIBCPP_DEBUG_LEVEL 2 | |
| 878 | #else | |
| 879 | # error Supported values for _LIBCPP_DEBUG are 0 and 1 | |
| 894 | 880 | #endif |
| 895 | 881 | |
| 896 | #ifndef _LIBCPP_DEBUG_LEVEL | |
| 897 | # define _LIBCPP_DEBUG_LEVEL 0 | |
| 882 | // _LIBCPP_DEBUG_LEVEL is always defined to one of [0, 1, 2] at this point | |
| 883 | #if _LIBCPP_DEBUG_LEVEL >= 1 | |
| 884 | # define _LIBCPP_DISABLE_EXTERN_TEMPLATE | |
| 898 | 885 | #endif |
| 899 | 886 | |
| 900 | 887 | #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE |
| 901 | 888 | #define _LIBCPP_EXTERN_TEMPLATE(...) |
| 902 | #define _LIBCPP_EXTERN_TEMPLATE2(...) | |
| 903 | 889 | #endif |
| 904 | 890 | |
| 905 | 891 | #ifndef _LIBCPP_EXTERN_TEMPLATE |
| 906 | 892 | #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; |
| 907 | 893 | #endif |
| 908 | 894 | |
| 909 | #ifndef _LIBCPP_EXTERN_TEMPLATE2 | |
| 910 | #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; | |
| 911 | #endif | |
| 912 | ||
| 913 | 895 | #ifndef _LIBCPP_EXTERN_TEMPLATE_DEFINE |
| 914 | 896 | #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__; |
| 915 | 897 | #endif |
| ... | ... | @@ -938,6 +920,8 @@ typedef unsigned int char32_t; |
| 938 | 920 | // We're deferring to Microsoft's STL to provide aligned new et al. We don't |
| 939 | 921 | // have it unless the language feature test macro is defined. |
| 940 | 922 | # define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION |
| 923 | #elif defined(__MVS__) | |
| 924 | # define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION | |
| 941 | 925 | #endif |
| 942 | 926 | |
| 943 | 927 | #if defined(__APPLE__) |
| ... | ... | @@ -999,6 +983,18 @@ typedef unsigned int char32_t; |
| 999 | 983 | # define _LIBCPP_DEPRECATED_IN_CXX17 |
| 1000 | 984 | #endif |
| 1001 | 985 | |
| 986 | #if _LIBCPP_STD_VER > 17 | |
| 987 | # define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED | |
| 988 | #else | |
| 989 | # define _LIBCPP_DEPRECATED_IN_CXX20 | |
| 990 | #endif | |
| 991 | ||
| 992 | #if !defined(_LIBCPP_NO_HAS_CHAR8_T) | |
| 993 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED | |
| 994 | #else | |
| 995 | # define _LIBCPP_DEPRECATED_WITH_CHAR8_T | |
| 996 | #endif | |
| 997 | ||
| 1002 | 998 | // Macros to enter and leave a state where deprecation warnings are suppressed. |
| 1003 | 999 | #if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \ |
| 1004 | 1000 | (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC)) |
| ... | ... | @@ -1037,14 +1033,6 @@ typedef unsigned int char32_t; |
| 1037 | 1033 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 1038 | 1034 | #endif |
| 1039 | 1035 | |
| 1040 | #if _LIBCPP_STD_VER > 17 && \ | |
| 1041 | !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \ | |
| 1042 | !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) | |
| 1043 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr | |
| 1044 | #else | |
| 1045 | # define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1046 | #endif | |
| 1047 | ||
| 1048 | 1036 | // The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other |
| 1049 | 1037 | // NODISCARD macros to the correct attribute. |
| 1050 | 1038 | #if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) |
| ... | ... | @@ -1079,12 +1067,6 @@ typedef unsigned int char32_t; |
| 1079 | 1067 | # define _LIBCPP_INLINE_VAR |
| 1080 | 1068 | #endif |
| 1081 | 1069 | |
| 1082 | #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1083 | # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) | |
| 1084 | #else | |
| 1085 | # define _LIBCPP_EXPLICIT_MOVE(x) (x) | |
| 1086 | #endif | |
| 1087 | ||
| 1088 | 1070 | #ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1089 | 1071 | #if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) |
| 1090 | 1072 | #define _LIBCPP_CONSTEXPR_IF_NODEBUG |
| ... | ... | @@ -1125,11 +1107,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1125 | 1107 | # if defined(__FreeBSD__) || \ |
| 1126 | 1108 | defined(__wasi__) || \ |
| 1127 | 1109 | defined(__NetBSD__) || \ |
| 1110 | defined(__NuttX__) || \ | |
| 1128 | 1111 | defined(__linux__) || \ |
| 1129 | 1112 | defined(__GNU__) || \ |
| 1130 | 1113 | defined(__APPLE__) || \ |
| 1131 | 1114 | defined(__CloudABI__) || \ |
| 1132 | 1115 | defined(__sun__) || \ |
| 1116 | defined(__MVS__) || \ | |
| 1133 | 1117 | (defined(__MINGW32__) && __has_include(<pthread.h>)) |
| 1134 | 1118 | # define _LIBCPP_HAS_THREAD_API_PTHREAD |
| 1135 | 1119 | # elif defined(__Fuchsia__) |
| ... | ... | @@ -1167,10 +1151,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1167 | 1151 | _LIBCPP_HAS_NO_THREADS is defined. |
| 1168 | 1152 | #endif |
| 1169 | 1153 | |
| 1170 | #if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS) | |
| 1171 | #error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set. | |
| 1172 | #endif | |
| 1173 | ||
| 1174 | 1154 | #if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) |
| 1175 | 1155 | #define __STDCPP_THREADS__ 1 |
| 1176 | 1156 | #endif |
| ... | ... | @@ -1227,8 +1207,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1227 | 1207 | # endif |
| 1228 | 1208 | #endif |
| 1229 | 1209 | |
| 1230 | #if defined(__BIONIC__) || defined(__CloudABI__) || \ | |
| 1231 | defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) | |
| 1210 | #if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \ | |
| 1211 | defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \ | |
| 1212 | defined(__MVS__) | |
| 1232 | 1213 | #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE |
| 1233 | 1214 | #endif |
| 1234 | 1215 | |
| ... | ... | @@ -1337,6 +1318,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1337 | 1318 | #endif |
| 1338 | 1319 | #endif // !defined(_LIBCPP_NODEBUG_TYPE) |
| 1339 | 1320 | |
| 1321 | #if __has_attribute(__preferred_name__) | |
| 1322 | #define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) | |
| 1323 | #else | |
| 1324 | #define _LIBCPP_PREFERRED_NAME(x) | |
| 1325 | #endif | |
| 1326 | ||
| 1340 | 1327 | #if defined(_LIBCPP_ABI_MICROSOFT) && \ |
| 1341 | 1328 | (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) |
| 1342 | 1329 | # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) |
| ... | ... | @@ -1367,120 +1354,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1367 | 1354 | #define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR |
| 1368 | 1355 | #endif |
| 1369 | 1356 | |
| 1370 | // Decide whether to use availability macros. | |
| 1371 | #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ | |
| 1372 | !defined(_LIBCXXABI_BUILDING_LIBRARY) && \ | |
| 1373 | !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ | |
| 1374 | __has_feature(attribute_availability_with_strict) && \ | |
| 1375 | __has_feature(attribute_availability_in_templates) && \ | |
| 1376 | __has_extension(pragma_clang_attribute_external_declaration) | |
| 1377 | # ifdef __APPLE__ | |
| 1378 | # define _LIBCPP_USE_AVAILABILITY_APPLE | |
| 1379 | # endif | |
| 1380 | #endif | |
| 1381 | ||
| 1382 | // Define availability macros. | |
| 1383 | #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) | |
| 1384 | # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ | |
| 1385 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 1386 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 1387 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 1388 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 1389 | # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ | |
| 1390 | __attribute__((availability(macosx,strict,introduced=10.13))) \ | |
| 1391 | __attribute__((availability(ios,strict,introduced=11.0))) \ | |
| 1392 | __attribute__((availability(tvos,strict,introduced=11.0))) \ | |
| 1393 | __attribute__((availability(watchos,strict,introduced=4.0))) | |
| 1394 | # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \ | |
| 1395 | _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 1396 | # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ | |
| 1397 | _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 1398 | # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ | |
| 1399 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 1400 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 1401 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 1402 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 1403 | # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ | |
| 1404 | __attribute__((availability(macosx,strict,introduced=10.12))) \ | |
| 1405 | __attribute__((availability(ios,strict,introduced=10.0))) \ | |
| 1406 | __attribute__((availability(tvos,strict,introduced=10.0))) \ | |
| 1407 | __attribute__((availability(watchos,strict,introduced=3.0))) | |
| 1408 | # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ | |
| 1409 | __attribute__((availability(ios,strict,introduced=6.0))) | |
| 1410 | # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ | |
| 1411 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 1412 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 1413 | # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ | |
| 1414 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 1415 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 1416 | # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ | |
| 1417 | __attribute__((availability(macosx,strict,introduced=10.9))) \ | |
| 1418 | __attribute__((availability(ios,strict,introduced=7.0))) | |
| 1419 | # define _LIBCPP_AVAILABILITY_FILESYSTEM \ | |
| 1420 | __attribute__((availability(macosx,strict,introduced=10.15))) \ | |
| 1421 | __attribute__((availability(ios,strict,introduced=13.0))) \ | |
| 1422 | __attribute__((availability(tvos,strict,introduced=13.0))) \ | |
| 1423 | __attribute__((availability(watchos,strict,introduced=6.0))) | |
| 1424 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \ | |
| 1425 | _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \ | |
| 1426 | _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ | |
| 1427 | _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ | |
| 1428 | _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") | |
| 1429 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \ | |
| 1430 | _Pragma("clang attribute pop") \ | |
| 1431 | _Pragma("clang attribute pop") \ | |
| 1432 | _Pragma("clang attribute pop") \ | |
| 1433 | _Pragma("clang attribute pop") | |
| 1434 | # define _LIBCPP_AVAILABILITY_TO_CHARS \ | |
| 1435 | _LIBCPP_AVAILABILITY_FILESYSTEM | |
| 1436 | # define _LIBCPP_AVAILABILITY_SYNC \ | |
| 1437 | __attribute__((unavailable)) | |
| 1438 | #else | |
| 1439 | # define _LIBCPP_AVAILABILITY_SHARED_MUTEX | |
| 1440 | # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS | |
| 1441 | # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 1442 | # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST | |
| 1443 | # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS | |
| 1444 | # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE | |
| 1445 | # define _LIBCPP_AVAILABILITY_FUTURE_ERROR | |
| 1446 | # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE | |
| 1447 | # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY | |
| 1448 | # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR | |
| 1449 | # define _LIBCPP_AVAILABILITY_FILESYSTEM | |
| 1450 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH | |
| 1451 | # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP | |
| 1452 | # define _LIBCPP_AVAILABILITY_TO_CHARS | |
| 1453 | # define _LIBCPP_AVAILABILITY_SYNC | |
| 1454 | #endif | |
| 1455 | ||
| 1456 | // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. | |
| 1457 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1458 | # define _LIBCPP_AVAILABILITY_FUTURE | |
| 1459 | # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST | |
| 1460 | # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS | |
| 1461 | # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS | |
| 1462 | #else | |
| 1463 | # define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR | |
| 1464 | # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST | |
| 1465 | # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS | |
| 1466 | # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS | |
| 1467 | #endif | |
| 1468 | ||
| 1469 | // The stream API was dropped and re-added in the dylib shipped on macOS | |
| 1470 | // and iOS. We can only assume the dylib to provide these definitions for | |
| 1471 | // macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available | |
| 1472 | // from the headers, but not from the dylib. Explicit instantiation | |
| 1473 | // declarations for streams exist conditionally to this; if we provide | |
| 1474 | // an explicit instantiation declaration and we try to deploy to a dylib | |
| 1475 | // that does not provide those symbols, we'll get a load-time error. | |
| 1476 | #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ | |
| 1477 | ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ | |
| 1478 | __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \ | |
| 1479 | (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ | |
| 1480 | __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)) | |
| 1481 | # define _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB | |
| 1482 | #endif | |
| 1483 | ||
| 1484 | 1357 | #if defined(_LIBCPP_COMPILER_IBM) |
| 1485 | 1358 | #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO |
| 1486 | 1359 | #endif |
| ... | ... | @@ -1547,6 +1420,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( |
| 1547 | 1420 | #define _LIBCPP_HAS_NO_FGETPOS_FSETPOS |
| 1548 | 1421 | #endif |
| 1549 | 1422 | |
| 1423 | #if __has_attribute(init_priority) | |
| 1424 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) | |
| 1425 | #else | |
| 1426 | # define _LIBCPP_INIT_PRIORITY_MAX | |
| 1427 | #endif | |
| 1428 | ||
| 1550 | 1429 | #endif // __cplusplus |
| 1551 | 1430 | |
| 1552 | 1431 | #endif // _LIBCPP_CONFIG |
lib/libcxx/include/__config_site.in+3-2| ... | ... | @@ -26,12 +26,13 @@ |
| 26 | 26 | #cmakedefine _LIBCPP_HAS_THREAD_API_WIN32 |
| 27 | 27 | #cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL |
| 28 | 28 | #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS |
| 29 | #cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS | |
| 29 | 30 | #cmakedefine _LIBCPP_NO_VCRUNTIME |
| 30 | #ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION | |
| 31 | 31 | #cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@ |
| 32 | #endif | |
| 33 | 32 | #cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ |
| 34 | 33 | #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS |
| 34 | #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE | |
| 35 | #cmakedefine _LIBCPP_HAS_NO_LOCALIZATION | |
| 35 | 36 | |
| 36 | 37 | @_LIBCPP_ABI_DEFINES@ |
| 37 | 38 |
lib/libcxx/include/__debug+17-22| ... | ... | @@ -27,26 +27,21 @@ |
| 27 | 27 | # include <cstddef> |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | #if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT) | |
| 31 | # define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : \ | |
| 32 | _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) | |
| 33 | #endif | |
| 34 | ||
| 35 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 36 | #ifndef _LIBCPP_DEBUG_ASSERT | |
| 37 | #define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m) | |
| 38 | #endif | |
| 39 | #define _LIBCPP_DEBUG_MODE(...) __VA_ARGS__ | |
| 40 | #endif | |
| 41 | ||
| 42 | #ifndef _LIBCPP_ASSERT | |
| 43 | # define _LIBCPP_ASSERT(x, m) ((void)0) | |
| 44 | #endif | |
| 45 | #ifndef _LIBCPP_DEBUG_ASSERT | |
| 30 | #if _LIBCPP_DEBUG_LEVEL == 0 | |
| 31 | # define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) | |
| 32 | # define _LIBCPP_ASSERT_IMPL(x, m) ((void)0) | |
| 33 | #elif _LIBCPP_DEBUG_LEVEL == 1 | |
| 46 | 34 | # define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) |
| 35 | # define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) | |
| 36 | #elif _LIBCPP_DEBUG_LEVEL == 2 | |
| 37 | # define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m) | |
| 38 | # define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) | |
| 39 | #else | |
| 40 | # error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2 | |
| 47 | 41 | #endif |
| 48 | #ifndef _LIBCPP_DEBUG_MODE | |
| 49 | #define _LIBCPP_DEBUG_MODE(...) ((void)0) | |
| 42 | ||
| 43 | #if !defined(_LIBCPP_ASSERT) | |
| 44 | # define _LIBCPP_ASSERT(x, m) _LIBCPP_ASSERT_IMPL(x, m) | |
| 50 | 45 | #endif |
| 51 | 46 | |
| 52 | 47 | _LIBCPP_BEGIN_NAMESPACE_STD |
| ... | ... | @@ -59,7 +54,7 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info { |
| 59 | 54 | __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m) |
| 60 | 55 | : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {} |
| 61 | 56 | |
| 62 | _LIBCPP_FUNC_VIS std::string what() const; | |
| 57 | _LIBCPP_FUNC_VIS string what() const; | |
| 63 | 58 | |
| 64 | 59 | const char* __file_; |
| 65 | 60 | int __line_; |
| ... | ... | @@ -83,7 +78,7 @@ void __libcpp_abort_debug_function(__libcpp_debug_info const&); |
| 83 | 78 | _LIBCPP_FUNC_VIS |
| 84 | 79 | bool __libcpp_set_debug_function(__libcpp_debug_function_type __func); |
| 85 | 80 | |
| 86 | #if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY) | |
| 81 | #if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) | |
| 87 | 82 | |
| 88 | 83 | struct _LIBCPP_TYPE_VIS __c_node; |
| 89 | 84 | |
| ... | ... | @@ -226,7 +221,7 @@ public: |
| 226 | 221 | |
| 227 | 222 | template <class _Cont> |
| 228 | 223 | _LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) { |
| 229 | return ::new(__mem) _C_node<_Cont>(__c, __next); | |
| 224 | return ::new (__mem) _C_node<_Cont>(__c, __next); | |
| 230 | 225 | } |
| 231 | 226 | |
| 232 | 227 | template <class _Cont> |
| ... | ... | @@ -271,7 +266,7 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db(); |
| 271 | 266 | _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); |
| 272 | 267 | |
| 273 | 268 | |
| 274 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY) | |
| 269 | #endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) | |
| 275 | 270 | |
| 276 | 271 | _LIBCPP_END_NAMESPACE_STD |
| 277 | 272 |
lib/libcxx/include/__functional_03+24-24| ... | ... | @@ -126,7 +126,7 @@ __func<_Fp, _Alloc, _Rp()>::__clone() const |
| 126 | 126 | _Ap __a(__f_.second()); |
| 127 | 127 | typedef __allocator_destructor<_Ap> _Dp; |
| 128 | 128 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 129 | ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 129 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 130 | 130 | return __hold.release(); |
| 131 | 131 | } |
| 132 | 132 | |
| ... | ... | @@ -134,7 +134,7 @@ template<class _Fp, class _Alloc, class _Rp> |
| 134 | 134 | void |
| 135 | 135 | __func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const |
| 136 | 136 | { |
| 137 | ::new (__p) __func(__f_.first(), __f_.second()); | |
| 137 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | template<class _Fp, class _Alloc, class _Rp> |
| ... | ... | @@ -212,7 +212,7 @@ __func<_Fp, _Alloc, _Rp(_A0)>::__clone() const |
| 212 | 212 | _Ap __a(__f_.second()); |
| 213 | 213 | typedef __allocator_destructor<_Ap> _Dp; |
| 214 | 214 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 215 | ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 215 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 216 | 216 | return __hold.release(); |
| 217 | 217 | } |
| 218 | 218 | |
| ... | ... | @@ -220,7 +220,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0> |
| 220 | 220 | void |
| 221 | 221 | __func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const |
| 222 | 222 | { |
| 223 | ::new (__p) __func(__f_.first(), __f_.second()); | |
| 223 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | template<class _Fp, class _Alloc, class _Rp, class _A0> |
| ... | ... | @@ -298,7 +298,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const |
| 298 | 298 | _Ap __a(__f_.second()); |
| 299 | 299 | typedef __allocator_destructor<_Ap> _Dp; |
| 300 | 300 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 301 | ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 301 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 302 | 302 | return __hold.release(); |
| 303 | 303 | } |
| 304 | 304 | |
| ... | ... | @@ -306,7 +306,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> |
| 306 | 306 | void |
| 307 | 307 | __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const |
| 308 | 308 | { |
| 309 | ::new (__p) __func(__f_.first(), __f_.second()); | |
| 309 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1> |
| ... | ... | @@ -384,7 +384,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const |
| 384 | 384 | _Ap __a(__f_.second()); |
| 385 | 385 | typedef __allocator_destructor<_Ap> _Dp; |
| 386 | 386 | unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 387 | ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 387 | ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); | |
| 388 | 388 | return __hold.release(); |
| 389 | 389 | } |
| 390 | 390 | |
| ... | ... | @@ -392,7 +392,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> |
| 392 | 392 | void |
| 393 | 393 | __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const |
| 394 | 394 | { |
| 395 | ::new (__p) __func(__f_.first(), __f_.second()); | |
| 395 | ::new ((void*)__p) __func(__f_.first(), __f_.second()); | |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2> |
| ... | ... | @@ -554,7 +554,7 @@ function<_Rp()>::function(_Fp __f, |
| 554 | 554 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 555 | 555 | { |
| 556 | 556 | __f_ = (__base*)&__buf_; |
| 557 | ::new (__f_) _FF(__f); | |
| 557 | ::new ((void*)__f_) _FF(__f); | |
| 558 | 558 | } |
| 559 | 559 | else |
| 560 | 560 | { |
| ... | ... | @@ -562,7 +562,7 @@ function<_Rp()>::function(_Fp __f, |
| 562 | 562 | _Ap __a; |
| 563 | 563 | typedef __allocator_destructor<_Ap> _Dp; |
| 564 | 564 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 565 | ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 565 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 566 | 566 | __f_ = __hold.release(); |
| 567 | 567 | } |
| 568 | 568 | } |
| ... | ... | @@ -581,7 +581,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 581 | 581 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 582 | 582 | { |
| 583 | 583 | __f_ = (__base*)&__buf_; |
| 584 | ::new (__f_) _FF(__f, __a0); | |
| 584 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 585 | 585 | } |
| 586 | 586 | else |
| 587 | 587 | { |
| ... | ... | @@ -589,7 +589,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 589 | 589 | _Ap __a(__a0); |
| 590 | 590 | typedef __allocator_destructor<_Ap> _Dp; |
| 591 | 591 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 592 | ::new (__hold.get()) _FF(__f, _Alloc(__a)); | |
| 592 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 593 | 593 | __f_ = __hold.release(); |
| 594 | 594 | } |
| 595 | 595 | } |
| ... | ... | @@ -834,7 +834,7 @@ function<_Rp(_A0)>::function(_Fp __f, |
| 834 | 834 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 835 | 835 | { |
| 836 | 836 | __f_ = (__base*)&__buf_; |
| 837 | ::new (__f_) _FF(__f); | |
| 837 | ::new ((void*)__f_) _FF(__f); | |
| 838 | 838 | } |
| 839 | 839 | else |
| 840 | 840 | { |
| ... | ... | @@ -842,7 +842,7 @@ function<_Rp(_A0)>::function(_Fp __f, |
| 842 | 842 | _Ap __a; |
| 843 | 843 | typedef __allocator_destructor<_Ap> _Dp; |
| 844 | 844 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 845 | ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 845 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 846 | 846 | __f_ = __hold.release(); |
| 847 | 847 | } |
| 848 | 848 | } |
| ... | ... | @@ -861,7 +861,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 861 | 861 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 862 | 862 | { |
| 863 | 863 | __f_ = (__base*)&__buf_; |
| 864 | ::new (__f_) _FF(__f, __a0); | |
| 864 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 865 | 865 | } |
| 866 | 866 | else |
| 867 | 867 | { |
| ... | ... | @@ -869,7 +869,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 869 | 869 | _Ap __a(__a0); |
| 870 | 870 | typedef __allocator_destructor<_Ap> _Dp; |
| 871 | 871 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 872 | ::new (__hold.get()) _FF(__f, _Alloc(__a)); | |
| 872 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 873 | 873 | __f_ = __hold.release(); |
| 874 | 874 | } |
| 875 | 875 | } |
| ... | ... | @@ -1114,7 +1114,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f, |
| 1114 | 1114 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1115 | 1115 | { |
| 1116 | 1116 | __f_ = (__base*)&__buf_; |
| 1117 | ::new (__f_) _FF(__f); | |
| 1117 | ::new ((void*)__f_) _FF(__f); | |
| 1118 | 1118 | } |
| 1119 | 1119 | else |
| 1120 | 1120 | { |
| ... | ... | @@ -1122,7 +1122,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f, |
| 1122 | 1122 | _Ap __a; |
| 1123 | 1123 | typedef __allocator_destructor<_Ap> _Dp; |
| 1124 | 1124 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1125 | ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 1125 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 1126 | 1126 | __f_ = __hold.release(); |
| 1127 | 1127 | } |
| 1128 | 1128 | } |
| ... | ... | @@ -1141,7 +1141,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 1141 | 1141 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1142 | 1142 | { |
| 1143 | 1143 | __f_ = (__base*)&__buf_; |
| 1144 | ::new (__f_) _FF(__f, __a0); | |
| 1144 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 1145 | 1145 | } |
| 1146 | 1146 | else |
| 1147 | 1147 | { |
| ... | ... | @@ -1149,7 +1149,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, |
| 1149 | 1149 | _Ap __a(__a0); |
| 1150 | 1150 | typedef __allocator_destructor<_Ap> _Dp; |
| 1151 | 1151 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1152 | ::new (__hold.get()) _FF(__f, _Alloc(__a)); | |
| 1152 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 1153 | 1153 | __f_ = __hold.release(); |
| 1154 | 1154 | } |
| 1155 | 1155 | } |
| ... | ... | @@ -1394,7 +1394,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f, |
| 1394 | 1394 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1395 | 1395 | { |
| 1396 | 1396 | __f_ = (__base*)&__buf_; |
| 1397 | ::new (__f_) _FF(__f); | |
| 1397 | ::new ((void*)__f_) _FF(__f); | |
| 1398 | 1398 | } |
| 1399 | 1399 | else |
| 1400 | 1400 | { |
| ... | ... | @@ -1402,7 +1402,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f, |
| 1402 | 1402 | _Ap __a; |
| 1403 | 1403 | typedef __allocator_destructor<_Ap> _Dp; |
| 1404 | 1404 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1405 | ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 1405 | ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); | |
| 1406 | 1406 | __f_ = __hold.release(); |
| 1407 | 1407 | } |
| 1408 | 1408 | } |
| ... | ... | @@ -1421,7 +1421,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp |
| 1421 | 1421 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1422 | 1422 | { |
| 1423 | 1423 | __f_ = (__base*)&__buf_; |
| 1424 | ::new (__f_) _FF(__f, __a0); | |
| 1424 | ::new ((void*)__f_) _FF(__f, __a0); | |
| 1425 | 1425 | } |
| 1426 | 1426 | else |
| 1427 | 1427 | { |
| ... | ... | @@ -1429,7 +1429,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp |
| 1429 | 1429 | _Ap __a(__a0); |
| 1430 | 1430 | typedef __allocator_destructor<_Ap> _Dp; |
| 1431 | 1431 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1432 | ::new (__hold.get()) _FF(__f, _Alloc(__a)); | |
| 1432 | ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); | |
| 1433 | 1433 | __f_ = __hold.release(); |
| 1434 | 1434 | } |
| 1435 | 1435 | } |
lib/libcxx/include/__functional_base+27-27| ... | ... | @@ -298,7 +298,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> |
| 298 | 298 | template <class _Tp, class ..._Args> |
| 299 | 299 | struct __invoke_return |
| 300 | 300 | { |
| 301 | typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type; | |
| 301 | typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type; | |
| 302 | 302 | }; |
| 303 | 303 | |
| 304 | 304 | #else // defined(_LIBCPP_CXX03_LANG) |
| ... | ... | @@ -314,27 +314,27 @@ struct __invoke_void_return_wrapper |
| 314 | 314 | #ifndef _LIBCPP_CXX03_LANG |
| 315 | 315 | template <class ..._Args> |
| 316 | 316 | static _Ret __call(_Args&&... __args) { |
| 317 | return __invoke(_VSTD::forward<_Args>(__args)...); | |
| 317 | return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); | |
| 318 | 318 | } |
| 319 | 319 | #else |
| 320 | 320 | template <class _Fn> |
| 321 | 321 | static _Ret __call(_Fn __f) { |
| 322 | return __invoke(__f); | |
| 322 | return _VSTD::__invoke(__f); | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | template <class _Fn, class _A0> |
| 326 | 326 | static _Ret __call(_Fn __f, _A0& __a0) { |
| 327 | return __invoke(__f, __a0); | |
| 327 | return _VSTD::__invoke(__f, __a0); | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | template <class _Fn, class _A0, class _A1> |
| 331 | 331 | static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) { |
| 332 | return __invoke(__f, __a0, __a1); | |
| 332 | return _VSTD::__invoke(__f, __a0, __a1); | |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | template <class _Fn, class _A0, class _A1, class _A2> |
| 336 | 336 | static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){ |
| 337 | return __invoke(__f, __a0, __a1, __a2); | |
| 337 | return _VSTD::__invoke(__f, __a0, __a1, __a2); | |
| 338 | 338 | } |
| 339 | 339 | #endif |
| 340 | 340 | }; |
| ... | ... | @@ -345,27 +345,27 @@ struct __invoke_void_return_wrapper<void> |
| 345 | 345 | #ifndef _LIBCPP_CXX03_LANG |
| 346 | 346 | template <class ..._Args> |
| 347 | 347 | static void __call(_Args&&... __args) { |
| 348 | __invoke(_VSTD::forward<_Args>(__args)...); | |
| 348 | _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); | |
| 349 | 349 | } |
| 350 | 350 | #else |
| 351 | 351 | template <class _Fn> |
| 352 | 352 | static void __call(_Fn __f) { |
| 353 | __invoke(__f); | |
| 353 | _VSTD::__invoke(__f); | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | template <class _Fn, class _A0> |
| 357 | 357 | static void __call(_Fn __f, _A0& __a0) { |
| 358 | __invoke(__f, __a0); | |
| 358 | _VSTD::__invoke(__f, __a0); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | template <class _Fn, class _A0, class _A1> |
| 362 | 362 | static void __call(_Fn __f, _A0& __a0, _A1& __a1) { |
| 363 | __invoke(__f, __a0, __a1); | |
| 363 | _VSTD::__invoke(__f, __a0, __a1); | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | template <class _Fn, class _A0, class _A1, class _A2> |
| 367 | 367 | static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) { |
| 368 | __invoke(__f, __a0, __a1, __a2); | |
| 368 | _VSTD::__invoke(__f, __a0, __a1, __a2); | |
| 369 | 369 | } |
| 370 | 370 | #endif |
| 371 | 371 | }; |
| ... | ... | @@ -398,112 +398,112 @@ public: |
| 398 | 398 | _LIBCPP_INLINE_VISIBILITY |
| 399 | 399 | typename __invoke_of<type&, _ArgTypes...>::type |
| 400 | 400 | operator() (_ArgTypes&&... __args) const { |
| 401 | return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); | |
| 401 | return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); | |
| 402 | 402 | } |
| 403 | 403 | #else |
| 404 | 404 | |
| 405 | 405 | _LIBCPP_INLINE_VISIBILITY |
| 406 | 406 | typename __invoke_return<type>::type |
| 407 | 407 | operator() () const { |
| 408 | return __invoke(get()); | |
| 408 | return _VSTD::__invoke(get()); | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | template <class _A0> |
| 412 | 412 | _LIBCPP_INLINE_VISIBILITY |
| 413 | 413 | typename __invoke_return0<type, _A0>::type |
| 414 | 414 | operator() (_A0& __a0) const { |
| 415 | return __invoke(get(), __a0); | |
| 415 | return _VSTD::__invoke(get(), __a0); | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | template <class _A0> |
| 419 | 419 | _LIBCPP_INLINE_VISIBILITY |
| 420 | 420 | typename __invoke_return0<type, _A0 const>::type |
| 421 | 421 | operator() (_A0 const& __a0) const { |
| 422 | return __invoke(get(), __a0); | |
| 422 | return _VSTD::__invoke(get(), __a0); | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | template <class _A0, class _A1> |
| 426 | 426 | _LIBCPP_INLINE_VISIBILITY |
| 427 | 427 | typename __invoke_return1<type, _A0, _A1>::type |
| 428 | 428 | operator() (_A0& __a0, _A1& __a1) const { |
| 429 | return __invoke(get(), __a0, __a1); | |
| 429 | return _VSTD::__invoke(get(), __a0, __a1); | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | template <class _A0, class _A1> |
| 433 | 433 | _LIBCPP_INLINE_VISIBILITY |
| 434 | 434 | typename __invoke_return1<type, _A0 const, _A1>::type |
| 435 | 435 | operator() (_A0 const& __a0, _A1& __a1) const { |
| 436 | return __invoke(get(), __a0, __a1); | |
| 436 | return _VSTD::__invoke(get(), __a0, __a1); | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | template <class _A0, class _A1> |
| 440 | 440 | _LIBCPP_INLINE_VISIBILITY |
| 441 | 441 | typename __invoke_return1<type, _A0, _A1 const>::type |
| 442 | 442 | operator() (_A0& __a0, _A1 const& __a1) const { |
| 443 | return __invoke(get(), __a0, __a1); | |
| 443 | return _VSTD::__invoke(get(), __a0, __a1); | |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | template <class _A0, class _A1> |
| 447 | 447 | _LIBCPP_INLINE_VISIBILITY |
| 448 | 448 | typename __invoke_return1<type, _A0 const, _A1 const>::type |
| 449 | 449 | operator() (_A0 const& __a0, _A1 const& __a1) const { |
| 450 | return __invoke(get(), __a0, __a1); | |
| 450 | return _VSTD::__invoke(get(), __a0, __a1); | |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | template <class _A0, class _A1, class _A2> |
| 454 | 454 | _LIBCPP_INLINE_VISIBILITY |
| 455 | 455 | typename __invoke_return2<type, _A0, _A1, _A2>::type |
| 456 | 456 | operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { |
| 457 | return __invoke(get(), __a0, __a1, __a2); | |
| 457 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | template <class _A0, class _A1, class _A2> |
| 461 | 461 | _LIBCPP_INLINE_VISIBILITY |
| 462 | 462 | typename __invoke_return2<type, _A0 const, _A1, _A2>::type |
| 463 | 463 | operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { |
| 464 | return __invoke(get(), __a0, __a1, __a2); | |
| 464 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | template <class _A0, class _A1, class _A2> |
| 468 | 468 | _LIBCPP_INLINE_VISIBILITY |
| 469 | 469 | typename __invoke_return2<type, _A0, _A1 const, _A2>::type |
| 470 | 470 | operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { |
| 471 | return __invoke(get(), __a0, __a1, __a2); | |
| 471 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | template <class _A0, class _A1, class _A2> |
| 475 | 475 | _LIBCPP_INLINE_VISIBILITY |
| 476 | 476 | typename __invoke_return2<type, _A0, _A1, _A2 const>::type |
| 477 | 477 | operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { |
| 478 | return __invoke(get(), __a0, __a1, __a2); | |
| 478 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | template <class _A0, class _A1, class _A2> |
| 482 | 482 | _LIBCPP_INLINE_VISIBILITY |
| 483 | 483 | typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type |
| 484 | 484 | operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { |
| 485 | return __invoke(get(), __a0, __a1, __a2); | |
| 485 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | template <class _A0, class _A1, class _A2> |
| 489 | 489 | _LIBCPP_INLINE_VISIBILITY |
| 490 | 490 | typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type |
| 491 | 491 | operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { |
| 492 | return __invoke(get(), __a0, __a1, __a2); | |
| 492 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | template <class _A0, class _A1, class _A2> |
| 496 | 496 | _LIBCPP_INLINE_VISIBILITY |
| 497 | 497 | typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type |
| 498 | 498 | operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { |
| 499 | return __invoke(get(), __a0, __a1, __a2); | |
| 499 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | template <class _A0, class _A1, class _A2> |
| 503 | 503 | _LIBCPP_INLINE_VISIBILITY |
| 504 | 504 | typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type |
| 505 | 505 | operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { |
| 506 | return __invoke(get(), __a0, __a1, __a2); | |
| 506 | return _VSTD::__invoke(get(), __a0, __a1, __a2); | |
| 507 | 507 | } |
| 508 | 508 | #endif // _LIBCPP_CXX03_LANG |
| 509 | 509 | }; |
lib/libcxx/include/__functional_base_03+12-12| ... | ... | @@ -40,7 +40,7 @@ struct __enable_invoke_imp<_Ret, _T1, false, true> { |
| 40 | 40 | template <class _Ret, class _T1> |
| 41 | 41 | struct __enable_invoke_imp<_Ret, _T1, false, false> { |
| 42 | 42 | typedef typename add_lvalue_reference< |
| 43 | typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type | |
| 43 | typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type | |
| 44 | 44 | >::type _Bullet4; |
| 45 | 45 | typedef _Bullet4 type; |
| 46 | 46 | }; |
| ... | ... | @@ -142,7 +142,7 @@ __invoke(_Fn __f, _T1& __t1) { |
| 142 | 142 | |
| 143 | 143 | template <class _Fp> |
| 144 | 144 | inline _LIBCPP_INLINE_VISIBILITY |
| 145 | decltype(_VSTD::declval<_Fp&>()()) | |
| 145 | decltype(declval<_Fp&>()()) | |
| 146 | 146 | __invoke(_Fp& __f) |
| 147 | 147 | { |
| 148 | 148 | return __f(); |
| ... | ... | @@ -150,7 +150,7 @@ __invoke(_Fp& __f) |
| 150 | 150 | |
| 151 | 151 | template <class _Fp, class _A0> |
| 152 | 152 | inline _LIBCPP_INLINE_VISIBILITY |
| 153 | decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>())) | |
| 153 | decltype(declval<_Fp&>()(declval<_A0&>())) | |
| 154 | 154 | __invoke(_Fp& __f, _A0& __a0) |
| 155 | 155 | { |
| 156 | 156 | return __f(__a0); |
| ... | ... | @@ -158,7 +158,7 @@ __invoke(_Fp& __f, _A0& __a0) |
| 158 | 158 | |
| 159 | 159 | template <class _Fp, class _A0, class _A1> |
| 160 | 160 | inline _LIBCPP_INLINE_VISIBILITY |
| 161 | decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>())) | |
| 161 | decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>())) | |
| 162 | 162 | __invoke(_Fp& __f, _A0& __a0, _A1& __a1) |
| 163 | 163 | { |
| 164 | 164 | return __f(__a0, __a1); |
| ... | ... | @@ -166,7 +166,7 @@ __invoke(_Fp& __f, _A0& __a0, _A1& __a1) |
| 166 | 166 | |
| 167 | 167 | template <class _Fp, class _A0, class _A1, class _A2> |
| 168 | 168 | inline _LIBCPP_INLINE_VISIBILITY |
| 169 | decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>())) | |
| 169 | decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>())) | |
| 170 | 170 | __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2) |
| 171 | 171 | { |
| 172 | 172 | return __f(__a0, __a1, __a2); |
| ... | ... | @@ -181,13 +181,13 @@ struct __invoke_return |
| 181 | 181 | template <class _Fp> |
| 182 | 182 | struct __invoke_return<_Fp, false> |
| 183 | 183 | { |
| 184 | typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type; | |
| 184 | typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type; | |
| 185 | 185 | }; |
| 186 | 186 | |
| 187 | 187 | template <class _Tp, class _A0> |
| 188 | 188 | struct __invoke_return0 |
| 189 | 189 | { |
| 190 | typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type; | |
| 190 | typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type; | |
| 191 | 191 | }; |
| 192 | 192 | |
| 193 | 193 | template <class _Rp, class _Tp, class _A0> |
| ... | ... | @@ -199,8 +199,8 @@ struct __invoke_return0<_Rp _Tp::*, _A0> |
| 199 | 199 | template <class _Tp, class _A0, class _A1> |
| 200 | 200 | struct __invoke_return1 |
| 201 | 201 | { |
| 202 | typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(), | |
| 203 | _VSTD::declval<_A1&>())) type; | |
| 202 | typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), | |
| 203 | declval<_A1&>())) type; | |
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | 206 | template <class _Rp, class _Class, class _A0, class _A1> |
| ... | ... | @@ -211,9 +211,9 @@ struct __invoke_return1<_Rp _Class::*, _A0, _A1> { |
| 211 | 211 | template <class _Tp, class _A0, class _A1, class _A2> |
| 212 | 212 | struct __invoke_return2 |
| 213 | 213 | { |
| 214 | typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(), | |
| 215 | _VSTD::declval<_A1&>(), | |
| 216 | _VSTD::declval<_A2&>())) type; | |
| 214 | typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), | |
| 215 | declval<_A1&>(), | |
| 216 | declval<_A2&>())) type; | |
| 217 | 217 | }; |
| 218 | 218 | |
| 219 | 219 | template <class _Ret, class _Class, class _A0, class _A1, class _A2> |
lib/libcxx/include/__hash_table+68-170| ... | ... | @@ -34,19 +34,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 34 | 34 | template <class _Key, class _Tp> |
| 35 | 35 | struct __hash_value_type; |
| 36 | 36 | |
| 37 | #ifndef _LIBCPP_CXX03_LANG | |
| 38 | 37 | template <class _Tp> |
| 39 | 38 | struct __is_hash_value_type_imp : false_type {}; |
| 40 | 39 | |
| 41 | 40 | template <class _Key, class _Value> |
| 42 | struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value>> : true_type {}; | |
| 41 | struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value> > : true_type {}; | |
| 43 | 42 | |
| 44 | 43 | template <class ..._Args> |
| 45 | 44 | struct __is_hash_value_type : false_type {}; |
| 46 | 45 | |
| 47 | 46 | template <class _One> |
| 48 | 47 | struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {}; |
| 49 | #endif | |
| 50 | 48 | |
| 51 | 49 | _LIBCPP_FUNC_VIS |
| 52 | 50 | size_t __next_prime(size_t __n); |
| ... | ... | @@ -122,7 +120,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 122 | 120 | size_t |
| 123 | 121 | __next_hash_pow2(size_t __n) |
| 124 | 122 | { |
| 125 | return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1))); | |
| 123 | return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n-1))); | |
| 126 | 124 | } |
| 127 | 125 | |
| 128 | 126 | |
| ... | ... | @@ -155,12 +153,10 @@ struct __hash_key_value_types { |
| 155 | 153 | static __container_value_type* __get_ptr(__node_value_type& __n) { |
| 156 | 154 | return _VSTD::addressof(__n); |
| 157 | 155 | } |
| 158 | #ifndef _LIBCPP_CXX03_LANG | |
| 159 | 156 | _LIBCPP_INLINE_VISIBILITY |
| 160 | 157 | static __container_value_type&& __move(__node_value_type& __v) { |
| 161 | 158 | return _VSTD::move(__v); |
| 162 | 159 | } |
| 163 | #endif | |
| 164 | 160 | }; |
| 165 | 161 | |
| 166 | 162 | template <class _Key, class _Tp> |
| ... | ... | @@ -197,13 +193,10 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > { |
| 197 | 193 | static __container_value_type* __get_ptr(__node_value_type& __n) { |
| 198 | 194 | return _VSTD::addressof(__n.__get_value()); |
| 199 | 195 | } |
| 200 | #ifndef _LIBCPP_CXX03_LANG | |
| 201 | 196 | _LIBCPP_INLINE_VISIBILITY |
| 202 | 197 | static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { |
| 203 | 198 | return __v.__move(); |
| 204 | 199 | } |
| 205 | #endif | |
| 206 | ||
| 207 | 200 | }; |
| 208 | 201 | |
| 209 | 202 | template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>, |
| ... | ... | @@ -295,10 +288,12 @@ public: |
| 295 | 288 | typedef typename _NodeTypes::__node_value_type_pointer pointer; |
| 296 | 289 | |
| 297 | 290 | _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) { |
| 298 | _LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this)); | |
| 291 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 292 | __get_db()->__insert_i(this); | |
| 293 | #endif | |
| 299 | 294 | } |
| 300 | 295 | |
| 301 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 296 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 302 | 297 | _LIBCPP_INLINE_VISIBILITY |
| 303 | 298 | __hash_iterator(const __hash_iterator& __i) |
| 304 | 299 | : __node_(__i.__node_) |
| ... | ... | @@ -322,7 +317,7 @@ public: |
| 322 | 317 | } |
| 323 | 318 | return *this; |
| 324 | 319 | } |
| 325 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 320 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 326 | 321 | |
| 327 | 322 | _LIBCPP_INLINE_VISIBILITY |
| 328 | 323 | reference operator*() const { |
| ... | ... | @@ -364,7 +359,7 @@ public: |
| 364 | 359 | {return !(__x == __y);} |
| 365 | 360 | |
| 366 | 361 | private: |
| 367 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 362 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 368 | 363 | _LIBCPP_INLINE_VISIBILITY |
| 369 | 364 | __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT |
| 370 | 365 | : __node_(__node) |
| ... | ... | @@ -405,17 +400,21 @@ public: |
| 405 | 400 | |
| 406 | 401 | |
| 407 | 402 | _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) { |
| 408 | _LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this)); | |
| 403 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 404 | __get_db()->__insert_i(this); | |
| 405 | #endif | |
| 409 | 406 | } |
| 410 | 407 | |
| 411 | 408 | _LIBCPP_INLINE_VISIBILITY |
| 412 | 409 | __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT |
| 413 | 410 | : __node_(__x.__node_) |
| 414 | 411 | { |
| 415 | _LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x)); | |
| 412 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 413 | __get_db()->__iterator_copy(this, &__x); | |
| 414 | #endif | |
| 416 | 415 | } |
| 417 | 416 | |
| 418 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 417 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 419 | 418 | _LIBCPP_INLINE_VISIBILITY |
| 420 | 419 | __hash_const_iterator(const __hash_const_iterator& __i) |
| 421 | 420 | : __node_(__i.__node_) |
| ... | ... | @@ -439,7 +438,7 @@ public: |
| 439 | 438 | } |
| 440 | 439 | return *this; |
| 441 | 440 | } |
| 442 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 441 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 443 | 442 | |
| 444 | 443 | _LIBCPP_INLINE_VISIBILITY |
| 445 | 444 | reference operator*() const { |
| ... | ... | @@ -480,7 +479,7 @@ public: |
| 480 | 479 | {return !(__x == __y);} |
| 481 | 480 | |
| 482 | 481 | private: |
| 483 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 482 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 484 | 483 | _LIBCPP_INLINE_VISIBILITY |
| 485 | 484 | __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT |
| 486 | 485 | : __node_(__node) |
| ... | ... | @@ -518,10 +517,12 @@ public: |
| 518 | 517 | typedef typename _NodeTypes::__node_value_type_pointer pointer; |
| 519 | 518 | |
| 520 | 519 | _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) { |
| 521 | _LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this)); | |
| 520 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 521 | __get_db()->__insert_i(this); | |
| 522 | #endif | |
| 522 | 523 | } |
| 523 | 524 | |
| 524 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 525 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 525 | 526 | _LIBCPP_INLINE_VISIBILITY |
| 526 | 527 | __hash_local_iterator(const __hash_local_iterator& __i) |
| 527 | 528 | : __node_(__i.__node_), |
| ... | ... | @@ -549,7 +550,7 @@ public: |
| 549 | 550 | } |
| 550 | 551 | return *this; |
| 551 | 552 | } |
| 552 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 553 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 553 | 554 | |
| 554 | 555 | _LIBCPP_INLINE_VISIBILITY |
| 555 | 556 | reference operator*() const { |
| ... | ... | @@ -593,7 +594,7 @@ public: |
| 593 | 594 | {return !(__x == __y);} |
| 594 | 595 | |
| 595 | 596 | private: |
| 596 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 597 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 597 | 598 | _LIBCPP_INLINE_VISIBILITY |
| 598 | 599 | __hash_local_iterator(__next_pointer __node, size_t __bucket, |
| 599 | 600 | size_t __bucket_count, const void* __c) _NOEXCEPT |
| ... | ... | @@ -650,7 +651,9 @@ public: |
| 650 | 651 | |
| 651 | 652 | |
| 652 | 653 | _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) { |
| 653 | _LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this)); | |
| 654 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 655 | __get_db()->__insert_i(this); | |
| 656 | #endif | |
| 654 | 657 | } |
| 655 | 658 | |
| 656 | 659 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -659,10 +662,12 @@ public: |
| 659 | 662 | __bucket_(__x.__bucket_), |
| 660 | 663 | __bucket_count_(__x.__bucket_count_) |
| 661 | 664 | { |
| 662 | _LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x)); | |
| 665 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 666 | __get_db()->__iterator_copy(this, &__x); | |
| 667 | #endif | |
| 663 | 668 | } |
| 664 | 669 | |
| 665 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 670 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 666 | 671 | _LIBCPP_INLINE_VISIBILITY |
| 667 | 672 | __hash_const_local_iterator(const __hash_const_local_iterator& __i) |
| 668 | 673 | : __node_(__i.__node_), |
| ... | ... | @@ -690,7 +695,7 @@ public: |
| 690 | 695 | } |
| 691 | 696 | return *this; |
| 692 | 697 | } |
| 693 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 698 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 694 | 699 | |
| 695 | 700 | _LIBCPP_INLINE_VISIBILITY |
| 696 | 701 | reference operator*() const { |
| ... | ... | @@ -734,7 +739,7 @@ public: |
| 734 | 739 | {return !(__x == __y);} |
| 735 | 740 | |
| 736 | 741 | private: |
| 737 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 742 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 738 | 743 | _LIBCPP_INLINE_VISIBILITY |
| 739 | 744 | __hash_const_local_iterator(__next_pointer __node, size_t __bucket, |
| 740 | 745 | size_t __bucket_count, const void* __c) _NOEXCEPT |
| ... | ... | @@ -783,7 +788,6 @@ public: |
| 783 | 788 | _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value) |
| 784 | 789 | : __data_(__size, __a) {} |
| 785 | 790 | |
| 786 | #ifndef _LIBCPP_CXX03_LANG | |
| 787 | 791 | _LIBCPP_INLINE_VISIBILITY |
| 788 | 792 | __bucket_list_deallocator(__bucket_list_deallocator&& __x) |
| 789 | 793 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| ... | ... | @@ -791,7 +795,6 @@ public: |
| 791 | 795 | { |
| 792 | 796 | __x.size() = 0; |
| 793 | 797 | } |
| 794 | #endif | |
| 795 | 798 | |
| 796 | 799 | _LIBCPP_INLINE_VISIBILITY |
| 797 | 800 | size_type& size() _NOEXCEPT {return __data_.first();} |
| ... | ... | @@ -1007,7 +1010,6 @@ public: |
| 1007 | 1010 | explicit __hash_table(const allocator_type& __a); |
| 1008 | 1011 | __hash_table(const __hash_table& __u); |
| 1009 | 1012 | __hash_table(const __hash_table& __u, const allocator_type& __a); |
| 1010 | #ifndef _LIBCPP_CXX03_LANG | |
| 1011 | 1013 | __hash_table(__hash_table&& __u) |
| 1012 | 1014 | _NOEXCEPT_( |
| 1013 | 1015 | is_nothrow_move_constructible<__bucket_list>::value && |
| ... | ... | @@ -1016,11 +1018,9 @@ public: |
| 1016 | 1018 | is_nothrow_move_constructible<hasher>::value && |
| 1017 | 1019 | is_nothrow_move_constructible<key_equal>::value); |
| 1018 | 1020 | __hash_table(__hash_table&& __u, const allocator_type& __a); |
| 1019 | #endif // _LIBCPP_CXX03_LANG | |
| 1020 | 1021 | ~__hash_table(); |
| 1021 | 1022 | |
| 1022 | 1023 | __hash_table& operator=(const __hash_table& __u); |
| 1023 | #ifndef _LIBCPP_CXX03_LANG | |
| 1024 | 1024 | _LIBCPP_INLINE_VISIBILITY |
| 1025 | 1025 | __hash_table& operator=(__hash_table&& __u) |
| 1026 | 1026 | _NOEXCEPT_( |
| ... | ... | @@ -1028,7 +1028,6 @@ public: |
| 1028 | 1028 | is_nothrow_move_assignable<__node_allocator>::value && |
| 1029 | 1029 | is_nothrow_move_assignable<hasher>::value && |
| 1030 | 1030 | is_nothrow_move_assignable<key_equal>::value); |
| 1031 | #endif | |
| 1032 | 1031 | template <class _InputIterator> |
| 1033 | 1032 | void __assign_unique(_InputIterator __first, _InputIterator __last); |
| 1034 | 1033 | template <class _InputIterator> |
| ... | ... | @@ -1037,7 +1036,7 @@ public: |
| 1037 | 1036 | _LIBCPP_INLINE_VISIBILITY |
| 1038 | 1037 | size_type max_size() const _NOEXCEPT |
| 1039 | 1038 | { |
| 1040 | return std::min<size_type>( | |
| 1039 | return _VSTD::min<size_type>( | |
| 1041 | 1040 | __node_traits::max_size(__node_alloc()), |
| 1042 | 1041 | numeric_limits<difference_type >::max() |
| 1043 | 1042 | ); |
| ... | ... | @@ -1066,7 +1065,6 @@ public: |
| 1066 | 1065 | iterator __node_insert_multi(const_iterator __p, |
| 1067 | 1066 | __node_pointer __nd); |
| 1068 | 1067 | |
| 1069 | #ifndef _LIBCPP_CXX03_LANG | |
| 1070 | 1068 | template <class _Key, class ..._Args> |
| 1071 | 1069 | _LIBCPP_INLINE_VISIBILITY |
| 1072 | 1070 | pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args); |
| ... | ... | @@ -1151,15 +1149,6 @@ public: |
| 1151 | 1149 | return __emplace_hint_multi(__p, _VSTD::forward<_Pp>(__x)); |
| 1152 | 1150 | } |
| 1153 | 1151 | |
| 1154 | #else // !defined(_LIBCPP_CXX03_LANG) | |
| 1155 | template <class _Key, class _Args> | |
| 1156 | _LIBCPP_INLINE_VISIBILITY | |
| 1157 | pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args); | |
| 1158 | ||
| 1159 | iterator __insert_multi(const __container_value_type& __x); | |
| 1160 | iterator __insert_multi(const_iterator __p, const __container_value_type& __x); | |
| 1161 | #endif | |
| 1162 | ||
| 1163 | 1152 | _LIBCPP_INLINE_VISIBILITY |
| 1164 | 1153 | pair<iterator, bool> __insert_unique(const __container_value_type& __x) { |
| 1165 | 1154 | return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); |
| ... | ... | @@ -1295,7 +1284,7 @@ public: |
| 1295 | 1284 | { |
| 1296 | 1285 | _LIBCPP_ASSERT(__n < bucket_count(), |
| 1297 | 1286 | "unordered container::begin(n) called with n >= bucket_count()"); |
| 1298 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1287 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1299 | 1288 | return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); |
| 1300 | 1289 | #else |
| 1301 | 1290 | return local_iterator(__bucket_list_[__n], __n, bucket_count()); |
| ... | ... | @@ -1308,7 +1297,7 @@ public: |
| 1308 | 1297 | { |
| 1309 | 1298 | _LIBCPP_ASSERT(__n < bucket_count(), |
| 1310 | 1299 | "unordered container::end(n) called with n >= bucket_count()"); |
| 1311 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1300 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1312 | 1301 | return local_iterator(nullptr, __n, bucket_count(), this); |
| 1313 | 1302 | #else |
| 1314 | 1303 | return local_iterator(nullptr, __n, bucket_count()); |
| ... | ... | @@ -1321,7 +1310,7 @@ public: |
| 1321 | 1310 | { |
| 1322 | 1311 | _LIBCPP_ASSERT(__n < bucket_count(), |
| 1323 | 1312 | "unordered container::cbegin(n) called with n >= bucket_count()"); |
| 1324 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1313 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1325 | 1314 | return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); |
| 1326 | 1315 | #else |
| 1327 | 1316 | return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); |
| ... | ... | @@ -1334,35 +1323,30 @@ public: |
| 1334 | 1323 | { |
| 1335 | 1324 | _LIBCPP_ASSERT(__n < bucket_count(), |
| 1336 | 1325 | "unordered container::cend(n) called with n >= bucket_count()"); |
| 1337 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1326 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1338 | 1327 | return const_local_iterator(nullptr, __n, bucket_count(), this); |
| 1339 | 1328 | #else |
| 1340 | 1329 | return const_local_iterator(nullptr, __n, bucket_count()); |
| 1341 | 1330 | #endif |
| 1342 | 1331 | } |
| 1343 | 1332 | |
| 1344 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1333 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1345 | 1334 | |
| 1346 | 1335 | bool __dereferenceable(const const_iterator* __i) const; |
| 1347 | 1336 | bool __decrementable(const const_iterator* __i) const; |
| 1348 | 1337 | bool __addable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1349 | 1338 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1350 | 1339 | |
| 1351 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1340 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1352 | 1341 | |
| 1353 | 1342 | private: |
| 1354 | 1343 | void __rehash(size_type __n); |
| 1355 | 1344 | |
| 1356 | #ifndef _LIBCPP_CXX03_LANG | |
| 1357 | 1345 | template <class ..._Args> |
| 1358 | 1346 | __node_holder __construct_node(_Args&& ...__args); |
| 1359 | 1347 | |
| 1360 | 1348 | template <class _First, class ..._Rest> |
| 1361 | 1349 | __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest); |
| 1362 | #else // _LIBCPP_CXX03_LANG | |
| 1363 | __node_holder __construct_node(const __container_value_type& __v); | |
| 1364 | __node_holder __construct_node_hash(size_t __hash, const __container_value_type& __v); | |
| 1365 | #endif | |
| 1366 | 1350 | |
| 1367 | 1351 | |
| 1368 | 1352 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1373,7 +1357,6 @@ private: |
| 1373 | 1357 | _LIBCPP_INLINE_VISIBILITY |
| 1374 | 1358 | void __copy_assign_alloc(const __hash_table&, false_type) {} |
| 1375 | 1359 | |
| 1376 | #ifndef _LIBCPP_CXX03_LANG | |
| 1377 | 1360 | void __move_assign(__hash_table& __u, false_type); |
| 1378 | 1361 | void __move_assign(__hash_table& __u, true_type) |
| 1379 | 1362 | _NOEXCEPT_( |
| ... | ... | @@ -1400,7 +1383,6 @@ private: |
| 1400 | 1383 | } |
| 1401 | 1384 | _LIBCPP_INLINE_VISIBILITY |
| 1402 | 1385 | void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {} |
| 1403 | #endif // _LIBCPP_CXX03_LANG | |
| 1404 | 1386 | |
| 1405 | 1387 | void __deallocate_node(__next_pointer __np) _NOEXCEPT; |
| 1406 | 1388 | __next_pointer __detach() _NOEXCEPT; |
| ... | ... | @@ -1477,8 +1459,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, |
| 1477 | 1459 | { |
| 1478 | 1460 | } |
| 1479 | 1461 | |
| 1480 | #ifndef _LIBCPP_CXX03_LANG | |
| 1481 | ||
| 1482 | 1462 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1483 | 1463 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) |
| 1484 | 1464 | _NOEXCEPT_( |
| ... | ... | @@ -1526,8 +1506,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, |
| 1526 | 1506 | } |
| 1527 | 1507 | } |
| 1528 | 1508 | |
| 1529 | #endif // _LIBCPP_CXX03_LANG | |
| 1530 | ||
| 1531 | 1509 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1532 | 1510 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() |
| 1533 | 1511 | { |
| ... | ... | @@ -1539,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() |
| 1539 | 1517 | #endif |
| 1540 | 1518 | |
| 1541 | 1519 | __deallocate_node(__p1_.first().__next_); |
| 1542 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1520 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1543 | 1521 | __get_db()->__erase_c(this); |
| 1544 | 1522 | #endif |
| 1545 | 1523 | } |
| ... | ... | @@ -1583,7 +1561,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) |
| 1583 | 1561 | while (__np != nullptr) |
| 1584 | 1562 | { |
| 1585 | 1563 | __next_pointer __next = __np->__next_; |
| 1586 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1564 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1587 | 1565 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1588 | 1566 | for (__i_node** __p = __c->end_; __p != __c->beg_; ) |
| 1589 | 1567 | { |
| ... | ... | @@ -1593,7 +1571,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) |
| 1593 | 1571 | { |
| 1594 | 1572 | (*__p)->__c_ = nullptr; |
| 1595 | 1573 | if (--__c->end_ != __p) |
| 1596 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1574 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1597 | 1575 | } |
| 1598 | 1576 | } |
| 1599 | 1577 | __get_db()->unlock(); |
| ... | ... | @@ -1618,8 +1596,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT |
| 1618 | 1596 | return __cache; |
| 1619 | 1597 | } |
| 1620 | 1598 | |
| 1621 | #ifndef _LIBCPP_CXX03_LANG | |
| 1622 | ||
| 1623 | 1599 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1624 | 1600 | void |
| 1625 | 1601 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( |
| ... | ... | @@ -1646,7 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( |
| 1646 | 1622 | __u.__p1_.first().__next_ = nullptr; |
| 1647 | 1623 | __u.size() = 0; |
| 1648 | 1624 | } |
| 1649 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1625 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1650 | 1626 | __get_db()->swap(this, &__u); |
| 1651 | 1627 | #endif |
| 1652 | 1628 | } |
| ... | ... | @@ -1714,8 +1690,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u) |
| 1714 | 1690 | return *this; |
| 1715 | 1691 | } |
| 1716 | 1692 | |
| 1717 | #endif // _LIBCPP_CXX03_LANG | |
| 1718 | ||
| 1719 | 1693 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 1720 | 1694 | template <class _InputIterator> |
| 1721 | 1695 | void |
| ... | ... | @@ -1800,7 +1774,7 @@ inline |
| 1800 | 1774 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 1801 | 1775 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT |
| 1802 | 1776 | { |
| 1803 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1777 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1804 | 1778 | return iterator(__p1_.first().__next_, this); |
| 1805 | 1779 | #else |
| 1806 | 1780 | return iterator(__p1_.first().__next_); |
| ... | ... | @@ -1812,7 +1786,7 @@ inline |
| 1812 | 1786 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 1813 | 1787 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT |
| 1814 | 1788 | { |
| 1815 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1789 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1816 | 1790 | return iterator(nullptr, this); |
| 1817 | 1791 | #else |
| 1818 | 1792 | return iterator(nullptr); |
| ... | ... | @@ -1824,7 +1798,7 @@ inline |
| 1824 | 1798 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator |
| 1825 | 1799 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT |
| 1826 | 1800 | { |
| 1827 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1801 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1828 | 1802 | return const_iterator(__p1_.first().__next_, this); |
| 1829 | 1803 | #else |
| 1830 | 1804 | return const_iterator(__p1_.first().__next_); |
| ... | ... | @@ -1836,7 +1810,7 @@ inline |
| 1836 | 1810 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator |
| 1837 | 1811 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT |
| 1838 | 1812 | { |
| 1839 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1813 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1840 | 1814 | return const_iterator(nullptr, this); |
| 1841 | 1815 | #else |
| 1842 | 1816 | return const_iterator(nullptr); |
| ... | ... | @@ -1945,7 +1919,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ |
| 1945 | 1919 | __existing_node = __nd->__ptr(); |
| 1946 | 1920 | __inserted = true; |
| 1947 | 1921 | } |
| 1948 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1922 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1949 | 1923 | return pair<iterator, bool>(iterator(__existing_node, this), __inserted); |
| 1950 | 1924 | #else |
| 1951 | 1925 | return pair<iterator, bool>(iterator(__existing_node), __inserted); |
| ... | ... | @@ -1955,7 +1929,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __ |
| 1955 | 1929 | // Prepare the container for an insertion of the value __cp_val with the hash |
| 1956 | 1930 | // __cp_hash. This does a lookup into the container to see if __cp_value is |
| 1957 | 1931 | // already present, and performs a rehash if necessary. Returns a pointer to the |
| 1958 | // last occurance of __cp_val in the map. | |
| 1932 | // last occurrence of __cp_val in the map. | |
| 1959 | 1933 | // |
| 1960 | 1934 | // Note that this function does forward exceptions if key_eq() throws, and never |
| 1961 | 1935 | // mutates __value or actually inserts into the map. |
| ... | ... | @@ -2043,7 +2017,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c |
| 2043 | 2017 | __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); |
| 2044 | 2018 | __node_insert_multi_perform(__cp, __pn); |
| 2045 | 2019 | |
| 2046 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2020 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2047 | 2021 | return iterator(__cp->__ptr(), this); |
| 2048 | 2022 | #else |
| 2049 | 2023 | return iterator(__cp->__ptr()); |
| ... | ... | @@ -2055,7 +2029,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 2055 | 2029 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( |
| 2056 | 2030 | const_iterator __p, __node_pointer __cp) |
| 2057 | 2031 | { |
| 2058 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2032 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2059 | 2033 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2060 | 2034 | "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" |
| 2061 | 2035 | " referring to this unordered container"); |
| ... | ... | @@ -2078,7 +2052,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( |
| 2078 | 2052 | __cp->__next_ = __np; |
| 2079 | 2053 | __pp->__next_ = static_cast<__next_pointer>(__cp); |
| 2080 | 2054 | ++size(); |
| 2081 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2055 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2082 | 2056 | return iterator(static_cast<__next_pointer>(__cp), this); |
| 2083 | 2057 | #else |
| 2084 | 2058 | return iterator(static_cast<__next_pointer>(__cp)); |
| ... | ... | @@ -2089,17 +2063,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( |
| 2089 | 2063 | |
| 2090 | 2064 | |
| 2091 | 2065 | |
| 2092 | #ifndef _LIBCPP_CXX03_LANG | |
| 2093 | 2066 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2094 | 2067 | template <class _Key, class ..._Args> |
| 2095 | 2068 | pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> |
| 2096 | 2069 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) |
| 2097 | #else | |
| 2098 | template <class _Tp, class _Hash, class _Equal, class _Alloc> | |
| 2099 | template <class _Key, class _Args> | |
| 2100 | pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> | |
| 2101 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args& __args) | |
| 2102 | #endif | |
| 2103 | 2070 | { |
| 2104 | 2071 | |
| 2105 | 2072 | size_t __hash = hash_function()(__k); |
| ... | ... | @@ -2123,11 +2090,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& |
| 2123 | 2090 | } |
| 2124 | 2091 | } |
| 2125 | 2092 | { |
| 2126 | #ifndef _LIBCPP_CXX03_LANG | |
| 2127 | 2093 | __node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...); |
| 2128 | #else | |
| 2129 | __node_holder __h = __construct_node_hash(__hash, __args); | |
| 2130 | #endif | |
| 2131 | 2094 | if (size()+1 > __bc * max_load_factor() || __bc == 0) |
| 2132 | 2095 | { |
| 2133 | 2096 | rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc), |
| ... | ... | @@ -2159,15 +2122,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& |
| 2159 | 2122 | __inserted = true; |
| 2160 | 2123 | } |
| 2161 | 2124 | __done: |
| 2162 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2125 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2163 | 2126 | return pair<iterator, bool>(iterator(__nd, this), __inserted); |
| 2164 | 2127 | #else |
| 2165 | 2128 | return pair<iterator, bool>(iterator(__nd), __inserted); |
| 2166 | 2129 | #endif |
| 2167 | 2130 | } |
| 2168 | 2131 | |
| 2169 | #ifndef _LIBCPP_CXX03_LANG | |
| 2170 | ||
| 2171 | 2132 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2172 | 2133 | template <class... _Args> |
| 2173 | 2134 | pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> |
| ... | ... | @@ -2197,7 +2158,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 2197 | 2158 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( |
| 2198 | 2159 | const_iterator __p, _Args&&... __args) |
| 2199 | 2160 | { |
| 2200 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2161 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2201 | 2162 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2202 | 2163 | "unordered container::emplace_hint(const_iterator, args...) called with an iterator not" |
| 2203 | 2164 | " referring to this unordered container"); |
| ... | ... | @@ -2208,36 +2169,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( |
| 2208 | 2169 | return __r; |
| 2209 | 2170 | } |
| 2210 | 2171 | |
| 2211 | #else // _LIBCPP_CXX03_LANG | |
| 2212 | ||
| 2213 | template <class _Tp, class _Hash, class _Equal, class _Alloc> | |
| 2214 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator | |
| 2215 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const __container_value_type& __x) | |
| 2216 | { | |
| 2217 | __node_holder __h = __construct_node(__x); | |
| 2218 | iterator __r = __node_insert_multi(__h.get()); | |
| 2219 | __h.release(); | |
| 2220 | return __r; | |
| 2221 | } | |
| 2222 | ||
| 2223 | template <class _Tp, class _Hash, class _Equal, class _Alloc> | |
| 2224 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator | |
| 2225 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p, | |
| 2226 | const __container_value_type& __x) | |
| 2227 | { | |
| 2228 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2229 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, | |
| 2230 | "unordered container::insert(const_iterator, lvalue) called with an iterator not" | |
| 2231 | " referring to this unordered container"); | |
| 2232 | #endif | |
| 2233 | __node_holder __h = __construct_node(__x); | |
| 2234 | iterator __r = __node_insert_multi(__p, __h.get()); | |
| 2235 | __h.release(); | |
| 2236 | return __r; | |
| 2237 | } | |
| 2238 | ||
| 2239 | #endif // _LIBCPP_CXX03_LANG | |
| 2240 | ||
| 2241 | 2172 | #if _LIBCPP_STD_VER > 14 |
| 2242 | 2173 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2243 | 2174 | template <class _NodeHandle, class _InsertReturnType> |
| ... | ... | @@ -2399,9 +2330,9 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2399 | 2330 | void |
| 2400 | 2331 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc) |
| 2401 | 2332 | { |
| 2402 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2333 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2403 | 2334 | __get_db()->__invalidate_all(this); |
| 2404 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2335 | #endif | |
| 2405 | 2336 | __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc(); |
| 2406 | 2337 | __bucket_list_.reset(__nbc > 0 ? |
| 2407 | 2338 | __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr); |
| ... | ... | @@ -2470,7 +2401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) |
| 2470 | 2401 | { |
| 2471 | 2402 | if ((__nd->__hash() == __hash) |
| 2472 | 2403 | && key_eq()(__nd->__upcast()->__value_, __k)) |
| 2473 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2404 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2474 | 2405 | return iterator(__nd, this); |
| 2475 | 2406 | #else |
| 2476 | 2407 | return iterator(__nd); |
| ... | ... | @@ -2501,7 +2432,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const |
| 2501 | 2432 | { |
| 2502 | 2433 | if ((__nd->__hash() == __hash) |
| 2503 | 2434 | && key_eq()(__nd->__upcast()->__value_, __k)) |
| 2504 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2435 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2505 | 2436 | return const_iterator(__nd, this); |
| 2506 | 2437 | #else |
| 2507 | 2438 | return const_iterator(__nd); |
| ... | ... | @@ -2513,8 +2444,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const |
| 2513 | 2444 | return end(); |
| 2514 | 2445 | } |
| 2515 | 2446 | |
| 2516 | #ifndef _LIBCPP_CXX03_LANG | |
| 2517 | ||
| 2518 | 2447 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2519 | 2448 | template <class ..._Args> |
| 2520 | 2449 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder |
| ... | ... | @@ -2550,43 +2479,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash( |
| 2550 | 2479 | return __h; |
| 2551 | 2480 | } |
| 2552 | 2481 | |
| 2553 | #else // _LIBCPP_CXX03_LANG | |
| 2554 | ||
| 2555 | template <class _Tp, class _Hash, class _Equal, class _Alloc> | |
| 2556 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder | |
| 2557 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const __container_value_type& __v) | |
| 2558 | { | |
| 2559 | __node_allocator& __na = __node_alloc(); | |
| 2560 | __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | |
| 2561 | __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v); | |
| 2562 | __h.get_deleter().__value_constructed = true; | |
| 2563 | __h->__hash_ = hash_function()(__h->__value_); | |
| 2564 | __h->__next_ = nullptr; | |
| 2565 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 2566 | } | |
| 2567 | ||
| 2568 | template <class _Tp, class _Hash, class _Equal, class _Alloc> | |
| 2569 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder | |
| 2570 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash, | |
| 2571 | const __container_value_type& __v) | |
| 2572 | { | |
| 2573 | __node_allocator& __na = __node_alloc(); | |
| 2574 | __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | |
| 2575 | __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v); | |
| 2576 | __h.get_deleter().__value_constructed = true; | |
| 2577 | __h->__hash_ = __hash; | |
| 2578 | __h->__next_ = nullptr; | |
| 2579 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 2580 | } | |
| 2581 | ||
| 2582 | #endif // _LIBCPP_CXX03_LANG | |
| 2583 | ||
| 2584 | 2482 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2585 | 2483 | typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 2586 | 2484 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) |
| 2587 | 2485 | { |
| 2588 | 2486 | __next_pointer __np = __p.__node_; |
| 2589 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2487 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2590 | 2488 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2591 | 2489 | "unordered container erase(iterator) called with an iterator not" |
| 2592 | 2490 | " referring to this container"); |
| ... | ... | @@ -2606,7 +2504,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator |
| 2606 | 2504 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, |
| 2607 | 2505 | const_iterator __last) |
| 2608 | 2506 | { |
| 2609 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2507 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2610 | 2508 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, |
| 2611 | 2509 | "unodered container::erase(iterator, iterator) called with an iterator not" |
| 2612 | 2510 | " referring to this unodered container"); |
| ... | ... | @@ -2620,7 +2518,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, |
| 2620 | 2518 | erase(__p); |
| 2621 | 2519 | } |
| 2622 | 2520 | __next_pointer __np = __last.__node_; |
| 2623 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2521 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2624 | 2522 | return iterator (__np, this); |
| 2625 | 2523 | #else |
| 2626 | 2524 | return iterator (__np); |
| ... | ... | @@ -2691,7 +2589,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT |
| 2691 | 2589 | __pn->__next_ = __cn->__next_; |
| 2692 | 2590 | __cn->__next_ = nullptr; |
| 2693 | 2591 | --size(); |
| 2694 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2592 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2695 | 2593 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 2696 | 2594 | for (__i_node** __dp = __c->end_; __dp != __c->beg_; ) |
| 2697 | 2595 | { |
| ... | ... | @@ -2701,7 +2599,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT |
| 2701 | 2599 | { |
| 2702 | 2600 | (*__dp)->__c_ = nullptr; |
| 2703 | 2601 | if (--__c->end_ != __dp) |
| 2704 | memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*)); | |
| 2602 | _VSTD::memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*)); | |
| 2705 | 2603 | } |
| 2706 | 2604 | } |
| 2707 | 2605 | __get_db()->unlock(); |
| ... | ... | @@ -2830,9 +2728,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) |
| 2830 | 2728 | __u.__bucket_list_.reset(__npp); |
| 2831 | 2729 | } |
| 2832 | 2730 | _VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size()); |
| 2833 | __swap_allocator(__bucket_list_.get_deleter().__alloc(), | |
| 2731 | _VSTD::__swap_allocator(__bucket_list_.get_deleter().__alloc(), | |
| 2834 | 2732 | __u.__bucket_list_.get_deleter().__alloc()); |
| 2835 | __swap_allocator(__node_alloc(), __u.__node_alloc()); | |
| 2733 | _VSTD::__swap_allocator(__node_alloc(), __u.__node_alloc()); | |
| 2836 | 2734 | _VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_); |
| 2837 | 2735 | __p2_.swap(__u.__p2_); |
| 2838 | 2736 | __p3_.swap(__u.__p3_); |
| ... | ... | @@ -2842,7 +2740,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) |
| 2842 | 2740 | if (__u.size() > 0) |
| 2843 | 2741 | __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = |
| 2844 | 2742 | __u.__p1_.first().__ptr(); |
| 2845 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2743 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2846 | 2744 | __get_db()->swap(this, &__u); |
| 2847 | 2745 | #endif |
| 2848 | 2746 | } |
| ... | ... | @@ -2876,7 +2774,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, |
| 2876 | 2774 | __x.swap(__y); |
| 2877 | 2775 | } |
| 2878 | 2776 | |
| 2879 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2777 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2880 | 2778 | |
| 2881 | 2779 | template <class _Tp, class _Hash, class _Equal, class _Alloc> |
| 2882 | 2780 | bool |
| ... | ... | @@ -2906,7 +2804,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, |
| 2906 | 2804 | return false; |
| 2907 | 2805 | } |
| 2908 | 2806 | |
| 2909 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2807 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 2910 | 2808 | |
| 2911 | 2809 | _LIBCPP_END_NAMESPACE_STD |
| 2912 | 2810 |
lib/libcxx/include/__libcpp_version+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | 11000 | |
| 1 | 12000 |
lib/libcxx/include/__locale+234-36| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #define _LIBCPP___LOCALE |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__availability> | |
| 14 | 15 | #include <string> |
| 15 | 16 | #include <memory> |
| 16 | 17 | #include <utility> |
| ... | ... | @@ -21,7 +22,9 @@ |
| 21 | 22 | #if defined(_LIBCPP_MSVCRT_LIKE) |
| 22 | 23 | # include <cstring> |
| 23 | 24 | # include <support/win32/locale_win32.h> |
| 24 | #elif defined(_AIX) | |
| 25 | #elif defined(__NuttX__) | |
| 26 | # include <support/nuttx/xlocale.h> | |
| 27 | #elif defined(_AIX) || defined(__MVS__) | |
| 25 | 28 | # include <support/ibm/xlocale.h> |
| 26 | 29 | #elif defined(__ANDROID__) |
| 27 | 30 | # include <support/android/locale_bionic.h> |
| ... | ... | @@ -76,7 +79,7 @@ struct __libcpp_locale_guard { |
| 76 | 79 | // locale name, otherwise it will be a semicolon-separated string listing |
| 77 | 80 | // each category. In the second case, we know at least one category won't |
| 78 | 81 | // be what we want, so we only have to check the first case. |
| 79 | if (strcmp(__l.__get_locale(), __lc) != 0) { | |
| 82 | if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) { | |
| 80 | 83 | __locale_all = _strdup(__lc); |
| 81 | 84 | if (__locale_all == nullptr) |
| 82 | 85 | __throw_bad_alloc(); |
| ... | ... | @@ -105,7 +108,6 @@ struct __libcpp_locale_guard { |
| 105 | 108 | }; |
| 106 | 109 | #endif |
| 107 | 110 | |
| 108 | ||
| 109 | 111 | class _LIBCPP_TYPE_VIS locale; |
| 110 | 112 | |
| 111 | 113 | template <class _Facet> |
| ... | ... | @@ -335,8 +337,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const |
| 335 | 337 | return static_cast<long>(__h); |
| 336 | 338 | } |
| 337 | 339 | |
| 338 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>) | |
| 339 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>) | |
| 340 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>) | |
| 341 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>) | |
| 340 | 342 | |
| 341 | 343 | // template <class CharT> class collate_byname; |
| 342 | 344 | |
| ... | ... | @@ -396,7 +398,26 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, |
| 396 | 398 | class _LIBCPP_TYPE_VIS ctype_base |
| 397 | 399 | { |
| 398 | 400 | public: |
| 399 | #if defined(__GLIBC__) | |
| 401 | #if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE) | |
| 402 | typedef unsigned long mask; | |
| 403 | static const mask space = 1<<0; | |
| 404 | static const mask print = 1<<1; | |
| 405 | static const mask cntrl = 1<<2; | |
| 406 | static const mask upper = 1<<3; | |
| 407 | static const mask lower = 1<<4; | |
| 408 | static const mask alpha = 1<<5; | |
| 409 | static const mask digit = 1<<6; | |
| 410 | static const mask punct = 1<<7; | |
| 411 | static const mask xdigit = 1<<8; | |
| 412 | static const mask blank = 1<<9; | |
| 413 | #if defined(__BIONIC__) | |
| 414 | // Historically this was a part of regex_traits rather than ctype_base. The | |
| 415 | // historical value of the constant is preserved for ABI compatibility. | |
| 416 | static const mask __regex_word = 0x8000; | |
| 417 | #else | |
| 418 | static const mask __regex_word = 1<<10; | |
| 419 | #endif // defined(__BIONIC__) | |
| 420 | #elif defined(__GLIBC__) | |
| 400 | 421 | typedef unsigned short mask; |
| 401 | 422 | static const mask space = _ISspace; |
| 402 | 423 | static const mask print = _ISprint; |
| ... | ... | @@ -485,24 +506,7 @@ public: |
| 485 | 506 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA |
| 486 | 507 | # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT |
| 487 | 508 | #else |
| 488 | typedef unsigned long mask; | |
| 489 | static const mask space = 1<<0; | |
| 490 | static const mask print = 1<<1; | |
| 491 | static const mask cntrl = 1<<2; | |
| 492 | static const mask upper = 1<<3; | |
| 493 | static const mask lower = 1<<4; | |
| 494 | static const mask alpha = 1<<5; | |
| 495 | static const mask digit = 1<<6; | |
| 496 | static const mask punct = 1<<7; | |
| 497 | static const mask xdigit = 1<<8; | |
| 498 | static const mask blank = 1<<9; | |
| 499 | #if defined(__BIONIC__) | |
| 500 | // Historically this was a part of regex_traits rather than ctype_base. The | |
| 501 | // historical value of the constant is preserved for ABI compatibility. | |
| 502 | static const mask __regex_word = 0x8000; | |
| 503 | #else | |
| 504 | static const mask __regex_word = 1<<10; | |
| 505 | #endif // defined(__BIONIC__) | |
| 509 | # error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE? | |
| 506 | 510 | #endif |
| 507 | 511 | static const mask alnum = alpha | digit; |
| 508 | 512 | static const mask graph = alnum | punct; |
| ... | ... | @@ -623,7 +627,7 @@ class _LIBCPP_TYPE_VIS ctype<char> |
| 623 | 627 | public: |
| 624 | 628 | typedef char char_type; |
| 625 | 629 | |
| 626 | explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); | |
| 630 | explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0); | |
| 627 | 631 | |
| 628 | 632 | _LIBCPP_INLINE_VISIBILITY |
| 629 | 633 | bool is(mask __m, char_type __c) const |
| ... | ... | @@ -1069,10 +1073,10 @@ protected: |
| 1069 | 1073 | virtual int do_max_length() const _NOEXCEPT; |
| 1070 | 1074 | }; |
| 1071 | 1075 | |
| 1072 | // template <> class codecvt<char16_t, char, mbstate_t> | |
| 1076 | // template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20 | |
| 1073 | 1077 | |
| 1074 | 1078 | template <> |
| 1075 | class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t> | |
| 1079 | class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char16_t, char, mbstate_t> | |
| 1076 | 1080 | : public locale::facet, |
| 1077 | 1081 | public codecvt_base |
| 1078 | 1082 | { |
| ... | ... | @@ -1155,10 +1159,100 @@ protected: |
| 1155 | 1159 | virtual int do_max_length() const _NOEXCEPT; |
| 1156 | 1160 | }; |
| 1157 | 1161 | |
| 1158 | // template <> class codecvt<char32_t, char, mbstate_t> | |
| 1162 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1163 | ||
| 1164 | // template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20 | |
| 1159 | 1165 | |
| 1160 | 1166 | template <> |
| 1161 | class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t> | |
| 1167 | class _LIBCPP_TYPE_VIS codecvt<char16_t, char8_t, mbstate_t> | |
| 1168 | : public locale::facet, | |
| 1169 | public codecvt_base | |
| 1170 | { | |
| 1171 | public: | |
| 1172 | typedef char16_t intern_type; | |
| 1173 | typedef char8_t extern_type; | |
| 1174 | typedef mbstate_t state_type; | |
| 1175 | ||
| 1176 | _LIBCPP_INLINE_VISIBILITY | |
| 1177 | explicit codecvt(size_t __refs = 0) | |
| 1178 | : locale::facet(__refs) {} | |
| 1179 | ||
| 1180 | _LIBCPP_INLINE_VISIBILITY | |
| 1181 | result out(state_type& __st, | |
| 1182 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 1183 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const | |
| 1184 | { | |
| 1185 | return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | |
| 1186 | } | |
| 1187 | ||
| 1188 | _LIBCPP_INLINE_VISIBILITY | |
| 1189 | result unshift(state_type& __st, | |
| 1190 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const | |
| 1191 | { | |
| 1192 | return do_unshift(__st, __to, __to_end, __to_nxt); | |
| 1193 | } | |
| 1194 | ||
| 1195 | _LIBCPP_INLINE_VISIBILITY | |
| 1196 | result in(state_type& __st, | |
| 1197 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 1198 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const | |
| 1199 | { | |
| 1200 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | |
| 1201 | } | |
| 1202 | ||
| 1203 | _LIBCPP_INLINE_VISIBILITY | |
| 1204 | int encoding() const _NOEXCEPT | |
| 1205 | { | |
| 1206 | return do_encoding(); | |
| 1207 | } | |
| 1208 | ||
| 1209 | _LIBCPP_INLINE_VISIBILITY | |
| 1210 | bool always_noconv() const _NOEXCEPT | |
| 1211 | { | |
| 1212 | return do_always_noconv(); | |
| 1213 | } | |
| 1214 | ||
| 1215 | _LIBCPP_INLINE_VISIBILITY | |
| 1216 | int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const | |
| 1217 | { | |
| 1218 | return do_length(__st, __frm, __end, __mx); | |
| 1219 | } | |
| 1220 | ||
| 1221 | _LIBCPP_INLINE_VISIBILITY | |
| 1222 | int max_length() const _NOEXCEPT | |
| 1223 | { | |
| 1224 | return do_max_length(); | |
| 1225 | } | |
| 1226 | ||
| 1227 | static locale::id id; | |
| 1228 | ||
| 1229 | protected: | |
| 1230 | _LIBCPP_INLINE_VISIBILITY | |
| 1231 | explicit codecvt(const char*, size_t __refs = 0) | |
| 1232 | : locale::facet(__refs) {} | |
| 1233 | ||
| 1234 | ~codecvt(); | |
| 1235 | ||
| 1236 | virtual result do_out(state_type& __st, | |
| 1237 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 1238 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 1239 | virtual result do_in(state_type& __st, | |
| 1240 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 1241 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 1242 | virtual result do_unshift(state_type& __st, | |
| 1243 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 1244 | virtual int do_encoding() const _NOEXCEPT; | |
| 1245 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 1246 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; | |
| 1247 | virtual int do_max_length() const _NOEXCEPT; | |
| 1248 | }; | |
| 1249 | ||
| 1250 | #endif | |
| 1251 | ||
| 1252 | // template <> class codecvt<char32_t, char, mbstate_t> // deprecated in C++20 | |
| 1253 | ||
| 1254 | template <> | |
| 1255 | class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char32_t, char, mbstate_t> | |
| 1162 | 1256 | : public locale::facet, |
| 1163 | 1257 | public codecvt_base |
| 1164 | 1258 | { |
| ... | ... | @@ -1241,6 +1335,96 @@ protected: |
| 1241 | 1335 | virtual int do_max_length() const _NOEXCEPT; |
| 1242 | 1336 | }; |
| 1243 | 1337 | |
| 1338 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1339 | ||
| 1340 | // template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20 | |
| 1341 | ||
| 1342 | template <> | |
| 1343 | class _LIBCPP_TYPE_VIS codecvt<char32_t, char8_t, mbstate_t> | |
| 1344 | : public locale::facet, | |
| 1345 | public codecvt_base | |
| 1346 | { | |
| 1347 | public: | |
| 1348 | typedef char32_t intern_type; | |
| 1349 | typedef char8_t extern_type; | |
| 1350 | typedef mbstate_t state_type; | |
| 1351 | ||
| 1352 | _LIBCPP_INLINE_VISIBILITY | |
| 1353 | explicit codecvt(size_t __refs = 0) | |
| 1354 | : locale::facet(__refs) {} | |
| 1355 | ||
| 1356 | _LIBCPP_INLINE_VISIBILITY | |
| 1357 | result out(state_type& __st, | |
| 1358 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 1359 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const | |
| 1360 | { | |
| 1361 | return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | |
| 1362 | } | |
| 1363 | ||
| 1364 | _LIBCPP_INLINE_VISIBILITY | |
| 1365 | result unshift(state_type& __st, | |
| 1366 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const | |
| 1367 | { | |
| 1368 | return do_unshift(__st, __to, __to_end, __to_nxt); | |
| 1369 | } | |
| 1370 | ||
| 1371 | _LIBCPP_INLINE_VISIBILITY | |
| 1372 | result in(state_type& __st, | |
| 1373 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 1374 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const | |
| 1375 | { | |
| 1376 | return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); | |
| 1377 | } | |
| 1378 | ||
| 1379 | _LIBCPP_INLINE_VISIBILITY | |
| 1380 | int encoding() const _NOEXCEPT | |
| 1381 | { | |
| 1382 | return do_encoding(); | |
| 1383 | } | |
| 1384 | ||
| 1385 | _LIBCPP_INLINE_VISIBILITY | |
| 1386 | bool always_noconv() const _NOEXCEPT | |
| 1387 | { | |
| 1388 | return do_always_noconv(); | |
| 1389 | } | |
| 1390 | ||
| 1391 | _LIBCPP_INLINE_VISIBILITY | |
| 1392 | int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const | |
| 1393 | { | |
| 1394 | return do_length(__st, __frm, __end, __mx); | |
| 1395 | } | |
| 1396 | ||
| 1397 | _LIBCPP_INLINE_VISIBILITY | |
| 1398 | int max_length() const _NOEXCEPT | |
| 1399 | { | |
| 1400 | return do_max_length(); | |
| 1401 | } | |
| 1402 | ||
| 1403 | static locale::id id; | |
| 1404 | ||
| 1405 | protected: | |
| 1406 | _LIBCPP_INLINE_VISIBILITY | |
| 1407 | explicit codecvt(const char*, size_t __refs = 0) | |
| 1408 | : locale::facet(__refs) {} | |
| 1409 | ||
| 1410 | ~codecvt(); | |
| 1411 | ||
| 1412 | virtual result do_out(state_type& __st, | |
| 1413 | const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, | |
| 1414 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 1415 | virtual result do_in(state_type& __st, | |
| 1416 | const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, | |
| 1417 | intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; | |
| 1418 | virtual result do_unshift(state_type& __st, | |
| 1419 | extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; | |
| 1420 | virtual int do_encoding() const _NOEXCEPT; | |
| 1421 | virtual bool do_always_noconv() const _NOEXCEPT; | |
| 1422 | virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; | |
| 1423 | virtual int do_max_length() const _NOEXCEPT; | |
| 1424 | }; | |
| 1425 | ||
| 1426 | #endif | |
| 1427 | ||
| 1244 | 1428 | // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname |
| 1245 | 1429 | |
| 1246 | 1430 | template <class _InternT, class _ExternT, class _StateT> |
| ... | ... | @@ -1258,15 +1442,21 @@ protected: |
| 1258 | 1442 | ~codecvt_byname(); |
| 1259 | 1443 | }; |
| 1260 | 1444 | |
| 1445 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1261 | 1446 | template <class _InternT, class _ExternT, class _StateT> |
| 1262 | 1447 | codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() |
| 1263 | 1448 | { |
| 1264 | 1449 | } |
| 1265 | ||
| 1266 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>) | |
| 1267 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) | |
| 1268 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) | |
| 1269 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) | |
| 1450 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1451 | ||
| 1452 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>) | |
| 1453 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) | |
| 1454 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20 | |
| 1455 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20 | |
| 1456 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1457 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20 | |
| 1458 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20 | |
| 1459 | #endif | |
| 1270 | 1460 | |
| 1271 | 1461 | template <size_t _Np> |
| 1272 | 1462 | struct __narrow_to_utf8 |
| ... | ... | @@ -1290,12 +1480,14 @@ struct __narrow_to_utf8<8> |
| 1290 | 1480 | } |
| 1291 | 1481 | }; |
| 1292 | 1482 | |
| 1483 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1293 | 1484 | template <> |
| 1294 | 1485 | struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16> |
| 1295 | 1486 | : public codecvt<char16_t, char, mbstate_t> |
| 1296 | 1487 | { |
| 1297 | 1488 | _LIBCPP_INLINE_VISIBILITY |
| 1298 | 1489 | __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} |
| 1490 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1299 | 1491 | |
| 1300 | 1492 | _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8(); |
| 1301 | 1493 | |
| ... | ... | @@ -1324,12 +1516,14 @@ struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16> |
| 1324 | 1516 | } |
| 1325 | 1517 | }; |
| 1326 | 1518 | |
| 1519 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1327 | 1520 | template <> |
| 1328 | 1521 | struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32> |
| 1329 | 1522 | : public codecvt<char32_t, char, mbstate_t> |
| 1330 | 1523 | { |
| 1331 | 1524 | _LIBCPP_INLINE_VISIBILITY |
| 1332 | 1525 | __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} |
| 1526 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1333 | 1527 | |
| 1334 | 1528 | _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8(); |
| 1335 | 1529 | |
| ... | ... | @@ -1380,12 +1574,14 @@ struct __widen_from_utf8<8> |
| 1380 | 1574 | } |
| 1381 | 1575 | }; |
| 1382 | 1576 | |
| 1577 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1383 | 1578 | template <> |
| 1384 | 1579 | struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16> |
| 1385 | 1580 | : public codecvt<char16_t, char, mbstate_t> |
| 1386 | 1581 | { |
| 1387 | 1582 | _LIBCPP_INLINE_VISIBILITY |
| 1388 | 1583 | __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} |
| 1584 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1389 | 1585 | |
| 1390 | 1586 | _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8(); |
| 1391 | 1587 | |
| ... | ... | @@ -1407,19 +1603,21 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16> |
| 1407 | 1603 | if (__r == codecvt_base::error || __nn == __nb) |
| 1408 | 1604 | __throw_runtime_error("locale not supported"); |
| 1409 | 1605 | for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) |
| 1410 | *__s = (wchar_t)*__p; | |
| 1606 | *__s = *__p; | |
| 1411 | 1607 | __nb = __nn; |
| 1412 | 1608 | } |
| 1413 | 1609 | return __s; |
| 1414 | 1610 | } |
| 1415 | 1611 | }; |
| 1416 | 1612 | |
| 1613 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1417 | 1614 | template <> |
| 1418 | 1615 | struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32> |
| 1419 | 1616 | : public codecvt<char32_t, char, mbstate_t> |
| 1420 | 1617 | { |
| 1421 | 1618 | _LIBCPP_INLINE_VISIBILITY |
| 1422 | 1619 | __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} |
| 1620 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1423 | 1621 | |
| 1424 | 1622 | _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8(); |
| 1425 | 1623 | |
| ... | ... | @@ -1441,7 +1639,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32> |
| 1441 | 1639 | if (__r == codecvt_base::error || __nn == __nb) |
| 1442 | 1640 | __throw_runtime_error("locale not supported"); |
| 1443 | 1641 | for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) |
| 1444 | *__s = (wchar_t)*__p; | |
| 1642 | *__s = *__p; | |
| 1445 | 1643 | __nb = __nn; |
| 1446 | 1644 | } |
| 1447 | 1645 | return __s; |
lib/libcxx/include/__memory/allocator_traits.h created+589| ... | ... | @@ -0,0 +1,589 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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___MEMORY_ALLOCATOR_TRAITS_H | |
| 11 | #define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <__memory/base.h> | |
| 15 | #include <__memory/pointer_traits.h> | |
| 16 | #include <type_traits> | |
| 17 | ||
| 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 19 | #pragma GCC system_header | |
| 20 | #endif | |
| 21 | ||
| 22 | _LIBCPP_PUSH_MACROS | |
| 23 | #include <__undef_macros> | |
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | template <class _Tp, class = void> | |
| 28 | struct __has_pointer_type : false_type {}; | |
| 29 | ||
| 30 | template <class _Tp> | |
| 31 | struct __has_pointer_type<_Tp, | |
| 32 | typename __void_t<typename _Tp::pointer>::type> : true_type {}; | |
| 33 | ||
| 34 | namespace __pointer_type_imp | |
| 35 | { | |
| 36 | ||
| 37 | template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value> | |
| 38 | struct __pointer_type | |
| 39 | { | |
| 40 | typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type; | |
| 41 | }; | |
| 42 | ||
| 43 | template <class _Tp, class _Dp> | |
| 44 | struct __pointer_type<_Tp, _Dp, false> | |
| 45 | { | |
| 46 | typedef _LIBCPP_NODEBUG_TYPE _Tp* type; | |
| 47 | }; | |
| 48 | ||
| 49 | } // __pointer_type_imp | |
| 50 | ||
| 51 | template <class _Tp, class _Dp> | |
| 52 | struct __pointer_type | |
| 53 | { | |
| 54 | typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type; | |
| 55 | }; | |
| 56 | ||
| 57 | template <class _Tp, class = void> | |
| 58 | struct __has_const_pointer : false_type {}; | |
| 59 | ||
| 60 | template <class _Tp> | |
| 61 | struct __has_const_pointer<_Tp, | |
| 62 | typename __void_t<typename _Tp::const_pointer>::type> : true_type {}; | |
| 63 | ||
| 64 | template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value> | |
| 65 | struct __const_pointer | |
| 66 | { | |
| 67 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type; | |
| 68 | }; | |
| 69 | ||
| 70 | template <class _Tp, class _Ptr, class _Alloc> | |
| 71 | struct __const_pointer<_Tp, _Ptr, _Alloc, false> | |
| 72 | { | |
| 73 | #ifndef _LIBCPP_CXX03_LANG | |
| 74 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type; | |
| 75 | #else | |
| 76 | typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type; | |
| 77 | #endif | |
| 78 | }; | |
| 79 | ||
| 80 | template <class _Tp, class = void> | |
| 81 | struct __has_void_pointer : false_type {}; | |
| 82 | ||
| 83 | template <class _Tp> | |
| 84 | struct __has_void_pointer<_Tp, | |
| 85 | typename __void_t<typename _Tp::void_pointer>::type> : true_type {}; | |
| 86 | ||
| 87 | template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value> | |
| 88 | struct __void_pointer | |
| 89 | { | |
| 90 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type; | |
| 91 | }; | |
| 92 | ||
| 93 | template <class _Ptr, class _Alloc> | |
| 94 | struct __void_pointer<_Ptr, _Alloc, false> | |
| 95 | { | |
| 96 | #ifndef _LIBCPP_CXX03_LANG | |
| 97 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type; | |
| 98 | #else | |
| 99 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type; | |
| 100 | #endif | |
| 101 | }; | |
| 102 | ||
| 103 | template <class _Tp, class = void> | |
| 104 | struct __has_const_void_pointer : false_type {}; | |
| 105 | ||
| 106 | template <class _Tp> | |
| 107 | struct __has_const_void_pointer<_Tp, | |
| 108 | typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {}; | |
| 109 | ||
| 110 | template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value> | |
| 111 | struct __const_void_pointer | |
| 112 | { | |
| 113 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type; | |
| 114 | }; | |
| 115 | ||
| 116 | template <class _Ptr, class _Alloc> | |
| 117 | struct __const_void_pointer<_Ptr, _Alloc, false> | |
| 118 | { | |
| 119 | #ifndef _LIBCPP_CXX03_LANG | |
| 120 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type; | |
| 121 | #else | |
| 122 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type; | |
| 123 | #endif | |
| 124 | }; | |
| 125 | ||
| 126 | template <class _Tp, class = void> | |
| 127 | struct __has_size_type : false_type {}; | |
| 128 | ||
| 129 | template <class _Tp> | |
| 130 | struct __has_size_type<_Tp, | |
| 131 | typename __void_t<typename _Tp::size_type>::type> : true_type {}; | |
| 132 | ||
| 133 | template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value> | |
| 134 | struct __size_type | |
| 135 | { | |
| 136 | typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type; | |
| 137 | }; | |
| 138 | ||
| 139 | template <class _Alloc, class _DiffType> | |
| 140 | struct __size_type<_Alloc, _DiffType, true> | |
| 141 | { | |
| 142 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type; | |
| 143 | }; | |
| 144 | ||
| 145 | template <class _Tp, class = void> | |
| 146 | struct __has_propagate_on_container_copy_assignment : false_type {}; | |
| 147 | ||
| 148 | template <class _Tp> | |
| 149 | struct __has_propagate_on_container_copy_assignment<_Tp, | |
| 150 | typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type> | |
| 151 | : true_type {}; | |
| 152 | ||
| 153 | template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value> | |
| 154 | struct __propagate_on_container_copy_assignment | |
| 155 | { | |
| 156 | typedef _LIBCPP_NODEBUG_TYPE false_type type; | |
| 157 | }; | |
| 158 | ||
| 159 | template <class _Alloc> | |
| 160 | struct __propagate_on_container_copy_assignment<_Alloc, true> | |
| 161 | { | |
| 162 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type; | |
| 163 | }; | |
| 164 | ||
| 165 | template <class _Tp, class = void> | |
| 166 | struct __has_propagate_on_container_move_assignment : false_type {}; | |
| 167 | ||
| 168 | template <class _Tp> | |
| 169 | struct __has_propagate_on_container_move_assignment<_Tp, | |
| 170 | typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type> | |
| 171 | : true_type {}; | |
| 172 | ||
| 173 | template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value> | |
| 174 | struct __propagate_on_container_move_assignment | |
| 175 | { | |
| 176 | typedef false_type type; | |
| 177 | }; | |
| 178 | ||
| 179 | template <class _Alloc> | |
| 180 | struct __propagate_on_container_move_assignment<_Alloc, true> | |
| 181 | { | |
| 182 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type; | |
| 183 | }; | |
| 184 | ||
| 185 | template <class _Tp, class = void> | |
| 186 | struct __has_propagate_on_container_swap : false_type {}; | |
| 187 | ||
| 188 | template <class _Tp> | |
| 189 | struct __has_propagate_on_container_swap<_Tp, | |
| 190 | typename __void_t<typename _Tp::propagate_on_container_swap>::type> | |
| 191 | : true_type {}; | |
| 192 | ||
| 193 | template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value> | |
| 194 | struct __propagate_on_container_swap | |
| 195 | { | |
| 196 | typedef false_type type; | |
| 197 | }; | |
| 198 | ||
| 199 | template <class _Alloc> | |
| 200 | struct __propagate_on_container_swap<_Alloc, true> | |
| 201 | { | |
| 202 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type; | |
| 203 | }; | |
| 204 | ||
| 205 | template <class _Tp, class = void> | |
| 206 | struct __has_is_always_equal : false_type {}; | |
| 207 | ||
| 208 | template <class _Tp> | |
| 209 | struct __has_is_always_equal<_Tp, | |
| 210 | typename __void_t<typename _Tp::is_always_equal>::type> | |
| 211 | : true_type {}; | |
| 212 | ||
| 213 | template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value> | |
| 214 | struct __is_always_equal | |
| 215 | { | |
| 216 | typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type; | |
| 217 | }; | |
| 218 | ||
| 219 | template <class _Alloc> | |
| 220 | struct __is_always_equal<_Alloc, true> | |
| 221 | { | |
| 222 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type; | |
| 223 | }; | |
| 224 | ||
| 225 | template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> | |
| 226 | struct __has_rebind_other | |
| 227 | { | |
| 228 | private: | |
| 229 | struct __two {char __lx; char __lxx;}; | |
| 230 | template <class _Xp> static __two __test(...); | |
| 231 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 232 | template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0); | |
| 233 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 234 | public: | |
| 235 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | |
| 236 | }; | |
| 237 | ||
| 238 | template <class _Tp, class _Up> | |
| 239 | struct __has_rebind_other<_Tp, _Up, false> | |
| 240 | { | |
| 241 | static const bool value = false; | |
| 242 | }; | |
| 243 | ||
| 244 | template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value> | |
| 245 | struct __allocator_traits_rebind | |
| 246 | { | |
| 247 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 248 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; | |
| 249 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 250 | }; | |
| 251 | ||
| 252 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> | |
| 253 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> | |
| 254 | { | |
| 255 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 256 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type; | |
| 257 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 258 | }; | |
| 259 | ||
| 260 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> | |
| 261 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> | |
| 262 | { | |
| 263 | typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type; | |
| 264 | }; | |
| 265 | ||
| 266 | #ifndef _LIBCPP_CXX03_LANG | |
| 267 | ||
| 268 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 269 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 270 | auto | |
| 271 | __has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) | |
| 272 | -> decltype((void)__a.allocate(__sz, __p), true_type()); | |
| 273 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 274 | ||
| 275 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 276 | auto | |
| 277 | __has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) | |
| 278 | -> false_type; | |
| 279 | ||
| 280 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 281 | struct __has_allocate_hint | |
| 282 | : decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(), | |
| 283 | declval<_SizeType>(), | |
| 284 | declval<_ConstVoidPtr>())) | |
| 285 | { | |
| 286 | }; | |
| 287 | ||
| 288 | #else // _LIBCPP_CXX03_LANG | |
| 289 | ||
| 290 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 291 | struct __has_allocate_hint | |
| 292 | : true_type | |
| 293 | { | |
| 294 | }; | |
| 295 | ||
| 296 | #endif // _LIBCPP_CXX03_LANG | |
| 297 | ||
| 298 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 299 | template <class _Alloc, class ..._Args, | |
| 300 | class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))> | |
| 301 | static true_type __test_has_construct(int); | |
| 302 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 303 | ||
| 304 | template <class _Alloc, class...> | |
| 305 | static false_type __test_has_construct(...); | |
| 306 | ||
| 307 | template <class _Alloc, class ..._Args> | |
| 308 | struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {}; | |
| 309 | ||
| 310 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 311 | ||
| 312 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 313 | template <class _Alloc, class _Pointer> | |
| 314 | auto | |
| 315 | __has_destroy_test(_Alloc&& __a, _Pointer&& __p) | |
| 316 | -> decltype(__a.destroy(__p), true_type()); | |
| 317 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 318 | ||
| 319 | template <class _Alloc, class _Pointer> | |
| 320 | auto | |
| 321 | __has_destroy_test(const _Alloc& __a, _Pointer&& __p) | |
| 322 | -> false_type; | |
| 323 | ||
| 324 | template <class _Alloc, class _Pointer> | |
| 325 | struct __has_destroy | |
| 326 | : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(), | |
| 327 | declval<_Pointer>())) | |
| 328 | { | |
| 329 | }; | |
| 330 | ||
| 331 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 332 | template <class _Alloc> | |
| 333 | auto | |
| 334 | __has_max_size_test(_Alloc&& __a) | |
| 335 | -> decltype(__a.max_size(), true_type()); | |
| 336 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 337 | ||
| 338 | template <class _Alloc> | |
| 339 | auto | |
| 340 | __has_max_size_test(const volatile _Alloc& __a) | |
| 341 | -> false_type; | |
| 342 | ||
| 343 | template <class _Alloc> | |
| 344 | struct __has_max_size | |
| 345 | : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>())) | |
| 346 | { | |
| 347 | }; | |
| 348 | ||
| 349 | template <class _Alloc> | |
| 350 | auto | |
| 351 | __has_select_on_container_copy_construction_test(_Alloc&& __a) | |
| 352 | -> decltype(__a.select_on_container_copy_construction(), true_type()); | |
| 353 | ||
| 354 | template <class _Alloc> | |
| 355 | auto | |
| 356 | __has_select_on_container_copy_construction_test(const volatile _Alloc& __a) | |
| 357 | -> false_type; | |
| 358 | ||
| 359 | template <class _Alloc> | |
| 360 | struct __has_select_on_container_copy_construction | |
| 361 | : decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>())) | |
| 362 | { | |
| 363 | }; | |
| 364 | ||
| 365 | #else // _LIBCPP_CXX03_LANG | |
| 366 | ||
| 367 | template <class _Alloc, class _Pointer, class = void> | |
| 368 | struct __has_destroy : false_type {}; | |
| 369 | ||
| 370 | template <class _Alloc, class _Pointer> | |
| 371 | struct __has_destroy<_Alloc, _Pointer, typename __void_t< | |
| 372 | decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>())) | |
| 373 | >::type> : true_type {}; | |
| 374 | ||
| 375 | template <class _Alloc> | |
| 376 | struct __has_max_size | |
| 377 | : true_type | |
| 378 | { | |
| 379 | }; | |
| 380 | ||
| 381 | template <class _Alloc> | |
| 382 | struct __has_select_on_container_copy_construction | |
| 383 | : false_type | |
| 384 | { | |
| 385 | }; | |
| 386 | ||
| 387 | #endif // _LIBCPP_CXX03_LANG | |
| 388 | ||
| 389 | template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value> | |
| 390 | struct __alloc_traits_difference_type | |
| 391 | { | |
| 392 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type; | |
| 393 | }; | |
| 394 | ||
| 395 | template <class _Alloc, class _Ptr> | |
| 396 | struct __alloc_traits_difference_type<_Alloc, _Ptr, true> | |
| 397 | { | |
| 398 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type; | |
| 399 | }; | |
| 400 | ||
| 401 | template <class _Tp> | |
| 402 | struct __is_default_allocator : false_type {}; | |
| 403 | ||
| 404 | template <class _Tp> | |
| 405 | struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {}; | |
| 406 | ||
| 407 | ||
| 408 | ||
| 409 | template <class _Alloc, | |
| 410 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value | |
| 411 | > | |
| 412 | struct __is_cpp17_move_insertable; | |
| 413 | template <class _Alloc> | |
| 414 | struct __is_cpp17_move_insertable<_Alloc, true> : true_type {}; | |
| 415 | template <class _Alloc> | |
| 416 | struct __is_cpp17_move_insertable<_Alloc, false> : is_move_constructible<typename _Alloc::value_type> {}; | |
| 417 | ||
| 418 | template <class _Alloc, | |
| 419 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value | |
| 420 | > | |
| 421 | struct __is_cpp17_copy_insertable; | |
| 422 | template <class _Alloc> | |
| 423 | struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {}; | |
| 424 | template <class _Alloc> | |
| 425 | struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool, | |
| 426 | is_copy_constructible<typename _Alloc::value_type>::value && | |
| 427 | __is_cpp17_move_insertable<_Alloc>::value> | |
| 428 | {}; | |
| 429 | ||
| 430 | ||
| 431 | ||
| 432 | template <class _Alloc> | |
| 433 | struct _LIBCPP_TEMPLATE_VIS allocator_traits | |
| 434 | { | |
| 435 | typedef _Alloc allocator_type; | |
| 436 | typedef typename allocator_type::value_type value_type; | |
| 437 | ||
| 438 | typedef typename __pointer_type<value_type, allocator_type>::type pointer; | |
| 439 | typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer; | |
| 440 | typedef typename __void_pointer<pointer, allocator_type>::type void_pointer; | |
| 441 | typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer; | |
| 442 | ||
| 443 | typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type; | |
| 444 | typedef typename __size_type<allocator_type, difference_type>::type size_type; | |
| 445 | ||
| 446 | typedef typename __propagate_on_container_copy_assignment<allocator_type>::type | |
| 447 | propagate_on_container_copy_assignment; | |
| 448 | typedef typename __propagate_on_container_move_assignment<allocator_type>::type | |
| 449 | propagate_on_container_move_assignment; | |
| 450 | typedef typename __propagate_on_container_swap<allocator_type>::type | |
| 451 | propagate_on_container_swap; | |
| 452 | typedef typename __is_always_equal<allocator_type>::type | |
| 453 | is_always_equal; | |
| 454 | ||
| 455 | #ifndef _LIBCPP_CXX03_LANG | |
| 456 | template <class _Tp> using rebind_alloc = | |
| 457 | typename __allocator_traits_rebind<allocator_type, _Tp>::type; | |
| 458 | template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >; | |
| 459 | #else // _LIBCPP_CXX03_LANG | |
| 460 | template <class _Tp> struct rebind_alloc | |
| 461 | {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;}; | |
| 462 | template <class _Tp> struct rebind_traits | |
| 463 | {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;}; | |
| 464 | #endif // _LIBCPP_CXX03_LANG | |
| 465 | ||
| 466 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 467 | static pointer allocate(allocator_type& __a, size_type __n) | |
| 468 | {return __a.allocate(__n);} | |
| 469 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 470 | static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) | |
| 471 | {return __allocate(__a, __n, __hint, | |
| 472 | __has_allocate_hint<allocator_type, size_type, const_void_pointer>());} | |
| 473 | ||
| 474 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 475 | static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT | |
| 476 | {__a.deallocate(__p, __n);} | |
| 477 | ||
| 478 | template <class _Tp, class... _Args> | |
| 479 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 480 | static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) | |
| 481 | {__construct(__has_construct<allocator_type, _Tp*, _Args...>(), | |
| 482 | __a, __p, _VSTD::forward<_Args>(__args)...);} | |
| 483 | ||
| 484 | template <class _Tp> | |
| 485 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 486 | static void destroy(allocator_type& __a, _Tp* __p) | |
| 487 | {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);} | |
| 488 | ||
| 489 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 490 | static size_type max_size(const allocator_type& __a) _NOEXCEPT | |
| 491 | {return __max_size(__has_max_size<const allocator_type>(), __a);} | |
| 492 | ||
| 493 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 494 | static allocator_type | |
| 495 | select_on_container_copy_construction(const allocator_type& __a) | |
| 496 | {return __select_on_container_copy_construction( | |
| 497 | __has_select_on_container_copy_construction<const allocator_type>(), | |
| 498 | __a);} | |
| 499 | ||
| 500 | private: | |
| 501 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 502 | static pointer __allocate(allocator_type& __a, size_type __n, | |
| 503 | const_void_pointer __hint, true_type) | |
| 504 | { | |
| 505 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 506 | return __a.allocate(__n, __hint); | |
| 507 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 508 | } | |
| 509 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 510 | static pointer __allocate(allocator_type& __a, size_type __n, | |
| 511 | const_void_pointer, false_type) | |
| 512 | {return __a.allocate(__n);} | |
| 513 | ||
| 514 | template <class _Tp, class... _Args> | |
| 515 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 516 | static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args) | |
| 517 | { | |
| 518 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 519 | __a.construct(__p, _VSTD::forward<_Args>(__args)...); | |
| 520 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 521 | } | |
| 522 | ||
| 523 | template <class _Tp, class... _Args> | |
| 524 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 525 | static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args) | |
| 526 | { | |
| 527 | #if _LIBCPP_STD_VER > 17 | |
| 528 | _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...); | |
| 529 | #else | |
| 530 | ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...); | |
| 531 | #endif | |
| 532 | } | |
| 533 | ||
| 534 | template <class _Tp> | |
| 535 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 536 | static void __destroy(true_type, allocator_type& __a, _Tp* __p) | |
| 537 | { | |
| 538 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 539 | __a.destroy(__p); | |
| 540 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 541 | } | |
| 542 | template <class _Tp> | |
| 543 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 544 | static void __destroy(false_type, allocator_type&, _Tp* __p) | |
| 545 | { | |
| 546 | #if _LIBCPP_STD_VER > 17 | |
| 547 | _VSTD::destroy_at(__p); | |
| 548 | #else | |
| 549 | __p->~_Tp(); | |
| 550 | #endif | |
| 551 | } | |
| 552 | ||
| 553 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 554 | static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT | |
| 555 | { | |
| 556 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 557 | return __a.max_size(); | |
| 558 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 559 | } | |
| 560 | ||
| 561 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 562 | static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT | |
| 563 | {return numeric_limits<size_type>::max() / sizeof(value_type);} | |
| 564 | ||
| 565 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 566 | static allocator_type | |
| 567 | __select_on_container_copy_construction(true_type, const allocator_type& __a) | |
| 568 | {return __a.select_on_container_copy_construction();} | |
| 569 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 570 | static allocator_type | |
| 571 | __select_on_container_copy_construction(false_type, const allocator_type& __a) | |
| 572 | {return __a;} | |
| 573 | }; | |
| 574 | ||
| 575 | template <class _Traits, class _Tp> | |
| 576 | struct __rebind_alloc_helper | |
| 577 | { | |
| 578 | #ifndef _LIBCPP_CXX03_LANG | |
| 579 | typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type; | |
| 580 | #else | |
| 581 | typedef typename _Traits::template rebind_alloc<_Tp>::other type; | |
| 582 | #endif | |
| 583 | }; | |
| 584 | ||
| 585 | _LIBCPP_END_NAMESPACE_STD | |
| 586 | ||
| 587 | _LIBCPP_POP_MACROS | |
| 588 | ||
| 589 | #endif // _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H |
lib/libcxx/include/__memory/base.h created+127| ... | ... | @@ -0,0 +1,127 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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___MEMORY_BASE_H | |
| 11 | #define _LIBCPP___MEMORY_BASE_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <__debug> | |
| 15 | #include <type_traits> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | #pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | _LIBCPP_PUSH_MACROS | |
| 22 | #include <__undef_macros> | |
| 23 | ||
| 24 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 25 | ||
| 26 | // addressof | |
| 27 | #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF | |
| 28 | ||
| 29 | template <class _Tp> | |
| 30 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 31 | _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY | |
| 32 | _Tp* | |
| 33 | addressof(_Tp& __x) _NOEXCEPT | |
| 34 | { | |
| 35 | return __builtin_addressof(__x); | |
| 36 | } | |
| 37 | ||
| 38 | #else | |
| 39 | ||
| 40 | template <class _Tp> | |
| 41 | inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY | |
| 42 | _Tp* | |
| 43 | addressof(_Tp& __x) _NOEXCEPT | |
| 44 | { | |
| 45 | return reinterpret_cast<_Tp *>( | |
| 46 | const_cast<char *>(&reinterpret_cast<const volatile char &>(__x))); | |
| 47 | } | |
| 48 | ||
| 49 | #endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF | |
| 50 | ||
| 51 | #if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF) | |
| 52 | // Objective-C++ Automatic Reference Counting uses qualified pointers | |
| 53 | // that require special addressof() signatures. When | |
| 54 | // _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler | |
| 55 | // itself is providing these definitions. Otherwise, we provide them. | |
| 56 | template <class _Tp> | |
| 57 | inline _LIBCPP_INLINE_VISIBILITY | |
| 58 | __strong _Tp* | |
| 59 | addressof(__strong _Tp& __x) _NOEXCEPT | |
| 60 | { | |
| 61 | return &__x; | |
| 62 | } | |
| 63 | ||
| 64 | #ifdef _LIBCPP_HAS_OBJC_ARC_WEAK | |
| 65 | template <class _Tp> | |
| 66 | inline _LIBCPP_INLINE_VISIBILITY | |
| 67 | __weak _Tp* | |
| 68 | addressof(__weak _Tp& __x) _NOEXCEPT | |
| 69 | { | |
| 70 | return &__x; | |
| 71 | } | |
| 72 | #endif | |
| 73 | ||
| 74 | template <class _Tp> | |
| 75 | inline _LIBCPP_INLINE_VISIBILITY | |
| 76 | __autoreleasing _Tp* | |
| 77 | addressof(__autoreleasing _Tp& __x) _NOEXCEPT | |
| 78 | { | |
| 79 | return &__x; | |
| 80 | } | |
| 81 | ||
| 82 | template <class _Tp> | |
| 83 | inline _LIBCPP_INLINE_VISIBILITY | |
| 84 | __unsafe_unretained _Tp* | |
| 85 | addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT | |
| 86 | { | |
| 87 | return &__x; | |
| 88 | } | |
| 89 | #endif | |
| 90 | ||
| 91 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 92 | template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete; | |
| 93 | #endif | |
| 94 | ||
| 95 | // construct_at | |
| 96 | ||
| 97 | #if _LIBCPP_STD_VER > 17 | |
| 98 | ||
| 99 | template<class _Tp, class ..._Args, class = decltype( | |
| 100 | ::new (_VSTD::declval<void*>()) _Tp(_VSTD::declval<_Args>()...) | |
| 101 | )> | |
| 102 | _LIBCPP_INLINE_VISIBILITY | |
| 103 | constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { | |
| 104 | _LIBCPP_ASSERT(__location, "null pointer given to construct_at"); | |
| 105 | return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...); | |
| 106 | } | |
| 107 | ||
| 108 | #endif | |
| 109 | ||
| 110 | // destroy_at | |
| 111 | ||
| 112 | #if _LIBCPP_STD_VER > 14 | |
| 113 | ||
| 114 | template <class _Tp> | |
| 115 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 116 | void destroy_at(_Tp* __loc) { | |
| 117 | _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at"); | |
| 118 | __loc->~_Tp(); | |
| 119 | } | |
| 120 | ||
| 121 | #endif | |
| 122 | ||
| 123 | _LIBCPP_END_NAMESPACE_STD | |
| 124 | ||
| 125 | _LIBCPP_POP_MACROS | |
| 126 | ||
| 127 | #endif // _LIBCPP___MEMORY_BASE_H |
lib/libcxx/include/__memory/pointer_traits.h created+169| ... | ... | @@ -0,0 +1,169 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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___MEMORY_POINTER_TRAITS_H | |
| 11 | #define _LIBCPP___MEMORY_POINTER_TRAITS_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <type_traits> | |
| 15 | ||
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 17 | #pragma GCC system_header | |
| 18 | #endif | |
| 19 | ||
| 20 | _LIBCPP_PUSH_MACROS | |
| 21 | #include <__undef_macros> | |
| 22 | ||
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 24 | ||
| 25 | template <class _Tp, class = void> | |
| 26 | struct __has_element_type : false_type {}; | |
| 27 | ||
| 28 | template <class _Tp> | |
| 29 | struct __has_element_type<_Tp, | |
| 30 | typename __void_t<typename _Tp::element_type>::type> : true_type {}; | |
| 31 | ||
| 32 | template <class _Ptr, bool = __has_element_type<_Ptr>::value> | |
| 33 | struct __pointer_traits_element_type; | |
| 34 | ||
| 35 | template <class _Ptr> | |
| 36 | struct __pointer_traits_element_type<_Ptr, true> | |
| 37 | { | |
| 38 | typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type; | |
| 39 | }; | |
| 40 | ||
| 41 | template <template <class, class...> class _Sp, class _Tp, class ..._Args> | |
| 42 | struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> | |
| 43 | { | |
| 44 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type; | |
| 45 | }; | |
| 46 | ||
| 47 | template <template <class, class...> class _Sp, class _Tp, class ..._Args> | |
| 48 | struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> | |
| 49 | { | |
| 50 | typedef _LIBCPP_NODEBUG_TYPE _Tp type; | |
| 51 | }; | |
| 52 | ||
| 53 | template <class _Tp, class = void> | |
| 54 | struct __has_difference_type : false_type {}; | |
| 55 | ||
| 56 | template <class _Tp> | |
| 57 | struct __has_difference_type<_Tp, | |
| 58 | typename __void_t<typename _Tp::difference_type>::type> : true_type {}; | |
| 59 | ||
| 60 | template <class _Ptr, bool = __has_difference_type<_Ptr>::value> | |
| 61 | struct __pointer_traits_difference_type | |
| 62 | { | |
| 63 | typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type; | |
| 64 | }; | |
| 65 | ||
| 66 | template <class _Ptr> | |
| 67 | struct __pointer_traits_difference_type<_Ptr, true> | |
| 68 | { | |
| 69 | typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type; | |
| 70 | }; | |
| 71 | ||
| 72 | template <class _Tp, class _Up> | |
| 73 | struct __has_rebind | |
| 74 | { | |
| 75 | private: | |
| 76 | struct __two {char __lx; char __lxx;}; | |
| 77 | template <class _Xp> static __two __test(...); | |
| 78 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 79 | template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0); | |
| 80 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 81 | public: | |
| 82 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | |
| 83 | }; | |
| 84 | ||
| 85 | template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> | |
| 86 | struct __pointer_traits_rebind | |
| 87 | { | |
| 88 | #ifndef _LIBCPP_CXX03_LANG | |
| 89 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type; | |
| 90 | #else | |
| 91 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; | |
| 92 | #endif | |
| 93 | }; | |
| 94 | ||
| 95 | template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> | |
| 96 | struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> | |
| 97 | { | |
| 98 | #ifndef _LIBCPP_CXX03_LANG | |
| 99 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type; | |
| 100 | #else | |
| 101 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type; | |
| 102 | #endif | |
| 103 | }; | |
| 104 | ||
| 105 | template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> | |
| 106 | struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> | |
| 107 | { | |
| 108 | typedef _Sp<_Up, _Args...> type; | |
| 109 | }; | |
| 110 | ||
| 111 | template <class _Ptr> | |
| 112 | struct _LIBCPP_TEMPLATE_VIS pointer_traits | |
| 113 | { | |
| 114 | typedef _Ptr pointer; | |
| 115 | typedef typename __pointer_traits_element_type<pointer>::type element_type; | |
| 116 | typedef typename __pointer_traits_difference_type<pointer>::type difference_type; | |
| 117 | ||
| 118 | #ifndef _LIBCPP_CXX03_LANG | |
| 119 | template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type; | |
| 120 | #else | |
| 121 | template <class _Up> struct rebind | |
| 122 | {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;}; | |
| 123 | #endif // _LIBCPP_CXX03_LANG | |
| 124 | ||
| 125 | private: | |
| 126 | struct __nat {}; | |
| 127 | public: | |
| 128 | _LIBCPP_INLINE_VISIBILITY | |
| 129 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 130 | __nat, element_type>::type& __r) | |
| 131 | {return pointer::pointer_to(__r);} | |
| 132 | }; | |
| 133 | ||
| 134 | template <class _Tp> | |
| 135 | struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> | |
| 136 | { | |
| 137 | typedef _Tp* pointer; | |
| 138 | typedef _Tp element_type; | |
| 139 | typedef ptrdiff_t difference_type; | |
| 140 | ||
| 141 | #ifndef _LIBCPP_CXX03_LANG | |
| 142 | template <class _Up> using rebind = _Up*; | |
| 143 | #else | |
| 144 | template <class _Up> struct rebind {typedef _Up* other;}; | |
| 145 | #endif | |
| 146 | ||
| 147 | private: | |
| 148 | struct __nat {}; | |
| 149 | public: | |
| 150 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 151 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 152 | __nat, element_type>::type& __r) _NOEXCEPT | |
| 153 | {return _VSTD::addressof(__r);} | |
| 154 | }; | |
| 155 | ||
| 156 | template <class _From, class _To> | |
| 157 | struct __rebind_pointer { | |
| 158 | #ifndef _LIBCPP_CXX03_LANG | |
| 159 | typedef typename pointer_traits<_From>::template rebind<_To> type; | |
| 160 | #else | |
| 161 | typedef typename pointer_traits<_From>::template rebind<_To>::other type; | |
| 162 | #endif | |
| 163 | }; | |
| 164 | ||
| 165 | _LIBCPP_END_NAMESPACE_STD | |
| 166 | ||
| 167 | _LIBCPP_POP_MACROS | |
| 168 | ||
| 169 | #endif // _LIBCPP___MEMORY_POINTER_TRAITS_H |
lib/libcxx/include/__memory/utilities.h created+88| ... | ... | @@ -0,0 +1,88 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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___MEMORY_UTILITIES_H | |
| 11 | #define _LIBCPP___MEMORY_UTILITIES_H | |
| 12 | ||
| 13 | #include <__config> | |
| 14 | #include <__memory/allocator_traits.h> | |
| 15 | #include <cstddef> | |
| 16 | ||
| 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |
| 18 | #pragma GCC system_header | |
| 19 | #endif | |
| 20 | ||
| 21 | _LIBCPP_PUSH_MACROS | |
| 22 | #include <__undef_macros> | |
| 23 | ||
| 24 | ||
| 25 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 26 | ||
| 27 | // Helper class to allocate memory using an Allocator in an exception safe | |
| 28 | // manner. | |
| 29 | // | |
| 30 | // The intended usage of this class is as follows: | |
| 31 | // | |
| 32 | // 0 | |
| 33 | // 1 __allocation_guard<SomeAllocator> guard(alloc, 10); | |
| 34 | // 2 do_some_initialization_that_may_throw(guard.__get()); | |
| 35 | // 3 save_allocated_pointer_in_a_noexcept_operation(guard.__release_ptr()); | |
| 36 | // 4 | |
| 37 | // | |
| 38 | // If line (2) throws an exception during initialization of the memory, the | |
| 39 | // guard's destructor will be called, and the memory will be released using | |
| 40 | // Allocator deallocation. Otherwise, we release the memory from the guard on | |
| 41 | // line (3) in an operation that can't throw -- after that, the guard is not | |
| 42 | // responsible for the memory anymore. | |
| 43 | // | |
| 44 | // This is similar to a unique_ptr, except it's easier to use with a | |
| 45 | // custom allocator. | |
| 46 | template<class _Alloc> | |
| 47 | struct __allocation_guard { | |
| 48 | using _Pointer = typename allocator_traits<_Alloc>::pointer; | |
| 49 | using _Size = typename allocator_traits<_Alloc>::size_type; | |
| 50 | ||
| 51 | template<class _AllocT> // we perform the allocator conversion inside the constructor | |
| 52 | _LIBCPP_HIDE_FROM_ABI | |
| 53 | explicit __allocation_guard(_AllocT __alloc, _Size __n) | |
| 54 | : __alloc_(_VSTD::move(__alloc)) | |
| 55 | , __n_(__n) | |
| 56 | , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important | |
| 57 | { } | |
| 58 | ||
| 59 | _LIBCPP_HIDE_FROM_ABI | |
| 60 | ~__allocation_guard() _NOEXCEPT { | |
| 61 | if (__ptr_ != nullptr) { | |
| 62 | allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_); | |
| 63 | } | |
| 64 | } | |
| 65 | ||
| 66 | _LIBCPP_HIDE_FROM_ABI | |
| 67 | _Pointer __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++ | |
| 68 | _Pointer __tmp = __ptr_; | |
| 69 | __ptr_ = nullptr; | |
| 70 | return __tmp; | |
| 71 | } | |
| 72 | ||
| 73 | _LIBCPP_HIDE_FROM_ABI | |
| 74 | _Pointer __get() const _NOEXCEPT { | |
| 75 | return __ptr_; | |
| 76 | } | |
| 77 | ||
| 78 | private: | |
| 79 | _Alloc __alloc_; | |
| 80 | _Size __n_; | |
| 81 | _Pointer __ptr_; | |
| 82 | }; | |
| 83 | ||
| 84 | _LIBCPP_END_NAMESPACE_STD | |
| 85 | ||
| 86 | _LIBCPP_POP_MACROS | |
| 87 | ||
| 88 | #endif // _LIBCPP___MEMORY_UTILITIES_H |
lib/libcxx/include/__mutex_base+2-5| ... | ... | @@ -146,7 +146,6 @@ private: |
| 146 | 146 | unique_lock& operator=(unique_lock const&); // = delete; |
| 147 | 147 | |
| 148 | 148 | public: |
| 149 | #ifndef _LIBCPP_CXX03_LANG | |
| 150 | 149 | _LIBCPP_INLINE_VISIBILITY |
| 151 | 150 | unique_lock(unique_lock&& __u) _NOEXCEPT |
| 152 | 151 | : __m_(__u.__m_), __owns_(__u.__owns_) |
| ... | ... | @@ -163,8 +162,6 @@ public: |
| 163 | 162 | return *this; |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | #endif // _LIBCPP_CXX03_LANG | |
| 167 | ||
| 168 | 165 | void lock(); |
| 169 | 166 | bool try_lock(); |
| 170 | 167 | |
| ... | ... | @@ -382,12 +379,12 @@ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) |
| 382 | 379 | |
| 383 | 380 | using __ratio = ratio_divide<_Period, nano>; |
| 384 | 381 | using __ns_rep = nanoseconds::rep; |
| 385 | __ns_rep __result_max = std::numeric_limits<__ns_rep>::max(); | |
| 382 | __ns_rep __result_max = numeric_limits<__ns_rep>::max(); | |
| 386 | 383 | if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { |
| 387 | 384 | return nanoseconds::max(); |
| 388 | 385 | } |
| 389 | 386 | |
| 390 | __ns_rep __result_min = std::numeric_limits<__ns_rep>::min(); | |
| 387 | __ns_rep __result_min = numeric_limits<__ns_rep>::min(); | |
| 391 | 388 | if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { |
| 392 | 389 | return nanoseconds::min(); |
| 393 | 390 | } |
lib/libcxx/include/__split_buffer+4-20| ... | ... | @@ -68,7 +68,6 @@ public: |
| 68 | 68 | __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); |
| 69 | 69 | ~__split_buffer(); |
| 70 | 70 | |
| 71 | #ifndef _LIBCPP_CXX03_LANG | |
| 72 | 71 | __split_buffer(__split_buffer&& __c) |
| 73 | 72 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| 74 | 73 | __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); |
| ... | ... | @@ -76,7 +75,6 @@ public: |
| 76 | 75 | _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && |
| 77 | 76 | is_nothrow_move_assignable<allocator_type>::value) || |
| 78 | 77 | !__alloc_traits::propagate_on_container_move_assignment::value); |
| 79 | #endif // _LIBCPP_CXX03_LANG | |
| 80 | 78 | |
| 81 | 79 | _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} |
| 82 | 80 | _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} |
| ... | ... | @@ -101,12 +99,10 @@ public: |
| 101 | 99 | void shrink_to_fit() _NOEXCEPT; |
| 102 | 100 | void push_front(const_reference __x); |
| 103 | 101 | _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); |
| 104 | #ifndef _LIBCPP_CXX03_LANG | |
| 105 | 102 | void push_front(value_type&& __x); |
| 106 | 103 | void push_back(value_type&& __x); |
| 107 | 104 | template <class... _Args> |
| 108 | 105 | void emplace_back(_Args&&... __args); |
| 109 | #endif // !defined(_LIBCPP_CXX03_LANG) | |
| 110 | 106 | |
| 111 | 107 | _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} |
| 112 | 108 | _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} |
| ... | ... | @@ -270,7 +266,7 @@ typename enable_if |
| 270 | 266 | >::type |
| 271 | 267 | __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) |
| 272 | 268 | { |
| 273 | _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last)); | |
| 269 | _ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last)); | |
| 274 | 270 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) { |
| 275 | 271 | __alloc_traits::construct(this->__alloc(), |
| 276 | 272 | _VSTD::__to_address(__tx.__pos_), *__first); |
| ... | ... | @@ -283,7 +279,7 @@ void |
| 283 | 279 | __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) |
| 284 | 280 | { |
| 285 | 281 | while (__begin_ != __new_begin) |
| 286 | __alloc_traits::destroy(__alloc(), __to_address(__begin_++)); | |
| 282 | __alloc_traits::destroy(__alloc(), _VSTD::__to_address(__begin_++)); | |
| 287 | 283 | } |
| 288 | 284 | |
| 289 | 285 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -300,7 +296,7 @@ void |
| 300 | 296 | __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT |
| 301 | 297 | { |
| 302 | 298 | while (__new_last != __end_) |
| 303 | __alloc_traits::destroy(__alloc(), __to_address(--__end_)); | |
| 299 | __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__end_)); | |
| 304 | 300 | } |
| 305 | 301 | |
| 306 | 302 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -350,8 +346,6 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer() |
| 350 | 346 | __alloc_traits::deallocate(__alloc(), __first_, capacity()); |
| 351 | 347 | } |
| 352 | 348 | |
| 353 | #ifndef _LIBCPP_CXX03_LANG | |
| 354 | ||
| 355 | 349 | template <class _Tp, class _Allocator> |
| 356 | 350 | __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) |
| 357 | 351 | _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| ... | ... | @@ -412,8 +406,6 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) |
| 412 | 406 | return *this; |
| 413 | 407 | } |
| 414 | 408 | |
| 415 | #endif // _LIBCPP_CXX03_LANG | |
| 416 | ||
| 417 | 409 | template <class _Tp, class _Allocator> |
| 418 | 410 | void |
| 419 | 411 | __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) |
| ... | ... | @@ -424,7 +416,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) |
| 424 | 416 | _VSTD::swap(__begin_, __x.__begin_); |
| 425 | 417 | _VSTD::swap(__end_, __x.__end_); |
| 426 | 418 | _VSTD::swap(__end_cap(), __x.__end_cap()); |
| 427 | __swap_allocator(__alloc(), __x.__alloc()); | |
| 419 | _VSTD::__swap_allocator(__alloc(), __x.__alloc()); | |
| 428 | 420 | } |
| 429 | 421 | |
| 430 | 422 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -499,8 +491,6 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) |
| 499 | 491 | --__begin_; |
| 500 | 492 | } |
| 501 | 493 | |
| 502 | #ifndef _LIBCPP_CXX03_LANG | |
| 503 | ||
| 504 | 494 | template <class _Tp, class _Allocator> |
| 505 | 495 | void |
| 506 | 496 | __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| ... | ... | @@ -531,8 +521,6 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) |
| 531 | 521 | --__begin_; |
| 532 | 522 | } |
| 533 | 523 | |
| 534 | #endif // _LIBCPP_CXX03_LANG | |
| 535 | ||
| 536 | 524 | template <class _Tp, class _Allocator> |
| 537 | 525 | inline _LIBCPP_INLINE_VISIBILITY |
| 538 | 526 | void |
| ... | ... | @@ -563,8 +551,6 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) |
| 563 | 551 | ++__end_; |
| 564 | 552 | } |
| 565 | 553 | |
| 566 | #ifndef _LIBCPP_CXX03_LANG | |
| 567 | ||
| 568 | 554 | template <class _Tp, class _Allocator> |
| 569 | 555 | void |
| 570 | 556 | __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) |
| ... | ... | @@ -626,8 +612,6 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) |
| 626 | 612 | ++__end_; |
| 627 | 613 | } |
| 628 | 614 | |
| 629 | #endif // _LIBCPP_CXX03_LANG | |
| 630 | ||
| 631 | 615 | template <class _Tp, class _Allocator> |
| 632 | 616 | inline _LIBCPP_INLINE_VISIBILITY |
| 633 | 617 | void |
lib/libcxx/include/__sso_allocator+5-4| ... | ... | @@ -11,8 +11,9 @@ |
| 11 | 11 | #define _LIBCPP___SSO_ALLOCATOR |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <type_traits> | |
| 14 | #include <memory> | |
| 15 | 15 | #include <new> |
| 16 | #include <type_traits> | |
| 16 | 17 | |
| 17 | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 18 | 19 | #pragma GCC system_header |
| ... | ... | @@ -47,21 +48,21 @@ public: |
| 47 | 48 | private: |
| 48 | 49 | __sso_allocator& operator=(const __sso_allocator&); |
| 49 | 50 | public: |
| 50 | _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0) | |
| 51 | _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr) | |
| 51 | 52 | { |
| 52 | 53 | if (!__allocated_ && __n <= _Np) |
| 53 | 54 | { |
| 54 | 55 | __allocated_ = true; |
| 55 | 56 | return (pointer)&buf_; |
| 56 | 57 | } |
| 57 | return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); | |
| 58 | return allocator<_Tp>().allocate(__n); | |
| 58 | 59 | } |
| 59 | 60 | _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) |
| 60 | 61 | { |
| 61 | 62 | if (__p == (pointer)&buf_) |
| 62 | 63 | __allocated_ = false; |
| 63 | 64 | else |
| 64 | _VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 65 | allocator<_Tp>().deallocate(__p, __n); | |
| 65 | 66 | } |
| 66 | 67 | _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} |
| 67 | 68 |
lib/libcxx/include/__string+49-47| ... | ... | @@ -55,7 +55,9 @@ template <> struct char_traits<char8_t>; // c++20 |
| 55 | 55 | |
| 56 | 56 | #include <__config> |
| 57 | 57 | #include <algorithm> // for search and min |
| 58 | #include <cstdio> // For EOF. | |
| 58 | #include <cstdio> // for EOF | |
| 59 | #include <cstring> // for memcpy | |
| 60 | #include <cwchar> // for wmemcpy | |
| 59 | 61 | #include <memory> // for __murmur2_or_cityhash |
| 60 | 62 | |
| 61 | 63 | #include <__debug> |
| ... | ... | @@ -92,7 +94,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 92 | 94 | _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \ |
| 93 | 95 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \ |
| 94 | 96 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \ |
| 95 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, std::allocator<_CharType> const&)) \ | |
| 97 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \ | |
| 96 | 98 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \ |
| 97 | 99 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \ |
| 98 | 100 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \ |
| ... | ... | @@ -108,7 +110,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 108 | 110 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ |
| 109 | 111 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ |
| 110 | 112 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ |
| 111 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \ | |
| 113 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ | |
| 112 | 114 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ |
| 113 | 115 | _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ |
| 114 | 116 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ |
| ... | ... | @@ -158,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 158 | 160 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \ |
| 159 | 161 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \ |
| 160 | 162 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \ |
| 161 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \ | |
| 163 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \ | |
| 162 | 164 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \ |
| 163 | 165 | _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \ |
| 164 | 166 | _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \ |
| ... | ... | @@ -268,7 +270,7 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a |
| 268 | 270 | return __s; |
| 269 | 271 | ++__s; |
| 270 | 272 | } |
| 271 | return 0; | |
| 273 | return nullptr; | |
| 272 | 274 | } |
| 273 | 275 | |
| 274 | 276 | template <class _CharT> |
| ... | ... | @@ -318,7 +320,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) |
| 318 | 320 | // constexpr versions of move/copy/assign. |
| 319 | 321 | |
| 320 | 322 | template <class _CharT> |
| 321 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 323 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 322 | 324 | _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT |
| 323 | 325 | { |
| 324 | 326 | if (__n == 0) return __s1; |
| ... | ... | @@ -331,7 +333,7 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT |
| 331 | 333 | } |
| 332 | 334 | |
| 333 | 335 | template <class _CharT> |
| 334 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 336 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 335 | 337 | _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT |
| 336 | 338 | { |
| 337 | 339 | _VSTD::copy_n(__s2, __n, __s1); |
| ... | ... | @@ -339,7 +341,7 @@ _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT |
| 339 | 341 | } |
| 340 | 342 | |
| 341 | 343 | template <class _CharT> |
| 342 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 344 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 343 | 345 | _CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT |
| 344 | 346 | { |
| 345 | 347 | _VSTD::fill_n(__s, __n, __a); |
| ... | ... | @@ -370,27 +372,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char> |
| 370 | 372 | length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);} |
| 371 | 373 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 372 | 374 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 373 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 375 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 374 | 376 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 375 | 377 | { |
| 376 | 378 | return __libcpp_is_constant_evaluated() |
| 377 | ? __move_constexpr(__s1, __s2, __n) | |
| 378 | : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); | |
| 379 | ? _VSTD::__move_constexpr(__s1, __s2, __n) | |
| 380 | : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); | |
| 379 | 381 | } |
| 380 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 382 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 381 | 383 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 382 | 384 | { |
| 383 | 385 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 384 | 386 | return __libcpp_is_constant_evaluated() |
| 385 | ? __copy_constexpr(__s1, __s2, __n) | |
| 386 | : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 387 | ? _VSTD::__copy_constexpr(__s1, __s2, __n) | |
| 388 | : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); | |
| 387 | 389 | } |
| 388 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 390 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 389 | 391 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT |
| 390 | 392 | { |
| 391 | 393 | return __libcpp_is_constant_evaluated() |
| 392 | ? __assign_constexpr(__s, __n, __a) | |
| 393 | : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); | |
| 394 | ? _VSTD::__assign_constexpr(__s, __n, __a) | |
| 395 | : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); | |
| 394 | 396 | } |
| 395 | 397 | |
| 396 | 398 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| ... | ... | @@ -414,7 +416,7 @@ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t |
| 414 | 416 | #if __has_feature(cxx_constexpr_string_builtins) |
| 415 | 417 | return __builtin_memcmp(__s1, __s2, __n); |
| 416 | 418 | #elif _LIBCPP_STD_VER <= 14 |
| 417 | return memcmp(__s1, __s2, __n); | |
| 419 | return _VSTD::memcmp(__s1, __s2, __n); | |
| 418 | 420 | #else |
| 419 | 421 | for (; __n; --__n, ++__s1, ++__s2) |
| 420 | 422 | { |
| ... | ... | @@ -436,7 +438,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) |
| 436 | 438 | #if __has_feature(cxx_constexpr_string_builtins) |
| 437 | 439 | return __builtin_char_memchr(__s, to_int_type(__a), __n); |
| 438 | 440 | #elif _LIBCPP_STD_VER <= 14 |
| 439 | return (const char_type*) memchr(__s, to_int_type(__a), __n); | |
| 441 | return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n); | |
| 440 | 442 | #else |
| 441 | 443 | for (; __n; --__n) |
| 442 | 444 | { |
| ... | ... | @@ -473,27 +475,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> |
| 473 | 475 | size_t length(const char_type* __s) _NOEXCEPT; |
| 474 | 476 | static _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 475 | 477 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 476 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 478 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 477 | 479 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 478 | 480 | { |
| 479 | 481 | return __libcpp_is_constant_evaluated() |
| 480 | ? __move_constexpr(__s1, __s2, __n) | |
| 481 | : __n == 0 ? __s1 : wmemmove(__s1, __s2, __n); | |
| 482 | ? _VSTD::__move_constexpr(__s1, __s2, __n) | |
| 483 | : __n == 0 ? __s1 : _VSTD::wmemmove(__s1, __s2, __n); | |
| 482 | 484 | } |
| 483 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 485 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 484 | 486 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 485 | 487 | { |
| 486 | 488 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 487 | 489 | return __libcpp_is_constant_evaluated() |
| 488 | ? __copy_constexpr(__s1, __s2, __n) | |
| 489 | : __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n); | |
| 490 | ? _VSTD::__copy_constexpr(__s1, __s2, __n) | |
| 491 | : __n == 0 ? __s1 : _VSTD::wmemcpy(__s1, __s2, __n); | |
| 490 | 492 | } |
| 491 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 493 | static inline _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 492 | 494 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT |
| 493 | 495 | { |
| 494 | 496 | return __libcpp_is_constant_evaluated() |
| 495 | ? __assign_constexpr(__s, __n, __a) | |
| 496 | : __n == 0 ? __s : wmemset(__s, __a, __n); | |
| 497 | ? _VSTD::__assign_constexpr(__s, __n, __a) | |
| 498 | : __n == 0 ? __s : _VSTD::wmemset(__s, __a, __n); | |
| 497 | 499 | } |
| 498 | 500 | static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT |
| 499 | 501 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} |
| ... | ... | @@ -516,7 +518,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size |
| 516 | 518 | #if __has_feature(cxx_constexpr_string_builtins) |
| 517 | 519 | return __builtin_wmemcmp(__s1, __s2, __n); |
| 518 | 520 | #elif _LIBCPP_STD_VER <= 14 |
| 519 | return wmemcmp(__s1, __s2, __n); | |
| 521 | return _VSTD::wmemcmp(__s1, __s2, __n); | |
| 520 | 522 | #else |
| 521 | 523 | for (; __n; --__n, ++__s1, ++__s2) |
| 522 | 524 | { |
| ... | ... | @@ -548,7 +550,7 @@ char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT |
| 548 | 550 | #if __has_feature(cxx_constexpr_string_builtins) |
| 549 | 551 | return __builtin_wcslen(__s); |
| 550 | 552 | #elif _LIBCPP_STD_VER <= 14 |
| 551 | return wcslen(__s); | |
| 553 | return _VSTD::wcslen(__s); | |
| 552 | 554 | #else |
| 553 | 555 | size_t __len = 0; |
| 554 | 556 | for (; !eq(*__s, char_type(0)); ++__s) |
| ... | ... | @@ -566,7 +568,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __ |
| 566 | 568 | #if __has_feature(cxx_constexpr_string_builtins) |
| 567 | 569 | return __builtin_wmemchr(__s, __a, __n); |
| 568 | 570 | #elif _LIBCPP_STD_VER <= 14 |
| 569 | return wmemchr(__s, __a, __n); | |
| 571 | return _VSTD::wmemchr(__s, __a, __n); | |
| 570 | 572 | #else |
| 571 | 573 | for (; __n; --__n) |
| 572 | 574 | { |
| ... | ... | @@ -606,29 +608,29 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> |
| 606 | 608 | _LIBCPP_INLINE_VISIBILITY static constexpr |
| 607 | 609 | const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; |
| 608 | 610 | |
| 609 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 611 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 610 | 612 | char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 611 | 613 | { |
| 612 | 614 | return __libcpp_is_constant_evaluated() |
| 613 | ? __move_constexpr(__s1, __s2, __n) | |
| 614 | : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); | |
| 615 | ? _VSTD::__move_constexpr(__s1, __s2, __n) | |
| 616 | : __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n); | |
| 615 | 617 | } |
| 616 | 618 | |
| 617 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 619 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 618 | 620 | char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT |
| 619 | 621 | { |
| 620 | 622 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); |
| 621 | 623 | return __libcpp_is_constant_evaluated() |
| 622 | ? __copy_constexpr(__s1, __s2, __n) | |
| 623 | : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | |
| 624 | ? _VSTD::__copy_constexpr(__s1, __s2, __n) | |
| 625 | : __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n); | |
| 624 | 626 | } |
| 625 | 627 | |
| 626 | static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 628 | static _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 627 | 629 | char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT |
| 628 | 630 | { |
| 629 | 631 | return __libcpp_is_constant_evaluated() |
| 630 | ? __assign_constexpr(__s, __n, __a) | |
| 631 | : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); | |
| 632 | ? _VSTD::__assign_constexpr(__s, __n, __a) | |
| 633 | : __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n); | |
| 632 | 634 | } |
| 633 | 635 | |
| 634 | 636 | static inline constexpr int_type not_eof(int_type __c) noexcept |
| ... | ... | @@ -683,7 +685,7 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __ |
| 683 | 685 | return __s; |
| 684 | 686 | ++__s; |
| 685 | 687 | } |
| 686 | return 0; | |
| 688 | return nullptr; | |
| 687 | 689 | } |
| 688 | 690 | |
| 689 | 691 | #endif // #_LIBCPP_NO_HAS_CHAR8_T |
| ... | ... | @@ -765,7 +767,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 765 | 767 | return __s; |
| 766 | 768 | ++__s; |
| 767 | 769 | } |
| 768 | return 0; | |
| 770 | return nullptr; | |
| 769 | 771 | } |
| 770 | 772 | |
| 771 | 773 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| ... | ... | @@ -885,7 +887,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _ |
| 885 | 887 | return __s; |
| 886 | 888 | ++__s; |
| 887 | 889 | } |
| 888 | return 0; | |
| 890 | return nullptr; | |
| 889 | 891 | } |
| 890 | 892 | |
| 891 | 893 | inline _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| ... | ... | @@ -943,7 +945,7 @@ __str_find(const _CharT *__p, _SizeT __sz, |
| 943 | 945 | if (__pos >= __sz) |
| 944 | 946 | return __npos; |
| 945 | 947 | const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); |
| 946 | if (__r == 0) | |
| 948 | if (__r == nullptr) | |
| 947 | 949 | return __npos; |
| 948 | 950 | return static_cast<_SizeT>(__r - __p); |
| 949 | 951 | } |
| ... | ... | @@ -972,7 +974,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1, |
| 972 | 974 | |
| 973 | 975 | // Find __f2 the first byte matching in __first1. |
| 974 | 976 | __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); |
| 975 | if (__first1 == 0) | |
| 977 | if (__first1 == nullptr) | |
| 976 | 978 | return __last1; |
| 977 | 979 | |
| 978 | 980 | // It is faster to compare from the first byte of __first1 even if we |
| ... | ... | @@ -1095,7 +1097,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz, |
| 1095 | 1097 | { |
| 1096 | 1098 | const _CharT* __pe = __p + __sz; |
| 1097 | 1099 | for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) |
| 1098 | if (_Traits::find(__s, __n, *__ps) == 0) | |
| 1100 | if (_Traits::find(__s, __n, *__ps) == nullptr) | |
| 1099 | 1101 | return static_cast<_SizeT>(__ps - __p); |
| 1100 | 1102 | } |
| 1101 | 1103 | return __npos; |
| ... | ... | @@ -1129,7 +1131,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz, |
| 1129 | 1131 | else |
| 1130 | 1132 | __pos = __sz; |
| 1131 | 1133 | for (const _CharT* __ps = __p + __pos; __ps != __p;) |
| 1132 | if (_Traits::find(__s, __n, *--__ps) == 0) | |
| 1134 | if (_Traits::find(__s, __n, *--__ps) == nullptr) | |
| 1133 | 1135 | return static_cast<_SizeT>(__ps - __p); |
| 1134 | 1136 | return __npos; |
| 1135 | 1137 | } |
lib/libcxx/include/__threading_support+36-26| ... | ... | @@ -11,10 +11,15 @@ |
| 11 | 11 | #define _LIBCPP_THREADING_SUPPORT |
| 12 | 12 | |
| 13 | 13 | #include <__config> |
| 14 | #include <__availability> | |
| 14 | 15 | #include <chrono> |
| 15 | 16 | #include <iosfwd> |
| 16 | 17 | #include <errno.h> |
| 17 | 18 | |
| 19 | #ifdef __MVS__ | |
| 20 | # include <support/ibm/nanosleep.h> | |
| 21 | #endif | |
| 22 | ||
| 18 | 23 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 19 | 24 | #pragma GCC system_header |
| 20 | 25 | #endif |
| ... | ... | @@ -26,7 +31,7 @@ |
| 26 | 31 | #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) |
| 27 | 32 | # include <pthread.h> |
| 28 | 33 | # include <sched.h> |
| 29 | # ifdef __APPLE__ | |
| 34 | # if defined(__APPLE__) || defined(__MVS__) | |
| 30 | 35 | # define _LIBCPP_NO_NATIVE_SEMAPHORES |
| 31 | 36 | # endif |
| 32 | 37 | # ifndef _LIBCPP_NO_NATIVE_SEMAPHORES |
| ... | ... | @@ -82,11 +87,14 @@ typedef pthread_once_t __libcpp_exec_once_flag; |
| 82 | 87 | #define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT |
| 83 | 88 | |
| 84 | 89 | // Thread id |
| 85 | typedef pthread_t __libcpp_thread_id; | |
| 90 | #if defined(__MVS__) | |
| 91 | typedef unsigned long long __libcpp_thread_id; | |
| 92 | #else | |
| 93 | typedef pthread_t __libcpp_thread_id; | |
| 94 | #endif | |
| 86 | 95 | |
| 87 | 96 | // Thread |
| 88 | #define _LIBCPP_NULL_THREAD 0U | |
| 89 | ||
| 97 | #define _LIBCPP_NULL_THREAD ((__libcpp_thread_t())) | |
| 90 | 98 | typedef pthread_t __libcpp_thread_t; |
| 91 | 99 | |
| 92 | 100 | // Thread Local Storage |
| ... | ... | @@ -278,24 +286,21 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); |
| 278 | 286 | #endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) |
| 279 | 287 | |
| 280 | 288 | struct __libcpp_timed_backoff_policy { |
| 281 | _LIBCPP_THREAD_ABI_VISIBILITY | |
| 282 | bool operator()(chrono::nanoseconds __elapsed) const; | |
| 289 | _LIBCPP_INLINE_VISIBILITY | |
| 290 | bool operator()(chrono::nanoseconds __elapsed) const | |
| 291 | { | |
| 292 | if(__elapsed > chrono::milliseconds(128)) | |
| 293 | __libcpp_thread_sleep_for(chrono::milliseconds(8)); | |
| 294 | else if(__elapsed > chrono::microseconds(64)) | |
| 295 | __libcpp_thread_sleep_for(__elapsed / 2); | |
| 296 | else if(__elapsed > chrono::microseconds(4)) | |
| 297 | __libcpp_thread_yield(); | |
| 298 | else | |
| 299 | {} // poll | |
| 300 | return false; | |
| 301 | } | |
| 283 | 302 | }; |
| 284 | 303 | |
| 285 | inline _LIBCPP_INLINE_VISIBILITY | |
| 286 | bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const | |
| 287 | { | |
| 288 | if(__elapsed > chrono::milliseconds(128)) | |
| 289 | __libcpp_thread_sleep_for(chrono::milliseconds(8)); | |
| 290 | else if(__elapsed > chrono::microseconds(64)) | |
| 291 | __libcpp_thread_sleep_for(__elapsed / 2); | |
| 292 | else if(__elapsed > chrono::microseconds(4)) | |
| 293 | __libcpp_thread_yield(); | |
| 294 | else | |
| 295 | ; // poll | |
| 296 | return false; | |
| 297 | } | |
| 298 | ||
| 299 | 304 | static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64; |
| 300 | 305 | |
| 301 | 306 | template<class _Fn, class _BFn> |
| ... | ... | @@ -484,7 +489,7 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag, |
| 484 | 489 | // Returns non-zero if the thread ids are equal, otherwise 0 |
| 485 | 490 | bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) |
| 486 | 491 | { |
| 487 | return pthread_equal(t1, t2) != 0; | |
| 492 | return t1 == t2; | |
| 488 | 493 | } |
| 489 | 494 | |
| 490 | 495 | // Returns non-zero if t1 < t2, otherwise 0 |
| ... | ... | @@ -495,28 +500,33 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) |
| 495 | 500 | |
| 496 | 501 | // Thread |
| 497 | 502 | bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) { |
| 498 | return *__t == 0; | |
| 503 | return *__t == __libcpp_thread_t(); | |
| 499 | 504 | } |
| 500 | 505 | |
| 501 | 506 | int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), |
| 502 | 507 | void *__arg) |
| 503 | 508 | { |
| 504 | return pthread_create(__t, 0, __func, __arg); | |
| 509 | return pthread_create(__t, nullptr, __func, __arg); | |
| 505 | 510 | } |
| 506 | 511 | |
| 507 | 512 | __libcpp_thread_id __libcpp_thread_get_current_id() |
| 508 | 513 | { |
| 509 | return pthread_self(); | |
| 514 | const __libcpp_thread_t thread = pthread_self(); | |
| 515 | return __libcpp_thread_get_id(&thread); | |
| 510 | 516 | } |
| 511 | 517 | |
| 512 | 518 | __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) |
| 513 | 519 | { |
| 520 | #if defined(__MVS__) | |
| 521 | return __t->__; | |
| 522 | #else | |
| 514 | 523 | return *__t; |
| 524 | #endif | |
| 515 | 525 | } |
| 516 | 526 | |
| 517 | 527 | int __libcpp_thread_join(__libcpp_thread_t *__t) |
| 518 | 528 | { |
| 519 | return pthread_join(*__t, 0); | |
| 529 | return pthread_join(*__t, nullptr); | |
| 520 | 530 | } |
| 521 | 531 | |
| 522 | 532 | int __libcpp_thread_detach(__libcpp_thread_t *__t) |
| ... | ... | @@ -651,7 +661,7 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2) |
| 651 | 661 | |
| 652 | 662 | // Thread |
| 653 | 663 | bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) { |
| 654 | return *__t == 0; | |
| 664 | return __libcpp_thread_get_id(__t) == 0; | |
| 655 | 665 | } |
| 656 | 666 | |
| 657 | 667 | int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), |
lib/libcxx/include/__tree+15-115| ... | ... | @@ -533,19 +533,17 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT |
| 533 | 533 | // node traits |
| 534 | 534 | |
| 535 | 535 | |
| 536 | #ifndef _LIBCPP_CXX03_LANG | |
| 537 | 536 | template <class _Tp> |
| 538 | 537 | struct __is_tree_value_type_imp : false_type {}; |
| 539 | 538 | |
| 540 | 539 | template <class _Key, class _Value> |
| 541 | struct __is_tree_value_type_imp<__value_type<_Key, _Value>> : true_type {}; | |
| 540 | struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {}; | |
| 542 | 541 | |
| 543 | 542 | template <class ..._Args> |
| 544 | 543 | struct __is_tree_value_type : false_type {}; |
| 545 | 544 | |
| 546 | 545 | template <class _One> |
| 547 | 546 | struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {}; |
| 548 | #endif | |
| 549 | 547 | |
| 550 | 548 | template <class _Tp> |
| 551 | 549 | struct __tree_key_value_types { |
| ... | ... | @@ -566,12 +564,10 @@ struct __tree_key_value_types { |
| 566 | 564 | static __container_value_type* __get_ptr(__node_value_type& __n) { |
| 567 | 565 | return _VSTD::addressof(__n); |
| 568 | 566 | } |
| 569 | #ifndef _LIBCPP_CXX03_LANG | |
| 570 | 567 | _LIBCPP_INLINE_VISIBILITY |
| 571 | 568 | static __container_value_type&& __move(__node_value_type& __v) { |
| 572 | 569 | return _VSTD::move(__v); |
| 573 | 570 | } |
| 574 | #endif | |
| 575 | 571 | }; |
| 576 | 572 | |
| 577 | 573 | template <class _Key, class _Tp> |
| ... | ... | @@ -616,12 +612,10 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > { |
| 616 | 612 | return _VSTD::addressof(__n.__get_value()); |
| 617 | 613 | } |
| 618 | 614 | |
| 619 | #ifndef _LIBCPP_CXX03_LANG | |
| 620 | 615 | _LIBCPP_INLINE_VISIBILITY |
| 621 | 616 | static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { |
| 622 | 617 | return __v.__move(); |
| 623 | 618 | } |
| 624 | #endif | |
| 625 | 619 | }; |
| 626 | 620 | |
| 627 | 621 | template <class _VoidPtr> |
| ... | ... | @@ -973,7 +967,7 @@ private: |
| 973 | 967 | |
| 974 | 968 | template<class _Tp, class _Compare> |
| 975 | 969 | #ifndef _LIBCPP_CXX03_LANG |
| 976 | _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value, | |
| 970 | _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value, | |
| 977 | 971 | "the specified comparator type does not provide a viable const call operator") |
| 978 | 972 | #endif |
| 979 | 973 | int __diagnose_non_const_comparator(); |
| ... | ... | @@ -1103,7 +1097,6 @@ public: |
| 1103 | 1097 | void __assign_unique(_ForwardIterator __first, _ForwardIterator __last); |
| 1104 | 1098 | template <class _InputIterator> |
| 1105 | 1099 | void __assign_multi(_InputIterator __first, _InputIterator __last); |
| 1106 | #ifndef _LIBCPP_CXX03_LANG | |
| 1107 | 1100 | __tree(__tree&& __t) |
| 1108 | 1101 | _NOEXCEPT_( |
| 1109 | 1102 | is_nothrow_move_constructible<__node_allocator>::value && |
| ... | ... | @@ -1114,8 +1107,6 @@ public: |
| 1114 | 1107 | __node_traits::propagate_on_container_move_assignment::value && |
| 1115 | 1108 | is_nothrow_move_assignable<value_compare>::value && |
| 1116 | 1109 | is_nothrow_move_assignable<__node_allocator>::value); |
| 1117 | #endif // _LIBCPP_CXX03_LANG | |
| 1118 | ||
| 1119 | 1110 | ~__tree(); |
| 1120 | 1111 | |
| 1121 | 1112 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1129,7 +1120,7 @@ public: |
| 1129 | 1120 | |
| 1130 | 1121 | _LIBCPP_INLINE_VISIBILITY |
| 1131 | 1122 | size_type max_size() const _NOEXCEPT |
| 1132 | {return std::min<size_type>( | |
| 1123 | {return _VSTD::min<size_type>( | |
| 1133 | 1124 | __node_traits::max_size(__node_alloc()), |
| 1134 | 1125 | numeric_limits<difference_type >::max());} |
| 1135 | 1126 | |
| ... | ... | @@ -1146,12 +1137,11 @@ public: |
| 1146 | 1137 | _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value); |
| 1147 | 1138 | #endif |
| 1148 | 1139 | |
| 1149 | #ifndef _LIBCPP_CXX03_LANG | |
| 1150 | 1140 | template <class _Key, class ..._Args> |
| 1151 | 1141 | pair<iterator, bool> |
| 1152 | 1142 | __emplace_unique_key_args(_Key const&, _Args&&... __args); |
| 1153 | 1143 | template <class _Key, class ..._Args> |
| 1154 | iterator | |
| 1144 | pair<iterator, bool> | |
| 1155 | 1145 | __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...); |
| 1156 | 1146 | |
| 1157 | 1147 | template <class... _Args> |
| ... | ... | @@ -1225,7 +1215,7 @@ public: |
| 1225 | 1215 | >::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) { |
| 1226 | 1216 | return __emplace_hint_unique_key_args(__p, __f, |
| 1227 | 1217 | _VSTD::forward<_First>(__f), |
| 1228 | _VSTD::forward<_Second>(__s)); | |
| 1218 | _VSTD::forward<_Second>(__s)).first; | |
| 1229 | 1219 | } |
| 1230 | 1220 | |
| 1231 | 1221 | template <class... _Args> |
| ... | ... | @@ -1245,25 +1235,16 @@ public: |
| 1245 | 1235 | _LIBCPP_INLINE_VISIBILITY |
| 1246 | 1236 | iterator |
| 1247 | 1237 | __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) { |
| 1248 | return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x)); | |
| 1238 | return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x)).first; | |
| 1249 | 1239 | } |
| 1250 | 1240 | |
| 1251 | 1241 | template <class _Pp> |
| 1252 | 1242 | _LIBCPP_INLINE_VISIBILITY |
| 1253 | 1243 | iterator |
| 1254 | 1244 | __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) { |
| 1255 | return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x)); | |
| 1245 | return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x)).first; | |
| 1256 | 1246 | } |
| 1257 | 1247 | |
| 1258 | #else | |
| 1259 | template <class _Key, class _Args> | |
| 1260 | _LIBCPP_INLINE_VISIBILITY | |
| 1261 | pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args); | |
| 1262 | template <class _Key, class _Args> | |
| 1263 | _LIBCPP_INLINE_VISIBILITY | |
| 1264 | iterator __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&); | |
| 1265 | #endif | |
| 1266 | ||
| 1267 | 1248 | _LIBCPP_INLINE_VISIBILITY |
| 1268 | 1249 | pair<iterator, bool> __insert_unique(const __container_value_type& __v) { |
| 1269 | 1250 | return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v); |
| ... | ... | @@ -1271,15 +1252,9 @@ public: |
| 1271 | 1252 | |
| 1272 | 1253 | _LIBCPP_INLINE_VISIBILITY |
| 1273 | 1254 | iterator __insert_unique(const_iterator __p, const __container_value_type& __v) { |
| 1274 | return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v); | |
| 1255 | return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first; | |
| 1275 | 1256 | } |
| 1276 | 1257 | |
| 1277 | #ifdef _LIBCPP_CXX03_LANG | |
| 1278 | _LIBCPP_INLINE_VISIBILITY | |
| 1279 | iterator __insert_multi(const __container_value_type& __v); | |
| 1280 | _LIBCPP_INLINE_VISIBILITY | |
| 1281 | iterator __insert_multi(const_iterator __p, const __container_value_type& __v); | |
| 1282 | #else | |
| 1283 | 1258 | _LIBCPP_INLINE_VISIBILITY |
| 1284 | 1259 | pair<iterator, bool> __insert_unique(__container_value_type&& __v) { |
| 1285 | 1260 | return __emplace_unique_key_args(_NodeTypes::__get_key(__v), _VSTD::move(__v)); |
| ... | ... | @@ -1287,7 +1262,7 @@ public: |
| 1287 | 1262 | |
| 1288 | 1263 | _LIBCPP_INLINE_VISIBILITY |
| 1289 | 1264 | iterator __insert_unique(const_iterator __p, __container_value_type&& __v) { |
| 1290 | return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v)); | |
| 1265 | return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v)).first; | |
| 1291 | 1266 | } |
| 1292 | 1267 | |
| 1293 | 1268 | template <class _Vp, class = typename enable_if< |
| ... | ... | @@ -1332,8 +1307,6 @@ public: |
| 1332 | 1307 | return __emplace_hint_multi(__p, _VSTD::forward<_Vp>(__v)); |
| 1333 | 1308 | } |
| 1334 | 1309 | |
| 1335 | #endif // !_LIBCPP_CXX03_LANG | |
| 1336 | ||
| 1337 | 1310 | _LIBCPP_INLINE_VISIBILITY |
| 1338 | 1311 | pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest); |
| 1339 | 1312 | |
| ... | ... | @@ -1455,7 +1428,7 @@ private: |
| 1455 | 1428 | __node_base_pointer& |
| 1456 | 1429 | __find_leaf(const_iterator __hint, |
| 1457 | 1430 | __parent_pointer& __parent, const key_type& __v); |
| 1458 | // FIXME: Make this function const qualified. Unfortunetly doing so | |
| 1431 | // FIXME: Make this function const qualified. Unfortunately doing so | |
| 1459 | 1432 | // breaks existing code which uses non-const callable comparators. |
| 1460 | 1433 | template <class _Key> |
| 1461 | 1434 | __node_base_pointer& |
| ... | ... | @@ -1471,12 +1444,8 @@ private: |
| 1471 | 1444 | __node_base_pointer& __dummy, |
| 1472 | 1445 | const _Key& __v); |
| 1473 | 1446 | |
| 1474 | #ifndef _LIBCPP_CXX03_LANG | |
| 1475 | 1447 | template <class ..._Args> |
| 1476 | 1448 | __node_holder __construct_node(_Args&& ...__args); |
| 1477 | #else | |
| 1478 | __node_holder __construct_node(const __container_value_type& __v); | |
| 1479 | #endif | |
| 1480 | 1449 | |
| 1481 | 1450 | void destroy(__node_pointer __nd) _NOEXCEPT; |
| 1482 | 1451 | |
| ... | ... | @@ -1706,8 +1675,6 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) |
| 1706 | 1675 | __begin_node() = __end_node(); |
| 1707 | 1676 | } |
| 1708 | 1677 | |
| 1709 | #ifndef _LIBCPP_CXX03_LANG | |
| 1710 | ||
| 1711 | 1678 | template <class _Tp, class _Compare, class _Allocator> |
| 1712 | 1679 | __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) |
| 1713 | 1680 | _NOEXCEPT_( |
| ... | ... | @@ -1814,8 +1781,6 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) |
| 1814 | 1781 | return *this; |
| 1815 | 1782 | } |
| 1816 | 1783 | |
| 1817 | #endif // _LIBCPP_CXX03_LANG | |
| 1818 | ||
| 1819 | 1784 | template <class _Tp, class _Compare, class _Allocator> |
| 1820 | 1785 | __tree<_Tp, _Compare, _Allocator>::~__tree() |
| 1821 | 1786 | { |
| ... | ... | @@ -1854,7 +1819,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) |
| 1854 | 1819 | using _VSTD::swap; |
| 1855 | 1820 | swap(__begin_node_, __t.__begin_node_); |
| 1856 | 1821 | swap(__pair1_.first(), __t.__pair1_.first()); |
| 1857 | __swap_allocator(__node_alloc(), __t.__node_alloc()); | |
| 1822 | _VSTD::__swap_allocator(__node_alloc(), __t.__node_alloc()); | |
| 1858 | 1823 | __pair3_.swap(__t.__pair3_); |
| 1859 | 1824 | if (size() == 0) |
| 1860 | 1825 | __begin_node() = __end_node(); |
| ... | ... | @@ -2117,17 +2082,10 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( |
| 2117 | 2082 | ++size(); |
| 2118 | 2083 | } |
| 2119 | 2084 | |
| 2120 | #ifndef _LIBCPP_CXX03_LANG | |
| 2121 | 2085 | template <class _Tp, class _Compare, class _Allocator> |
| 2122 | 2086 | template <class _Key, class... _Args> |
| 2123 | 2087 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> |
| 2124 | 2088 | __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) |
| 2125 | #else | |
| 2126 | template <class _Tp, class _Compare, class _Allocator> | |
| 2127 | template <class _Key, class _Args> | |
| 2128 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> | |
| 2129 | __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args& __args) | |
| 2130 | #endif | |
| 2131 | 2089 | { |
| 2132 | 2090 | __parent_pointer __parent; |
| 2133 | 2091 | __node_base_pointer& __child = __find_equal(__parent, __k); |
| ... | ... | @@ -2135,11 +2093,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A |
| 2135 | 2093 | bool __inserted = false; |
| 2136 | 2094 | if (__child == nullptr) |
| 2137 | 2095 | { |
| 2138 | #ifndef _LIBCPP_CXX03_LANG | |
| 2139 | 2096 | __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); |
| 2140 | #else | |
| 2141 | __node_holder __h = __construct_node(__args); | |
| 2142 | #endif | |
| 2143 | 2097 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); |
| 2144 | 2098 | __r = __h.release(); |
| 2145 | 2099 | __inserted = true; |
| ... | ... | @@ -2147,41 +2101,27 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A |
| 2147 | 2101 | return pair<iterator, bool>(iterator(__r), __inserted); |
| 2148 | 2102 | } |
| 2149 | 2103 | |
| 2150 | ||
| 2151 | #ifndef _LIBCPP_CXX03_LANG | |
| 2152 | 2104 | template <class _Tp, class _Compare, class _Allocator> |
| 2153 | 2105 | template <class _Key, class... _Args> |
| 2154 | typename __tree<_Tp, _Compare, _Allocator>::iterator | |
| 2106 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> | |
| 2155 | 2107 | __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args( |
| 2156 | 2108 | const_iterator __p, _Key const& __k, _Args&&... __args) |
| 2157 | #else | |
| 2158 | template <class _Tp, class _Compare, class _Allocator> | |
| 2159 | template <class _Key, class _Args> | |
| 2160 | typename __tree<_Tp, _Compare, _Allocator>::iterator | |
| 2161 | __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args( | |
| 2162 | const_iterator __p, _Key const& __k, _Args& __args) | |
| 2163 | #endif | |
| 2164 | 2109 | { |
| 2165 | 2110 | __parent_pointer __parent; |
| 2166 | 2111 | __node_base_pointer __dummy; |
| 2167 | 2112 | __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k); |
| 2168 | 2113 | __node_pointer __r = static_cast<__node_pointer>(__child); |
| 2114 | bool __inserted = false; | |
| 2169 | 2115 | if (__child == nullptr) |
| 2170 | 2116 | { |
| 2171 | #ifndef _LIBCPP_CXX03_LANG | |
| 2172 | 2117 | __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); |
| 2173 | #else | |
| 2174 | __node_holder __h = __construct_node(__args); | |
| 2175 | #endif | |
| 2176 | 2118 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); |
| 2177 | 2119 | __r = __h.release(); |
| 2120 | __inserted = true; | |
| 2178 | 2121 | } |
| 2179 | return iterator(__r); | |
| 2122 | return pair<iterator, bool>(iterator(__r), __inserted); | |
| 2180 | 2123 | } |
| 2181 | 2124 | |
| 2182 | ||
| 2183 | #ifndef _LIBCPP_CXX03_LANG | |
| 2184 | ||
| 2185 | 2125 | template <class _Tp, class _Compare, class _Allocator> |
| 2186 | 2126 | template <class ..._Args> |
| 2187 | 2127 | typename __tree<_Tp, _Compare, _Allocator>::__node_holder |
| ... | ... | @@ -2259,46 +2199,6 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, |
| 2259 | 2199 | return iterator(static_cast<__node_pointer>(__h.release())); |
| 2260 | 2200 | } |
| 2261 | 2201 | |
| 2262 | ||
| 2263 | #else // _LIBCPP_CXX03_LANG | |
| 2264 | ||
| 2265 | template <class _Tp, class _Compare, class _Allocator> | |
| 2266 | typename __tree<_Tp, _Compare, _Allocator>::__node_holder | |
| 2267 | __tree<_Tp, _Compare, _Allocator>::__construct_node(const __container_value_type& __v) | |
| 2268 | { | |
| 2269 | __node_allocator& __na = __node_alloc(); | |
| 2270 | __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); | |
| 2271 | __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v); | |
| 2272 | __h.get_deleter().__value_constructed = true; | |
| 2273 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 2274 | } | |
| 2275 | ||
| 2276 | #endif // _LIBCPP_CXX03_LANG | |
| 2277 | ||
| 2278 | #ifdef _LIBCPP_CXX03_LANG | |
| 2279 | template <class _Tp, class _Compare, class _Allocator> | |
| 2280 | typename __tree<_Tp, _Compare, _Allocator>::iterator | |
| 2281 | __tree<_Tp, _Compare, _Allocator>::__insert_multi(const __container_value_type& __v) | |
| 2282 | { | |
| 2283 | __parent_pointer __parent; | |
| 2284 | __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__v)); | |
| 2285 | __node_holder __h = __construct_node(__v); | |
| 2286 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | |
| 2287 | return iterator(__h.release()); | |
| 2288 | } | |
| 2289 | ||
| 2290 | template <class _Tp, class _Compare, class _Allocator> | |
| 2291 | typename __tree<_Tp, _Compare, _Allocator>::iterator | |
| 2292 | __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __container_value_type& __v) | |
| 2293 | { | |
| 2294 | __parent_pointer __parent; | |
| 2295 | __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__v)); | |
| 2296 | __node_holder __h = __construct_node(__v); | |
| 2297 | __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); | |
| 2298 | return iterator(__h.release()); | |
| 2299 | } | |
| 2300 | #endif | |
| 2301 | ||
| 2302 | 2202 | template <class _Tp, class _Compare, class _Allocator> |
| 2303 | 2203 | pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> |
| 2304 | 2204 | __tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd) |
lib/libcxx/include/algorithm+273-248| ... | ... | @@ -47,16 +47,16 @@ template <class InputIterator, class Predicate> |
| 47 | 47 | find_if(InputIterator first, InputIterator last, Predicate pred); |
| 48 | 48 | |
| 49 | 49 | template<class InputIterator, class Predicate> |
| 50 | InputIterator // constexpr in C++20 | |
| 50 | constexpr InputIterator // constexpr in C++20 | |
| 51 | 51 | find_if_not(InputIterator first, InputIterator last, Predicate pred); |
| 52 | 52 | |
| 53 | 53 | template <class ForwardIterator1, class ForwardIterator2> |
| 54 | ForwardIterator1 // constexpr in C++20 | |
| 54 | constexpr ForwardIterator1 // constexpr in C++20 | |
| 55 | 55 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 56 | 56 | ForwardIterator2 first2, ForwardIterator2 last2); |
| 57 | 57 | |
| 58 | 58 | template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> |
| 59 | ForwardIterator1 // constexpr in C++20 | |
| 59 | constexpr ForwardIterator1 // constexpr in C++20 | |
| 60 | 60 | find_end(ForwardIterator1 first1, ForwardIterator1 last1, |
| 61 | 61 | ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); |
| 62 | 62 | |
| ... | ... | @@ -185,11 +185,11 @@ template <class BidirectionalIterator1, class BidirectionalIterator2> |
| 185 | 185 | BidirectionalIterator2 result); |
| 186 | 186 | |
| 187 | 187 | template <class ForwardIterator1, class ForwardIterator2> |
| 188 | ForwardIterator2 | |
| 188 | constexpr ForwardIterator2 // constexpr in C++20 | |
| 189 | 189 | swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); |
| 190 | 190 | |
| 191 | 191 | template <class ForwardIterator1, class ForwardIterator2> |
| 192 | void | |
| 192 | constexpr void // constexpr in C++20 | |
| 193 | 193 | iter_swap(ForwardIterator1 a, ForwardIterator2 b); |
| 194 | 194 | |
| 195 | 195 | template <class InputIterator, class OutputIterator, class UnaryOperation> |
| ... | ... | @@ -251,19 +251,19 @@ template <class InputIterator, class OutputIterator, class Predicate> |
| 251 | 251 | remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred); |
| 252 | 252 | |
| 253 | 253 | template <class ForwardIterator> |
| 254 | ForwardIterator | |
| 254 | constexpr ForwardIterator // constexpr in C++20 | |
| 255 | 255 | unique(ForwardIterator first, ForwardIterator last); |
| 256 | 256 | |
| 257 | 257 | template <class ForwardIterator, class BinaryPredicate> |
| 258 | ForwardIterator | |
| 258 | constexpr ForwardIterator // constexpr in C++20 | |
| 259 | 259 | unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); |
| 260 | 260 | |
| 261 | 261 | template <class InputIterator, class OutputIterator> |
| 262 | OutputIterator | |
| 262 | constexpr OutputIterator // constexpr in C++20 | |
| 263 | 263 | unique_copy(InputIterator first, InputIterator last, OutputIterator result); |
| 264 | 264 | |
| 265 | 265 | template <class InputIterator, class OutputIterator, class BinaryPredicate> |
| 266 | OutputIterator | |
| 266 | constexpr OutputIterator // constexpr in C++20 | |
| 267 | 267 | unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred); |
| 268 | 268 | |
| 269 | 269 | template <class BidirectionalIterator> |
| ... | ... | @@ -275,11 +275,11 @@ template <class BidirectionalIterator, class OutputIterator> |
| 275 | 275 | reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result); |
| 276 | 276 | |
| 277 | 277 | template <class ForwardIterator> |
| 278 | ForwardIterator | |
| 278 | constexpr ForwardIterator // constexpr in C++20 | |
| 279 | 279 | rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last); |
| 280 | 280 | |
| 281 | 281 | template <class ForwardIterator, class OutputIterator> |
| 282 | OutputIterator | |
| 282 | constexpr OutputIterator // constexpr in C++20 | |
| 283 | 283 | rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); |
| 284 | 284 | |
| 285 | 285 | template <class RandomAccessIterator> |
| ... | ... | @@ -329,7 +329,7 @@ template <class ForwardIterator> |
| 329 | 329 | is_sorted(ForwardIterator first, ForwardIterator last); |
| 330 | 330 | |
| 331 | 331 | template <class ForwardIterator, class Compare> |
| 332 | bool | |
| 332 | constexpr bool // constexpr in C++20 | |
| 333 | 333 | is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); |
| 334 | 334 | |
| 335 | 335 | template<class ForwardIterator> |
| ... | ... | @@ -415,12 +415,12 @@ template <class ForwardIterator, class T, class Compare> |
| 415 | 415 | binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp); |
| 416 | 416 | |
| 417 | 417 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
| 418 | OutputIterator | |
| 418 | constexpr OutputIterator // constexpr in C++20 | |
| 419 | 419 | merge(InputIterator1 first1, InputIterator1 last1, |
| 420 | 420 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 421 | 421 | |
| 422 | 422 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
| 423 | OutputIterator | |
| 423 | constexpr OutputIterator // constexpr in C++20 | |
| 424 | 424 | merge(InputIterator1 first1, InputIterator1 last1, |
| 425 | 425 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 426 | 426 | |
| ... | ... | @@ -441,12 +441,12 @@ template <class InputIterator1, class InputIterator2, class Compare> |
| 441 | 441 | includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); |
| 442 | 442 | |
| 443 | 443 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
| 444 | OutputIterator | |
| 444 | constexpr OutputIterator // constexpr in C++20 | |
| 445 | 445 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 446 | 446 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 447 | 447 | |
| 448 | 448 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
| 449 | OutputIterator | |
| 449 | constexpr OutputIterator // constexpr in C++20 | |
| 450 | 450 | set_union(InputIterator1 first1, InputIterator1 last1, |
| 451 | 451 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 452 | 452 | |
| ... | ... | @@ -461,22 +461,22 @@ template <class InputIterator1, class InputIterator2, class OutputIterator, clas |
| 461 | 461 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 462 | 462 | |
| 463 | 463 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
| 464 | OutputIterator | |
| 464 | constexpr OutputIterator // constexpr in C++20 | |
| 465 | 465 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 466 | 466 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 467 | 467 | |
| 468 | 468 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
| 469 | OutputIterator | |
| 469 | constexpr OutputIterator // constexpr in C++20 | |
| 470 | 470 | set_difference(InputIterator1 first1, InputIterator1 last1, |
| 471 | 471 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 472 | 472 | |
| 473 | 473 | template <class InputIterator1, class InputIterator2, class OutputIterator> |
| 474 | OutputIterator | |
| 474 | constexpr OutputIterator // constexpr in C++20 | |
| 475 | 475 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 476 | 476 | InputIterator2 first2, InputIterator2 last2, OutputIterator result); |
| 477 | 477 | |
| 478 | 478 | template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare> |
| 479 | OutputIterator | |
| 479 | constexpr OutputIterator // constexpr in C++20 | |
| 480 | 480 | set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, |
| 481 | 481 | InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); |
| 482 | 482 | |
| ... | ... | @@ -529,82 +529,82 @@ template <class RandomAccessIterator, class Compare> |
| 529 | 529 | is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp); |
| 530 | 530 | |
| 531 | 531 | template <class ForwardIterator> |
| 532 | ForwardIterator | |
| 533 | min_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 | |
| 532 | constexpr ForwardIterator // constexpr in C++14 | |
| 533 | min_element(ForwardIterator first, ForwardIterator last); | |
| 534 | 534 | |
| 535 | 535 | template <class ForwardIterator, class Compare> |
| 536 | ForwardIterator | |
| 537 | min_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 | |
| 536 | constexpr ForwardIterator // constexpr in C++14 | |
| 537 | min_element(ForwardIterator first, ForwardIterator last, Compare comp); | |
| 538 | 538 | |
| 539 | 539 | template <class T> |
| 540 | const T& | |
| 541 | min(const T& a, const T& b); // constexpr in C++14 | |
| 540 | constexpr const T& // constexpr in C++14 | |
| 541 | min(const T& a, const T& b); | |
| 542 | 542 | |
| 543 | 543 | template <class T, class Compare> |
| 544 | const T& | |
| 545 | min(const T& a, const T& b, Compare comp); // constexpr in C++14 | |
| 544 | constexpr const T& // constexpr in C++14 | |
| 545 | min(const T& a, const T& b, Compare comp); | |
| 546 | 546 | |
| 547 | 547 | template<class T> |
| 548 | T | |
| 549 | min(initializer_list<T> t); // constexpr in C++14 | |
| 548 | constexpr T // constexpr in C++14 | |
| 549 | min(initializer_list<T> t); | |
| 550 | 550 | |
| 551 | 551 | template<class T, class Compare> |
| 552 | T | |
| 553 | min(initializer_list<T> t, Compare comp); // constexpr in C++14 | |
| 552 | constexpr T // constexpr in C++14 | |
| 553 | min(initializer_list<T> t, Compare comp); | |
| 554 | 554 | |
| 555 | 555 | template<class T> |
| 556 | constexpr const T& clamp( const T& v, const T& lo, const T& hi ); // C++17 | |
| 556 | constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17 | |
| 557 | 557 | |
| 558 | 558 | template<class T, class Compare> |
| 559 | constexpr const T& clamp( const T& v, const T& lo, const T& hi, Compare comp ); // C++17 | |
| 559 | constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17 | |
| 560 | 560 | |
| 561 | 561 | template <class ForwardIterator> |
| 562 | ForwardIterator | |
| 563 | max_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 | |
| 562 | constexpr ForwardIterator // constexpr in C++14 | |
| 563 | max_element(ForwardIterator first, ForwardIterator last); | |
| 564 | 564 | |
| 565 | 565 | template <class ForwardIterator, class Compare> |
| 566 | ForwardIterator | |
| 567 | max_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 | |
| 566 | constexpr ForwardIterator // constexpr in C++14 | |
| 567 | max_element(ForwardIterator first, ForwardIterator last, Compare comp); | |
| 568 | 568 | |
| 569 | 569 | template <class T> |
| 570 | const T& | |
| 571 | max(const T& a, const T& b); // constexpr in C++14 | |
| 570 | constexpr const T& // constexpr in C++14 | |
| 571 | max(const T& a, const T& b); | |
| 572 | 572 | |
| 573 | 573 | template <class T, class Compare> |
| 574 | const T& | |
| 575 | max(const T& a, const T& b, Compare comp); // constexpr in C++14 | |
| 574 | constexpr const T& // constexpr in C++14 | |
| 575 | max(const T& a, const T& b, Compare comp); | |
| 576 | 576 | |
| 577 | 577 | template<class T> |
| 578 | T | |
| 579 | max(initializer_list<T> t); // constexpr in C++14 | |
| 578 | constexpr T // constexpr in C++14 | |
| 579 | max(initializer_list<T> t); | |
| 580 | 580 | |
| 581 | 581 | template<class T, class Compare> |
| 582 | T | |
| 583 | max(initializer_list<T> t, Compare comp); // constexpr in C++14 | |
| 582 | constexpr T // constexpr in C++14 | |
| 583 | max(initializer_list<T> t, Compare comp); | |
| 584 | 584 | |
| 585 | 585 | template<class ForwardIterator> |
| 586 | pair<ForwardIterator, ForwardIterator> | |
| 587 | minmax_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14 | |
| 586 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 | |
| 587 | minmax_element(ForwardIterator first, ForwardIterator last); | |
| 588 | 588 | |
| 589 | 589 | template<class ForwardIterator, class Compare> |
| 590 | pair<ForwardIterator, ForwardIterator> | |
| 591 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14 | |
| 590 | constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14 | |
| 591 | minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); | |
| 592 | 592 | |
| 593 | 593 | template<class T> |
| 594 | pair<const T&, const T&> | |
| 595 | minmax(const T& a, const T& b); // constexpr in C++14 | |
| 594 | constexpr pair<const T&, const T&> // constexpr in C++14 | |
| 595 | minmax(const T& a, const T& b); | |
| 596 | 596 | |
| 597 | 597 | template<class T, class Compare> |
| 598 | pair<const T&, const T&> | |
| 599 | minmax(const T& a, const T& b, Compare comp); // constexpr in C++14 | |
| 598 | constexpr pair<const T&, const T&> // constexpr in C++14 | |
| 599 | minmax(const T& a, const T& b, Compare comp); | |
| 600 | 600 | |
| 601 | 601 | template<class T> |
| 602 | pair<T, T> | |
| 603 | minmax(initializer_list<T> t); // constexpr in C++14 | |
| 602 | constexpr pair<T, T> // constexpr in C++14 | |
| 603 | minmax(initializer_list<T> t); | |
| 604 | 604 | |
| 605 | 605 | template<class T, class Compare> |
| 606 | pair<T, T> | |
| 607 | minmax(initializer_list<T> t, Compare comp); // constexpr in C++14 | |
| 606 | constexpr pair<T, T> // constexpr in C++14 | |
| 607 | minmax(initializer_list<T> t, Compare comp); | |
| 608 | 608 | |
| 609 | 609 | template <class InputIterator1, class InputIterator2> |
| 610 | 610 | constexpr bool // constexpr in C++20 |
| ... | ... | @@ -895,7 +895,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 895 | 895 | _InputIterator |
| 896 | 896 | for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) |
| 897 | 897 | { |
| 898 | typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; | |
| 898 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; | |
| 899 | 899 | _IntegralSize __n = __orig_n; |
| 900 | 900 | while (__n > 0) |
| 901 | 901 | { |
| ... | ... | @@ -1614,7 +1614,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, |
| 1614 | 1614 | _Size __count, const _Tp& __value_, _BinaryPredicate __pred) |
| 1615 | 1615 | { |
| 1616 | 1616 | return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type> |
| 1617 | (__first, __last, __convert_to_integral(__count), __value_, __pred, | |
| 1617 | (__first, __last, _VSTD::__convert_to_integral(__count), __value_, __pred, | |
| 1618 | 1618 | typename iterator_traits<_ForwardIterator>::iterator_category()); |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| ... | ... | @@ -1625,13 +1625,13 @@ _ForwardIterator |
| 1625 | 1625 | search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) |
| 1626 | 1626 | { |
| 1627 | 1627 | typedef typename iterator_traits<_ForwardIterator>::value_type __v; |
| 1628 | return _VSTD::search_n(__first, __last, __convert_to_integral(__count), | |
| 1628 | return _VSTD::search_n(__first, __last, _VSTD::__convert_to_integral(__count), | |
| 1629 | 1629 | __value_, __equal_to<__v, _Tp>()); |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | // copy |
| 1633 | 1633 | template <class _Iter> |
| 1634 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1634 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 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 _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1642 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1643 | 1643 | typename enable_if |
| 1644 | 1644 | < |
| 1645 | 1645 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1653,7 +1653,7 @@ __unwrap_iter(move_iterator<_Tp*> __i) |
| 1653 | 1653 | #if _LIBCPP_DEBUG_LEVEL < 2 |
| 1654 | 1654 | |
| 1655 | 1655 | template <class _Tp> |
| 1656 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1656 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1657 | 1657 | typename enable_if |
| 1658 | 1658 | < |
| 1659 | 1659 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1665,7 +1665,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i) |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | template <class _Tp> |
| 1668 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1668 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1669 | 1669 | typename enable_if |
| 1670 | 1670 | < |
| 1671 | 1671 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1679,7 +1679,7 @@ __unwrap_iter(__wrap_iter<const _Tp*> __i) |
| 1679 | 1679 | #else |
| 1680 | 1680 | |
| 1681 | 1681 | template <class _Tp> |
| 1682 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1682 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1683 | 1683 | typename enable_if |
| 1684 | 1684 | < |
| 1685 | 1685 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1707,7 +1707,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1707 | 1707 | _OutputIterator |
| 1708 | 1708 | __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 1709 | 1709 | { |
| 1710 | return __copy_constexpr(__first, __last, __result); | |
| 1710 | return _VSTD::__copy_constexpr(__first, __last, __result); | |
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | template <class _Tp, class _Up> |
| ... | ... | @@ -1727,16 +1727,16 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result) |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | template <class _InputIterator, class _OutputIterator> |
| 1730 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1730 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1731 | 1731 | _OutputIterator |
| 1732 | 1732 | copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 1733 | 1733 | { |
| 1734 | 1734 | if (__libcpp_is_constant_evaluated()) { |
| 1735 | 1735 | return _VSTD::__copy_constexpr( |
| 1736 | __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1736 | _VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _VSTD::__unwrap_iter(__result)); | |
| 1737 | 1737 | } else { |
| 1738 | 1738 | return _VSTD::__copy( |
| 1739 | __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1739 | _VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _VSTD::__unwrap_iter(__result)); | |
| 1740 | 1740 | } |
| 1741 | 1741 | } |
| 1742 | 1742 | |
| ... | ... | @@ -1757,7 +1757,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1757 | 1757 | _OutputIterator |
| 1758 | 1758 | __copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) |
| 1759 | 1759 | { |
| 1760 | return __copy_backward_constexpr(__first, __last, __result); | |
| 1760 | return _VSTD::__copy_backward_constexpr(__first, __last, __result); | |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | 1763 | template <class _Tp, class _Up> |
| ... | ... | @@ -1780,19 +1780,19 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result) |
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | 1782 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 1783 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1783 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1784 | 1784 | _BidirectionalIterator2 |
| 1785 | 1785 | copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, |
| 1786 | 1786 | _BidirectionalIterator2 __result) |
| 1787 | 1787 | { |
| 1788 | 1788 | if (__libcpp_is_constant_evaluated()) { |
| 1789 | return _VSTD::__copy_backward_constexpr(__unwrap_iter(__first), | |
| 1790 | __unwrap_iter(__last), | |
| 1791 | __unwrap_iter(__result)); | |
| 1789 | return _VSTD::__copy_backward_constexpr(_VSTD::__unwrap_iter(__first), | |
| 1790 | _VSTD::__unwrap_iter(__last), | |
| 1791 | _VSTD::__unwrap_iter(__result)); | |
| 1792 | 1792 | } else { |
| 1793 | return _VSTD::__copy_backward(__unwrap_iter(__first), | |
| 1794 | __unwrap_iter(__last), | |
| 1795 | __unwrap_iter(__result)); | |
| 1793 | return _VSTD::__copy_backward(_VSTD::__unwrap_iter(__first), | |
| 1794 | _VSTD::__unwrap_iter(__last), | |
| 1795 | _VSTD::__unwrap_iter(__result)); | |
| 1796 | 1796 | } |
| 1797 | 1797 | } |
| 1798 | 1798 | |
| ... | ... | @@ -1818,7 +1818,7 @@ copy_if(_InputIterator __first, _InputIterator __last, |
| 1818 | 1818 | // copy_n |
| 1819 | 1819 | |
| 1820 | 1820 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 1821 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1821 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1822 | 1822 | typename enable_if |
| 1823 | 1823 | < |
| 1824 | 1824 | __is_cpp17_input_iterator<_InputIterator>::value && |
| ... | ... | @@ -1827,7 +1827,7 @@ typename enable_if |
| 1827 | 1827 | >::type |
| 1828 | 1828 | copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| 1829 | 1829 | { |
| 1830 | typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; | |
| 1830 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; | |
| 1831 | 1831 | _IntegralSize __n = __orig_n; |
| 1832 | 1832 | if (__n > 0) |
| 1833 | 1833 | { |
| ... | ... | @@ -1844,7 +1844,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | 1846 | template<class _InputIterator, class _Size, class _OutputIterator> |
| 1847 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED | |
| 1847 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1848 | 1848 | typename enable_if |
| 1849 | 1849 | < |
| 1850 | 1850 | __is_cpp17_random_access_iterator<_InputIterator>::value, |
| ... | ... | @@ -1852,25 +1852,35 @@ typename enable_if |
| 1852 | 1852 | >::type |
| 1853 | 1853 | copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) |
| 1854 | 1854 | { |
| 1855 | typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; | |
| 1855 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; | |
| 1856 | 1856 | _IntegralSize __n = __orig_n; |
| 1857 | 1857 | return _VSTD::copy(__first, __first + __n, __result); |
| 1858 | 1858 | } |
| 1859 | 1859 | |
| 1860 | 1860 | // move |
| 1861 | 1861 | |
| 1862 | // __move_constexpr exists so that __move doesn't call itself when delegating to the constexpr | |
| 1863 | // version of __move. | |
| 1862 | 1864 | template <class _InputIterator, class _OutputIterator> |
| 1863 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1865 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1864 | 1866 | _OutputIterator |
| 1865 | __move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1867 | __move_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1866 | 1868 | { |
| 1867 | 1869 | for (; __first != __last; ++__first, (void) ++__result) |
| 1868 | 1870 | *__result = _VSTD::move(*__first); |
| 1869 | 1871 | return __result; |
| 1870 | 1872 | } |
| 1871 | 1873 | |
| 1874 | template <class _InputIterator, class _OutputIterator> | |
| 1875 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1876 | _OutputIterator | |
| 1877 | __move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1878 | { | |
| 1879 | return _VSTD::__move_constexpr(__first, __last, __result); | |
| 1880 | } | |
| 1881 | ||
| 1872 | 1882 | template <class _Tp, class _Up> |
| 1873 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1883 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1874 | 1884 | typename enable_if |
| 1875 | 1885 | < |
| 1876 | 1886 | is_same<typename remove_const<_Tp>::type, _Up>::value && |
| ... | ... | @@ -1879,6 +1889,8 @@ typename enable_if |
| 1879 | 1889 | >::type |
| 1880 | 1890 | __move(_Tp* __first, _Tp* __last, _Up* __result) |
| 1881 | 1891 | { |
| 1892 | if (__libcpp_is_constant_evaluated()) | |
| 1893 | return _VSTD::__move_constexpr(__first, __last, __result); | |
| 1882 | 1894 | const size_t __n = static_cast<size_t>(__last - __first); |
| 1883 | 1895 | if (__n > 0) |
| 1884 | 1896 | _VSTD::memmove(__result, __first, __n * sizeof(_Up)); |
| ... | ... | @@ -1886,27 +1898,37 @@ __move(_Tp* __first, _Tp* __last, _Up* __result) |
| 1886 | 1898 | } |
| 1887 | 1899 | |
| 1888 | 1900 | template <class _InputIterator, class _OutputIterator> |
| 1889 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1901 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1890 | 1902 | _OutputIterator |
| 1891 | 1903 | move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 1892 | 1904 | { |
| 1893 | return _VSTD::__move(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1905 | return _VSTD::__move(_VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _VSTD::__unwrap_iter(__result)); | |
| 1894 | 1906 | } |
| 1895 | 1907 | |
| 1896 | 1908 | // move_backward |
| 1897 | 1909 | |
| 1910 | // __move_backward_constexpr exists so that __move_backward doesn't call itself when delegating to | |
| 1911 | // the constexpr version of __move_backward. | |
| 1898 | 1912 | template <class _InputIterator, class _OutputIterator> |
| 1899 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1913 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1900 | 1914 | _OutputIterator |
| 1901 | __move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1915 | __move_backward_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1902 | 1916 | { |
| 1903 | 1917 | while (__first != __last) |
| 1904 | 1918 | *--__result = _VSTD::move(*--__last); |
| 1905 | 1919 | return __result; |
| 1906 | 1920 | } |
| 1907 | 1921 | |
| 1922 | template <class _InputIterator, class _OutputIterator> | |
| 1923 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1924 | _OutputIterator | |
| 1925 | __move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) | |
| 1926 | { | |
| 1927 | return _VSTD::__move_backward_constexpr(__first, __last, __result); | |
| 1928 | } | |
| 1929 | ||
| 1908 | 1930 | template <class _Tp, class _Up> |
| 1909 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1931 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 1910 | 1932 | typename enable_if |
| 1911 | 1933 | < |
| 1912 | 1934 | is_same<typename remove_const<_Tp>::type, _Up>::value && |
| ... | ... | @@ -1915,6 +1937,8 @@ typename enable_if |
| 1915 | 1937 | >::type |
| 1916 | 1938 | __move_backward(_Tp* __first, _Tp* __last, _Up* __result) |
| 1917 | 1939 | { |
| 1940 | if (__libcpp_is_constant_evaluated()) | |
| 1941 | return _VSTD::__move_backward_constexpr(__first, __last, __result); | |
| 1918 | 1942 | const size_t __n = static_cast<size_t>(__last - __first); |
| 1919 | 1943 | if (__n > 0) |
| 1920 | 1944 | { |
| ... | ... | @@ -1925,12 +1949,12 @@ __move_backward(_Tp* __first, _Tp* __last, _Up* __result) |
| 1925 | 1949 | } |
| 1926 | 1950 | |
| 1927 | 1951 | template <class _BidirectionalIterator1, class _BidirectionalIterator2> |
| 1928 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1952 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1929 | 1953 | _BidirectionalIterator2 |
| 1930 | 1954 | move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, |
| 1931 | 1955 | _BidirectionalIterator2 __result) |
| 1932 | 1956 | { |
| 1933 | return _VSTD::__move_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); | |
| 1957 | return _VSTD::__move_backward(_VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _VSTD::__unwrap_iter(__result)); | |
| 1934 | 1958 | } |
| 1935 | 1959 | |
| 1936 | 1960 | // iter_swap |
| ... | ... | @@ -2033,7 +2057,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 2033 | 2057 | _OutputIterator |
| 2034 | 2058 | fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) |
| 2035 | 2059 | { |
| 2036 | return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_); | |
| 2060 | return _VSTD::__fill_n(__first, _VSTD::__convert_to_integral(__n), __value_); | |
| 2037 | 2061 | } |
| 2038 | 2062 | |
| 2039 | 2063 | // fill |
| ... | ... | @@ -2081,7 +2105,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 2081 | 2105 | _OutputIterator |
| 2082 | 2106 | generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) |
| 2083 | 2107 | { |
| 2084 | typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; | |
| 2108 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; | |
| 2085 | 2109 | _IntegralSize __n = __orig_n; |
| 2086 | 2110 | for (; __n > 0; ++__first, (void) --__n) |
| 2087 | 2111 | *__first = __gen(); |
| ... | ... | @@ -2333,7 +2357,7 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out |
| 2333 | 2357 | // rotate |
| 2334 | 2358 | |
| 2335 | 2359 | template <class _ForwardIterator> |
| 2336 | _ForwardIterator | |
| 2360 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 2337 | 2361 | __rotate_left(_ForwardIterator __first, _ForwardIterator __last) |
| 2338 | 2362 | { |
| 2339 | 2363 | typedef typename iterator_traits<_ForwardIterator>::value_type value_type; |
| ... | ... | @@ -2344,7 +2368,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last) |
| 2344 | 2368 | } |
| 2345 | 2369 | |
| 2346 | 2370 | template <class _BidirectionalIterator> |
| 2347 | _BidirectionalIterator | |
| 2371 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator | |
| 2348 | 2372 | __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 2349 | 2373 | { |
| 2350 | 2374 | typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; |
| ... | ... | @@ -2356,7 +2380,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) |
| 2356 | 2380 | } |
| 2357 | 2381 | |
| 2358 | 2382 | template <class _ForwardIterator> |
| 2359 | _ForwardIterator | |
| 2383 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator | |
| 2360 | 2384 | __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) |
| 2361 | 2385 | { |
| 2362 | 2386 | _ForwardIterator __i = __middle; |
| ... | ... | @@ -2392,7 +2416,7 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt |
| 2392 | 2416 | |
| 2393 | 2417 | template<typename _Integral> |
| 2394 | 2418 | inline _LIBCPP_INLINE_VISIBILITY |
| 2395 | _Integral | |
| 2419 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _Integral | |
| 2396 | 2420 | __algo_gcd(_Integral __x, _Integral __y) |
| 2397 | 2421 | { |
| 2398 | 2422 | do |
| ... | ... | @@ -2405,7 +2429,7 @@ __algo_gcd(_Integral __x, _Integral __y) |
| 2405 | 2429 | } |
| 2406 | 2430 | |
| 2407 | 2431 | template<typename _RandomAccessIterator> |
| 2408 | _RandomAccessIterator | |
| 2432 | _LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator | |
| 2409 | 2433 | __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) |
| 2410 | 2434 | { |
| 2411 | 2435 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| ... | ... | @@ -2441,7 +2465,7 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran |
| 2441 | 2465 | |
| 2442 | 2466 | template <class _ForwardIterator> |
| 2443 | 2467 | inline _LIBCPP_INLINE_VISIBILITY |
| 2444 | _ForwardIterator | |
| 2468 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator | |
| 2445 | 2469 | __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, |
| 2446 | 2470 | _VSTD::forward_iterator_tag) |
| 2447 | 2471 | { |
| ... | ... | @@ -2456,7 +2480,7 @@ __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator _ |
| 2456 | 2480 | |
| 2457 | 2481 | template <class _BidirectionalIterator> |
| 2458 | 2482 | inline _LIBCPP_INLINE_VISIBILITY |
| 2459 | _BidirectionalIterator | |
| 2483 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator | |
| 2460 | 2484 | __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, |
| 2461 | 2485 | _VSTD::bidirectional_iterator_tag) |
| 2462 | 2486 | { |
| ... | ... | @@ -2473,7 +2497,7 @@ __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _Bidir |
| 2473 | 2497 | |
| 2474 | 2498 | template <class _RandomAccessIterator> |
| 2475 | 2499 | inline _LIBCPP_INLINE_VISIBILITY |
| 2476 | _RandomAccessIterator | |
| 2500 | _LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator | |
| 2477 | 2501 | __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, |
| 2478 | 2502 | _VSTD::random_access_iterator_tag) |
| 2479 | 2503 | { |
| ... | ... | @@ -2491,7 +2515,7 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA |
| 2491 | 2515 | |
| 2492 | 2516 | template <class _ForwardIterator> |
| 2493 | 2517 | inline _LIBCPP_INLINE_VISIBILITY |
| 2494 | _ForwardIterator | |
| 2518 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator | |
| 2495 | 2519 | rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) |
| 2496 | 2520 | { |
| 2497 | 2521 | if (__first == __middle) |
| ... | ... | @@ -2505,7 +2529,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l |
| 2505 | 2529 | // rotate_copy |
| 2506 | 2530 | |
| 2507 | 2531 | template <class _ForwardIterator, class _OutputIterator> |
| 2508 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2532 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 2509 | 2533 | _OutputIterator |
| 2510 | 2534 | rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) |
| 2511 | 2535 | { |
| ... | ... | @@ -2684,12 +2708,12 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi) |
| 2684 | 2708 | |
| 2685 | 2709 | template <class _ForwardIterator, class _Compare> |
| 2686 | 2710 | _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 2687 | std::pair<_ForwardIterator, _ForwardIterator> | |
| 2711 | pair<_ForwardIterator, _ForwardIterator> | |
| 2688 | 2712 | minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) |
| 2689 | 2713 | { |
| 2690 | 2714 | static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value, |
| 2691 | 2715 | "std::minmax_element requires a ForwardIterator"); |
| 2692 | std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); | |
| 2716 | pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); | |
| 2693 | 2717 | if (__first != __last) |
| 2694 | 2718 | { |
| 2695 | 2719 | if (++__first != __last) |
| ... | ... | @@ -2735,7 +2759,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com |
| 2735 | 2759 | template <class _ForwardIterator> |
| 2736 | 2760 | _LIBCPP_NODISCARD_EXT inline |
| 2737 | 2761 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 2738 | std::pair<_ForwardIterator, _ForwardIterator> | |
| 2762 | pair<_ForwardIterator, _ForwardIterator> | |
| 2739 | 2763 | minmax_element(_ForwardIterator __first, _ForwardIterator __last) |
| 2740 | 2764 | { |
| 2741 | 2765 | return _VSTD::minmax_element(__first, __last, |
| ... | ... | @@ -2774,7 +2798,7 @@ minmax(initializer_list<_Tp> __t, _Compare __comp) |
| 2774 | 2798 | typedef typename initializer_list<_Tp>::const_iterator _Iter; |
| 2775 | 2799 | _Iter __first = __t.begin(); |
| 2776 | 2800 | _Iter __last = __t.end(); |
| 2777 | std::pair<_Tp, _Tp> __result(*__first, *__first); | |
| 2801 | pair<_Tp, _Tp> __result(*__first, *__first); | |
| 2778 | 2802 | |
| 2779 | 2803 | ++__first; |
| 2780 | 2804 | if (__t.size() % 2 == 0) |
| ... | ... | @@ -3050,7 +3074,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 3050 | 3074 | if (_Rp == 0) |
| 3051 | 3075 | return static_cast<result_type>(_Eng(__g, _Dt)()); |
| 3052 | 3076 | size_t __w = _Dt - __libcpp_clz(_Rp) - 1; |
| 3053 | if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) | |
| 3077 | if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) | |
| 3054 | 3078 | ++__w; |
| 3055 | 3079 | _Eng __e(__g, __w); |
| 3056 | 3080 | _UIntType __u; |
| ... | ... | @@ -3380,8 +3404,8 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3380 | 3404 | // Move the falses into the temporary buffer, and the trues to the front of the line |
| 3381 | 3405 | // Update __first to always point to the end of the trues |
| 3382 | 3406 | value_type* __t = __p.first; |
| 3383 | ::new(__t) value_type(_VSTD::move(*__first)); | |
| 3384 | __d.__incr((value_type*)0); | |
| 3407 | ::new ((void*)__t) value_type(_VSTD::move(*__first)); | |
| 3408 | __d.template __incr<value_type>(); | |
| 3385 | 3409 | ++__t; |
| 3386 | 3410 | _ForwardIterator __i = __first; |
| 3387 | 3411 | while (++__i != __last) |
| ... | ... | @@ -3393,8 +3417,8 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3393 | 3417 | } |
| 3394 | 3418 | else |
| 3395 | 3419 | { |
| 3396 | ::new(__t) value_type(_VSTD::move(*__i)); | |
| 3397 | __d.__incr((value_type*)0); | |
| 3420 | ::new ((void*)__t) value_type(_VSTD::move(*__i)); | |
| 3421 | __d.template __incr<value_type>(); | |
| 3398 | 3422 | ++__t; |
| 3399 | 3423 | } |
| 3400 | 3424 | } |
| ... | ... | @@ -3415,7 +3439,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3415 | 3439 | // F????????????????? |
| 3416 | 3440 | // f m l |
| 3417 | 3441 | typedef typename add_lvalue_reference<_Predicate>::type _PredRef; |
| 3418 | _ForwardIterator __first_false = __stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, __fit); | |
| 3442 | _ForwardIterator __first_false = _VSTD::__stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, __fit); | |
| 3419 | 3443 | // TTTFFFFF?????????? |
| 3420 | 3444 | // f ff m l |
| 3421 | 3445 | // recurse on [__m, __last], except increase __m until *(__m) is false, *__last know to be true |
| ... | ... | @@ -3430,7 +3454,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3430 | 3454 | } |
| 3431 | 3455 | // TTTFFFFFTTTF?????? |
| 3432 | 3456 | // f ff m m1 l |
| 3433 | __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __fit); | |
| 3457 | __second_false = _VSTD::__stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __fit); | |
| 3434 | 3458 | __second_half_done: |
| 3435 | 3459 | // TTTFFFFFTTTTTFFFFF |
| 3436 | 3460 | // f ff m sf l |
| ... | ... | @@ -3472,7 +3496,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate |
| 3472 | 3496 | __p = _VSTD::get_temporary_buffer<value_type>(__len); |
| 3473 | 3497 | __h.reset(__p.first); |
| 3474 | 3498 | } |
| 3475 | return __stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3499 | return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3476 | 3500 | (__first, __last, __pred, __len, __p, forward_iterator_tag()); |
| 3477 | 3501 | } |
| 3478 | 3502 | |
| ... | ... | @@ -3510,8 +3534,8 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last |
| 3510 | 3534 | // Move the falses into the temporary buffer, and the trues to the front of the line |
| 3511 | 3535 | // Update __first to always point to the end of the trues |
| 3512 | 3536 | value_type* __t = __p.first; |
| 3513 | ::new(__t) value_type(_VSTD::move(*__first)); | |
| 3514 | __d.__incr((value_type*)0); | |
| 3537 | ::new ((void*)__t) value_type(_VSTD::move(*__first)); | |
| 3538 | __d.template __incr<value_type>(); | |
| 3515 | 3539 | ++__t; |
| 3516 | 3540 | _BidirectionalIterator __i = __first; |
| 3517 | 3541 | while (++__i != __last) |
| ... | ... | @@ -3523,8 +3547,8 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last |
| 3523 | 3547 | } |
| 3524 | 3548 | else |
| 3525 | 3549 | { |
| 3526 | ::new(__t) value_type(_VSTD::move(*__i)); | |
| 3527 | __d.__incr((value_type*)0); | |
| 3550 | ::new ((void*)__t) value_type(_VSTD::move(*__i)); | |
| 3551 | __d.template __incr<value_type>(); | |
| 3528 | 3552 | ++__t; |
| 3529 | 3553 | } |
| 3530 | 3554 | } |
| ... | ... | @@ -3558,7 +3582,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last |
| 3558 | 3582 | // F???TFFF?????????T |
| 3559 | 3583 | // f m1 m l |
| 3560 | 3584 | typedef typename add_lvalue_reference<_Predicate>::type _PredRef; |
| 3561 | __first_false = __stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit); | |
| 3585 | __first_false = _VSTD::__stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit); | |
| 3562 | 3586 | __first_half_done: |
| 3563 | 3587 | // TTTFFFFF?????????T |
| 3564 | 3588 | // f ff m l |
| ... | ... | @@ -3575,7 +3599,7 @@ __first_half_done: |
| 3575 | 3599 | } |
| 3576 | 3600 | // TTTFFFFFTTTF?????T |
| 3577 | 3601 | // f ff m m1 l |
| 3578 | __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __bit); | |
| 3602 | __second_false = _VSTD::__stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __bit); | |
| 3579 | 3603 | __second_half_done: |
| 3580 | 3604 | // TTTFFFFFTTTTTFFFFF |
| 3581 | 3605 | // f ff m sf l |
| ... | ... | @@ -3620,7 +3644,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last |
| 3620 | 3644 | __p = _VSTD::get_temporary_buffer<value_type>(__len); |
| 3621 | 3645 | __h.reset(__p.first); |
| 3622 | 3646 | } |
| 3623 | return __stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3647 | return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3624 | 3648 | (__first, __last, __pred, __len, __p, bidirectional_iterator_tag()); |
| 3625 | 3649 | } |
| 3626 | 3650 | |
| ... | ... | @@ -3629,7 +3653,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 3629 | 3653 | _ForwardIterator |
| 3630 | 3654 | stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) |
| 3631 | 3655 | { |
| 3632 | return __stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3656 | return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type> | |
| 3633 | 3657 | (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); |
| 3634 | 3658 | } |
| 3635 | 3659 | |
| ... | ... | @@ -3727,7 +3751,7 @@ unsigned |
| 3727 | 3751 | __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, |
| 3728 | 3752 | _ForwardIterator __x4, _Compare __c) |
| 3729 | 3753 | { |
| 3730 | unsigned __r = __sort3<_Compare>(__x1, __x2, __x3, __c); | |
| 3754 | unsigned __r = _VSTD::__sort3<_Compare>(__x1, __x2, __x3, __c); | |
| 3731 | 3755 | if (__c(*__x4, *__x3)) |
| 3732 | 3756 | { |
| 3733 | 3757 | swap(*__x3, *__x4); |
| ... | ... | @@ -3754,7 +3778,7 @@ unsigned |
| 3754 | 3778 | __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, |
| 3755 | 3779 | _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c) |
| 3756 | 3780 | { |
| 3757 | unsigned __r = __sort4<_Compare>(__x1, __x2, __x3, __x4, __c); | |
| 3781 | unsigned __r = _VSTD::__sort4<_Compare>(__x1, __x2, __x3, __x4, __c); | |
| 3758 | 3782 | if (__c(*__x5, *__x4)) |
| 3759 | 3783 | { |
| 3760 | 3784 | swap(*__x4, *__x5); |
| ... | ... | @@ -3779,14 +3803,14 @@ __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, |
| 3779 | 3803 | } |
| 3780 | 3804 | |
| 3781 | 3805 | // Assumes size > 0 |
| 3782 | template <class _Compare, class _BirdirectionalIterator> | |
| 3806 | template <class _Compare, class _BidirectionalIterator> | |
| 3783 | 3807 | void |
| 3784 | __selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) | |
| 3808 | __selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) | |
| 3785 | 3809 | { |
| 3786 | _BirdirectionalIterator __lm1 = __last; | |
| 3810 | _BidirectionalIterator __lm1 = __last; | |
| 3787 | 3811 | for (--__lm1; __first != __lm1; ++__first) |
| 3788 | 3812 | { |
| 3789 | _BirdirectionalIterator __i = _VSTD::min_element<_BirdirectionalIterator, | |
| 3813 | _BidirectionalIterator __i = _VSTD::min_element<_BidirectionalIterator, | |
| 3790 | 3814 | typename add_lvalue_reference<_Compare>::type> |
| 3791 | 3815 | (__first, __last, __comp); |
| 3792 | 3816 | if (__i != __first) |
| ... | ... | @@ -3794,19 +3818,19 @@ __selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last |
| 3794 | 3818 | } |
| 3795 | 3819 | } |
| 3796 | 3820 | |
| 3797 | template <class _Compare, class _BirdirectionalIterator> | |
| 3821 | template <class _Compare, class _BidirectionalIterator> | |
| 3798 | 3822 | void |
| 3799 | __insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) | |
| 3823 | __insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) | |
| 3800 | 3824 | { |
| 3801 | typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; | |
| 3825 | typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; | |
| 3802 | 3826 | if (__first != __last) |
| 3803 | 3827 | { |
| 3804 | _BirdirectionalIterator __i = __first; | |
| 3828 | _BidirectionalIterator __i = __first; | |
| 3805 | 3829 | for (++__i; __i != __last; ++__i) |
| 3806 | 3830 | { |
| 3807 | _BirdirectionalIterator __j = __i; | |
| 3831 | _BidirectionalIterator __j = __i; | |
| 3808 | 3832 | value_type __t(_VSTD::move(*__j)); |
| 3809 | for (_BirdirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j) | |
| 3833 | for (_BidirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j) | |
| 3810 | 3834 | *__j = _VSTD::move(*__k); |
| 3811 | 3835 | *__j = _VSTD::move(__t); |
| 3812 | 3836 | } |
| ... | ... | @@ -3819,7 +3843,7 @@ __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, |
| 3819 | 3843 | { |
| 3820 | 3844 | typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; |
| 3821 | 3845 | _RandomAccessIterator __j = __first+2; |
| 3822 | __sort3<_Compare>(__first, __first+1, __j, __comp); | |
| 3846 | _VSTD::__sort3<_Compare>(__first, __first+1, __j, __comp); | |
| 3823 | 3847 | for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) |
| 3824 | 3848 | { |
| 3825 | 3849 | if (__comp(*__i, *__j)) |
| ... | ... | @@ -3863,7 +3887,7 @@ __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator |
| 3863 | 3887 | } |
| 3864 | 3888 | typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; |
| 3865 | 3889 | _RandomAccessIterator __j = __first+2; |
| 3866 | __sort3<_Compare>(__first, __first+1, __j, __comp); | |
| 3890 | _VSTD::__sort3<_Compare>(__first, __first+1, __j, __comp); | |
| 3867 | 3891 | const unsigned __limit = 8; |
| 3868 | 3892 | unsigned __count = 0; |
| 3869 | 3893 | for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) |
| ... | ... | @@ -3887,35 +3911,35 @@ __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator |
| 3887 | 3911 | return true; |
| 3888 | 3912 | } |
| 3889 | 3913 | |
| 3890 | template <class _Compare, class _BirdirectionalIterator> | |
| 3914 | template <class _Compare, class _BidirectionalIterator> | |
| 3891 | 3915 | void |
| 3892 | __insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator __last1, | |
| 3893 | typename iterator_traits<_BirdirectionalIterator>::value_type* __first2, _Compare __comp) | |
| 3916 | __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1, | |
| 3917 | typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) | |
| 3894 | 3918 | { |
| 3895 | typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; | |
| 3919 | typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; | |
| 3896 | 3920 | if (__first1 != __last1) |
| 3897 | 3921 | { |
| 3898 | 3922 | __destruct_n __d(0); |
| 3899 | 3923 | unique_ptr<value_type, __destruct_n&> __h(__first2, __d); |
| 3900 | 3924 | value_type* __last2 = __first2; |
| 3901 | ::new(__last2) value_type(_VSTD::move(*__first1)); | |
| 3902 | __d.__incr((value_type*)0); | |
| 3925 | ::new ((void*)__last2) value_type(_VSTD::move(*__first1)); | |
| 3926 | __d.template __incr<value_type>(); | |
| 3903 | 3927 | for (++__last2; ++__first1 != __last1; ++__last2) |
| 3904 | 3928 | { |
| 3905 | 3929 | value_type* __j2 = __last2; |
| 3906 | 3930 | value_type* __i2 = __j2; |
| 3907 | 3931 | if (__comp(*__first1, *--__i2)) |
| 3908 | 3932 | { |
| 3909 | ::new(__j2) value_type(_VSTD::move(*__i2)); | |
| 3910 | __d.__incr((value_type*)0); | |
| 3933 | ::new ((void*)__j2) value_type(_VSTD::move(*__i2)); | |
| 3934 | __d.template __incr<value_type>(); | |
| 3911 | 3935 | for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) |
| 3912 | 3936 | *__j2 = _VSTD::move(*__i2); |
| 3913 | 3937 | *__j2 = _VSTD::move(*__first1); |
| 3914 | 3938 | } |
| 3915 | 3939 | else |
| 3916 | 3940 | { |
| 3917 | ::new(__j2) value_type(_VSTD::move(*__first1)); | |
| 3918 | __d.__incr((value_type*)0); | |
| 3941 | ::new ((void*)__j2) value_type(_VSTD::move(*__first1)); | |
| 3942 | __d.template __incr<value_type>(); | |
| 3919 | 3943 | } |
| 3920 | 3944 | } |
| 3921 | 3945 | __h.release(); |
| ... | ... | @@ -4032,7 +4056,7 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c |
| 4032 | 4056 | ++__i; |
| 4033 | 4057 | } |
| 4034 | 4058 | // [__first, __i) == *__first and *__first < [__i, __last) |
| 4035 | // The first part is sorted, sort the secod part | |
| 4059 | // The first part is sorted, sort the second part | |
| 4036 | 4060 | // _VSTD::__sort<_Compare>(__i, __last, __comp); |
| 4037 | 4061 | __first = __i; |
| 4038 | 4062 | goto __restart; |
| ... | ... | @@ -4138,7 +4162,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 4138 | 4162 | void |
| 4139 | 4163 | sort(_Tp** __first, _Tp** __last) |
| 4140 | 4164 | { |
| 4141 | _VSTD::sort((size_t*)__first, (size_t*)__last, __less<size_t>()); | |
| 4165 | _VSTD::sort((uintptr_t*)__first, (uintptr_t*)__last, __less<uintptr_t>()); | |
| 4142 | 4166 | } |
| 4143 | 4167 | |
| 4144 | 4168 | template <class _Tp> |
| ... | ... | @@ -4223,7 +4247,7 @@ _ForwardIterator |
| 4223 | 4247 | lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) |
| 4224 | 4248 | { |
| 4225 | 4249 | typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; |
| 4226 | return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4250 | return _VSTD::__lower_bound<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4227 | 4251 | } |
| 4228 | 4252 | |
| 4229 | 4253 | template <class _ForwardIterator, class _Tp> |
| ... | ... | @@ -4267,7 +4291,7 @@ _ForwardIterator |
| 4267 | 4291 | upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) |
| 4268 | 4292 | { |
| 4269 | 4293 | typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; |
| 4270 | return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4294 | return _VSTD::__upper_bound<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4271 | 4295 | } |
| 4272 | 4296 | |
| 4273 | 4297 | template <class _ForwardIterator, class _Tp> |
| ... | ... | @@ -4308,8 +4332,8 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va |
| 4308 | 4332 | _ForwardIterator __mp1 = __m; |
| 4309 | 4333 | return pair<_ForwardIterator, _ForwardIterator> |
| 4310 | 4334 | ( |
| 4311 | __lower_bound<_Compare>(__first, __m, __value_, __comp), | |
| 4312 | __upper_bound<_Compare>(++__mp1, __last, __value_, __comp) | |
| 4335 | _VSTD::__lower_bound<_Compare>(__first, __m, __value_, __comp), | |
| 4336 | _VSTD::__upper_bound<_Compare>(++__mp1, __last, __value_, __comp) | |
| 4313 | 4337 | ); |
| 4314 | 4338 | } |
| 4315 | 4339 | } |
| ... | ... | @@ -4323,7 +4347,7 @@ pair<_ForwardIterator, _ForwardIterator> |
| 4323 | 4347 | equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) |
| 4324 | 4348 | { |
| 4325 | 4349 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 4326 | return __equal_range<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4350 | return _VSTD::__equal_range<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4327 | 4351 | } |
| 4328 | 4352 | |
| 4329 | 4353 | template <class _ForwardIterator, class _Tp> |
| ... | ... | @@ -4343,7 +4367,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 4343 | 4367 | bool |
| 4344 | 4368 | __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) |
| 4345 | 4369 | { |
| 4346 | __first = __lower_bound<_Compare>(__first, __last, __value_, __comp); | |
| 4370 | __first = _VSTD::__lower_bound<_Compare>(__first, __last, __value_, __comp); | |
| 4347 | 4371 | return __first != __last && !__comp(__value_, *__first); |
| 4348 | 4372 | } |
| 4349 | 4373 | |
| ... | ... | @@ -4354,7 +4378,7 @@ bool |
| 4354 | 4378 | binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) |
| 4355 | 4379 | { |
| 4356 | 4380 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 4357 | return __binary_search<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4381 | return _VSTD::__binary_search<_Comp_ref>(__first, __last, __value_, __comp); | |
| 4358 | 4382 | } |
| 4359 | 4383 | |
| 4360 | 4384 | template <class _ForwardIterator, class _Tp> |
| ... | ... | @@ -4370,6 +4394,7 @@ binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va |
| 4370 | 4394 | // merge |
| 4371 | 4395 | |
| 4372 | 4396 | template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 4397 | _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4373 | 4398 | _OutputIterator |
| 4374 | 4399 | __merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4375 | 4400 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| ... | ... | @@ -4393,7 +4418,7 @@ __merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4393 | 4418 | } |
| 4394 | 4419 | |
| 4395 | 4420 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 4396 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4421 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4397 | 4422 | _OutputIterator |
| 4398 | 4423 | merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4399 | 4424 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| ... | ... | @@ -4403,7 +4428,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4403 | 4428 | } |
| 4404 | 4429 | |
| 4405 | 4430 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 4406 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4431 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 4407 | 4432 | _OutputIterator |
| 4408 | 4433 | merge(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4409 | 4434 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) |
| ... | ... | @@ -4456,20 +4481,20 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator |
| 4456 | 4481 | if (__len1 <= __len2) |
| 4457 | 4482 | { |
| 4458 | 4483 | value_type* __p = __buff; |
| 4459 | for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) | |
| 4460 | ::new(__p) value_type(_VSTD::move(*__i)); | |
| 4461 | __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); | |
| 4484 | for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p) | |
| 4485 | ::new ((void*)__p) value_type(_VSTD::move(*__i)); | |
| 4486 | _VSTD::__half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); | |
| 4462 | 4487 | } |
| 4463 | 4488 | else |
| 4464 | 4489 | { |
| 4465 | 4490 | value_type* __p = __buff; |
| 4466 | for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) | |
| 4467 | ::new(__p) value_type(_VSTD::move(*__i)); | |
| 4491 | for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr<value_type>(), (void) ++__i, (void) ++__p) | |
| 4492 | ::new ((void*)__p) value_type(_VSTD::move(*__i)); | |
| 4468 | 4493 | typedef reverse_iterator<_BidirectionalIterator> _RBi; |
| 4469 | 4494 | typedef reverse_iterator<value_type*> _Rv; |
| 4470 | __half_inplace_merge(_Rv(__p), _Rv(__buff), | |
| 4471 | _RBi(__middle), _RBi(__first), | |
| 4472 | _RBi(__last), __invert<_Compare>(__comp)); | |
| 4495 | _VSTD::__half_inplace_merge(_Rv(__p), _Rv(__buff), | |
| 4496 | _RBi(__middle), _RBi(__first), | |
| 4497 | _RBi(__last), _VSTD::__invert<_Compare>(__comp)); | |
| 4473 | 4498 | } |
| 4474 | 4499 | } |
| 4475 | 4500 | |
| ... | ... | @@ -4487,7 +4512,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, |
| 4487 | 4512 | if (__len2 == 0) |
| 4488 | 4513 | return; |
| 4489 | 4514 | if (__len1 <= __buff_size || __len2 <= __buff_size) |
| 4490 | return __buffered_inplace_merge<_Compare> | |
| 4515 | return _VSTD::__buffered_inplace_merge<_Compare> | |
| 4491 | 4516 | (__first, __middle, __last, __comp, __len1, __len2, __buff); |
| 4492 | 4517 | // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0 |
| 4493 | 4518 | for (; true; ++__first, (void) --__len1) |
| ... | ... | @@ -4515,7 +4540,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, |
| 4515 | 4540 | __len21 = __len2 / 2; |
| 4516 | 4541 | __m2 = __middle; |
| 4517 | 4542 | _VSTD::advance(__m2, __len21); |
| 4518 | __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp); | |
| 4543 | __m1 = _VSTD::__upper_bound<_Compare>(__first, __middle, *__m2, __comp); | |
| 4519 | 4544 | __len11 = _VSTD::distance(__first, __m1); |
| 4520 | 4545 | } |
| 4521 | 4546 | else |
| ... | ... | @@ -4530,7 +4555,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, |
| 4530 | 4555 | __len11 = __len1 / 2; |
| 4531 | 4556 | __m1 = __first; |
| 4532 | 4557 | _VSTD::advance(__m1, __len11); |
| 4533 | __m2 = __lower_bound<_Compare>(__middle, __last, *__m1, __comp); | |
| 4558 | __m2 = _VSTD::__lower_bound<_Compare>(__middle, __last, *__m1, __comp); | |
| 4534 | 4559 | __len21 = _VSTD::distance(__middle, __m2); |
| 4535 | 4560 | } |
| 4536 | 4561 | difference_type __len12 = __len1 - __len11; // distance(__m1, __middle) |
| ... | ... | @@ -4539,11 +4564,11 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, |
| 4539 | 4564 | // swap middle two partitions |
| 4540 | 4565 | __middle = _VSTD::rotate(__m1, __middle, __m2); |
| 4541 | 4566 | // __len12 and __len21 now have swapped meanings |
| 4542 | // merge smaller range with recurisve call and larger with tail recursion elimination | |
| 4567 | // merge smaller range with recursive call and larger with tail recursion elimination | |
| 4543 | 4568 | if (__len11 + __len21 < __len12 + __len22) |
| 4544 | 4569 | { |
| 4545 | __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); | |
| 4546 | // __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); | |
| 4570 | _VSTD::__inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); | |
| 4571 | // _VSTD::__inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); | |
| 4547 | 4572 | __first = __middle; |
| 4548 | 4573 | __middle = __m2; |
| 4549 | 4574 | __len1 = __len12; |
| ... | ... | @@ -4551,8 +4576,8 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, |
| 4551 | 4576 | } |
| 4552 | 4577 | else |
| 4553 | 4578 | { |
| 4554 | __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); | |
| 4555 | // __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); | |
| 4579 | _VSTD::__inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); | |
| 4580 | // _VSTD::__inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); | |
| 4556 | 4581 | __last = __middle; |
| 4557 | 4582 | __middle = __m1; |
| 4558 | 4583 | __len1 = __len11; |
| ... | ... | @@ -4603,28 +4628,28 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, |
| 4603 | 4628 | { |
| 4604 | 4629 | if (__first1 == __last1) |
| 4605 | 4630 | { |
| 4606 | for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0)) | |
| 4607 | ::new (__result) value_type(_VSTD::move(*__first2)); | |
| 4631 | for (; __first2 != __last2; ++__first2, ++__result, (void)__d.template __incr<value_type>()) | |
| 4632 | ::new ((void*)__result) value_type(_VSTD::move(*__first2)); | |
| 4608 | 4633 | __h.release(); |
| 4609 | 4634 | return; |
| 4610 | 4635 | } |
| 4611 | 4636 | if (__first2 == __last2) |
| 4612 | 4637 | { |
| 4613 | for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0)) | |
| 4614 | ::new (__result) value_type(_VSTD::move(*__first1)); | |
| 4638 | for (; __first1 != __last1; ++__first1, ++__result, (void)__d.template __incr<value_type>()) | |
| 4639 | ::new ((void*)__result) value_type(_VSTD::move(*__first1)); | |
| 4615 | 4640 | __h.release(); |
| 4616 | 4641 | return; |
| 4617 | 4642 | } |
| 4618 | 4643 | if (__comp(*__first2, *__first1)) |
| 4619 | 4644 | { |
| 4620 | ::new (__result) value_type(_VSTD::move(*__first2)); | |
| 4621 | __d.__incr((value_type*)0); | |
| 4645 | ::new ((void*)__result) value_type(_VSTD::move(*__first2)); | |
| 4646 | __d.template __incr<value_type>(); | |
| 4622 | 4647 | ++__first2; |
| 4623 | 4648 | } |
| 4624 | 4649 | else |
| 4625 | 4650 | { |
| 4626 | ::new (__result) value_type(_VSTD::move(*__first1)); | |
| 4627 | __d.__incr((value_type*)0); | |
| 4651 | ::new ((void*)__result) value_type(_VSTD::move(*__first1)); | |
| 4652 | __d.template __incr<value_type>(); | |
| 4628 | 4653 | ++__first1; |
| 4629 | 4654 | } |
| 4630 | 4655 | } |
| ... | ... | @@ -4677,38 +4702,38 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1 |
| 4677 | 4702 | case 0: |
| 4678 | 4703 | return; |
| 4679 | 4704 | case 1: |
| 4680 | ::new(__first2) value_type(_VSTD::move(*__first1)); | |
| 4705 | ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); | |
| 4681 | 4706 | return; |
| 4682 | 4707 | case 2: |
| 4683 | 4708 | __destruct_n __d(0); |
| 4684 | 4709 | unique_ptr<value_type, __destruct_n&> __h2(__first2, __d); |
| 4685 | 4710 | if (__comp(*--__last1, *__first1)) |
| 4686 | 4711 | { |
| 4687 | ::new(__first2) value_type(_VSTD::move(*__last1)); | |
| 4688 | __d.__incr((value_type*)0); | |
| 4712 | ::new ((void*)__first2) value_type(_VSTD::move(*__last1)); | |
| 4713 | __d.template __incr<value_type>(); | |
| 4689 | 4714 | ++__first2; |
| 4690 | ::new(__first2) value_type(_VSTD::move(*__first1)); | |
| 4715 | ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); | |
| 4691 | 4716 | } |
| 4692 | 4717 | else |
| 4693 | 4718 | { |
| 4694 | ::new(__first2) value_type(_VSTD::move(*__first1)); | |
| 4695 | __d.__incr((value_type*)0); | |
| 4719 | ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); | |
| 4720 | __d.template __incr<value_type>(); | |
| 4696 | 4721 | ++__first2; |
| 4697 | ::new(__first2) value_type(_VSTD::move(*__last1)); | |
| 4722 | ::new ((void*)__first2) value_type(_VSTD::move(*__last1)); | |
| 4698 | 4723 | } |
| 4699 | 4724 | __h2.release(); |
| 4700 | 4725 | return; |
| 4701 | 4726 | } |
| 4702 | 4727 | if (__len <= 8) |
| 4703 | 4728 | { |
| 4704 | __insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp); | |
| 4729 | _VSTD::__insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp); | |
| 4705 | 4730 | return; |
| 4706 | 4731 | } |
| 4707 | 4732 | typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; |
| 4708 | 4733 | _RandomAccessIterator __m = __first1 + __l2; |
| 4709 | __stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2); | |
| 4710 | __stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2); | |
| 4711 | __merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp); | |
| 4734 | _VSTD::__stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2); | |
| 4735 | _VSTD::__stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2); | |
| 4736 | _VSTD::__merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp); | |
| 4712 | 4737 | } |
| 4713 | 4738 | |
| 4714 | 4739 | template <class _Tp> |
| ... | ... | @@ -4737,7 +4762,7 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp |
| 4737 | 4762 | } |
| 4738 | 4763 | if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value)) |
| 4739 | 4764 | { |
| 4740 | __insertion_sort<_Compare>(__first, __last, __comp); | |
| 4765 | _VSTD::__insertion_sort<_Compare>(__first, __last, __comp); | |
| 4741 | 4766 | return; |
| 4742 | 4767 | } |
| 4743 | 4768 | typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; |
| ... | ... | @@ -4746,21 +4771,21 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp |
| 4746 | 4771 | { |
| 4747 | 4772 | __destruct_n __d(0); |
| 4748 | 4773 | unique_ptr<value_type, __destruct_n&> __h2(__buff, __d); |
| 4749 | __stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff); | |
| 4750 | __d.__set(__l2, (value_type*)0); | |
| 4751 | __stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2); | |
| 4752 | __d.__set(__len, (value_type*)0); | |
| 4753 | __merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp); | |
| 4754 | // __merge<_Compare>(move_iterator<value_type*>(__buff), | |
| 4755 | // move_iterator<value_type*>(__buff + __l2), | |
| 4756 | // move_iterator<_RandomAccessIterator>(__buff + __l2), | |
| 4757 | // move_iterator<_RandomAccessIterator>(__buff + __len), | |
| 4758 | // __first, __comp); | |
| 4774 | _VSTD::__stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff); | |
| 4775 | __d.__set(__l2, (value_type*)nullptr); | |
| 4776 | _VSTD::__stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2); | |
| 4777 | __d.__set(__len, (value_type*)nullptr); | |
| 4778 | _VSTD::__merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp); | |
| 4779 | // _VSTD::__merge<_Compare>(move_iterator<value_type*>(__buff), | |
| 4780 | // move_iterator<value_type*>(__buff + __l2), | |
| 4781 | // move_iterator<_RandomAccessIterator>(__buff + __l2), | |
| 4782 | // move_iterator<_RandomAccessIterator>(__buff + __len), | |
| 4783 | // __first, __comp); | |
| 4759 | 4784 | return; |
| 4760 | 4785 | } |
| 4761 | __stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size); | |
| 4762 | __stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size); | |
| 4763 | __inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size); | |
| 4786 | _VSTD::__stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size); | |
| 4787 | _VSTD::__stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size); | |
| 4788 | _VSTD::__inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size); | |
| 4764 | 4789 | } |
| 4765 | 4790 | |
| 4766 | 4791 | template <class _RandomAccessIterator, class _Compare> |
| ... | ... | @@ -4779,7 +4804,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar |
| 4779 | 4804 | __h.reset(__buf.first); |
| 4780 | 4805 | } |
| 4781 | 4806 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 4782 | __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second); | |
| 4807 | _VSTD::__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second); | |
| 4783 | 4808 | } |
| 4784 | 4809 | |
| 4785 | 4810 | template <class _RandomAccessIterator> |
| ... | ... | @@ -4883,7 +4908,7 @@ void |
| 4883 | 4908 | push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 4884 | 4909 | { |
| 4885 | 4910 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 4886 | __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first); | |
| 4911 | _VSTD::__sift_up<_Comp_ref>(__first, __last, __comp, __last - __first); | |
| 4887 | 4912 | } |
| 4888 | 4913 | |
| 4889 | 4914 | template <class _RandomAccessIterator> |
| ... | ... | @@ -4960,7 +4985,7 @@ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare |
| 4960 | 4985 | if (__len > 1) |
| 4961 | 4986 | { |
| 4962 | 4987 | swap(*__first, *--__last); |
| 4963 | __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); | |
| 4988 | _VSTD::__sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); | |
| 4964 | 4989 | } |
| 4965 | 4990 | } |
| 4966 | 4991 | |
| ... | ... | @@ -4970,7 +4995,7 @@ void |
| 4970 | 4995 | pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 4971 | 4996 | { |
| 4972 | 4997 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 4973 | __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first); | |
| 4998 | _VSTD::__pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first); | |
| 4974 | 4999 | } |
| 4975 | 5000 | |
| 4976 | 5001 | template <class _RandomAccessIterator> |
| ... | ... | @@ -4994,7 +5019,7 @@ __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar |
| 4994 | 5019 | // start from the first parent, there is no need to consider children |
| 4995 | 5020 | for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) |
| 4996 | 5021 | { |
| 4997 | __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); | |
| 5022 | _VSTD::__sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); | |
| 4998 | 5023 | } |
| 4999 | 5024 | } |
| 5000 | 5025 | } |
| ... | ... | @@ -5005,7 +5030,7 @@ void |
| 5005 | 5030 | make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 5006 | 5031 | { |
| 5007 | 5032 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5008 | __make_heap<_Comp_ref>(__first, __last, __comp); | |
| 5033 | _VSTD::__make_heap<_Comp_ref>(__first, __last, __comp); | |
| 5009 | 5034 | } |
| 5010 | 5035 | |
| 5011 | 5036 | template <class _RandomAccessIterator> |
| ... | ... | @@ -5024,7 +5049,7 @@ __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar |
| 5024 | 5049 | { |
| 5025 | 5050 | typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; |
| 5026 | 5051 | for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) |
| 5027 | __pop_heap<_Compare>(__first, __last, __comp, __n); | |
| 5052 | _VSTD::__pop_heap<_Compare>(__first, __last, __comp, __n); | |
| 5028 | 5053 | } |
| 5029 | 5054 | |
| 5030 | 5055 | template <class _RandomAccessIterator, class _Compare> |
| ... | ... | @@ -5033,7 +5058,7 @@ void |
| 5033 | 5058 | sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) |
| 5034 | 5059 | { |
| 5035 | 5060 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5036 | __sort_heap<_Comp_ref>(__first, __last, __comp); | |
| 5061 | _VSTD::__sort_heap<_Comp_ref>(__first, __last, __comp); | |
| 5037 | 5062 | } |
| 5038 | 5063 | |
| 5039 | 5064 | template <class _RandomAccessIterator> |
| ... | ... | @@ -5051,17 +5076,17 @@ void |
| 5051 | 5076 | __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, |
| 5052 | 5077 | _Compare __comp) |
| 5053 | 5078 | { |
| 5054 | __make_heap<_Compare>(__first, __middle, __comp); | |
| 5079 | _VSTD::__make_heap<_Compare>(__first, __middle, __comp); | |
| 5055 | 5080 | typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first; |
| 5056 | 5081 | for (_RandomAccessIterator __i = __middle; __i != __last; ++__i) |
| 5057 | 5082 | { |
| 5058 | 5083 | if (__comp(*__i, *__first)) |
| 5059 | 5084 | { |
| 5060 | 5085 | swap(*__i, *__first); |
| 5061 | __sift_down<_Compare>(__first, __middle, __comp, __len, __first); | |
| 5086 | _VSTD::__sift_down<_Compare>(__first, __middle, __comp, __len, __first); | |
| 5062 | 5087 | } |
| 5063 | 5088 | } |
| 5064 | __sort_heap<_Compare>(__first, __middle, __comp); | |
| 5089 | _VSTD::__sort_heap<_Compare>(__first, __middle, __comp); | |
| 5065 | 5090 | } |
| 5066 | 5091 | |
| 5067 | 5092 | template <class _RandomAccessIterator, class _Compare> |
| ... | ... | @@ -5071,7 +5096,7 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran |
| 5071 | 5096 | _Compare __comp) |
| 5072 | 5097 | { |
| 5073 | 5098 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5074 | __partial_sort<_Comp_ref>(__first, __middle, __last, __comp); | |
| 5099 | _VSTD::__partial_sort<_Comp_ref>(__first, __middle, __last, __comp); | |
| 5075 | 5100 | } |
| 5076 | 5101 | |
| 5077 | 5102 | template <class _RandomAccessIterator> |
| ... | ... | @@ -5095,15 +5120,15 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 5095 | 5120 | { |
| 5096 | 5121 | for (; __first != __last && __r != __result_last; ++__first, (void) ++__r) |
| 5097 | 5122 | *__r = *__first; |
| 5098 | __make_heap<_Compare>(__result_first, __r, __comp); | |
| 5123 | _VSTD::__make_heap<_Compare>(__result_first, __r, __comp); | |
| 5099 | 5124 | typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; |
| 5100 | 5125 | for (; __first != __last; ++__first) |
| 5101 | 5126 | if (__comp(*__first, *__result_first)) |
| 5102 | 5127 | { |
| 5103 | 5128 | *__result_first = *__first; |
| 5104 | __sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); | |
| 5129 | _VSTD::__sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); | |
| 5105 | 5130 | } |
| 5106 | __sort_heap<_Compare>(__result_first, __r, __comp); | |
| 5131 | _VSTD::__sort_heap<_Compare>(__result_first, __r, __comp); | |
| 5107 | 5132 | } |
| 5108 | 5133 | return __r; |
| 5109 | 5134 | } |
| ... | ... | @@ -5115,7 +5140,7 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last, |
| 5115 | 5140 | _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) |
| 5116 | 5141 | { |
| 5117 | 5142 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5118 | return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp); | |
| 5143 | return _VSTD::__partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp); | |
| 5119 | 5144 | } |
| 5120 | 5145 | |
| 5121 | 5146 | template <class _InputIterator, class _RandomAccessIterator> |
| ... | ... | @@ -5161,7 +5186,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando |
| 5161 | 5186 | } |
| 5162 | 5187 | if (__len <= __limit) |
| 5163 | 5188 | { |
| 5164 | __selection_sort<_Compare>(__first, __last, __comp); | |
| 5189 | _VSTD::__selection_sort<_Compare>(__first, __last, __comp); | |
| 5165 | 5190 | return; |
| 5166 | 5191 | } |
| 5167 | 5192 | // __len > __limit >= 3 |
| ... | ... | @@ -5185,7 +5210,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando |
| 5185 | 5210 | if (__i == --__j) |
| 5186 | 5211 | { |
| 5187 | 5212 | // *__first == *__m, *__m <= all other elements |
| 5188 | // Parition instead into [__first, __i) == *__first and *__first < [__i, __last) | |
| 5213 | // Partition instead into [__first, __i) == *__first and *__first < [__i, __last) | |
| 5189 | 5214 | ++__i; // __first + 1 |
| 5190 | 5215 | __j = __last; |
| 5191 | 5216 | if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1) |
| ... | ... | @@ -5223,8 +5248,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando |
| 5223 | 5248 | // The first part is sorted, |
| 5224 | 5249 | if (__nth < __i) |
| 5225 | 5250 | return; |
| 5226 | // __nth_element the secod part | |
| 5227 | // __nth_element<_Compare>(__i, __nth, __last, __comp); | |
| 5251 | // __nth_element the second part | |
| 5252 | // _VSTD::__nth_element<_Compare>(__i, __nth, __last, __comp); | |
| 5228 | 5253 | __first = __i; |
| 5229 | 5254 | goto __restart; |
| 5230 | 5255 | } |
| ... | ... | @@ -5306,12 +5331,12 @@ not_sorted: |
| 5306 | 5331 | // __nth_element on range containing __nth |
| 5307 | 5332 | if (__nth < __i) |
| 5308 | 5333 | { |
| 5309 | // __nth_element<_Compare>(__first, __nth, __i, __comp); | |
| 5334 | // _VSTD::__nth_element<_Compare>(__first, __nth, __i, __comp); | |
| 5310 | 5335 | __last = __i; |
| 5311 | 5336 | } |
| 5312 | 5337 | else |
| 5313 | 5338 | { |
| 5314 | // __nth_element<_Compare>(__i+1, __nth, __last, __comp); | |
| 5339 | // _VSTD::__nth_element<_Compare>(__i+1, __nth, __last, __comp); | |
| 5315 | 5340 | __first = ++__i; |
| 5316 | 5341 | } |
| 5317 | 5342 | } |
| ... | ... | @@ -5323,7 +5348,7 @@ void |
| 5323 | 5348 | nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) |
| 5324 | 5349 | { |
| 5325 | 5350 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5326 | __nth_element<_Comp_ref>(__first, __nth, __last, __comp); | |
| 5351 | _VSTD::__nth_element<_Comp_ref>(__first, __nth, __last, __comp); | |
| 5327 | 5352 | } |
| 5328 | 5353 | |
| 5329 | 5354 | template <class _RandomAccessIterator> |
| ... | ... | @@ -5359,7 +5384,7 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi |
| 5359 | 5384 | _Compare __comp) |
| 5360 | 5385 | { |
| 5361 | 5386 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5362 | return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); | |
| 5387 | return _VSTD::__includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); | |
| 5363 | 5388 | } |
| 5364 | 5389 | |
| 5365 | 5390 | template <class _InputIterator1, class _InputIterator2> |
| ... | ... | @@ -5376,7 +5401,7 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi |
| 5376 | 5401 | // set_union |
| 5377 | 5402 | |
| 5378 | 5403 | template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5379 | _OutputIterator | |
| 5404 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 5380 | 5405 | __set_union(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5381 | 5406 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5382 | 5407 | { |
| ... | ... | @@ -5401,17 +5426,17 @@ __set_union(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5401 | 5426 | } |
| 5402 | 5427 | |
| 5403 | 5428 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 5404 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5429 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5405 | 5430 | _OutputIterator |
| 5406 | 5431 | set_union(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5407 | 5432 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5408 | 5433 | { |
| 5409 | 5434 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5410 | return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5435 | return _VSTD::__set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5411 | 5436 | } |
| 5412 | 5437 | |
| 5413 | 5438 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5414 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5439 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5415 | 5440 | _OutputIterator |
| 5416 | 5441 | set_union(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5417 | 5442 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) |
| ... | ... | @@ -5453,7 +5478,7 @@ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5453 | 5478 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5454 | 5479 | { |
| 5455 | 5480 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5456 | return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5481 | return _VSTD::__set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5457 | 5482 | } |
| 5458 | 5483 | |
| 5459 | 5484 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| ... | ... | @@ -5470,7 +5495,7 @@ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5470 | 5495 | // set_difference |
| 5471 | 5496 | |
| 5472 | 5497 | template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5473 | _OutputIterator | |
| 5498 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 5474 | 5499 | __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5475 | 5500 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5476 | 5501 | { |
| ... | ... | @@ -5495,17 +5520,17 @@ __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5495 | 5520 | } |
| 5496 | 5521 | |
| 5497 | 5522 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 5498 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5523 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5499 | 5524 | _OutputIterator |
| 5500 | 5525 | set_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5501 | 5526 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5502 | 5527 | { |
| 5503 | 5528 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5504 | return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5529 | return _VSTD::__set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5505 | 5530 | } |
| 5506 | 5531 | |
| 5507 | 5532 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5508 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5533 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5509 | 5534 | _OutputIterator |
| 5510 | 5535 | set_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5511 | 5536 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) |
| ... | ... | @@ -5518,7 +5543,7 @@ set_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5518 | 5543 | // set_symmetric_difference |
| 5519 | 5544 | |
| 5520 | 5545 | template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5521 | _OutputIterator | |
| 5546 | _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator | |
| 5522 | 5547 | __set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5523 | 5548 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5524 | 5549 | { |
| ... | ... | @@ -5548,17 +5573,17 @@ __set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5548 | 5573 | } |
| 5549 | 5574 | |
| 5550 | 5575 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> |
| 5551 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5576 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5552 | 5577 | _OutputIterator |
| 5553 | 5578 | set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5554 | 5579 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) |
| 5555 | 5580 | { |
| 5556 | 5581 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5557 | return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5582 | return _VSTD::__set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); | |
| 5558 | 5583 | } |
| 5559 | 5584 | |
| 5560 | 5585 | template <class _InputIterator1, class _InputIterator2, class _OutputIterator> |
| 5561 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5586 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 5562 | 5587 | _OutputIterator |
| 5563 | 5588 | set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5564 | 5589 | _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) |
| ... | ... | @@ -5593,7 +5618,7 @@ lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, |
| 5593 | 5618 | _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) |
| 5594 | 5619 | { |
| 5595 | 5620 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5596 | return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); | |
| 5621 | return _VSTD::__lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); | |
| 5597 | 5622 | } |
| 5598 | 5623 | |
| 5599 | 5624 | template <class _InputIterator1, class _InputIterator2> |
| ... | ... | @@ -5643,7 +5668,7 @@ bool |
| 5643 | 5668 | next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) |
| 5644 | 5669 | { |
| 5645 | 5670 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5646 | return __next_permutation<_Comp_ref>(__first, __last, __comp); | |
| 5671 | return _VSTD::__next_permutation<_Comp_ref>(__first, __last, __comp); | |
| 5647 | 5672 | } |
| 5648 | 5673 | |
| 5649 | 5674 | template <class _BidirectionalIterator> |
| ... | ... | @@ -5690,7 +5715,7 @@ bool |
| 5690 | 5715 | prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) |
| 5691 | 5716 | { |
| 5692 | 5717 | typedef typename __comp_ref_type<_Compare>::type _Comp_ref; |
| 5693 | return __prev_permutation<_Comp_ref>(__first, __last, __comp); | |
| 5718 | return _VSTD::__prev_permutation<_Comp_ref>(__first, __last, __comp); | |
| 5694 | 5719 | } |
| 5695 | 5720 | |
| 5696 | 5721 | template <class _BidirectionalIterator> |
lib/libcxx/include/any+22-8| ... | ... | @@ -81,8 +81,8 @@ namespace std { |
| 81 | 81 | */ |
| 82 | 82 | |
| 83 | 83 | #include <experimental/__config> |
| 84 | #include <__availability> | |
| 84 | 85 | #include <memory> |
| 85 | #include <new> | |
| 86 | 86 | #include <typeinfo> |
| 87 | 87 | #include <type_traits> |
| 88 | 88 | #include <cstdlib> |
| ... | ... | @@ -157,7 +157,7 @@ namespace __any_imp |
| 157 | 157 | template <class _Tp> |
| 158 | 158 | inline _LIBCPP_INLINE_VISIBILITY |
| 159 | 159 | constexpr const void* __get_fallback_typeid() { |
| 160 | return &__unique_typeinfo<decay_t<_Tp>>::__id; | |
| 160 | return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id; | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | template <class _Tp> |
| ... | ... | @@ -368,7 +368,11 @@ namespace __any_imp |
| 368 | 368 | template <class ..._Args> |
| 369 | 369 | _LIBCPP_INLINE_VISIBILITY |
| 370 | 370 | static _Tp& __create(any & __dest, _Args&&... __args) { |
| 371 | _Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...); | |
| 371 | typedef allocator<_Tp> _Alloc; | |
| 372 | typedef allocator_traits<_Alloc> _ATraits; | |
| 373 | _Alloc __a; | |
| 374 | _Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s.__buf)); | |
| 375 | _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); | |
| 372 | 376 | __dest.__h = &_SmallHandler::__handle; |
| 373 | 377 | return *__ret; |
| 374 | 378 | } |
| ... | ... | @@ -376,8 +380,11 @@ namespace __any_imp |
| 376 | 380 | private: |
| 377 | 381 | _LIBCPP_INLINE_VISIBILITY |
| 378 | 382 | static void __destroy(any & __this) { |
| 379 | _Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf)); | |
| 380 | __value.~_Tp(); | |
| 383 | typedef allocator<_Tp> _Alloc; | |
| 384 | typedef allocator_traits<_Alloc> _ATraits; | |
| 385 | _Alloc __a; | |
| 386 | _Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf)); | |
| 387 | _ATraits::destroy(__a, __p); | |
| 381 | 388 | __this.__h = nullptr; |
| 382 | 389 | } |
| 383 | 390 | |
| ... | ... | @@ -445,10 +452,12 @@ namespace __any_imp |
| 445 | 452 | _LIBCPP_INLINE_VISIBILITY |
| 446 | 453 | static _Tp& __create(any & __dest, _Args&&... __args) { |
| 447 | 454 | typedef allocator<_Tp> _Alloc; |
| 455 | typedef allocator_traits<_Alloc> _ATraits; | |
| 448 | 456 | typedef __allocator_destructor<_Alloc> _Dp; |
| 449 | 457 | _Alloc __a; |
| 450 | unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); | |
| 451 | _Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...); | |
| 458 | unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1)); | |
| 459 | _Tp * __ret = __hold.get(); | |
| 460 | _ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...); | |
| 452 | 461 | __dest.__s.__ptr = __hold.release(); |
| 453 | 462 | __dest.__h = &_LargeHandler::__handle; |
| 454 | 463 | return *__ret; |
| ... | ... | @@ -458,7 +467,12 @@ namespace __any_imp |
| 458 | 467 | |
| 459 | 468 | _LIBCPP_INLINE_VISIBILITY |
| 460 | 469 | static void __destroy(any & __this){ |
| 461 | delete static_cast<_Tp*>(__this.__s.__ptr); | |
| 470 | typedef allocator<_Tp> _Alloc; | |
| 471 | typedef allocator_traits<_Alloc> _ATraits; | |
| 472 | _Alloc __a; | |
| 473 | _Tp * __p = static_cast<_Tp *>(__this.__s.__ptr); | |
| 474 | _ATraits::destroy(__a, __p); | |
| 475 | _ATraits::deallocate(__a, __p, 1); | |
| 462 | 476 | __this.__h = nullptr; |
| 463 | 477 | } |
| 464 | 478 |
lib/libcxx/include/array+5-9| ... | ... | @@ -142,8 +142,8 @@ struct _LIBCPP_TEMPLATE_VIS array |
| 142 | 142 | typedef const value_type* const_pointer; |
| 143 | 143 | typedef size_t size_type; |
| 144 | 144 | typedef ptrdiff_t difference_type; |
| 145 | typedef std::reverse_iterator<iterator> reverse_iterator; | |
| 146 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 145 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; | |
| 146 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 147 | 147 | |
| 148 | 148 | _Tp __elems_[_Size]; |
| 149 | 149 | |
| ... | ... | @@ -155,7 +155,7 @@ struct _LIBCPP_TEMPLATE_VIS array |
| 155 | 155 | |
| 156 | 156 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 157 | 157 | void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { |
| 158 | std::swap_ranges(data(), data() + _Size, __a.data()); | |
| 158 | _VSTD::swap_ranges(data(), data() + _Size, __a.data()); | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // iterators: |
| ... | ... | @@ -245,8 +245,8 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> |
| 245 | 245 | typedef const value_type* const_pointer; |
| 246 | 246 | typedef size_t size_type; |
| 247 | 247 | typedef ptrdiff_t difference_type; |
| 248 | typedef std::reverse_iterator<iterator> reverse_iterator; | |
| 249 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 248 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; | |
| 249 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; | |
| 250 | 250 | |
| 251 | 251 | typedef typename conditional<is_const<_Tp>::value, const char, |
| 252 | 252 | char>::type _CharType; |
| ... | ... | @@ -459,8 +459,6 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT |
| 459 | 459 | return __a.__elems_[_Ip]; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | #ifndef _LIBCPP_CXX03_LANG | |
| 463 | ||
| 464 | 462 | template <size_t _Ip, class _Tp, size_t _Size> |
| 465 | 463 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 466 | 464 | _Tp&& |
| ... | ... | @@ -479,8 +477,6 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT |
| 479 | 477 | return _VSTD::move(__a.__elems_[_Ip]); |
| 480 | 478 | } |
| 481 | 479 | |
| 482 | #endif // !_LIBCPP_CXX03_LANG | |
| 483 | ||
| 484 | 480 | #if _LIBCPP_STD_VER > 17 |
| 485 | 481 | |
| 486 | 482 | template <typename _Tp, size_t _Size, size_t... _Index> |
lib/libcxx/include/atomic+93-77| ... | ... | @@ -16,9 +16,12 @@ |
| 16 | 16 | namespace std |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | // feature test macro | |
| 19 | // feature test macro [version.syn] | |
| 20 | 20 | |
| 21 | #define __cpp_lib_atomic_is_always_lock_free // as specified by SG10 | |
| 21 | #define __cpp_lib_atomic_is_always_lock_free | |
| 22 | #define __cpp_lib_atomic_flag_test | |
| 23 | #define __cpp_lib_atomic_lock_free_type_aliases | |
| 24 | #define __cpp_lib_atomic_wait | |
| 22 | 25 | |
| 23 | 26 | // order and consistency |
| 24 | 27 | |
| ... | ... | @@ -45,6 +48,7 @@ template <class T> T kill_dependency(T y) noexcept; |
| 45 | 48 | |
| 46 | 49 | #define ATOMIC_BOOL_LOCK_FREE unspecified |
| 47 | 50 | #define ATOMIC_CHAR_LOCK_FREE unspecified |
| 51 | #define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20 | |
| 48 | 52 | #define ATOMIC_CHAR16_T_LOCK_FREE unspecified |
| 49 | 53 | #define ATOMIC_CHAR32_T_LOCK_FREE unspecified |
| 50 | 54 | #define ATOMIC_WCHAR_T_LOCK_FREE unspecified |
| ... | ... | @@ -108,6 +112,7 @@ template <> |
| 108 | 112 | struct atomic<integral> |
| 109 | 113 | { |
| 110 | 114 | using value_type = integral; |
| 115 | using difference_type = value_type; | |
| 111 | 116 | |
| 112 | 117 | static constexpr bool is_always_lock_free; |
| 113 | 118 | bool is_lock_free() const volatile noexcept; |
| ... | ... | @@ -190,6 +195,7 @@ template <class T> |
| 190 | 195 | struct atomic<T*> |
| 191 | 196 | { |
| 192 | 197 | using value_type = T*; |
| 198 | using difference_type = ptrdiff_t; | |
| 193 | 199 | |
| 194 | 200 | static constexpr bool is_always_lock_free; |
| 195 | 201 | bool is_lock_free() const volatile noexcept; |
| ... | ... | @@ -460,6 +466,7 @@ typedef atomic<long> atomic_long; |
| 460 | 466 | typedef atomic<unsigned long> atomic_ulong; |
| 461 | 467 | typedef atomic<long long> atomic_llong; |
| 462 | 468 | typedef atomic<unsigned long long> atomic_ullong; |
| 469 | typedef atomic<char8_t> atomic_char8_t; // C++20 | |
| 463 | 470 | typedef atomic<char16_t> atomic_char16_t; |
| 464 | 471 | typedef atomic<char32_t> atomic_char32_t; |
| 465 | 472 | typedef atomic<wchar_t> atomic_wchar_t; |
| ... | ... | @@ -477,7 +484,7 @@ typedef atomic<int_fast8_t> atomic_int_fast8_t; |
| 477 | 484 | typedef atomic<uint_fast8_t> atomic_uint_fast8_t; |
| 478 | 485 | typedef atomic<int_fast16_t> atomic_int_fast16_t; |
| 479 | 486 | typedef atomic<uint_fast16_t> atomic_uint_fast16_t; |
| 480 | typedef atomic<int_fast32_t> atomic_int_fast32_t; | |
| 487 | typedef atomic<int_fast32_t> atomic_int_fast32_t; | |
| 481 | 488 | typedef atomic<uint_fast32_t> atomic_uint_fast32_t; |
| 482 | 489 | typedef atomic<int_fast64_t> atomic_int_fast64_t; |
| 483 | 490 | typedef atomic<uint_fast64_t> atomic_uint_fast64_t; |
| ... | ... | @@ -568,6 +575,7 @@ template <class T> |
| 568 | 575 | */ |
| 569 | 576 | |
| 570 | 577 | #include <__config> |
| 578 | #include <__availability> | |
| 571 | 579 | #include <__threading_support> |
| 572 | 580 | #include <cstddef> |
| 573 | 581 | #include <cstdint> |
| ... | ... | @@ -654,7 +662,7 @@ typedef enum memory_order { |
| 654 | 662 | |
| 655 | 663 | template <typename _Tp> _LIBCPP_INLINE_VISIBILITY |
| 656 | 664 | bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) { |
| 657 | return memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0; | |
| 665 | return _VSTD::memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0; | |
| 658 | 666 | } |
| 659 | 667 | |
| 660 | 668 | static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value), |
| ... | ... | @@ -1119,6 +1127,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT |
| 1119 | 1127 | #if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) |
| 1120 | 1128 | # define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE |
| 1121 | 1129 | # define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE |
| 1130 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1131 | # define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE | |
| 1132 | #endif | |
| 1122 | 1133 | # define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE |
| 1123 | 1134 | # define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE |
| 1124 | 1135 | # define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE |
| ... | ... | @@ -1130,6 +1141,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT |
| 1130 | 1141 | #elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE) |
| 1131 | 1142 | # define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE |
| 1132 | 1143 | # define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE |
| 1144 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1145 | # define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE | |
| 1146 | #endif | |
| 1133 | 1147 | # define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE |
| 1134 | 1148 | # define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE |
| 1135 | 1149 | # define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE |
| ... | ... | @@ -1245,10 +1259,10 @@ template <typename _Tp> |
| 1245 | 1259 | _LIBCPP_INLINE_VISIBILITY |
| 1246 | 1260 | bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a, |
| 1247 | 1261 | _Tp* __expected, _Tp __value, memory_order, memory_order) { |
| 1248 | __a->__lock(); | |
| 1249 | 1262 | _Tp __temp; |
| 1263 | __a->__lock(); | |
| 1250 | 1264 | __cxx_atomic_assign_volatile(__temp, __a->__a_value); |
| 1251 | bool __ret = __temp == *__expected; | |
| 1265 | bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); | |
| 1252 | 1266 | if(__ret) |
| 1253 | 1267 | __cxx_atomic_assign_volatile(__a->__a_value, __value); |
| 1254 | 1268 | else |
| ... | ... | @@ -1261,11 +1275,11 @@ _LIBCPP_INLINE_VISIBILITY |
| 1261 | 1275 | bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a, |
| 1262 | 1276 | _Tp* __expected, _Tp __value, memory_order, memory_order) { |
| 1263 | 1277 | __a->__lock(); |
| 1264 | bool __ret = __a->__a_value == *__expected; | |
| 1278 | bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); | |
| 1265 | 1279 | if(__ret) |
| 1266 | __a->__a_value = __value; | |
| 1280 | _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); | |
| 1267 | 1281 | else |
| 1268 | *__expected = __a->__a_value; | |
| 1282 | _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); | |
| 1269 | 1283 | __a->__unlock(); |
| 1270 | 1284 | return __ret; |
| 1271 | 1285 | } |
| ... | ... | @@ -1274,10 +1288,10 @@ template <typename _Tp> |
| 1274 | 1288 | _LIBCPP_INLINE_VISIBILITY |
| 1275 | 1289 | bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a, |
| 1276 | 1290 | _Tp* __expected, _Tp __value, memory_order, memory_order) { |
| 1277 | __a->__lock(); | |
| 1278 | 1291 | _Tp __temp; |
| 1292 | __a->__lock(); | |
| 1279 | 1293 | __cxx_atomic_assign_volatile(__temp, __a->__a_value); |
| 1280 | bool __ret = __temp == *__expected; | |
| 1294 | bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); | |
| 1281 | 1295 | if(__ret) |
| 1282 | 1296 | __cxx_atomic_assign_volatile(__a->__a_value, __value); |
| 1283 | 1297 | else |
| ... | ... | @@ -1290,11 +1304,11 @@ _LIBCPP_INLINE_VISIBILITY |
| 1290 | 1304 | bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a, |
| 1291 | 1305 | _Tp* __expected, _Tp __value, memory_order, memory_order) { |
| 1292 | 1306 | __a->__lock(); |
| 1293 | bool __ret = __a->__a_value == *__expected; | |
| 1307 | bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); | |
| 1294 | 1308 | if(__ret) |
| 1295 | __a->__a_value = __value; | |
| 1309 | _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); | |
| 1296 | 1310 | else |
| 1297 | *__expected = __a->__a_value; | |
| 1311 | _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); | |
| 1298 | 1312 | __a->__unlock(); |
| 1299 | 1313 | return __ret; |
| 1300 | 1314 | } |
| ... | ... | @@ -1444,6 +1458,9 @@ template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC |
| 1444 | 1458 | template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; |
| 1445 | 1459 | template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; |
| 1446 | 1460 | template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; }; |
| 1461 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1462 | template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; }; | |
| 1463 | #endif | |
| 1447 | 1464 | template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; }; |
| 1448 | 1465 | template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; }; |
| 1449 | 1466 | template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; }; |
| ... | ... | @@ -1486,8 +1503,6 @@ struct __cxx_atomic_impl : public _Base { |
| 1486 | 1503 | using __cxx_contention_t = int64_t; |
| 1487 | 1504 | #endif //__linux__ |
| 1488 | 1505 | |
| 1489 | #if _LIBCPP_STD_VER >= 11 | |
| 1490 | ||
| 1491 | 1506 | using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>; |
| 1492 | 1507 | |
| 1493 | 1508 | #ifndef _LIBCPP_HAS_NO_PLATFORM_WAIT |
| ... | ... | @@ -1519,7 +1534,7 @@ struct __libcpp_atomic_wait_backoff_impl { |
| 1519 | 1534 | else if(__elapsed > chrono::microseconds(4)) |
| 1520 | 1535 | __libcpp_thread_yield(); |
| 1521 | 1536 | else |
| 1522 | ; // poll | |
| 1537 | {} // poll | |
| 1523 | 1538 | return false; |
| 1524 | 1539 | } |
| 1525 | 1540 | }; |
| ... | ... | @@ -1565,8 +1580,6 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, mem |
| 1565 | 1580 | return __cxx_atomic_wait(__a, __test_fn); |
| 1566 | 1581 | } |
| 1567 | 1582 | |
| 1568 | #endif //_LIBCPP_STD_VER >= 11 | |
| 1569 | ||
| 1570 | 1583 | // general atomic<T> |
| 1571 | 1584 | |
| 1572 | 1585 | template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> |
| ... | ... | @@ -1775,6 +1788,7 @@ struct atomic |
| 1775 | 1788 | { |
| 1776 | 1789 | typedef __atomic_base<_Tp> __base; |
| 1777 | 1790 | typedef _Tp value_type; |
| 1791 | typedef value_type difference_type; | |
| 1778 | 1792 | _LIBCPP_INLINE_VISIBILITY |
| 1779 | 1793 | atomic() _NOEXCEPT _LIBCPP_DEFAULT |
| 1780 | 1794 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1796,6 +1810,7 @@ struct atomic<_Tp*> |
| 1796 | 1810 | { |
| 1797 | 1811 | typedef __atomic_base<_Tp*> __base; |
| 1798 | 1812 | typedef _Tp* value_type; |
| 1813 | typedef ptrdiff_t difference_type; | |
| 1799 | 1814 | _LIBCPP_INLINE_VISIBILITY |
| 1800 | 1815 | atomic() _NOEXCEPT _LIBCPP_DEFAULT |
| 1801 | 1816 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1872,7 +1887,7 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT |
| 1872 | 1887 | template <class _Tp> |
| 1873 | 1888 | _LIBCPP_INLINE_VISIBILITY |
| 1874 | 1889 | void |
| 1875 | atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1890 | atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1876 | 1891 | { |
| 1877 | 1892 | __cxx_atomic_init(&__o->__a_, __d); |
| 1878 | 1893 | } |
| ... | ... | @@ -1880,7 +1895,7 @@ atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1880 | 1895 | template <class _Tp> |
| 1881 | 1896 | _LIBCPP_INLINE_VISIBILITY |
| 1882 | 1897 | void |
| 1883 | atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1898 | atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1884 | 1899 | { |
| 1885 | 1900 | __cxx_atomic_init(&__o->__a_, __d); |
| 1886 | 1901 | } |
| ... | ... | @@ -1890,7 +1905,7 @@ atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1890 | 1905 | template <class _Tp> |
| 1891 | 1906 | _LIBCPP_INLINE_VISIBILITY |
| 1892 | 1907 | void |
| 1893 | atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1908 | atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1894 | 1909 | { |
| 1895 | 1910 | __o->store(__d); |
| 1896 | 1911 | } |
| ... | ... | @@ -1898,7 +1913,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1898 | 1913 | template <class _Tp> |
| 1899 | 1914 | _LIBCPP_INLINE_VISIBILITY |
| 1900 | 1915 | void |
| 1901 | atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1916 | atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1902 | 1917 | { |
| 1903 | 1918 | __o->store(__d); |
| 1904 | 1919 | } |
| ... | ... | @@ -1908,7 +1923,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1908 | 1923 | template <class _Tp> |
| 1909 | 1924 | _LIBCPP_INLINE_VISIBILITY |
| 1910 | 1925 | void |
| 1911 | atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | |
| 1926 | atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT | |
| 1912 | 1927 | _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) |
| 1913 | 1928 | { |
| 1914 | 1929 | __o->store(__d, __m); |
| ... | ... | @@ -1917,7 +1932,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE |
| 1917 | 1932 | template <class _Tp> |
| 1918 | 1933 | _LIBCPP_INLINE_VISIBILITY |
| 1919 | 1934 | void |
| 1920 | atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | |
| 1935 | atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT | |
| 1921 | 1936 | _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) |
| 1922 | 1937 | { |
| 1923 | 1938 | __o->store(__d, __m); |
| ... | ... | @@ -1966,7 +1981,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT |
| 1966 | 1981 | template <class _Tp> |
| 1967 | 1982 | _LIBCPP_INLINE_VISIBILITY |
| 1968 | 1983 | _Tp |
| 1969 | atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1984 | atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1970 | 1985 | { |
| 1971 | 1986 | return __o->exchange(__d); |
| 1972 | 1987 | } |
| ... | ... | @@ -1974,7 +1989,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1974 | 1989 | template <class _Tp> |
| 1975 | 1990 | _LIBCPP_INLINE_VISIBILITY |
| 1976 | 1991 | _Tp |
| 1977 | atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT | |
| 1992 | atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 1978 | 1993 | { |
| 1979 | 1994 | return __o->exchange(__d); |
| 1980 | 1995 | } |
| ... | ... | @@ -1984,7 +1999,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT |
| 1984 | 1999 | template <class _Tp> |
| 1985 | 2000 | _LIBCPP_INLINE_VISIBILITY |
| 1986 | 2001 | _Tp |
| 1987 | atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | |
| 2002 | atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT | |
| 1988 | 2003 | { |
| 1989 | 2004 | return __o->exchange(__d, __m); |
| 1990 | 2005 | } |
| ... | ... | @@ -1992,7 +2007,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _ |
| 1992 | 2007 | template <class _Tp> |
| 1993 | 2008 | _LIBCPP_INLINE_VISIBILITY |
| 1994 | 2009 | _Tp |
| 1995 | atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT | |
| 2010 | atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT | |
| 1996 | 2011 | { |
| 1997 | 2012 | return __o->exchange(__d, __m); |
| 1998 | 2013 | } |
| ... | ... | @@ -2002,7 +2017,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT |
| 2002 | 2017 | template <class _Tp> |
| 2003 | 2018 | _LIBCPP_INLINE_VISIBILITY |
| 2004 | 2019 | bool |
| 2005 | atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | |
| 2020 | atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 2006 | 2021 | { |
| 2007 | 2022 | return __o->compare_exchange_weak(*__e, __d); |
| 2008 | 2023 | } |
| ... | ... | @@ -2010,7 +2025,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX |
| 2010 | 2025 | template <class _Tp> |
| 2011 | 2026 | _LIBCPP_INLINE_VISIBILITY |
| 2012 | 2027 | bool |
| 2013 | atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | |
| 2028 | atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 2014 | 2029 | { |
| 2015 | 2030 | return __o->compare_exchange_weak(*__e, __d); |
| 2016 | 2031 | } |
| ... | ... | @@ -2020,7 +2035,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT |
| 2020 | 2035 | template <class _Tp> |
| 2021 | 2036 | _LIBCPP_INLINE_VISIBILITY |
| 2022 | 2037 | bool |
| 2023 | atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | |
| 2038 | atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 2024 | 2039 | { |
| 2025 | 2040 | return __o->compare_exchange_strong(*__e, __d); |
| 2026 | 2041 | } |
| ... | ... | @@ -2028,7 +2043,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO |
| 2028 | 2043 | template <class _Tp> |
| 2029 | 2044 | _LIBCPP_INLINE_VISIBILITY |
| 2030 | 2045 | bool |
| 2031 | atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT | |
| 2046 | atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT | |
| 2032 | 2047 | { |
| 2033 | 2048 | return __o->compare_exchange_strong(*__e, __d); |
| 2034 | 2049 | } |
| ... | ... | @@ -2038,8 +2053,8 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT |
| 2038 | 2053 | template <class _Tp> |
| 2039 | 2054 | _LIBCPP_INLINE_VISIBILITY |
| 2040 | 2055 | bool |
| 2041 | atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, | |
| 2042 | _Tp __d, | |
| 2056 | atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, | |
| 2057 | typename atomic<_Tp>::value_type __d, | |
| 2043 | 2058 | memory_order __s, memory_order __f) _NOEXCEPT |
| 2044 | 2059 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 2045 | 2060 | { |
| ... | ... | @@ -2049,7 +2064,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, |
| 2049 | 2064 | template <class _Tp> |
| 2050 | 2065 | _LIBCPP_INLINE_VISIBILITY |
| 2051 | 2066 | bool |
| 2052 | atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, | |
| 2067 | atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, | |
| 2053 | 2068 | memory_order __s, memory_order __f) _NOEXCEPT |
| 2054 | 2069 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 2055 | 2070 | { |
| ... | ... | @@ -2062,7 +2077,7 @@ template <class _Tp> |
| 2062 | 2077 | _LIBCPP_INLINE_VISIBILITY |
| 2063 | 2078 | bool |
| 2064 | 2079 | atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, |
| 2065 | _Tp* __e, _Tp __d, | |
| 2080 | typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, | |
| 2066 | 2081 | memory_order __s, memory_order __f) _NOEXCEPT |
| 2067 | 2082 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 2068 | 2083 | { |
| ... | ... | @@ -2072,8 +2087,8 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, |
| 2072 | 2087 | template <class _Tp> |
| 2073 | 2088 | _LIBCPP_INLINE_VISIBILITY |
| 2074 | 2089 | bool |
| 2075 | atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, | |
| 2076 | _Tp __d, | |
| 2090 | atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, | |
| 2091 | typename atomic<_Tp>::value_type __d, | |
| 2077 | 2092 | memory_order __s, memory_order __f) _NOEXCEPT |
| 2078 | 2093 | _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) |
| 2079 | 2094 | { |
| ... | ... | @@ -2156,10 +2171,10 @@ template <class _Tp> |
| 2156 | 2171 | _LIBCPP_INLINE_VISIBILITY |
| 2157 | 2172 | typename enable_if |
| 2158 | 2173 | < |
| 2159 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2174 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2160 | 2175 | _Tp |
| 2161 | 2176 | >::type |
| 2162 | atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2177 | atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT | |
| 2163 | 2178 | { |
| 2164 | 2179 | return __o->fetch_add(__op); |
| 2165 | 2180 | } |
| ... | ... | @@ -2168,10 +2183,10 @@ template <class _Tp> |
| 2168 | 2183 | _LIBCPP_INLINE_VISIBILITY |
| 2169 | 2184 | typename enable_if |
| 2170 | 2185 | < |
| 2171 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2186 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2172 | 2187 | _Tp |
| 2173 | 2188 | >::type |
| 2174 | atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2189 | atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT | |
| 2175 | 2190 | { |
| 2176 | 2191 | return __o->fetch_add(__op); |
| 2177 | 2192 | } |
| ... | ... | @@ -2179,7 +2194,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT |
| 2179 | 2194 | template <class _Tp> |
| 2180 | 2195 | _LIBCPP_INLINE_VISIBILITY |
| 2181 | 2196 | _Tp* |
| 2182 | atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | |
| 2197 | atomic_fetch_add(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT | |
| 2183 | 2198 | { |
| 2184 | 2199 | return __o->fetch_add(__op); |
| 2185 | 2200 | } |
| ... | ... | @@ -2187,7 +2202,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT |
| 2187 | 2202 | template <class _Tp> |
| 2188 | 2203 | _LIBCPP_INLINE_VISIBILITY |
| 2189 | 2204 | _Tp* |
| 2190 | atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | |
| 2205 | atomic_fetch_add(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT | |
| 2191 | 2206 | { |
| 2192 | 2207 | return __o->fetch_add(__op); |
| 2193 | 2208 | } |
| ... | ... | @@ -2198,10 +2213,10 @@ template <class _Tp> |
| 2198 | 2213 | _LIBCPP_INLINE_VISIBILITY |
| 2199 | 2214 | typename enable_if |
| 2200 | 2215 | < |
| 2201 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2216 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2202 | 2217 | _Tp |
| 2203 | 2218 | >::type |
| 2204 | atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2219 | atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2205 | 2220 | { |
| 2206 | 2221 | return __o->fetch_add(__op, __m); |
| 2207 | 2222 | } |
| ... | ... | @@ -2210,10 +2225,10 @@ template <class _Tp> |
| 2210 | 2225 | _LIBCPP_INLINE_VISIBILITY |
| 2211 | 2226 | typename enable_if |
| 2212 | 2227 | < |
| 2213 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2228 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2214 | 2229 | _Tp |
| 2215 | 2230 | >::type |
| 2216 | atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2231 | atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2217 | 2232 | { |
| 2218 | 2233 | return __o->fetch_add(__op, __m); |
| 2219 | 2234 | } |
| ... | ... | @@ -2221,8 +2236,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP |
| 2221 | 2236 | template <class _Tp> |
| 2222 | 2237 | _LIBCPP_INLINE_VISIBILITY |
| 2223 | 2238 | _Tp* |
| 2224 | atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, | |
| 2225 | memory_order __m) _NOEXCEPT | |
| 2239 | atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2226 | 2240 | { |
| 2227 | 2241 | return __o->fetch_add(__op, __m); |
| 2228 | 2242 | } |
| ... | ... | @@ -2230,7 +2244,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, |
| 2230 | 2244 | template <class _Tp> |
| 2231 | 2245 | _LIBCPP_INLINE_VISIBILITY |
| 2232 | 2246 | _Tp* |
| 2233 | atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT | |
| 2247 | atomic_fetch_add_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2234 | 2248 | { |
| 2235 | 2249 | return __o->fetch_add(__op, __m); |
| 2236 | 2250 | } |
| ... | ... | @@ -2241,10 +2255,10 @@ template <class _Tp> |
| 2241 | 2255 | _LIBCPP_INLINE_VISIBILITY |
| 2242 | 2256 | typename enable_if |
| 2243 | 2257 | < |
| 2244 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2258 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2245 | 2259 | _Tp |
| 2246 | 2260 | >::type |
| 2247 | atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2261 | atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT | |
| 2248 | 2262 | { |
| 2249 | 2263 | return __o->fetch_sub(__op); |
| 2250 | 2264 | } |
| ... | ... | @@ -2253,10 +2267,10 @@ template <class _Tp> |
| 2253 | 2267 | _LIBCPP_INLINE_VISIBILITY |
| 2254 | 2268 | typename enable_if |
| 2255 | 2269 | < |
| 2256 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2270 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2257 | 2271 | _Tp |
| 2258 | 2272 | >::type |
| 2259 | atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2273 | atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT | |
| 2260 | 2274 | { |
| 2261 | 2275 | return __o->fetch_sub(__op); |
| 2262 | 2276 | } |
| ... | ... | @@ -2264,7 +2278,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT |
| 2264 | 2278 | template <class _Tp> |
| 2265 | 2279 | _LIBCPP_INLINE_VISIBILITY |
| 2266 | 2280 | _Tp* |
| 2267 | atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | |
| 2281 | atomic_fetch_sub(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT | |
| 2268 | 2282 | { |
| 2269 | 2283 | return __o->fetch_sub(__op); |
| 2270 | 2284 | } |
| ... | ... | @@ -2272,7 +2286,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT |
| 2272 | 2286 | template <class _Tp> |
| 2273 | 2287 | _LIBCPP_INLINE_VISIBILITY |
| 2274 | 2288 | _Tp* |
| 2275 | atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT | |
| 2289 | atomic_fetch_sub(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT | |
| 2276 | 2290 | { |
| 2277 | 2291 | return __o->fetch_sub(__op); |
| 2278 | 2292 | } |
| ... | ... | @@ -2283,10 +2297,10 @@ template <class _Tp> |
| 2283 | 2297 | _LIBCPP_INLINE_VISIBILITY |
| 2284 | 2298 | typename enable_if |
| 2285 | 2299 | < |
| 2286 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2300 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2287 | 2301 | _Tp |
| 2288 | 2302 | >::type |
| 2289 | atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2303 | atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2290 | 2304 | { |
| 2291 | 2305 | return __o->fetch_sub(__op, __m); |
| 2292 | 2306 | } |
| ... | ... | @@ -2295,10 +2309,10 @@ template <class _Tp> |
| 2295 | 2309 | _LIBCPP_INLINE_VISIBILITY |
| 2296 | 2310 | typename enable_if |
| 2297 | 2311 | < |
| 2298 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, | |
| 2312 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value, | |
| 2299 | 2313 | _Tp |
| 2300 | 2314 | >::type |
| 2301 | atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2315 | atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2302 | 2316 | { |
| 2303 | 2317 | return __o->fetch_sub(__op, __m); |
| 2304 | 2318 | } |
| ... | ... | @@ -2306,8 +2320,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP |
| 2306 | 2320 | template <class _Tp> |
| 2307 | 2321 | _LIBCPP_INLINE_VISIBILITY |
| 2308 | 2322 | _Tp* |
| 2309 | atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, | |
| 2310 | memory_order __m) _NOEXCEPT | |
| 2323 | atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2311 | 2324 | { |
| 2312 | 2325 | return __o->fetch_sub(__op, __m); |
| 2313 | 2326 | } |
| ... | ... | @@ -2315,7 +2328,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, |
| 2315 | 2328 | template <class _Tp> |
| 2316 | 2329 | _LIBCPP_INLINE_VISIBILITY |
| 2317 | 2330 | _Tp* |
| 2318 | atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT | |
| 2331 | atomic_fetch_sub_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT | |
| 2319 | 2332 | { |
| 2320 | 2333 | return __o->fetch_sub(__op, __m); |
| 2321 | 2334 | } |
| ... | ... | @@ -2329,7 +2342,7 @@ typename enable_if |
| 2329 | 2342 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2330 | 2343 | _Tp |
| 2331 | 2344 | >::type |
| 2332 | atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2345 | atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2333 | 2346 | { |
| 2334 | 2347 | return __o->fetch_and(__op); |
| 2335 | 2348 | } |
| ... | ... | @@ -2341,7 +2354,7 @@ typename enable_if |
| 2341 | 2354 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2342 | 2355 | _Tp |
| 2343 | 2356 | >::type |
| 2344 | atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2357 | atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2345 | 2358 | { |
| 2346 | 2359 | return __o->fetch_and(__op); |
| 2347 | 2360 | } |
| ... | ... | @@ -2355,7 +2368,7 @@ typename enable_if |
| 2355 | 2368 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2356 | 2369 | _Tp |
| 2357 | 2370 | >::type |
| 2358 | atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2371 | atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2359 | 2372 | { |
| 2360 | 2373 | return __o->fetch_and(__op, __m); |
| 2361 | 2374 | } |
| ... | ... | @@ -2367,7 +2380,7 @@ typename enable_if |
| 2367 | 2380 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2368 | 2381 | _Tp |
| 2369 | 2382 | >::type |
| 2370 | atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2383 | atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2371 | 2384 | { |
| 2372 | 2385 | return __o->fetch_and(__op, __m); |
| 2373 | 2386 | } |
| ... | ... | @@ -2381,7 +2394,7 @@ typename enable_if |
| 2381 | 2394 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2382 | 2395 | _Tp |
| 2383 | 2396 | >::type |
| 2384 | atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2397 | atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2385 | 2398 | { |
| 2386 | 2399 | return __o->fetch_or(__op); |
| 2387 | 2400 | } |
| ... | ... | @@ -2393,7 +2406,7 @@ typename enable_if |
| 2393 | 2406 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2394 | 2407 | _Tp |
| 2395 | 2408 | >::type |
| 2396 | atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2409 | atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2397 | 2410 | { |
| 2398 | 2411 | return __o->fetch_or(__op); |
| 2399 | 2412 | } |
| ... | ... | @@ -2407,7 +2420,7 @@ typename enable_if |
| 2407 | 2420 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2408 | 2421 | _Tp |
| 2409 | 2422 | >::type |
| 2410 | atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2423 | atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2411 | 2424 | { |
| 2412 | 2425 | return __o->fetch_or(__op, __m); |
| 2413 | 2426 | } |
| ... | ... | @@ -2419,7 +2432,7 @@ typename enable_if |
| 2419 | 2432 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2420 | 2433 | _Tp |
| 2421 | 2434 | >::type |
| 2422 | atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2435 | atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2423 | 2436 | { |
| 2424 | 2437 | return __o->fetch_or(__op, __m); |
| 2425 | 2438 | } |
| ... | ... | @@ -2433,7 +2446,7 @@ typename enable_if |
| 2433 | 2446 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2434 | 2447 | _Tp |
| 2435 | 2448 | >::type |
| 2436 | atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2449 | atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2437 | 2450 | { |
| 2438 | 2451 | return __o->fetch_xor(__op); |
| 2439 | 2452 | } |
| ... | ... | @@ -2445,7 +2458,7 @@ typename enable_if |
| 2445 | 2458 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2446 | 2459 | _Tp |
| 2447 | 2460 | >::type |
| 2448 | atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT | |
| 2461 | atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT | |
| 2449 | 2462 | { |
| 2450 | 2463 | return __o->fetch_xor(__op); |
| 2451 | 2464 | } |
| ... | ... | @@ -2459,7 +2472,7 @@ typename enable_if |
| 2459 | 2472 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2460 | 2473 | _Tp |
| 2461 | 2474 | >::type |
| 2462 | atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2475 | atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2463 | 2476 | { |
| 2464 | 2477 | return __o->fetch_xor(__op, __m); |
| 2465 | 2478 | } |
| ... | ... | @@ -2471,7 +2484,7 @@ typename enable_if |
| 2471 | 2484 | is_integral<_Tp>::value && !is_same<_Tp, bool>::value, |
| 2472 | 2485 | _Tp |
| 2473 | 2486 | >::type |
| 2474 | atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT | |
| 2487 | atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT | |
| 2475 | 2488 | { |
| 2476 | 2489 | return __o->fetch_xor(__op, __m); |
| 2477 | 2490 | } |
| ... | ... | @@ -2715,6 +2728,9 @@ typedef atomic<long> atomic_long; |
| 2715 | 2728 | typedef atomic<unsigned long> atomic_ulong; |
| 2716 | 2729 | typedef atomic<long long> atomic_llong; |
| 2717 | 2730 | typedef atomic<unsigned long long> atomic_ullong; |
| 2731 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 2732 | typedef atomic<char8_t> atomic_char8_t; | |
| 2733 | #endif | |
| 2718 | 2734 | typedef atomic<char16_t> atomic_char16_t; |
| 2719 | 2735 | typedef atomic<char32_t> atomic_char32_t; |
| 2720 | 2736 | typedef atomic<wchar_t> atomic_wchar_t; |
lib/libcxx/include/barrier+10-2| ... | ... | @@ -22,6 +22,8 @@ namespace std |
| 22 | 22 | public: |
| 23 | 23 | using arrival_token = see below; |
| 24 | 24 | |
| 25 | static constexpr ptrdiff_t max() noexcept; | |
| 26 | ||
| 25 | 27 | constexpr explicit barrier(ptrdiff_t phase_count, |
| 26 | 28 | CompletionFunction f = CompletionFunction()); |
| 27 | 29 | ~barrier(); |
| ... | ... | @@ -44,6 +46,7 @@ namespace std |
| 44 | 46 | */ |
| 45 | 47 | |
| 46 | 48 | #include <__config> |
| 49 | #include <__availability> | |
| 47 | 50 | #include <atomic> |
| 48 | 51 | #ifndef _LIBCPP_HAS_NO_TREE_BARRIER |
| 49 | 52 | # include <memory> |
| ... | ... | @@ -57,6 +60,9 @@ namespace std |
| 57 | 60 | # error <barrier> is not supported on this single threaded system |
| 58 | 61 | #endif |
| 59 | 62 | |
| 63 | _LIBCPP_PUSH_MACROS | |
| 64 | #include <__undef_macros> | |
| 65 | ||
| 60 | 66 | #if _LIBCPP_STD_VER >= 14 |
| 61 | 67 | |
| 62 | 68 | _LIBCPP_BEGIN_NAMESPACE_STD |
| ... | ... | @@ -287,7 +293,7 @@ public: |
| 287 | 293 | |
| 288 | 294 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 289 | 295 | barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF()) |
| 290 | : __b(__count, std::move(__completion)) { | |
| 296 | : __b(__count, _VSTD::move(__completion)) { | |
| 291 | 297 | } |
| 292 | 298 | |
| 293 | 299 | barrier(barrier const&) = delete; |
| ... | ... | @@ -301,7 +307,7 @@ public: |
| 301 | 307 | _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 302 | 308 | void wait(arrival_token&& __phase) const |
| 303 | 309 | { |
| 304 | __b.wait(std::move(__phase)); | |
| 310 | __b.wait(_VSTD::move(__phase)); | |
| 305 | 311 | } |
| 306 | 312 | 	_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY |
| 307 | 313 | void arrive_and_wait() |
| ... | ... | @@ -319,4 +325,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 319 | 325 | |
| 320 | 326 | #endif // _LIBCPP_STD_VER >= 14 |
| 321 | 327 | |
| 328 | _LIBCPP_POP_MACROS | |
| 329 | ||
| 322 | 330 | #endif //_LIBCPP_BARRIER |
lib/libcxx/include/bit+14-15| ... | ... | @@ -17,13 +17,13 @@ namespace std { |
| 17 | 17 | |
| 18 | 18 | // [bit.pow.two], integral powers of 2 |
| 19 | 19 | template <class T> |
| 20 | constexpr bool ispow2(T x) noexcept; // C++20 | |
| 20 | constexpr bool has_single_bit(T x) noexcept; // C++20 | |
| 21 | 21 | template <class T> |
| 22 | constexpr T ceil2(T x); // C++20 | |
| 22 | constexpr T bit_ceil(T x); // C++20 | |
| 23 | 23 | template <class T> |
| 24 | constexpr T floor2(T x) noexcept; // C++20 | |
| 24 | constexpr T bit_floor(T x) noexcept; // C++20 | |
| 25 | 25 | template <class T> |
| 26 | constexpr T log2p1(T x) noexcept; // C++20 | |
| 26 | constexpr T bit_width(T x) noexcept; // C++20 | |
| 27 | 27 | |
| 28 | 28 | // [bit.rotate], rotating |
| 29 | 29 | template<class T> |
| ... | ... | @@ -343,14 +343,14 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 343 | 343 | unsigned __bit_log2(_Tp __t) _NOEXCEPT |
| 344 | 344 | { |
| 345 | 345 | static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned"); |
| 346 | return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t); | |
| 346 | return numeric_limits<_Tp>::digits - 1 - __countl_zero(__t); | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | template <class _Tp> |
| 350 | 350 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 351 | bool __ispow2(_Tp __t) _NOEXCEPT | |
| 351 | bool __has_single_bit(_Tp __t) _NOEXCEPT | |
| 352 | 352 | { |
| 353 | static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned"); | |
| 353 | static_assert(__bitop_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned"); | |
| 354 | 354 | return __t != 0 && (((__t & (__t - 1)) == 0)); |
| 355 | 355 | } |
| 356 | 356 | |
| ... | ... | @@ -399,7 +399,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr |
| 399 | 399 | enable_if_t<__bitop_unsigned_integer<_Tp>::value, int> |
| 400 | 400 | countr_zero(_Tp __t) noexcept |
| 401 | 401 | { |
| 402 | 	return __countr_zero(__t); | |
| 402 | return __countr_zero(__t); | |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | |
| ... | ... | @@ -424,15 +424,15 @@ popcount(_Tp __t) noexcept |
| 424 | 424 | template <class _Tp> |
| 425 | 425 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 426 | 426 | enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool> |
| 427 | ispow2(_Tp __t) noexcept | |
| 427 | has_single_bit(_Tp __t) noexcept | |
| 428 | 428 | { |
| 429 | return __ispow2(__t); | |
| 429 | return __has_single_bit(__t); | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | template <class _Tp> |
| 433 | 433 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 434 | 434 | enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp> |
| 435 | floor2(_Tp __t) noexcept | |
| 435 | bit_floor(_Tp __t) noexcept | |
| 436 | 436 | { |
| 437 | 437 | return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t); |
| 438 | 438 | } |
| ... | ... | @@ -440,11 +440,11 @@ floor2(_Tp __t) noexcept |
| 440 | 440 | template <class _Tp> |
| 441 | 441 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 442 | 442 | enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp> |
| 443 | ceil2(_Tp __t) noexcept | |
| 443 | bit_ceil(_Tp __t) noexcept | |
| 444 | 444 | { |
| 445 | 445 | if (__t < 2) return 1; |
| 446 | 446 | const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u)); |
| 447 | _LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2"); | |
| 447 | _LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); | |
| 448 | 448 | |
| 449 | 449 | if constexpr (sizeof(_Tp) >= sizeof(unsigned)) |
| 450 | 450 | return _Tp{1} << __n; |
| ... | ... | @@ -459,12 +459,11 @@ ceil2(_Tp __t) noexcept |
| 459 | 459 | template <class _Tp> |
| 460 | 460 | _LIBCPP_INLINE_VISIBILITY constexpr |
| 461 | 461 | enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp> |
| 462 | log2p1(_Tp __t) noexcept | |
| 462 | bit_width(_Tp __t) noexcept | |
| 463 | 463 | { |
| 464 | 464 | return __t == 0 ? 0 : __bit_log2(__t) + 1; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | ||
| 468 | 467 | enum class endian |
| 469 | 468 | { |
| 470 | 469 | little = 0xDEAD, |
lib/libcxx/include/bitset+5-5| ... | ... | @@ -380,7 +380,7 @@ unsigned long long |
| 380 | 380 | __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const |
| 381 | 381 | { |
| 382 | 382 | unsigned long long __r = __first_[0]; |
| 383 | for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) | |
| 383 | for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) | |
| 384 | 384 | __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT); |
| 385 | 385 | return __r; |
| 386 | 386 | } |
| ... | ... | @@ -625,13 +625,13 @@ protected: |
| 625 | 625 | explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; |
| 626 | 626 | |
| 627 | 627 | _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT |
| 628 | {return reference(0, 1);} | |
| 628 | {return reference(nullptr, 1);} | |
| 629 | 629 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT |
| 630 | {return const_reference(0, 1);} | |
| 630 | {return const_reference(nullptr, 1);} | |
| 631 | 631 | _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT |
| 632 | {return iterator(0, 0);} | |
| 632 | {return iterator(nullptr, 0);} | |
| 633 | 633 | _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT |
| 634 | {return const_iterator(0, 0);} | |
| 634 | {return const_iterator(nullptr, 0);} | |
| 635 | 635 | |
| 636 | 636 | _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} |
| 637 | 637 | _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {} |
lib/libcxx/include/charconv+14-13| ... | ... | @@ -74,12 +74,13 @@ namespace std { |
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | 76 | #include <__config> |
| 77 | #include <__availability> | |
| 77 | 78 | #include <__errc> |
| 78 | #include <type_traits> | |
| 79 | #include <cmath> // for log2f | |
| 80 | #include <cstdint> | |
| 81 | #include <cstring> | |
| 79 | 82 | #include <limits> |
| 80 | #include <stdint.h> | |
| 81 | #include <string.h> | |
| 82 | #include <math.h> | |
| 83 | #include <type_traits> | |
| 83 | 84 | |
| 84 | 85 | #include <__debug> |
| 85 | 86 | |
| ... | ... | @@ -206,7 +207,7 @@ __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) |
| 206 | 207 | { |
| 207 | 208 | auto __c = __a * __b; |
| 208 | 209 | __r = __c; |
| 209 | return __c > (numeric_limits<unsigned char>::max)(); | |
| 210 | return __c > numeric_limits<unsigned char>::max(); | |
| 210 | 211 | } |
| 211 | 212 | |
| 212 | 213 | template <typename _Tp> |
| ... | ... | @@ -215,7 +216,7 @@ __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) |
| 215 | 216 | { |
| 216 | 217 | auto __c = __a * __b; |
| 217 | 218 | __r = __c; |
| 218 | return __c > (numeric_limits<unsigned short>::max)(); | |
| 219 | return __c > numeric_limits<unsigned short>::max(); | |
| 219 | 220 | } |
| 220 | 221 | |
| 221 | 222 | template <typename _Tp> |
| ... | ... | @@ -226,7 +227,7 @@ __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) |
| 226 | 227 | #if !defined(_LIBCPP_COMPILER_MSVC) |
| 227 | 228 | return __builtin_mul_overflow(__a, __b, &__r); |
| 228 | 229 | #else |
| 229 | bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a; | |
| 230 | bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a; | |
| 230 | 231 | __r = __a * __b; |
| 231 | 232 | return __did; |
| 232 | 233 | #endif |
| ... | ... | @@ -332,7 +333,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) |
| 332 | 333 | auto __len = __p - __buf; |
| 333 | 334 | if (__len <= __diff) |
| 334 | 335 | { |
| 335 | memcpy(__first, __buf, __len); | |
| 336 | _VSTD::memcpy(__first, __buf, __len); | |
| 336 | 337 | return {__first + __len, {}}; |
| 337 | 338 | } |
| 338 | 339 | else |
| ... | ... | @@ -381,7 +382,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base, |
| 381 | 382 | return {__last, errc::value_too_large}; |
| 382 | 383 | else |
| 383 | 384 | { |
| 384 | memmove(__first, __p, __len); | |
| 385 | _VSTD::memmove(__first, __p, __len); | |
| 385 | 386 | return {__first + __len, {}}; |
| 386 | 387 | } |
| 387 | 388 | } |
| ... | ... | @@ -428,13 +429,13 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) |
| 428 | 429 | if (__x <= __complement(__to_unsigned(__tl::min()))) |
| 429 | 430 | { |
| 430 | 431 | __x = __complement(__x); |
| 431 | memcpy(&__value, &__x, sizeof(__x)); | |
| 432 | _VSTD::memcpy(&__value, &__x, sizeof(__x)); | |
| 432 | 433 | return __r; |
| 433 | 434 | } |
| 434 | 435 | } |
| 435 | 436 | else |
| 436 | 437 | { |
| 437 | if (__x <= (__tl::max)()) | |
| 438 | if (__x <= __tl::max()) | |
| 438 | 439 | { |
| 439 | 440 | __value = __x; |
| 440 | 441 | return __r; |
| ... | ... | @@ -525,7 +526,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value) |
| 525 | 526 | auto __p = __tx::__read(__first, __last, __a, __b); |
| 526 | 527 | if (__p == __last || !__in_pattern(*__p)) |
| 527 | 528 | { |
| 528 | __output_type __m = (numeric_limits<_Tp>::max)(); | |
| 529 | __output_type __m = numeric_limits<_Tp>::max(); | |
| 529 | 530 | if (__m >= __a && __m - __a >= __b) |
| 530 | 531 | { |
| 531 | 532 | __value = __a + __b; |
| ... | ... | @@ -580,7 +581,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value, |
| 580 | 581 | |
| 581 | 582 | if (__p == __last || !__in_pattern(*__p, __base)) |
| 582 | 583 | { |
| 583 | if ((__tl::max)() - __a >= __b) | |
| 584 | if (__tl::max() - __a >= __b) | |
| 584 | 585 | { |
| 585 | 586 | __value = __a + __b; |
| 586 | 587 | return {__p, {}}; |
lib/libcxx/include/chrono+4-3| ... | ... | @@ -824,6 +824,7 @@ constexpr chrono::year operator ""y(unsigned lo |
| 824 | 824 | */ |
| 825 | 825 | |
| 826 | 826 | #include <__config> |
| 827 | #include <__availability> | |
| 827 | 828 | #include <ctime> |
| 828 | 829 | #include <type_traits> |
| 829 | 830 | #include <ratio> |
| ... | ... | @@ -1076,7 +1077,7 @@ public: |
| 1076 | 1077 | is_convertible<_Rep2, rep>::value && |
| 1077 | 1078 | (treat_as_floating_point<rep>::value || |
| 1078 | 1079 | !treat_as_floating_point<_Rep2>::value) |
| 1079 | >::type* = 0) | |
| 1080 | >::type* = nullptr) | |
| 1080 | 1081 | : __rep_(__r) {} |
| 1081 | 1082 | |
| 1082 | 1083 | // conversions |
| ... | ... | @@ -1089,7 +1090,7 @@ public: |
| 1089 | 1090 | treat_as_floating_point<rep>::value || |
| 1090 | 1091 | (__no_overflow<_Period2, period>::type::den == 1 && |
| 1091 | 1092 | !treat_as_floating_point<_Rep2>::value)) |
| 1092 | >::type* = 0) | |
| 1093 | >::type* = nullptr) | |
| 1093 | 1094 | : __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {} |
| 1094 | 1095 | |
| 1095 | 1096 | // observer |
| ... | ... | @@ -1375,7 +1376,7 @@ public: |
| 1375 | 1376 | typename enable_if |
| 1376 | 1377 | < |
| 1377 | 1378 | is_convertible<_Duration2, duration>::value |
| 1378 | >::type* = 0) | |
| 1379 | >::type* = nullptr) | |
| 1379 | 1380 | : __d_(t.time_since_epoch()) {} |
| 1380 | 1381 | |
| 1381 | 1382 | // observer |
lib/libcxx/include/cmath+2-2| ... | ... | @@ -660,8 +660,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { |
| 660 | 660 | template <class _IntT, class _RealT> |
| 661 | 661 | _LIBCPP_INLINE_VISIBILITY |
| 662 | 662 | _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { |
| 663 | using _Lim = std::numeric_limits<_IntT>; | |
| 664 | const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>(); | |
| 663 | using _Lim = numeric_limits<_IntT>; | |
| 664 | const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>(); | |
| 665 | 665 | if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { |
| 666 | 666 | return _Lim::max(); |
| 667 | 667 | } else if (__r <= _Lim::lowest()) { |
lib/libcxx/include/codecvt+24| ... | ... | @@ -109,6 +109,7 @@ protected: |
| 109 | 109 | virtual int do_max_length() const _NOEXCEPT; |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 112 | 113 | template <> |
| 113 | 114 | class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t> |
| 114 | 115 | : public codecvt<char16_t, char, mbstate_t> |
| ... | ... | @@ -125,6 +126,8 @@ public: |
| 125 | 126 | codecvt_mode _Mode) |
| 126 | 127 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 127 | 128 | _Mode_(_Mode) {} |
| 129 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 130 | ||
| 128 | 131 | protected: |
| 129 | 132 | virtual result |
| 130 | 133 | do_out(state_type& __st, |
| ... | ... | @@ -144,6 +147,7 @@ protected: |
| 144 | 147 | virtual int do_max_length() const _NOEXCEPT; |
| 145 | 148 | }; |
| 146 | 149 | |
| 150 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 147 | 151 | template <> |
| 148 | 152 | class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t> |
| 149 | 153 | : public codecvt<char32_t, char, mbstate_t> |
| ... | ... | @@ -160,6 +164,8 @@ public: |
| 160 | 164 | codecvt_mode _Mode) |
| 161 | 165 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 162 | 166 | _Mode_(_Mode) {} |
| 167 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 168 | ||
| 163 | 169 | protected: |
| 164 | 170 | virtual result |
| 165 | 171 | do_out(state_type& __st, |
| ... | ... | @@ -267,6 +273,7 @@ protected: |
| 267 | 273 | virtual int do_max_length() const _NOEXCEPT; |
| 268 | 274 | }; |
| 269 | 275 | |
| 276 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 270 | 277 | template <> |
| 271 | 278 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false> |
| 272 | 279 | : public codecvt<char16_t, char, mbstate_t> |
| ... | ... | @@ -283,6 +290,8 @@ public: |
| 283 | 290 | codecvt_mode _Mode) |
| 284 | 291 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 285 | 292 | _Mode_(_Mode) {} |
| 293 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 294 | ||
| 286 | 295 | protected: |
| 287 | 296 | virtual result |
| 288 | 297 | do_out(state_type& __st, |
| ... | ... | @@ -302,6 +311,7 @@ protected: |
| 302 | 311 | virtual int do_max_length() const _NOEXCEPT; |
| 303 | 312 | }; |
| 304 | 313 | |
| 314 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 305 | 315 | template <> |
| 306 | 316 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true> |
| 307 | 317 | : public codecvt<char16_t, char, mbstate_t> |
| ... | ... | @@ -318,6 +328,8 @@ public: |
| 318 | 328 | codecvt_mode _Mode) |
| 319 | 329 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 320 | 330 | _Mode_(_Mode) {} |
| 331 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 332 | ||
| 321 | 333 | protected: |
| 322 | 334 | virtual result |
| 323 | 335 | do_out(state_type& __st, |
| ... | ... | @@ -337,6 +349,7 @@ protected: |
| 337 | 349 | virtual int do_max_length() const _NOEXCEPT; |
| 338 | 350 | }; |
| 339 | 351 | |
| 352 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 340 | 353 | template <> |
| 341 | 354 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false> |
| 342 | 355 | : public codecvt<char32_t, char, mbstate_t> |
| ... | ... | @@ -353,6 +366,8 @@ public: |
| 353 | 366 | codecvt_mode _Mode) |
| 354 | 367 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 355 | 368 | _Mode_(_Mode) {} |
| 369 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 370 | ||
| 356 | 371 | protected: |
| 357 | 372 | virtual result |
| 358 | 373 | do_out(state_type& __st, |
| ... | ... | @@ -372,6 +387,7 @@ protected: |
| 372 | 387 | virtual int do_max_length() const _NOEXCEPT; |
| 373 | 388 | }; |
| 374 | 389 | |
| 390 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 375 | 391 | template <> |
| 376 | 392 | class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true> |
| 377 | 393 | : public codecvt<char32_t, char, mbstate_t> |
| ... | ... | @@ -388,6 +404,8 @@ public: |
| 388 | 404 | codecvt_mode _Mode) |
| 389 | 405 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 390 | 406 | _Mode_(_Mode) {} |
| 407 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 408 | ||
| 391 | 409 | protected: |
| 392 | 410 | virtual result |
| 393 | 411 | do_out(state_type& __st, |
| ... | ... | @@ -460,6 +478,7 @@ protected: |
| 460 | 478 | virtual int do_max_length() const _NOEXCEPT; |
| 461 | 479 | }; |
| 462 | 480 | |
| 481 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 463 | 482 | template <> |
| 464 | 483 | class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t> |
| 465 | 484 | : public codecvt<char32_t, char, mbstate_t> |
| ... | ... | @@ -476,6 +495,8 @@ public: |
| 476 | 495 | codecvt_mode _Mode) |
| 477 | 496 | : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 478 | 497 | _Mode_(_Mode) {} |
| 498 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 499 | ||
| 479 | 500 | protected: |
| 480 | 501 | virtual result |
| 481 | 502 | do_out(state_type& __st, |
| ... | ... | @@ -495,6 +516,7 @@ protected: |
| 495 | 516 | virtual int do_max_length() const _NOEXCEPT; |
| 496 | 517 | }; |
| 497 | 518 | |
| 519 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 498 | 520 | template <> |
| 499 | 521 | class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t> |
| 500 | 522 | : public codecvt<char16_t, char, mbstate_t> |
| ... | ... | @@ -511,6 +533,8 @@ public: |
| 511 | 533 | codecvt_mode _Mode) |
| 512 | 534 | : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode), |
| 513 | 535 | _Mode_(_Mode) {} |
| 536 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 537 | ||
| 514 | 538 | protected: |
| 515 | 539 | virtual result |
| 516 | 540 | do_out(state_type& __st, |
lib/libcxx/include/compare+9-4| ... | ... | @@ -154,8 +154,13 @@ enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char { |
| 154 | 154 | __unordered = -127 |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | struct _CmpUnspecifiedType; | |
| 158 | using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)(); | |
| 157 | struct _CmpUnspecifiedParam { | |
| 158 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEVAL | |
| 159 | _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {} | |
| 160 | ||
| 161 | template<typename _Tp, typename = _VSTD::enable_if_t<!_VSTD::is_same_v<_Tp, int>>> | |
| 162 | _CmpUnspecifiedParam(_Tp) = delete; | |
| 163 | }; | |
| 159 | 164 | |
| 160 | 165 | class weak_equality { |
| 161 | 166 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -696,8 +701,8 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept { |
| 696 | 701 | |
| 697 | 702 | template <size_t _Size> |
| 698 | 703 | constexpr _ClassifyCompCategory |
| 699 | __compute_comp_type(std::array<_ClassifyCompCategory, _Size> __types) { | |
| 700 | std::array<int, _CCC_Size> __seen = {}; | |
| 704 | __compute_comp_type(array<_ClassifyCompCategory, _Size> __types) { | |
| 705 | array<int, _CCC_Size> __seen = {}; | |
| 701 | 706 | for (auto __type : __types) |
| 702 | 707 | ++__seen[__type]; |
| 703 | 708 | if (__seen[_None]) |
lib/libcxx/include/complex+7-10| ... | ... | @@ -227,14 +227,6 @@ template<class T> complex<T> sqrt (const complex<T>&); |
| 227 | 227 | template<class T> complex<T> tan (const complex<T>&); |
| 228 | 228 | template<class T> complex<T> tanh (const complex<T>&); |
| 229 | 229 | |
| 230 | template<class T, class charT, class traits> | |
| 231 | basic_istream<charT, traits>& | |
| 232 | operator>>(basic_istream<charT, traits>& is, complex<T>& x); | |
| 233 | ||
| 234 | template<class T, class charT, class traits> | |
| 235 | basic_ostream<charT, traits>& | |
| 236 | operator<<(basic_ostream<charT, traits>& o, const complex<T>& x); | |
| 237 | ||
| 238 | 230 | } // std |
| 239 | 231 | |
| 240 | 232 | */ |
| ... | ... | @@ -244,9 +236,12 @@ template<class T, class charT, class traits> |
| 244 | 236 | #include <stdexcept> |
| 245 | 237 | #include <cmath> |
| 246 | 238 | #include <iosfwd> |
| 247 | #include <sstream> | |
| 248 | 239 | #include <version> |
| 249 | 240 | |
| 241 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 242 | # include <sstream> // for std::basic_ostringstream | |
| 243 | #endif | |
| 244 | ||
| 250 | 245 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 251 | 246 | #pragma GCC system_header |
| 252 | 247 | #endif |
| ... | ... | @@ -955,7 +950,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 955 | 950 | complex<_Tp> |
| 956 | 951 | proj(const complex<_Tp>& __c) |
| 957 | 952 | { |
| 958 | std::complex<_Tp> __r = __c; | |
| 953 | complex<_Tp> __r = __c; | |
| 959 | 954 | if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag())) |
| 960 | 955 | __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag())); |
| 961 | 956 | return __r; |
| ... | ... | @@ -1438,6 +1433,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) |
| 1438 | 1433 | return __is; |
| 1439 | 1434 | } |
| 1440 | 1435 | |
| 1436 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 1441 | 1437 | template<class _Tp, class _CharT, class _Traits> |
| 1442 | 1438 | basic_ostream<_CharT, _Traits>& |
| 1443 | 1439 | operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) |
| ... | ... | @@ -1449,6 +1445,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) |
| 1449 | 1445 | __s << '(' << __x.real() << ',' << __x.imag() << ')'; |
| 1450 | 1446 | return __os << __s.str(); |
| 1451 | 1447 | } |
| 1448 | #endif // !_LIBCPP_HAS_NO_LOCALIZATION | |
| 1452 | 1449 | |
| 1453 | 1450 | #if _LIBCPP_STD_VER > 11 |
| 1454 | 1451 | // Literal suffix for complex number literals [complex.literals] |
lib/libcxx/include/ctime+15-1| ... | ... | @@ -52,6 +52,20 @@ int timespec_get( struct timespec *ts, int base); // C++17 |
| 52 | 52 | #pragma GCC system_header |
| 53 | 53 | #endif |
| 54 | 54 | |
| 55 | // FIXME: | |
| 56 | // Apple SDKs don't define ::timespec_get unconditionally in C++ mode. This | |
| 57 | // should be fixed in future SDKs, but for the time being we need to avoid | |
| 58 | // trying to use that declaration when the SDK doesn't provide it. Note that | |
| 59 | // we're detecting this here instead of in <__config> because we can't include | |
| 60 | // system headers from <__config>, since it leads to circular module dependencies. | |
| 61 | // This is also meant to be a very temporary workaround until the SDKs are fixed. | |
| 62 | #if defined(__APPLE__) | |
| 63 | # include <sys/cdefs.h> | |
| 64 | # if defined(_LIBCPP_HAS_TIMESPEC_GET) && (__DARWIN_C_LEVEL < __DARWIN_C_FULL) | |
| 65 | # define _LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED | |
| 66 | # endif | |
| 67 | #endif | |
| 68 | ||
| 55 | 69 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 56 | 70 | |
| 57 | 71 | using ::clock_t; |
| ... | ... | @@ -72,7 +86,7 @@ using ::gmtime; |
| 72 | 86 | using ::localtime; |
| 73 | 87 | #endif |
| 74 | 88 | using ::strftime; |
| 75 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) | |
| 89 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED) | |
| 76 | 90 | using ::timespec_get; |
| 77 | 91 | #endif |
| 78 | 92 |
lib/libcxx/include/deque+8-8| ... | ... | @@ -1237,7 +1237,7 @@ __deque_base<_Tp, _Allocator>::swap(__deque_base& __c) |
| 1237 | 1237 | __map_.swap(__c.__map_); |
| 1238 | 1238 | _VSTD::swap(__start_, __c.__start_); |
| 1239 | 1239 | _VSTD::swap(size(), __c.size()); |
| 1240 | __swap_allocator(__alloc(), __c.__alloc()); | |
| 1240 | _VSTD::__swap_allocator(__alloc(), __c.__alloc()); | |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -1393,7 +1393,7 @@ public: |
| 1393 | 1393 | size_type size() const _NOEXCEPT {return __base::size();} |
| 1394 | 1394 | _LIBCPP_INLINE_VISIBILITY |
| 1395 | 1395 | size_type max_size() const _NOEXCEPT |
| 1396 | {return std::min<size_type>( | |
| 1396 | {return _VSTD::min<size_type>( | |
| 1397 | 1397 | __alloc_traits::max_size(__base::__alloc()), |
| 1398 | 1398 | numeric_limits<difference_type>::max());} |
| 1399 | 1399 | void resize(size_type __n); |
| ... | ... | @@ -1586,7 +1586,7 @@ public: |
| 1586 | 1586 | |
| 1587 | 1587 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 1588 | 1588 | template<class _InputIterator, |
| 1589 | class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 1589 | class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 1590 | 1590 | class = typename enable_if<__is_allocator<_Alloc>::value, void>::type |
| 1591 | 1591 | > |
| 1592 | 1592 | deque(_InputIterator, _InputIterator) |
| ... | ... | @@ -2376,7 +2376,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, |
| 2376 | 2376 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { |
| 2377 | 2377 | _ConstructTransaction __tx(this, __br); |
| 2378 | 2378 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) { |
| 2379 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f); | |
| 2379 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), *__f); | |
| 2380 | 2380 | } |
| 2381 | 2381 | } |
| 2382 | 2382 | } |
| ... | ... | @@ -2393,7 +2393,7 @@ deque<_Tp, _Allocator>::__append(size_type __n) |
| 2393 | 2393 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { |
| 2394 | 2394 | _ConstructTransaction __tx(this, __br); |
| 2395 | 2395 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { |
| 2396 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_)); | |
| 2396 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_)); | |
| 2397 | 2397 | } |
| 2398 | 2398 | } |
| 2399 | 2399 | } |
| ... | ... | @@ -2410,7 +2410,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) |
| 2410 | 2410 | for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { |
| 2411 | 2411 | _ConstructTransaction __tx(this, __br); |
| 2412 | 2412 | for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { |
| 2413 | __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v); | |
| 2413 | __alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), __v); | |
| 2414 | 2414 | } |
| 2415 | 2415 | } |
| 2416 | 2416 | |
| ... | ... | @@ -2708,7 +2708,7 @@ void |
| 2708 | 2708 | deque<_Tp, _Allocator>::pop_front() |
| 2709 | 2709 | { |
| 2710 | 2710 | allocator_type& __a = __base::__alloc(); |
| 2711 | __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() + | |
| 2711 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() + | |
| 2712 | 2712 | __base::__start_ / __base::__block_size) + |
| 2713 | 2713 | __base::__start_ % __base::__block_size)); |
| 2714 | 2714 | --__base::size(); |
| ... | ... | @@ -2723,7 +2723,7 @@ deque<_Tp, _Allocator>::pop_back() |
| 2723 | 2723 | _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque"); |
| 2724 | 2724 | allocator_type& __a = __base::__alloc(); |
| 2725 | 2725 | size_type __p = __base::size() + __base::__start_ - 1; |
| 2726 | __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() + | |
| 2726 | __alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() + | |
| 2727 | 2727 | __p / __base::__block_size) + |
| 2728 | 2728 | __p % __base::__block_size)); |
| 2729 | 2729 | --__base::size(); |
lib/libcxx/include/exception+2| ... | ... | @@ -77,6 +77,8 @@ template <class E> void rethrow_if_nested(const E& e); |
| 77 | 77 | */ |
| 78 | 78 | |
| 79 | 79 | #include <__config> |
| 80 | #include <__availability> | |
| 81 | #include <__memory/base.h> | |
| 80 | 82 | #include <cstddef> |
| 81 | 83 | #include <cstdlib> |
| 82 | 84 | #include <type_traits> |
lib/libcxx/include/experimental/memory_resource+2-3| ... | ... | @@ -116,7 +116,7 @@ public: |
| 116 | 116 | { return do_is_equal(__other); } |
| 117 | 117 | |
| 118 | 118 | // 8.5.3, memory.resource.priv |
| 119 | protected: | |
| 119 | private: | |
| 120 | 120 | virtual void* do_allocate(size_t, size_t) = 0; |
| 121 | 121 | virtual void do_deallocate(void*, size_t, size_t) = 0; |
| 122 | 122 | virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0; |
| ... | ... | @@ -381,7 +381,7 @@ public: |
| 381 | 381 | { return __alloc_; } |
| 382 | 382 | |
| 383 | 383 | // 8.7.3, memory.resource.adaptor.mem |
| 384 | protected: | |
| 384 | private: | |
| 385 | 385 | virtual void * do_allocate(size_t __bytes, size_t) |
| 386 | 386 | { |
| 387 | 387 | if (__bytes > __max_size()) { |
| ... | ... | @@ -407,7 +407,6 @@ protected: |
| 407 | 407 | return __p ? __alloc_ == __p->__alloc_ : false; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | private: | |
| 411 | 410 | _LIBCPP_INLINE_VISIBILITY |
| 412 | 411 | size_t __max_size() const _NOEXCEPT { |
| 413 | 412 | return numeric_limits<size_t>::max() - _MaxAlign; |
lib/libcxx/include/experimental/simd+5| ... | ... | @@ -659,6 +659,9 @@ public: |
| 659 | 659 | #pragma GCC system_header |
| 660 | 660 | #endif |
| 661 | 661 | |
| 662 | _LIBCPP_PUSH_MACROS | |
| 663 | #include <__undef_macros> | |
| 664 | ||
| 662 | 665 | _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD |
| 663 | 666 | |
| 664 | 667 | #if _LIBCPP_STD_VER >= 17 |
| ... | ... | @@ -1566,4 +1569,6 @@ public: |
| 1566 | 1569 | |
| 1567 | 1570 | _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD |
| 1568 | 1571 | |
| 1572 | _LIBCPP_POP_MACROS | |
| 1573 | ||
| 1569 | 1574 | #endif /* _LIBCPP_EXPERIMENTAL_SIMD */ |
lib/libcxx/include/ext/hash_map+1-1| ... | ... | @@ -671,7 +671,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) |
| 671 | 671 | __h.get_deleter().__first_constructed = true; |
| 672 | 672 | __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); |
| 673 | 673 | __h.get_deleter().__second_constructed = true; |
| 674 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 674 | return __h; | |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
lib/libcxx/include/filesystem+84-37| ... | ... | @@ -230,21 +230,25 @@ |
| 230 | 230 | */ |
| 231 | 231 | |
| 232 | 232 | #include <__config> |
| 233 | #include <__availability> | |
| 233 | 234 | #include <cstddef> |
| 234 | 235 | #include <cstdlib> |
| 235 | 236 | #include <chrono> |
| 236 | 237 | #include <iterator> |
| 237 | 238 | #include <iosfwd> |
| 238 | #include <locale> | |
| 239 | 239 | #include <memory> |
| 240 | 240 | #include <stack> |
| 241 | 241 | #include <string> |
| 242 | 242 | #include <system_error> |
| 243 | 243 | #include <utility> |
| 244 | #include <iomanip> // for quoted | |
| 245 | 244 | #include <string_view> |
| 246 | 245 | #include <version> |
| 247 | 246 | |
| 247 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 248 | # include <locale> | |
| 249 | # include <iomanip> // for quoted | |
| 250 | #endif | |
| 251 | ||
| 248 | 252 | #include <__debug> |
| 249 | 253 | |
| 250 | 254 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -543,6 +547,13 @@ struct __can_convert_char<wchar_t> { |
| 543 | 547 | static const bool value = true; |
| 544 | 548 | using __char_type = wchar_t; |
| 545 | 549 | }; |
| 550 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 551 | template <> | |
| 552 | struct __can_convert_char<char8_t> { | |
| 553 | static const bool value = true; | |
| 554 | using __char_type = char8_t; | |
| 555 | }; | |
| 556 | #endif | |
| 546 | 557 | template <> |
| 547 | 558 | struct __can_convert_char<char16_t> { |
| 548 | 559 | static const bool value = true; |
| ... | ... | @@ -560,7 +571,7 @@ __is_separator(_ECharT __e) { |
| 560 | 571 | return __e == _ECharT('/'); |
| 561 | 572 | } |
| 562 | 573 | |
| 563 | struct _NullSentinal {}; | |
| 574 | struct _NullSentinel {}; | |
| 564 | 575 | |
| 565 | 576 | template <class _Tp> |
| 566 | 577 | using _Void = void; |
| ... | ... | @@ -615,9 +626,9 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> |
| 615 | 626 | static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } |
| 616 | 627 | static _ECharT const* __range_end(const _ECharT* __b) { |
| 617 | 628 | using _Iter = const _ECharT*; |
| 618 | const _ECharT __sentinal = _ECharT{}; | |
| 629 | const _ECharT __sentinel = _ECharT{}; | |
| 619 | 630 | _Iter __e = __b; |
| 620 | for (; *__e != __sentinal; ++__e) | |
| 631 | for (; *__e != __sentinel; ++__e) | |
| 621 | 632 | ; |
| 622 | 633 | return __e; |
| 623 | 634 | } |
| ... | ... | @@ -639,7 +650,7 @@ struct __is_pathable_iter< |
| 639 | 650 | using _Base = __can_convert_char<_ECharT>; |
| 640 | 651 | |
| 641 | 652 | static _Iter __range_begin(_Iter __b) { return __b; } |
| 642 | static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; } | |
| 653 | static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; } | |
| 643 | 654 | |
| 644 | 655 | static _ECharT __first_or_null(_Iter __b) { return *__b; } |
| 645 | 656 | }; |
| ... | ... | @@ -661,6 +672,10 @@ struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> { |
| 661 | 672 | template <class _Tp> |
| 662 | 673 | struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {}; |
| 663 | 674 | |
| 675 | template <class _ECharT> | |
| 676 | struct _PathCVT; | |
| 677 | ||
| 678 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 664 | 679 | template <class _ECharT> |
| 665 | 680 | struct _PathCVT { |
| 666 | 681 | static_assert(__can_convert_char<_ECharT>::value, |
| ... | ... | @@ -684,13 +699,13 @@ struct _PathCVT { |
| 684 | 699 | } |
| 685 | 700 | |
| 686 | 701 | template <class _Iter> |
| 687 | static void __append_range(string& __dest, _Iter __b, _NullSentinal) { | |
| 702 | static void __append_range(string& __dest, _Iter __b, _NullSentinel) { | |
| 688 | 703 | static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); |
| 689 | const _ECharT __sentinal = _ECharT{}; | |
| 690 | if (*__b == __sentinal) | |
| 704 | const _ECharT __sentinel = _ECharT{}; | |
| 705 | if (*__b == __sentinel) | |
| 691 | 706 | return; |
| 692 | 707 | basic_string<_ECharT> __tmp; |
| 693 | for (; *__b != __sentinal; ++__b) | |
| 708 | for (; *__b != __sentinel; ++__b) | |
| 694 | 709 | __tmp.push_back(*__b); |
| 695 | 710 | _Narrower()(back_inserter(__dest), __tmp.data(), |
| 696 | 711 | __tmp.data() + __tmp.length()); |
| ... | ... | @@ -703,6 +718,7 @@ struct _PathCVT { |
| 703 | 718 | _Traits::__range_end(__s)); |
| 704 | 719 | } |
| 705 | 720 | }; |
| 721 | #endif // !_LIBCPP_HAS_NO_LOCALIZATION | |
| 706 | 722 | |
| 707 | 723 | template <> |
| 708 | 724 | struct _PathCVT<char> { |
| ... | ... | @@ -721,9 +737,9 @@ struct _PathCVT<char> { |
| 721 | 737 | } |
| 722 | 738 | |
| 723 | 739 | template <class _Iter> |
| 724 | static void __append_range(string& __dest, _Iter __b, _NullSentinal) { | |
| 725 | const char __sentinal = char{}; | |
| 726 | for (; *__b != __sentinal; ++__b) | |
| 740 | static void __append_range(string& __dest, _Iter __b, _NullSentinel) { | |
| 741 | const char __sentinel = char{}; | |
| 742 | for (; *__b != __sentinel; ++__b) | |
| 727 | 743 | __dest.push_back(*__b); |
| 728 | 744 | } |
| 729 | 745 | |
| ... | ... | @@ -779,12 +795,14 @@ public: |
| 779 | 795 | _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); |
| 780 | 796 | } |
| 781 | 797 | |
| 798 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 782 | 799 | // TODO Implement locale conversions. |
| 783 | 800 | template <class _Source, class = _EnableIfPathable<_Source, void> > |
| 784 | 801 | path(const _Source& __src, const locale& __loc, format = format::auto_format); |
| 785 | 802 | template <class _InputIt> |
| 786 | 803 | path(_InputIt __first, _InputIt _last, const locale& __loc, |
| 787 | 804 | format = format::auto_format); |
| 805 | #endif | |
| 788 | 806 | |
| 789 | 807 | _LIBCPP_INLINE_VISIBILITY |
| 790 | 808 | ~path() = default; |
| ... | ... | @@ -922,9 +940,8 @@ public: |
| 922 | 940 | template <class _ECharT> |
| 923 | 941 | typename enable_if<__can_convert_char<_ECharT>::value, path&>::type |
| 924 | 942 | operator+=(_ECharT __x) { |
| 925 | basic_string<_ECharT> __tmp; | |
| 926 | __tmp += __x; | |
| 927 | _PathCVT<_ECharT>::__append_source(__pn_, __tmp); | |
| 943 | _PathCVT<_ECharT>::__append_source(__pn_, | |
| 944 | basic_string_view<_ECharT>(&__x, 1)); | |
| 928 | 945 | return *this; |
| 929 | 946 | } |
| 930 | 947 | |
| ... | ... | @@ -983,6 +1000,14 @@ public: |
| 983 | 1000 | |
| 984 | 1001 | _LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; } |
| 985 | 1002 | |
| 1003 | _LIBCPP_INLINE_VISIBILITY _VSTD::string string() const { return __pn_; } | |
| 1004 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1005 | _LIBCPP_INLINE_VISIBILITY _VSTD::u8string u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } | |
| 1006 | #else | |
| 1007 | _LIBCPP_INLINE_VISIBILITY _VSTD::string u8string() const { return __pn_; } | |
| 1008 | #endif | |
| 1009 | ||
| 1010 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 986 | 1011 | template <class _ECharT, class _Traits = char_traits<_ECharT>, |
| 987 | 1012 | class _Allocator = allocator<_ECharT> > |
| 988 | 1013 | basic_string<_ECharT, _Traits, _Allocator> |
| ... | ... | @@ -995,19 +1020,26 @@ public: |
| 995 | 1020 | return __s; |
| 996 | 1021 | } |
| 997 | 1022 | |
| 998 | _LIBCPP_INLINE_VISIBILITY std::string string() const { return __pn_; } | |
| 999 | _LIBCPP_INLINE_VISIBILITY std::wstring wstring() const { | |
| 1023 | _LIBCPP_INLINE_VISIBILITY _VSTD::wstring wstring() const { | |
| 1000 | 1024 | return string<wchar_t>(); |
| 1001 | 1025 | } |
| 1002 | _LIBCPP_INLINE_VISIBILITY std::string u8string() const { return __pn_; } | |
| 1003 | _LIBCPP_INLINE_VISIBILITY std::u16string u16string() const { | |
| 1026 | _LIBCPP_INLINE_VISIBILITY _VSTD::u16string u16string() const { | |
| 1004 | 1027 | return string<char16_t>(); |
| 1005 | 1028 | } |
| 1006 | _LIBCPP_INLINE_VISIBILITY std::u32string u32string() const { | |
| 1029 | _LIBCPP_INLINE_VISIBILITY _VSTD::u32string u32string() const { | |
| 1007 | 1030 | return string<char32_t>(); |
| 1008 | 1031 | } |
| 1032 | #endif | |
| 1009 | 1033 | |
| 1010 | 1034 | // generic format observers |
| 1035 | _VSTD::string generic_string() const { return __pn_; } | |
| 1036 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1037 | _VSTD::u8string generic_u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); } | |
| 1038 | #else | |
| 1039 | _VSTD::string generic_u8string() const { return __pn_; } | |
| 1040 | #endif | |
| 1041 | ||
| 1042 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 1011 | 1043 | template <class _ECharT, class _Traits = char_traits<_ECharT>, |
| 1012 | 1044 | class _Allocator = allocator<_ECharT> > |
| 1013 | 1045 | basic_string<_ECharT, _Traits, _Allocator> |
| ... | ... | @@ -1015,11 +1047,10 @@ public: |
| 1015 | 1047 | return string<_ECharT, _Traits, _Allocator>(__a); |
| 1016 | 1048 | } |
| 1017 | 1049 | |
| 1018 | std::string generic_string() const { return __pn_; } | |
| 1019 | std::wstring generic_wstring() const { return string<wchar_t>(); } | |
| 1020 | std::string generic_u8string() const { return __pn_; } | |
| 1021 | std::u16string generic_u16string() const { return string<char16_t>(); } | |
| 1022 | std::u32string generic_u32string() const { return string<char32_t>(); } | |
| 1050 | _VSTD::wstring generic_wstring() const { return string<wchar_t>(); } | |
| 1051 | _VSTD::u16string generic_u16string() const { return string<char16_t>(); } | |
| 1052 | _VSTD::u32string generic_u32string() const { return string<char32_t>(); } | |
| 1053 | #endif | |
| 1023 | 1054 | |
| 1024 | 1055 | private: |
| 1025 | 1056 | int __compare(__string_view) const; |
| ... | ... | @@ -1123,13 +1154,14 @@ public: |
| 1123 | 1154 | iterator begin() const; |
| 1124 | 1155 | iterator end() const; |
| 1125 | 1156 | |
| 1157 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 1126 | 1158 | template <class _CharT, class _Traits> |
| 1127 | 1159 | _LIBCPP_INLINE_VISIBILITY friend |
| 1128 | 1160 | typename enable_if<is_same<_CharT, char>::value && |
| 1129 | 1161 | is_same<_Traits, char_traits<char> >::value, |
| 1130 | 1162 | basic_ostream<_CharT, _Traits>&>::type |
| 1131 | 1163 | operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { |
| 1132 | __os << std::__quoted(__p.native()); | |
| 1164 | __os << _VSTD::__quoted(__p.native()); | |
| 1133 | 1165 | return __os; |
| 1134 | 1166 | } |
| 1135 | 1167 | |
| ... | ... | @@ -1139,7 +1171,7 @@ public: |
| 1139 | 1171 | !is_same<_Traits, char_traits<char> >::value, |
| 1140 | 1172 | basic_ostream<_CharT, _Traits>&>::type |
| 1141 | 1173 | operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { |
| 1142 | __os << std::__quoted(__p.string<_CharT, _Traits>()); | |
| 1174 | __os << _VSTD::__quoted(__p.string<_CharT, _Traits>()); | |
| 1143 | 1175 | return __os; |
| 1144 | 1176 | } |
| 1145 | 1177 | |
| ... | ... | @@ -1151,6 +1183,7 @@ public: |
| 1151 | 1183 | __p = __tmp; |
| 1152 | 1184 | return __is; |
| 1153 | 1185 | } |
| 1186 | #endif // !_LIBCPP_HAS_NO_LOCALIZATION | |
| 1154 | 1187 | |
| 1155 | 1188 | friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept { |
| 1156 | 1189 | return __lhs.compare(__rhs) == 0; |
| ... | ... | @@ -1194,23 +1227,37 @@ _LIBCPP_FUNC_VIS |
| 1194 | 1227 | size_t hash_value(const path& __p) noexcept; |
| 1195 | 1228 | |
| 1196 | 1229 | template <class _Source> |
| 1197 | _LIBCPP_INLINE_VISIBILITY | |
| 1230 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T | |
| 1198 | 1231 | typename enable_if<__is_pathable<_Source>::value, path>::type |
| 1199 | 1232 | u8path(const _Source& __s) { |
| 1200 | 1233 | static_assert( |
| 1234 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1235 | is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value || | |
| 1236 | #endif | |
| 1201 | 1237 | is_same<typename __is_pathable<_Source>::__char_type, char>::value, |
| 1202 | 1238 | "u8path(Source const&) requires Source have a character type of type " |
| 1203 | "'char'"); | |
| 1239 | "'char'" | |
| 1240 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1241 | " or 'char8_t'" | |
| 1242 | #endif | |
| 1243 | ); | |
| 1204 | 1244 | return path(__s); |
| 1205 | 1245 | } |
| 1206 | 1246 | |
| 1207 | 1247 | template <class _InputIt> |
| 1208 | _LIBCPP_INLINE_VISIBILITY | |
| 1248 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T | |
| 1209 | 1249 | typename enable_if<__is_pathable<_InputIt>::value, path>::type |
| 1210 | 1250 | u8path(_InputIt __f, _InputIt __l) { |
| 1211 | 1251 | static_assert( |
| 1252 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1253 | is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value || | |
| 1254 | #endif | |
| 1212 | 1255 | is_same<typename __is_pathable<_InputIt>::__char_type, char>::value, |
| 1213 | "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"); | |
| 1256 | "u8path(Iter, Iter) requires Iter have a value_type of type 'char'" | |
| 1257 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1258 | " or 'char8_t'" | |
| 1259 | #endif | |
| 1260 | ); | |
| 1214 | 1261 | return path(__f, __l); |
| 1215 | 1262 | } |
| 1216 | 1263 | |
| ... | ... | @@ -1230,7 +1277,7 @@ public: |
| 1230 | 1277 | typedef bidirectional_iterator_tag iterator_category; |
| 1231 | 1278 | |
| 1232 | 1279 | typedef path value_type; |
| 1233 | typedef std::ptrdiff_t difference_type; | |
| 1280 | typedef ptrdiff_t difference_type; | |
| 1234 | 1281 | typedef const path* pointer; |
| 1235 | 1282 | typedef const path& reference; |
| 1236 | 1283 | |
| ... | ... | @@ -1374,7 +1421,7 @@ template <class... _Args> |
| 1374 | 1421 | _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY |
| 1375 | 1422 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1376 | 1423 | void __throw_filesystem_error(_Args&&... __args) { |
| 1377 | throw filesystem_error(std::forward<_Args>(__args)...); | |
| 1424 | throw filesystem_error(_VSTD::forward<_Args>(__args)...); | |
| 1378 | 1425 | } |
| 1379 | 1426 | #else |
| 1380 | 1427 | void __throw_filesystem_error(_Args&&...) { |
| ... | ... | @@ -2204,7 +2251,7 @@ private: |
| 2204 | 2251 | |
| 2205 | 2252 | _LIBCPP_INLINE_VISIBILITY |
| 2206 | 2253 | void __assign_iter_entry(_Path&& __p, __cached_data __dt) { |
| 2207 | __p_ = std::move(__p); | |
| 2254 | __p_ = _VSTD::move(__p); | |
| 2208 | 2255 | __data_ = __dt; |
| 2209 | 2256 | } |
| 2210 | 2257 | |
| ... | ... | @@ -2505,10 +2552,10 @@ end(const directory_iterator&) noexcept { |
| 2505 | 2552 | class recursive_directory_iterator { |
| 2506 | 2553 | public: |
| 2507 | 2554 | using value_type = directory_entry; |
| 2508 | using difference_type = std::ptrdiff_t; | |
| 2555 | using difference_type = ptrdiff_t; | |
| 2509 | 2556 | using pointer = directory_entry const*; |
| 2510 | 2557 | using reference = directory_entry const&; |
| 2511 | using iterator_category = std::input_iterator_tag; | |
| 2558 | using iterator_category = input_iterator_tag; | |
| 2512 | 2559 | |
| 2513 | 2560 | public: |
| 2514 | 2561 | // constructors and destructor |
lib/libcxx/include/forward_list+3-3| ... | ... | @@ -603,7 +603,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) |
| 603 | 603 | __is_nothrow_swappable<__node_allocator>::value) |
| 604 | 604 | #endif |
| 605 | 605 | { |
| 606 | __swap_allocator(__alloc(), __x.__alloc(), | |
| 606 | _VSTD::__swap_allocator(__alloc(), __x.__alloc(), | |
| 607 | 607 | integral_constant<bool, __node_traits::propagate_on_container_swap::value>()); |
| 608 | 608 | using _VSTD::swap; |
| 609 | 609 | swap(__before_begin()->__next_, __x.__before_begin()->__next_); |
| ... | ... | @@ -758,7 +758,7 @@ public: |
| 758 | 758 | {return base::__before_begin()->__next_ == nullptr;} |
| 759 | 759 | _LIBCPP_INLINE_VISIBILITY |
| 760 | 760 | size_type max_size() const _NOEXCEPT { |
| 761 | return std::min<size_type>( | |
| 761 | return _VSTD::min<size_type>( | |
| 762 | 762 | __node_traits::max_size(base::__alloc()), |
| 763 | 763 | numeric_limits<difference_type>::max()); |
| 764 | 764 | } |
| ... | ... | @@ -871,7 +871,7 @@ private: |
| 871 | 871 | |
| 872 | 872 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 873 | 873 | template<class _InputIterator, |
| 874 | class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 874 | class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 875 | 875 | class = typename enable_if<__is_allocator<_Alloc>::value, void>::type |
| 876 | 876 | > |
| 877 | 877 | forward_list(_InputIterator, _InputIterator) |
lib/libcxx/include/fstream+72-64| ... | ... | @@ -180,6 +180,7 @@ typedef basic_fstream<wchar_t> wfstream; |
| 180 | 180 | */ |
| 181 | 181 | |
| 182 | 182 | #include <__config> |
| 183 | #include <__availability> | |
| 183 | 184 | #include <ostream> |
| 184 | 185 | #include <istream> |
| 185 | 186 | #include <__locale> |
| ... | ... | @@ -240,7 +241,7 @@ public: |
| 240 | 241 | return open(__p.c_str(), __mode); |
| 241 | 242 | } |
| 242 | 243 | #endif |
| 243 | _LIBCPP_INLINE_VISIBILITY | |
| 244 | inline _LIBCPP_INLINE_VISIBILITY | |
| 244 | 245 | basic_filebuf* __open(int __fd, ios_base::openmode __mode); |
| 245 | 246 | #endif |
| 246 | 247 | basic_filebuf* close(); |
| ... | ... | @@ -286,13 +287,13 @@ private: |
| 286 | 287 | |
| 287 | 288 | template <class _CharT, class _Traits> |
| 288 | 289 | basic_filebuf<_CharT, _Traits>::basic_filebuf() |
| 289 | : __extbuf_(0), | |
| 290 | __extbufnext_(0), | |
| 291 | __extbufend_(0), | |
| 290 | : __extbuf_(nullptr), | |
| 291 | __extbufnext_(nullptr), | |
| 292 | __extbufend_(nullptr), | |
| 292 | 293 | __ebs_(0), |
| 293 | __intbuf_(0), | |
| 294 | __intbuf_(nullptr), | |
| 294 | 295 | __ibs_(0), |
| 295 | __file_(0), | |
| 296 | __file_(nullptr), | |
| 296 | 297 | __cv_(nullptr), |
| 297 | 298 | __st_(), |
| 298 | 299 | __st_last_(), |
| ... | ... | @@ -307,7 +308,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() |
| 307 | 308 | __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc()); |
| 308 | 309 | __always_noconv_ = __cv_->always_noconv(); |
| 309 | 310 | } |
| 310 | setbuf(0, 4096); | |
| 311 | setbuf(nullptr, 4096); | |
| 311 | 312 | } |
| 312 | 313 | |
| 313 | 314 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -359,13 +360,13 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) |
| 359 | 360 | (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()), |
| 360 | 361 | (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback())); |
| 361 | 362 | } |
| 362 | __rhs.__extbuf_ = 0; | |
| 363 | __rhs.__extbufnext_ = 0; | |
| 364 | __rhs.__extbufend_ = 0; | |
| 363 | __rhs.__extbuf_ = nullptr; | |
| 364 | __rhs.__extbufnext_ = nullptr; | |
| 365 | __rhs.__extbufend_ = nullptr; | |
| 365 | 366 | __rhs.__ebs_ = 0; |
| 366 | 367 | __rhs.__intbuf_ = 0; |
| 367 | 368 | __rhs.__ibs_ = 0; |
| 368 | __rhs.__file_ = 0; | |
| 369 | __rhs.__file_ = nullptr; | |
| 369 | 370 | __rhs.__st_ = state_type(); |
| 370 | 371 | __rhs.__st_last_ = state_type(); |
| 371 | 372 | __rhs.__om_ = 0; |
| ... | ... | @@ -499,7 +500,7 @@ inline |
| 499 | 500 | bool |
| 500 | 501 | basic_filebuf<_CharT, _Traits>::is_open() const |
| 501 | 502 | { |
| 502 | return __file_ != 0; | |
| 503 | return __file_ != nullptr; | |
| 503 | 504 | } |
| 504 | 505 | |
| 505 | 506 | template <class _CharT, class _Traits> |
| ... | ... | @@ -547,8 +548,8 @@ template <class _CharT, class _Traits> |
| 547 | 548 | basic_filebuf<_CharT, _Traits>* |
| 548 | 549 | basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) |
| 549 | 550 | { |
| 550 | basic_filebuf<_CharT, _Traits>* __rt = 0; | |
| 551 | if (__file_ == 0) | |
| 551 | basic_filebuf<_CharT, _Traits>* __rt = nullptr; | |
| 552 | if (__file_ == nullptr) | |
| 552 | 553 | { |
| 553 | 554 | if (const char* __mdstr = __make_mdstring(__mode)) { |
| 554 | 555 | __rt = this; |
| ... | ... | @@ -558,22 +559,23 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) |
| 558 | 559 | if (__mode & ios_base::ate) { |
| 559 | 560 | if (fseek(__file_, 0, SEEK_END)) { |
| 560 | 561 | fclose(__file_); |
| 561 | __file_ = 0; | |
| 562 | __rt = 0; | |
| 562 | __file_ = nullptr; | |
| 563 | __rt = nullptr; | |
| 563 | 564 | } |
| 564 | 565 | } |
| 565 | 566 | } else |
| 566 | __rt = 0; | |
| 567 | __rt = nullptr; | |
| 567 | 568 | } |
| 568 | 569 | } |
| 569 | 570 | return __rt; |
| 570 | 571 | } |
| 571 | 572 | |
| 572 | 573 | template <class _CharT, class _Traits> |
| 573 | _LIBCPP_INLINE_VISIBILITY basic_filebuf<_CharT, _Traits>* | |
| 574 | inline _LIBCPP_INLINE_VISIBILITY | |
| 575 | basic_filebuf<_CharT, _Traits>* | |
| 574 | 576 | basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { |
| 575 | basic_filebuf<_CharT, _Traits>* __rt = 0; | |
| 576 | if (__file_ == 0) { | |
| 577 | basic_filebuf<_CharT, _Traits>* __rt = nullptr; | |
| 578 | if (__file_ == nullptr) { | |
| 577 | 579 | if (const char* __mdstr = __make_mdstring(__mode)) { |
| 578 | 580 | __rt = this; |
| 579 | 581 | __file_ = fdopen(__fd, __mdstr); |
| ... | ... | @@ -582,12 +584,12 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { |
| 582 | 584 | if (__mode & ios_base::ate) { |
| 583 | 585 | if (fseek(__file_, 0, SEEK_END)) { |
| 584 | 586 | fclose(__file_); |
| 585 | __file_ = 0; | |
| 586 | __rt = 0; | |
| 587 | __file_ = nullptr; | |
| 588 | __rt = nullptr; | |
| 587 | 589 | } |
| 588 | 590 | } |
| 589 | 591 | } else |
| 590 | __rt = 0; | |
| 592 | __rt = nullptr; | |
| 591 | 593 | } |
| 592 | 594 | } |
| 593 | 595 | return __rt; |
| ... | ... | @@ -600,8 +602,8 @@ template <class _CharT, class _Traits> |
| 600 | 602 | basic_filebuf<_CharT, _Traits>* |
| 601 | 603 | basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) |
| 602 | 604 | { |
| 603 | basic_filebuf<_CharT, _Traits>* __rt = 0; | |
| 604 | if (__file_ == 0) | |
| 605 | basic_filebuf<_CharT, _Traits>* __rt = nullptr; | |
| 606 | if (__file_ == nullptr) | |
| 605 | 607 | { |
| 606 | 608 | __rt = this; |
| 607 | 609 | const wchar_t* __mdstr; |
| ... | ... | @@ -650,7 +652,7 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo |
| 650 | 652 | __mdstr = L"a+b"; |
| 651 | 653 | break; |
| 652 | 654 | default: |
| 653 | __rt = 0; | |
| 655 | __rt = nullptr; | |
| 654 | 656 | break; |
| 655 | 657 | } |
| 656 | 658 | if (__rt) |
| ... | ... | @@ -664,13 +666,13 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo |
| 664 | 666 | if (fseek(__file_, 0, SEEK_END)) |
| 665 | 667 | { |
| 666 | 668 | fclose(__file_); |
| 667 | __file_ = 0; | |
| 668 | __rt = 0; | |
| 669 | __file_ = nullptr; | |
| 670 | __rt = nullptr; | |
| 669 | 671 | } |
| 670 | 672 | } |
| 671 | 673 | } |
| 672 | 674 | else |
| 673 | __rt = 0; | |
| 675 | __rt = nullptr; | |
| 674 | 676 | } |
| 675 | 677 | } |
| 676 | 678 | return __rt; |
| ... | ... | @@ -690,16 +692,16 @@ template <class _CharT, class _Traits> |
| 690 | 692 | basic_filebuf<_CharT, _Traits>* |
| 691 | 693 | basic_filebuf<_CharT, _Traits>::close() |
| 692 | 694 | { |
| 693 | basic_filebuf<_CharT, _Traits>* __rt = 0; | |
| 695 | basic_filebuf<_CharT, _Traits>* __rt = nullptr; | |
| 694 | 696 | if (__file_) |
| 695 | 697 | { |
| 696 | 698 | __rt = this; |
| 697 | 699 | unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); |
| 698 | 700 | if (sync()) |
| 699 | __rt = 0; | |
| 701 | __rt = nullptr; | |
| 700 | 702 | if (fclose(__h.release())) |
| 701 | __rt = 0; | |
| 702 | __file_ = 0; | |
| 703 | __rt = nullptr; | |
| 704 | __file_ = nullptr; | |
| 703 | 705 | setbuf(0, 0); |
| 704 | 706 | } |
| 705 | 707 | return __rt; |
| ... | ... | @@ -709,17 +711,17 @@ template <class _CharT, class _Traits> |
| 709 | 711 | typename basic_filebuf<_CharT, _Traits>::int_type |
| 710 | 712 | basic_filebuf<_CharT, _Traits>::underflow() |
| 711 | 713 | { |
| 712 | if (__file_ == 0) | |
| 714 | if (__file_ == nullptr) | |
| 713 | 715 | return traits_type::eof(); |
| 714 | 716 | bool __initial = __read_mode(); |
| 715 | 717 | char_type __1buf; |
| 716 | if (this->gptr() == 0) | |
| 718 | if (this->gptr() == nullptr) | |
| 717 | 719 | this->setg(&__1buf, &__1buf+1, &__1buf+1); |
| 718 | 720 | const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); |
| 719 | 721 | int_type __c = traits_type::eof(); |
| 720 | 722 | if (this->gptr() == this->egptr()) |
| 721 | 723 | { |
| 722 | memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); | |
| 724 | _VSTD::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); | |
| 723 | 725 | if (__always_noconv_) |
| 724 | 726 | { |
| 725 | 727 | size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz); |
| ... | ... | @@ -736,7 +738,7 @@ basic_filebuf<_CharT, _Traits>::underflow() |
| 736 | 738 | { |
| 737 | 739 | _LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); |
| 738 | 740 | if (__extbufend_ != __extbufnext_) |
| 739 | memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); | |
| 741 | _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); | |
| 740 | 742 | __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); |
| 741 | 743 | __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); |
| 742 | 744 | size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), |
| ... | ... | @@ -771,7 +773,7 @@ basic_filebuf<_CharT, _Traits>::underflow() |
| 771 | 773 | else |
| 772 | 774 | __c = traits_type::to_int_type(*this->gptr()); |
| 773 | 775 | if (this->eback() == &__1buf) |
| 774 | this->setg(0, 0, 0); | |
| 776 | this->setg(nullptr, nullptr, nullptr); | |
| 775 | 777 | return __c; |
| 776 | 778 | } |
| 777 | 779 | |
| ... | ... | @@ -801,7 +803,7 @@ template <class _CharT, class _Traits> |
| 801 | 803 | typename basic_filebuf<_CharT, _Traits>::int_type |
| 802 | 804 | basic_filebuf<_CharT, _Traits>::overflow(int_type __c) |
| 803 | 805 | { |
| 804 | if (__file_ == 0) | |
| 806 | if (__file_ == nullptr) | |
| 805 | 807 | return traits_type::eof(); |
| 806 | 808 | __write_mode(); |
| 807 | 809 | char_type __1buf; |
| ... | ... | @@ -809,7 +811,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) |
| 809 | 811 | char_type* __epb_save = this->epptr(); |
| 810 | 812 | if (!traits_type::eq_int_type(__c, traits_type::eof())) |
| 811 | 813 | { |
| 812 | if (this->pptr() == 0) | |
| 814 | if (this->pptr() == nullptr) | |
| 813 | 815 | this->setp(&__1buf, &__1buf+1); |
| 814 | 816 | *this->pptr() = traits_type::to_char_type(__c); |
| 815 | 817 | this->pbump(1); |
| ... | ... | @@ -866,8 +868,8 @@ template <class _CharT, class _Traits> |
| 866 | 868 | basic_streambuf<_CharT, _Traits>* |
| 867 | 869 | basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) |
| 868 | 870 | { |
| 869 | this->setg(0, 0, 0); | |
| 870 | this->setp(0, 0); | |
| 871 | this->setg(nullptr, nullptr, nullptr); | |
| 872 | this->setp(nullptr, nullptr); | |
| 871 | 873 | if (__owns_eb_) |
| 872 | 874 | delete [] __extbuf_; |
| 873 | 875 | if (__owns_ib_) |
| ... | ... | @@ -909,7 +911,7 @@ basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) |
| 909 | 911 | else |
| 910 | 912 | { |
| 911 | 913 | __ibs_ = 0; |
| 912 | __intbuf_ = 0; | |
| 914 | __intbuf_ = nullptr; | |
| 913 | 915 | __owns_ib_ = false; |
| 914 | 916 | } |
| 915 | 917 | return this; |
| ... | ... | @@ -924,7 +926,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, |
| 924 | 926 | __throw_bad_cast(); |
| 925 | 927 | |
| 926 | 928 | int __width = __cv_->encoding(); |
| 927 | if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) | |
| 929 | if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync()) | |
| 928 | 930 | return pos_type(off_type(-1)); |
| 929 | 931 | // __width > 0 || __off == 0 |
| 930 | 932 | int __whence; |
| ... | ... | @@ -959,7 +961,7 @@ template <class _CharT, class _Traits> |
| 959 | 961 | typename basic_filebuf<_CharT, _Traits>::pos_type |
| 960 | 962 | basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) |
| 961 | 963 | { |
| 962 | if (__file_ == 0 || sync()) | |
| 964 | if (__file_ == nullptr || sync()) | |
| 963 | 965 | return pos_type(off_type(-1)); |
| 964 | 966 | #if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) |
| 965 | 967 | if (fseek(__file_, __sp, SEEK_SET)) |
| ... | ... | @@ -976,7 +978,7 @@ template <class _CharT, class _Traits> |
| 976 | 978 | int |
| 977 | 979 | basic_filebuf<_CharT, _Traits>::sync() |
| 978 | 980 | { |
| 979 | if (__file_ == 0) | |
| 981 | if (__file_ == nullptr) | |
| 980 | 982 | return 0; |
| 981 | 983 | if (!__cv_) |
| 982 | 984 | __throw_bad_cast(); |
| ... | ... | @@ -1035,7 +1037,7 @@ basic_filebuf<_CharT, _Traits>::sync() |
| 1035 | 1037 | if (__update_st) |
| 1036 | 1038 | __st_ = __state; |
| 1037 | 1039 | __extbufnext_ = __extbufend_ = __extbuf_; |
| 1038 | this->setg(0, 0, 0); | |
| 1040 | this->setg(nullptr, nullptr, nullptr); | |
| 1039 | 1041 | __cm_ = 0; |
| 1040 | 1042 | } |
| 1041 | 1043 | return 0; |
| ... | ... | @@ -1051,8 +1053,8 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) |
| 1051 | 1053 | __always_noconv_ = __cv_->always_noconv(); |
| 1052 | 1054 | if (__old_anc != __always_noconv_) |
| 1053 | 1055 | { |
| 1054 | this->setg(0, 0, 0); | |
| 1055 | this->setp(0, 0); | |
| 1056 | this->setg(nullptr, nullptr, nullptr); | |
| 1057 | this->setp(nullptr, nullptr); | |
| 1056 | 1058 | // invariant, char_type is char, else we couldn't get here |
| 1057 | 1059 | if (__always_noconv_) // need to dump __intbuf_ |
| 1058 | 1060 | { |
| ... | ... | @@ -1062,7 +1064,7 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) |
| 1062 | 1064 | __ebs_ = __ibs_; |
| 1063 | 1065 | __extbuf_ = (char*)__intbuf_; |
| 1064 | 1066 | __ibs_ = 0; |
| 1065 | __intbuf_ = 0; | |
| 1067 | __intbuf_ = nullptr; | |
| 1066 | 1068 | __owns_ib_ = false; |
| 1067 | 1069 | } |
| 1068 | 1070 | else // need to obtain an __intbuf_. |
| ... | ... | @@ -1091,7 +1093,7 @@ basic_filebuf<_CharT, _Traits>::__read_mode() |
| 1091 | 1093 | { |
| 1092 | 1094 | if (!(__cm_ & ios_base::in)) |
| 1093 | 1095 | { |
| 1094 | this->setp(0, 0); | |
| 1096 | this->setp(nullptr, nullptr); | |
| 1095 | 1097 | if (__always_noconv_) |
| 1096 | 1098 | this->setg((char_type*)__extbuf_, |
| 1097 | 1099 | (char_type*)__extbuf_ + __ebs_, |
| ... | ... | @@ -1110,7 +1112,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode() |
| 1110 | 1112 | { |
| 1111 | 1113 | if (!(__cm_ & ios_base::out)) |
| 1112 | 1114 | { |
| 1113 | this->setg(0, 0, 0); | |
| 1115 | this->setg(nullptr, nullptr, nullptr); | |
| 1114 | 1116 | if (__ebs_ > sizeof(__extbuf_min_)) |
| 1115 | 1117 | { |
| 1116 | 1118 | if (__always_noconv_) |
| ... | ... | @@ -1120,7 +1122,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode() |
| 1120 | 1122 | this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1)); |
| 1121 | 1123 | } |
| 1122 | 1124 | else |
| 1123 | this->setp(0, 0); | |
| 1125 | this->setp(nullptr, nullptr); | |
| 1124 | 1126 | __cm_ = ios_base::out; |
| 1125 | 1127 | } |
| 1126 | 1128 | } |
| ... | ... | @@ -1206,7 +1208,7 @@ inline |
| 1206 | 1208 | basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode) |
| 1207 | 1209 | : basic_istream<char_type, traits_type>(&__sb_) |
| 1208 | 1210 | { |
| 1209 | if (__sb_.open(__s, __mode | ios_base::in) == 0) | |
| 1211 | if (__sb_.open(__s, __mode | ios_base::in) == nullptr) | |
| 1210 | 1212 | this->setstate(ios_base::failbit); |
| 1211 | 1213 | } |
| 1212 | 1214 | |
| ... | ... | @@ -1216,7 +1218,7 @@ inline |
| 1216 | 1218 | basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode) |
| 1217 | 1219 | : basic_istream<char_type, traits_type>(&__sb_) |
| 1218 | 1220 | { |
| 1219 | if (__sb_.open(__s, __mode | ios_base::in) == 0) | |
| 1221 | if (__sb_.open(__s, __mode | ios_base::in) == nullptr) | |
| 1220 | 1222 | this->setstate(ios_base::failbit); |
| 1221 | 1223 | } |
| 1222 | 1224 | #endif |
| ... | ... | @@ -1226,7 +1228,7 @@ inline |
| 1226 | 1228 | basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode) |
| 1227 | 1229 | : basic_istream<char_type, traits_type>(&__sb_) |
| 1228 | 1230 | { |
| 1229 | if (__sb_.open(__s, __mode | ios_base::in) == 0) | |
| 1231 | if (__sb_.open(__s, __mode | ios_base::in) == nullptr) | |
| 1230 | 1232 | this->setstate(ios_base::failbit); |
| 1231 | 1233 | } |
| 1232 | 1234 | #endif |
| ... | ... | @@ -1419,7 +1421,7 @@ inline |
| 1419 | 1421 | basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode) |
| 1420 | 1422 | : basic_ostream<char_type, traits_type>(&__sb_) |
| 1421 | 1423 | { |
| 1422 | if (__sb_.open(__s, __mode | ios_base::out) == 0) | |
| 1424 | if (__sb_.open(__s, __mode | ios_base::out) == nullptr) | |
| 1423 | 1425 | this->setstate(ios_base::failbit); |
| 1424 | 1426 | } |
| 1425 | 1427 | |
| ... | ... | @@ -1429,7 +1431,7 @@ inline |
| 1429 | 1431 | basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode) |
| 1430 | 1432 | : basic_ostream<char_type, traits_type>(&__sb_) |
| 1431 | 1433 | { |
| 1432 | if (__sb_.open(__s, __mode | ios_base::out) == 0) | |
| 1434 | if (__sb_.open(__s, __mode | ios_base::out) == nullptr) | |
| 1433 | 1435 | this->setstate(ios_base::failbit); |
| 1434 | 1436 | } |
| 1435 | 1437 | #endif |
| ... | ... | @@ -1439,7 +1441,7 @@ inline |
| 1439 | 1441 | basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode) |
| 1440 | 1442 | : basic_ostream<char_type, traits_type>(&__sb_) |
| 1441 | 1443 | { |
| 1442 | if (__sb_.open(__s, __mode | ios_base::out) == 0) | |
| 1444 | if (__sb_.open(__s, __mode | ios_base::out) == nullptr) | |
| 1443 | 1445 | this->setstate(ios_base::failbit); |
| 1444 | 1446 | } |
| 1445 | 1447 | #endif |
| ... | ... | @@ -1548,7 +1550,7 @@ inline |
| 1548 | 1550 | void |
| 1549 | 1551 | basic_ofstream<_CharT, _Traits>::close() |
| 1550 | 1552 | { |
| 1551 | if (__sb_.close() == 0) | |
| 1553 | if (__sb_.close() == nullptr) | |
| 1552 | 1554 | this->setstate(ios_base::failbit); |
| 1553 | 1555 | } |
| 1554 | 1556 | |
| ... | ... | @@ -1632,7 +1634,7 @@ inline |
| 1632 | 1634 | basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode) |
| 1633 | 1635 | : basic_iostream<char_type, traits_type>(&__sb_) |
| 1634 | 1636 | { |
| 1635 | if (__sb_.open(__s, __mode) == 0) | |
| 1637 | if (__sb_.open(__s, __mode) == nullptr) | |
| 1636 | 1638 | this->setstate(ios_base::failbit); |
| 1637 | 1639 | } |
| 1638 | 1640 | |
| ... | ... | @@ -1642,7 +1644,7 @@ inline |
| 1642 | 1644 | basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode) |
| 1643 | 1645 | : basic_iostream<char_type, traits_type>(&__sb_) |
| 1644 | 1646 | { |
| 1645 | if (__sb_.open(__s, __mode) == 0) | |
| 1647 | if (__sb_.open(__s, __mode) == nullptr) | |
| 1646 | 1648 | this->setstate(ios_base::failbit); |
| 1647 | 1649 | } |
| 1648 | 1650 | #endif |
| ... | ... | @@ -1652,7 +1654,7 @@ inline |
| 1652 | 1654 | basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode) |
| 1653 | 1655 | : basic_iostream<char_type, traits_type>(&__sb_) |
| 1654 | 1656 | { |
| 1655 | if (__sb_.open(__s, __mode) == 0) | |
| 1657 | if (__sb_.open(__s, __mode) == nullptr) | |
| 1656 | 1658 | this->setstate(ios_base::failbit); |
| 1657 | 1659 | } |
| 1658 | 1660 | #endif |
| ... | ... | @@ -1752,10 +1754,16 @@ inline |
| 1752 | 1754 | void |
| 1753 | 1755 | basic_fstream<_CharT, _Traits>::close() |
| 1754 | 1756 | { |
| 1755 | if (__sb_.close() == 0) | |
| 1757 | if (__sb_.close() == nullptr) | |
| 1756 | 1758 | this->setstate(ios_base::failbit); |
| 1757 | 1759 | } |
| 1758 | 1760 | |
| 1761 | #if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1) | |
| 1762 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>) | |
| 1763 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>) | |
| 1764 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>) | |
| 1765 | #endif | |
| 1766 | ||
| 1759 | 1767 | _LIBCPP_END_NAMESPACE_STD |
| 1760 | 1768 | |
| 1761 | 1769 | _LIBCPP_POP_MACROS |
lib/libcxx/include/functional+49-49| ... | ... | @@ -470,6 +470,7 @@ template <> struct hash<bool>; |
| 470 | 470 | template <> struct hash<char>; |
| 471 | 471 | template <> struct hash<signed char>; |
| 472 | 472 | template <> struct hash<unsigned char>; |
| 473 | template <> struct hash<char8_t>; // since C++20 | |
| 473 | 474 | template <> struct hash<char16_t>; |
| 474 | 475 | template <> struct hash<char32_t>; |
| 475 | 476 | template <> struct hash<wchar_t>; |
| ... | ... | @@ -508,10 +509,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited |
| 508 | 509 | |
| 509 | 510 | #include <__functional_base> |
| 510 | 511 | |
| 511 | #if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC) | |
| 512 | #include <Block.h> | |
| 513 | #endif | |
| 514 | ||
| 515 | 512 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 516 | 513 | #pragma GCC system_header |
| 517 | 514 | #endif |
| ... | ... | @@ -1299,7 +1296,7 @@ public: |
| 1299 | 1296 | _LIBCPP_INLINE_VISIBILITY |
| 1300 | 1297 | typename __invoke_return<type, _ArgTypes...>::type |
| 1301 | 1298 | operator() (_ArgTypes&&... __args) const { |
| 1302 | return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); | |
| 1299 | return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); | |
| 1303 | 1300 | } |
| 1304 | 1301 | #else |
| 1305 | 1302 | |
| ... | ... | @@ -1307,98 +1304,98 @@ public: |
| 1307 | 1304 | _LIBCPP_INLINE_VISIBILITY |
| 1308 | 1305 | typename __invoke_return0<type, _A0>::type |
| 1309 | 1306 | operator() (_A0& __a0) const { |
| 1310 | return __invoke(__f_, __a0); | |
| 1307 | return _VSTD::__invoke(__f_, __a0); | |
| 1311 | 1308 | } |
| 1312 | 1309 | |
| 1313 | 1310 | template <class _A0> |
| 1314 | 1311 | _LIBCPP_INLINE_VISIBILITY |
| 1315 | 1312 | typename __invoke_return0<type, _A0 const>::type |
| 1316 | 1313 | operator() (_A0 const& __a0) const { |
| 1317 | return __invoke(__f_, __a0); | |
| 1314 | return _VSTD::__invoke(__f_, __a0); | |
| 1318 | 1315 | } |
| 1319 | 1316 | |
| 1320 | 1317 | template <class _A0, class _A1> |
| 1321 | 1318 | _LIBCPP_INLINE_VISIBILITY |
| 1322 | 1319 | typename __invoke_return1<type, _A0, _A1>::type |
| 1323 | 1320 | operator() (_A0& __a0, _A1& __a1) const { |
| 1324 | return __invoke(__f_, __a0, __a1); | |
| 1321 | return _VSTD::__invoke(__f_, __a0, __a1); | |
| 1325 | 1322 | } |
| 1326 | 1323 | |
| 1327 | 1324 | template <class _A0, class _A1> |
| 1328 | 1325 | _LIBCPP_INLINE_VISIBILITY |
| 1329 | 1326 | typename __invoke_return1<type, _A0 const, _A1>::type |
| 1330 | 1327 | operator() (_A0 const& __a0, _A1& __a1) const { |
| 1331 | return __invoke(__f_, __a0, __a1); | |
| 1328 | return _VSTD::__invoke(__f_, __a0, __a1); | |
| 1332 | 1329 | } |
| 1333 | 1330 | |
| 1334 | 1331 | template <class _A0, class _A1> |
| 1335 | 1332 | _LIBCPP_INLINE_VISIBILITY |
| 1336 | 1333 | typename __invoke_return1<type, _A0, _A1 const>::type |
| 1337 | 1334 | operator() (_A0& __a0, _A1 const& __a1) const { |
| 1338 | return __invoke(__f_, __a0, __a1); | |
| 1335 | return _VSTD::__invoke(__f_, __a0, __a1); | |
| 1339 | 1336 | } |
| 1340 | 1337 | |
| 1341 | 1338 | template <class _A0, class _A1> |
| 1342 | 1339 | _LIBCPP_INLINE_VISIBILITY |
| 1343 | 1340 | typename __invoke_return1<type, _A0 const, _A1 const>::type |
| 1344 | 1341 | operator() (_A0 const& __a0, _A1 const& __a1) const { |
| 1345 | return __invoke(__f_, __a0, __a1); | |
| 1342 | return _VSTD::__invoke(__f_, __a0, __a1); | |
| 1346 | 1343 | } |
| 1347 | 1344 | |
| 1348 | 1345 | template <class _A0, class _A1, class _A2> |
| 1349 | 1346 | _LIBCPP_INLINE_VISIBILITY |
| 1350 | 1347 | typename __invoke_return2<type, _A0, _A1, _A2>::type |
| 1351 | 1348 | operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { |
| 1352 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1349 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1353 | 1350 | } |
| 1354 | 1351 | |
| 1355 | 1352 | template <class _A0, class _A1, class _A2> |
| 1356 | 1353 | _LIBCPP_INLINE_VISIBILITY |
| 1357 | 1354 | typename __invoke_return2<type, _A0 const, _A1, _A2>::type |
| 1358 | 1355 | operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { |
| 1359 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1356 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1360 | 1357 | } |
| 1361 | 1358 | |
| 1362 | 1359 | template <class _A0, class _A1, class _A2> |
| 1363 | 1360 | _LIBCPP_INLINE_VISIBILITY |
| 1364 | 1361 | typename __invoke_return2<type, _A0, _A1 const, _A2>::type |
| 1365 | 1362 | operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { |
| 1366 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1363 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1367 | 1364 | } |
| 1368 | 1365 | |
| 1369 | 1366 | template <class _A0, class _A1, class _A2> |
| 1370 | 1367 | _LIBCPP_INLINE_VISIBILITY |
| 1371 | 1368 | typename __invoke_return2<type, _A0, _A1, _A2 const>::type |
| 1372 | 1369 | operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { |
| 1373 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1370 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1374 | 1371 | } |
| 1375 | 1372 | |
| 1376 | 1373 | template <class _A0, class _A1, class _A2> |
| 1377 | 1374 | _LIBCPP_INLINE_VISIBILITY |
| 1378 | 1375 | typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type |
| 1379 | 1376 | operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { |
| 1380 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1377 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1381 | 1378 | } |
| 1382 | 1379 | |
| 1383 | 1380 | template <class _A0, class _A1, class _A2> |
| 1384 | 1381 | _LIBCPP_INLINE_VISIBILITY |
| 1385 | 1382 | typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type |
| 1386 | 1383 | operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { |
| 1387 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1384 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1388 | 1385 | } |
| 1389 | 1386 | |
| 1390 | 1387 | template <class _A0, class _A1, class _A2> |
| 1391 | 1388 | _LIBCPP_INLINE_VISIBILITY |
| 1392 | 1389 | typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type |
| 1393 | 1390 | operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { |
| 1394 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1391 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1395 | 1392 | } |
| 1396 | 1393 | |
| 1397 | 1394 | template <class _A0, class _A1, class _A2> |
| 1398 | 1395 | _LIBCPP_INLINE_VISIBILITY |
| 1399 | 1396 | typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type |
| 1400 | 1397 | operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { |
| 1401 | return __invoke(__f_, __a0, __a1, __a2); | |
| 1398 | return _VSTD::__invoke(__f_, __a0, __a1, __a2); | |
| 1402 | 1399 | } |
| 1403 | 1400 | #endif |
| 1404 | 1401 | }; |
| ... | ... | @@ -1596,7 +1593,7 @@ public: |
| 1596 | 1593 | const _Target& __target() const { return __f_; } |
| 1597 | 1594 | |
| 1598 | 1595 | _LIBCPP_INLINE_VISIBILITY |
| 1599 | explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {} | |
| 1596 | explicit __default_alloc_func(_Target&& __f) : __f_(_VSTD::move(__f)) {} | |
| 1600 | 1597 | |
| 1601 | 1598 | _LIBCPP_INLINE_VISIBILITY |
| 1602 | 1599 | explicit __default_alloc_func(const _Target& __f) : __f_(__f) {} |
| ... | ... | @@ -1612,7 +1609,7 @@ public: |
| 1612 | 1609 | __builtin_new_allocator::__holder_t __hold = |
| 1613 | 1610 | __builtin_new_allocator::__allocate_type<__default_alloc_func>(1); |
| 1614 | 1611 | __default_alloc_func* __res = |
| 1615 | ::new (__hold.get()) __default_alloc_func(__f_); | |
| 1612 | ::new ((void*)__hold.get()) __default_alloc_func(__f_); | |
| 1616 | 1613 | (void)__hold.release(); |
| 1617 | 1614 | return __res; |
| 1618 | 1615 | } |
| ... | ... | @@ -1703,7 +1700,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> |
| 1703 | 1700 | void |
| 1704 | 1701 | __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const |
| 1705 | 1702 | { |
| 1706 | ::new (__p) __func(__f_.__target(), __f_.__get_allocator()); | |
| 1703 | ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator()); | |
| 1707 | 1704 | } |
| 1708 | 1705 | |
| 1709 | 1706 | template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> |
| ... | ... | @@ -1739,7 +1736,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOE |
| 1739 | 1736 | { |
| 1740 | 1737 | if (__ti == typeid(_Fp)) |
| 1741 | 1738 | return &__f_.__target(); |
| 1742 | return (const void*)0; | |
| 1739 | return nullptr; | |
| 1743 | 1740 | } |
| 1744 | 1741 | |
| 1745 | 1742 | template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> |
| ... | ... | @@ -1769,11 +1766,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1769 | 1766 | |
| 1770 | 1767 | public: |
| 1771 | 1768 | _LIBCPP_INLINE_VISIBILITY |
| 1772 | __value_func() _NOEXCEPT : __f_(0) {} | |
| 1769 | __value_func() _NOEXCEPT : __f_(nullptr) {} | |
| 1773 | 1770 | |
| 1774 | 1771 | template <class _Fp, class _Alloc> |
| 1775 | 1772 | _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a) |
| 1776 | : __f_(0) | |
| 1773 | : __f_(nullptr) | |
| 1777 | 1774 | { |
| 1778 | 1775 | typedef allocator_traits<_Alloc> __alloc_traits; |
| 1779 | 1776 | typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun; |
| ... | ... | @@ -1803,13 +1800,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1803 | 1800 | template <class _Fp, |
| 1804 | 1801 | class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type> |
| 1805 | 1802 | _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f) |
| 1806 | : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {} | |
| 1803 | : __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {} | |
| 1807 | 1804 | |
| 1808 | 1805 | _LIBCPP_INLINE_VISIBILITY |
| 1809 | 1806 | __value_func(const __value_func& __f) |
| 1810 | 1807 | { |
| 1811 | if (__f.__f_ == 0) | |
| 1812 | __f_ = 0; | |
| 1808 | if (__f.__f_ == nullptr) | |
| 1809 | __f_ = nullptr; | |
| 1813 | 1810 | else if ((void*)__f.__f_ == &__f.__buf_) |
| 1814 | 1811 | { |
| 1815 | 1812 | __f_ = __as_base(&__buf_); |
| ... | ... | @@ -1822,8 +1819,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1822 | 1819 | _LIBCPP_INLINE_VISIBILITY |
| 1823 | 1820 | __value_func(__value_func&& __f) _NOEXCEPT |
| 1824 | 1821 | { |
| 1825 | if (__f.__f_ == 0) | |
| 1826 | __f_ = 0; | |
| 1822 | if (__f.__f_ == nullptr) | |
| 1823 | __f_ = nullptr; | |
| 1827 | 1824 | else if ((void*)__f.__f_ == &__f.__buf_) |
| 1828 | 1825 | { |
| 1829 | 1826 | __f_ = __as_base(&__buf_); |
| ... | ... | @@ -1832,7 +1829,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1832 | 1829 | else |
| 1833 | 1830 | { |
| 1834 | 1831 | __f_ = __f.__f_; |
| 1835 | __f.__f_ = 0; | |
| 1832 | __f.__f_ = nullptr; | |
| 1836 | 1833 | } |
| 1837 | 1834 | } |
| 1838 | 1835 | |
| ... | ... | @@ -1849,8 +1846,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1849 | 1846 | __value_func& operator=(__value_func&& __f) |
| 1850 | 1847 | { |
| 1851 | 1848 | *this = nullptr; |
| 1852 | if (__f.__f_ == 0) | |
| 1853 | __f_ = 0; | |
| 1849 | if (__f.__f_ == nullptr) | |
| 1850 | __f_ = nullptr; | |
| 1854 | 1851 | else if ((void*)__f.__f_ == &__f.__buf_) |
| 1855 | 1852 | { |
| 1856 | 1853 | __f_ = __as_base(&__buf_); |
| ... | ... | @@ -1859,7 +1856,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1859 | 1856 | else |
| 1860 | 1857 | { |
| 1861 | 1858 | __f_ = __f.__f_; |
| 1862 | __f.__f_ = 0; | |
| 1859 | __f.__f_ = nullptr; | |
| 1863 | 1860 | } |
| 1864 | 1861 | return *this; |
| 1865 | 1862 | } |
| ... | ... | @@ -1868,7 +1865,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1868 | 1865 | __value_func& operator=(nullptr_t) |
| 1869 | 1866 | { |
| 1870 | 1867 | __func* __f = __f_; |
| 1871 | __f_ = 0; | |
| 1868 | __f_ = nullptr; | |
| 1872 | 1869 | if ((void*)__f == &__buf_) |
| 1873 | 1870 | __f->destroy(); |
| 1874 | 1871 | else if (__f) |
| ... | ... | @@ -1879,7 +1876,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1879 | 1876 | _LIBCPP_INLINE_VISIBILITY |
| 1880 | 1877 | _Rp operator()(_ArgTypes&&... __args) const |
| 1881 | 1878 | { |
| 1882 | if (__f_ == 0) | |
| 1879 | if (__f_ == nullptr) | |
| 1883 | 1880 | __throw_bad_function_call(); |
| 1884 | 1881 | return (*__f_)(_VSTD::forward<_ArgTypes>(__args)...); |
| 1885 | 1882 | } |
| ... | ... | @@ -1895,10 +1892,10 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1895 | 1892 | __func* __t = __as_base(&__tempbuf); |
| 1896 | 1893 | __f_->__clone(__t); |
| 1897 | 1894 | __f_->destroy(); |
| 1898 | __f_ = 0; | |
| 1895 | __f_ = nullptr; | |
| 1899 | 1896 | __f.__f_->__clone(__as_base(&__buf_)); |
| 1900 | 1897 | __f.__f_->destroy(); |
| 1901 | __f.__f_ = 0; | |
| 1898 | __f.__f_ = nullptr; | |
| 1902 | 1899 | __f_ = __as_base(&__buf_); |
| 1903 | 1900 | __t->__clone(__as_base(&__f.__buf_)); |
| 1904 | 1901 | __t->destroy(); |
| ... | ... | @@ -1923,13 +1920,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1923 | 1920 | } |
| 1924 | 1921 | |
| 1925 | 1922 | _LIBCPP_INLINE_VISIBILITY |
| 1926 | _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != 0; } | |
| 1923 | _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != nullptr; } | |
| 1927 | 1924 | |
| 1928 | 1925 | #ifndef _LIBCPP_NO_RTTI |
| 1929 | 1926 | _LIBCPP_INLINE_VISIBILITY |
| 1930 | 1927 | const std::type_info& target_type() const _NOEXCEPT |
| 1931 | 1928 | { |
| 1932 | if (__f_ == 0) | |
| 1929 | if (__f_ == nullptr) | |
| 1933 | 1930 | return typeid(void); |
| 1934 | 1931 | return __f_->target_type(); |
| 1935 | 1932 | } |
| ... | ... | @@ -1937,8 +1934,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> |
| 1937 | 1934 | template <typename _Tp> |
| 1938 | 1935 | _LIBCPP_INLINE_VISIBILITY const _Tp* target() const _NOEXCEPT |
| 1939 | 1936 | { |
| 1940 | if (__f_ == 0) | |
| 1941 | return 0; | |
| 1937 | if (__f_ == nullptr) | |
| 1938 | return nullptr; | |
| 1942 | 1939 | return (const _Tp*)__f_->target(typeid(_Tp)); |
| 1943 | 1940 | } |
| 1944 | 1941 | #endif // _LIBCPP_NO_RTTI |
| ... | ... | @@ -2157,7 +2154,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)> |
| 2157 | 2154 | } else { |
| 2158 | 2155 | __builtin_new_allocator::__holder_t __hold = |
| 2159 | 2156 | __builtin_new_allocator::__allocate_type<_Fun>(1); |
| 2160 | __buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f)); | |
| 2157 | __buf_.__large = ::new ((void*)__hold.get()) _Fun(_VSTD::move(__f)); | |
| 2161 | 2158 | (void)__hold.release(); |
| 2162 | 2159 | } |
| 2163 | 2160 | } |
| ... | ... | @@ -2257,6 +2254,9 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)> |
| 2257 | 2254 | |
| 2258 | 2255 | #if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC) |
| 2259 | 2256 | |
| 2257 | extern "C" void *_Block_copy(const void *); | |
| 2258 | extern "C" void _Block_release(const void *); | |
| 2259 | ||
| 2260 | 2260 | template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes> |
| 2261 | 2261 | class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> |
| 2262 | 2262 | : public __base<_Rp(_ArgTypes...)> |
| ... | ... | @@ -2267,14 +2267,14 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> |
| 2267 | 2267 | public: |
| 2268 | 2268 | _LIBCPP_INLINE_VISIBILITY |
| 2269 | 2269 | explicit __func(__block_type const& __f) |
| 2270 | : __f_(__f ? Block_copy(__f) : (__block_type)0) | |
| 2270 | : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr)) | |
| 2271 | 2271 | { } |
| 2272 | 2272 | |
| 2273 | 2273 | // [TODO] add && to save on a retain |
| 2274 | 2274 | |
| 2275 | 2275 | _LIBCPP_INLINE_VISIBILITY |
| 2276 | 2276 | explicit __func(__block_type __f, const _Alloc& /* unused */) |
| 2277 | : __f_(__f ? Block_copy(__f) : (__block_type)0) | |
| 2277 | : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr)) | |
| 2278 | 2278 | { } |
| 2279 | 2279 | |
| 2280 | 2280 | virtual __base<_Rp(_ArgTypes...)>* __clone() const { |
| ... | ... | @@ -2286,12 +2286,12 @@ public: |
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | 2288 | virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const { |
| 2289 | ::new (__p) __func(__f_); | |
| 2289 | ::new ((void*)__p) __func(__f_); | |
| 2290 | 2290 | } |
| 2291 | 2291 | |
| 2292 | 2292 | virtual void destroy() _NOEXCEPT { |
| 2293 | 2293 | if (__f_) |
| 2294 | Block_release(__f_); | |
| 2294 | _Block_release(__f_); | |
| 2295 | 2295 | __f_ = 0; |
| 2296 | 2296 | } |
| 2297 | 2297 | |
| ... | ... | @@ -2303,7 +2303,7 @@ public: |
| 2303 | 2303 | } |
| 2304 | 2304 | |
| 2305 | 2305 | virtual _Rp operator()(_ArgTypes&& ... __arg) { |
| 2306 | return __invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...); | |
| 2306 | return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...); | |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | 2309 | #ifndef _LIBCPP_NO_RTTI |
| ... | ... | @@ -2518,7 +2518,7 @@ template<class _Rp, class ..._ArgTypes> |
| 2518 | 2518 | function<_Rp(_ArgTypes...)>& |
| 2519 | 2519 | function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT |
| 2520 | 2520 | { |
| 2521 | __f_ = std::move(__f.__f_); | |
| 2521 | __f_ = _VSTD::move(__f.__f_); | |
| 2522 | 2522 | return *this; |
| 2523 | 2523 | } |
| 2524 | 2524 |
lib/libcxx/include/future+43-193| ... | ... | @@ -362,6 +362,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; |
| 362 | 362 | */ |
| 363 | 363 | |
| 364 | 364 | #include <__config> |
| 365 | #include <__availability> | |
| 365 | 366 | #include <system_error> |
| 366 | 367 | #include <memory> |
| 367 | 368 | #include <chrono> |
| ... | ... | @@ -624,18 +625,10 @@ protected: |
| 624 | 625 | public: |
| 625 | 626 | |
| 626 | 627 | template <class _Arg> |
| 627 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 628 | void set_value(_Arg&& __arg); | |
| 629 | #else | |
| 630 | void set_value(_Arg& __arg); | |
| 631 | #endif | |
| 628 | void set_value(_Arg&& __arg); | |
| 632 | 629 | |
| 633 | 630 | template <class _Arg> |
| 634 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 635 | void set_value_at_thread_exit(_Arg&& __arg); | |
| 636 | #else | |
| 637 | void set_value_at_thread_exit(_Arg& __arg); | |
| 638 | #endif | |
| 631 | void set_value_at_thread_exit(_Arg&& __arg); | |
| 639 | 632 | |
| 640 | 633 | _Rp move(); |
| 641 | 634 | typename add_lvalue_reference<_Rp>::type copy(); |
| ... | ... | @@ -654,16 +647,12 @@ template <class _Rp> |
| 654 | 647 | template <class _Arg> |
| 655 | 648 | _LIBCPP_AVAILABILITY_FUTURE |
| 656 | 649 | void |
| 657 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 658 | 650 | __assoc_state<_Rp>::set_value(_Arg&& __arg) |
| 659 | #else | |
| 660 | __assoc_state<_Rp>::set_value(_Arg& __arg) | |
| 661 | #endif | |
| 662 | 651 | { |
| 663 | 652 | unique_lock<mutex> __lk(this->__mut_); |
| 664 | 653 | if (this->__has_value()) |
| 665 | 654 | __throw_future_error(future_errc::promise_already_satisfied); |
| 666 | ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); | |
| 655 | ::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); | |
| 667 | 656 | this->__state_ |= base::__constructed | base::ready; |
| 668 | 657 | __cv_.notify_all(); |
| 669 | 658 | } |
| ... | ... | @@ -671,16 +660,12 @@ __assoc_state<_Rp>::set_value(_Arg& __arg) |
| 671 | 660 | template <class _Rp> |
| 672 | 661 | template <class _Arg> |
| 673 | 662 | void |
| 674 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 675 | 663 | __assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) |
| 676 | #else | |
| 677 | __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg) | |
| 678 | #endif | |
| 679 | 664 | { |
| 680 | 665 | unique_lock<mutex> __lk(this->__mut_); |
| 681 | 666 | if (this->__has_value()) |
| 682 | 667 | __throw_future_error(future_errc::promise_already_satisfied); |
| 683 | ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); | |
| 668 | ::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); | |
| 684 | 669 | this->__state_ |= base::__constructed; |
| 685 | 670 | __thread_local_data()->__make_ready_at_thread_exit(this); |
| 686 | 671 | } |
| ... | ... | @@ -856,16 +841,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state |
| 856 | 841 | _Fp __func_; |
| 857 | 842 | |
| 858 | 843 | public: |
| 859 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 860 | 844 | _LIBCPP_INLINE_VISIBILITY |
| 861 | 845 | explicit __deferred_assoc_state(_Fp&& __f); |
| 862 | #endif | |
| 863 | 846 | |
| 864 | 847 | virtual void __execute(); |
| 865 | 848 | }; |
| 866 | 849 | |
| 867 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 868 | ||
| 869 | 850 | template <class _Rp, class _Fp> |
| 870 | 851 | inline |
| 871 | 852 | __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) |
| ... | ... | @@ -874,8 +855,6 @@ __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) |
| 874 | 855 | this->__set_deferred(); |
| 875 | 856 | } |
| 876 | 857 | |
| 877 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 878 | ||
| 879 | 858 | template <class _Rp, class _Fp> |
| 880 | 859 | void |
| 881 | 860 | __deferred_assoc_state<_Rp, _Fp>::__execute() |
| ... | ... | @@ -903,16 +882,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state<void, _Fp> |
| 903 | 882 | _Fp __func_; |
| 904 | 883 | |
| 905 | 884 | public: |
| 906 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 907 | 885 | _LIBCPP_INLINE_VISIBILITY |
| 908 | 886 | explicit __deferred_assoc_state(_Fp&& __f); |
| 909 | #endif | |
| 910 | 887 | |
| 911 | 888 | virtual void __execute(); |
| 912 | 889 | }; |
| 913 | 890 | |
| 914 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 915 | ||
| 916 | 891 | template <class _Fp> |
| 917 | 892 | inline |
| 918 | 893 | __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) |
| ... | ... | @@ -921,8 +896,6 @@ __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) |
| 921 | 896 | this->__set_deferred(); |
| 922 | 897 | } |
| 923 | 898 | |
| 924 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 925 | ||
| 926 | 899 | template <class _Fp> |
| 927 | 900 | void |
| 928 | 901 | __deferred_assoc_state<void, _Fp>::__execute() |
| ... | ... | @@ -952,16 +925,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state |
| 952 | 925 | |
| 953 | 926 | virtual void __on_zero_shared() _NOEXCEPT; |
| 954 | 927 | public: |
| 955 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 956 | 928 | _LIBCPP_INLINE_VISIBILITY |
| 957 | 929 | explicit __async_assoc_state(_Fp&& __f); |
| 958 | #endif | |
| 959 | 930 | |
| 960 | 931 | virtual void __execute(); |
| 961 | 932 | }; |
| 962 | 933 | |
| 963 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 964 | ||
| 965 | 934 | template <class _Rp, class _Fp> |
| 966 | 935 | inline |
| 967 | 936 | __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) |
| ... | ... | @@ -969,8 +938,6 @@ __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) |
| 969 | 938 | { |
| 970 | 939 | } |
| 971 | 940 | |
| 972 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 973 | ||
| 974 | 941 | template <class _Rp, class _Fp> |
| 975 | 942 | void |
| 976 | 943 | __async_assoc_state<_Rp, _Fp>::__execute() |
| ... | ... | @@ -1007,16 +974,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp> |
| 1007 | 974 | |
| 1008 | 975 | virtual void __on_zero_shared() _NOEXCEPT; |
| 1009 | 976 | public: |
| 1010 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1011 | 977 | _LIBCPP_INLINE_VISIBILITY |
| 1012 | 978 | explicit __async_assoc_state(_Fp&& __f); |
| 1013 | #endif | |
| 1014 | 979 | |
| 1015 | 980 | virtual void __execute(); |
| 1016 | 981 | }; |
| 1017 | 982 | |
| 1018 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1019 | ||
| 1020 | 983 | template <class _Fp> |
| 1021 | 984 | inline |
| 1022 | 985 | __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) |
| ... | ... | @@ -1024,8 +987,6 @@ __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) |
| 1024 | 987 | { |
| 1025 | 988 | } |
| 1026 | 989 | |
| 1027 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1028 | ||
| 1029 | 990 | template <class _Fp> |
| 1030 | 991 | void |
| 1031 | 992 | __async_assoc_state<void, _Fp>::__execute() |
| ... | ... | @@ -1062,19 +1023,11 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS future; |
| 1062 | 1023 | |
| 1063 | 1024 | template <class _Rp, class _Fp> |
| 1064 | 1025 | _LIBCPP_INLINE_VISIBILITY future<_Rp> |
| 1065 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1066 | 1026 | __make_deferred_assoc_state(_Fp&& __f); |
| 1067 | #else | |
| 1068 | __make_deferred_assoc_state(_Fp __f); | |
| 1069 | #endif | |
| 1070 | 1027 | |
| 1071 | 1028 | template <class _Rp, class _Fp> |
| 1072 | 1029 | _LIBCPP_INLINE_VISIBILITY future<_Rp> |
| 1073 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1074 | 1030 | __make_async_assoc_state(_Fp&& __f); |
| 1075 | #else | |
| 1076 | __make_async_assoc_state(_Fp __f); | |
| 1077 | #endif | |
| 1078 | 1031 | |
| 1079 | 1032 | template <class _Rp> |
| 1080 | 1033 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future |
| ... | ... | @@ -1086,22 +1039,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future |
| 1086 | 1039 | template <class> friend class promise; |
| 1087 | 1040 | template <class> friend class shared_future; |
| 1088 | 1041 | |
| 1089 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1090 | 1042 | template <class _R1, class _Fp> |
| 1091 | 1043 | friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); |
| 1092 | 1044 | template <class _R1, class _Fp> |
| 1093 | 1045 | friend future<_R1> __make_async_assoc_state(_Fp&& __f); |
| 1094 | #else | |
| 1095 | template <class _R1, class _Fp> | |
| 1096 | friend future<_R1> __make_deferred_assoc_state(_Fp __f); | |
| 1097 | template <class _R1, class _Fp> | |
| 1098 | friend future<_R1> __make_async_assoc_state(_Fp __f); | |
| 1099 | #endif | |
| 1100 | 1046 | |
| 1101 | 1047 | public: |
| 1102 | 1048 | _LIBCPP_INLINE_VISIBILITY |
| 1103 | 1049 | future() _NOEXCEPT : __state_(nullptr) {} |
| 1104 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1105 | 1050 | _LIBCPP_INLINE_VISIBILITY |
| 1106 | 1051 | future(future&& __rhs) _NOEXCEPT |
| 1107 | 1052 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| ... | ... | @@ -1110,15 +1055,10 @@ public: |
| 1110 | 1055 | _LIBCPP_INLINE_VISIBILITY |
| 1111 | 1056 | future& operator=(future&& __rhs) _NOEXCEPT |
| 1112 | 1057 | { |
| 1113 | future(std::move(__rhs)).swap(*this); | |
| 1058 | future(_VSTD::move(__rhs)).swap(*this); | |
| 1114 | 1059 | return *this; |
| 1115 | 1060 | } |
| 1116 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1117 | private: | |
| 1118 | future(const future&); | |
| 1119 | future& operator=(const future&); | |
| 1120 | public: | |
| 1121 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1061 | ||
| 1122 | 1062 | ~future(); |
| 1123 | 1063 | _LIBCPP_INLINE_VISIBILITY |
| 1124 | 1064 | shared_future<_Rp> share() _NOEXCEPT; |
| ... | ... | @@ -1186,22 +1126,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&> |
| 1186 | 1126 | template <class> friend class promise; |
| 1187 | 1127 | template <class> friend class shared_future; |
| 1188 | 1128 | |
| 1189 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1190 | 1129 | template <class _R1, class _Fp> |
| 1191 | 1130 | friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); |
| 1192 | 1131 | template <class _R1, class _Fp> |
| 1193 | 1132 | friend future<_R1> __make_async_assoc_state(_Fp&& __f); |
| 1194 | #else | |
| 1195 | template <class _R1, class _Fp> | |
| 1196 | friend future<_R1> __make_deferred_assoc_state(_Fp __f); | |
| 1197 | template <class _R1, class _Fp> | |
| 1198 | friend future<_R1> __make_async_assoc_state(_Fp __f); | |
| 1199 | #endif | |
| 1200 | 1133 | |
| 1201 | 1134 | public: |
| 1202 | 1135 | _LIBCPP_INLINE_VISIBILITY |
| 1203 | 1136 | future() _NOEXCEPT : __state_(nullptr) {} |
| 1204 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1205 | 1137 | _LIBCPP_INLINE_VISIBILITY |
| 1206 | 1138 | future(future&& __rhs) _NOEXCEPT |
| 1207 | 1139 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| ... | ... | @@ -1210,15 +1142,10 @@ public: |
| 1210 | 1142 | _LIBCPP_INLINE_VISIBILITY |
| 1211 | 1143 | future& operator=(future&& __rhs) _NOEXCEPT |
| 1212 | 1144 | { |
| 1213 | future(std::move(__rhs)).swap(*this); | |
| 1145 | future(_VSTD::move(__rhs)).swap(*this); | |
| 1214 | 1146 | return *this; |
| 1215 | 1147 | } |
| 1216 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1217 | private: | |
| 1218 | future(const future&); | |
| 1219 | future& operator=(const future&); | |
| 1220 | public: | |
| 1221 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1148 | ||
| 1222 | 1149 | ~future(); |
| 1223 | 1150 | _LIBCPP_INLINE_VISIBILITY |
| 1224 | 1151 | shared_future<_Rp&> share() _NOEXCEPT; |
| ... | ... | @@ -1281,22 +1208,14 @@ class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future<void> |
| 1281 | 1208 | template <class> friend class promise; |
| 1282 | 1209 | template <class> friend class shared_future; |
| 1283 | 1210 | |
| 1284 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1285 | 1211 | template <class _R1, class _Fp> |
| 1286 | 1212 | friend future<_R1> __make_deferred_assoc_state(_Fp&& __f); |
| 1287 | 1213 | template <class _R1, class _Fp> |
| 1288 | 1214 | friend future<_R1> __make_async_assoc_state(_Fp&& __f); |
| 1289 | #else | |
| 1290 | template <class _R1, class _Fp> | |
| 1291 | friend future<_R1> __make_deferred_assoc_state(_Fp __f); | |
| 1292 | template <class _R1, class _Fp> | |
| 1293 | friend future<_R1> __make_async_assoc_state(_Fp __f); | |
| 1294 | #endif | |
| 1295 | 1215 | |
| 1296 | 1216 | public: |
| 1297 | 1217 | _LIBCPP_INLINE_VISIBILITY |
| 1298 | 1218 | future() _NOEXCEPT : __state_(nullptr) {} |
| 1299 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1300 | 1219 | _LIBCPP_INLINE_VISIBILITY |
| 1301 | 1220 | future(future&& __rhs) _NOEXCEPT |
| 1302 | 1221 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| ... | ... | @@ -1305,15 +1224,10 @@ public: |
| 1305 | 1224 | _LIBCPP_INLINE_VISIBILITY |
| 1306 | 1225 | future& operator=(future&& __rhs) _NOEXCEPT |
| 1307 | 1226 | { |
| 1308 | future(std::move(__rhs)).swap(*this); | |
| 1227 | future(_VSTD::move(__rhs)).swap(*this); | |
| 1309 | 1228 | return *this; |
| 1310 | 1229 | } |
| 1311 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1312 | private: | |
| 1313 | future(const future&); | |
| 1314 | future& operator=(const future&); | |
| 1315 | public: | |
| 1316 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1230 | ||
| 1317 | 1231 | ~future(); |
| 1318 | 1232 | _LIBCPP_INLINE_VISIBILITY |
| 1319 | 1233 | shared_future<void> share() _NOEXCEPT; |
| ... | ... | @@ -1367,32 +1281,21 @@ public: |
| 1367 | 1281 | promise(); |
| 1368 | 1282 | template <class _Alloc> |
| 1369 | 1283 | promise(allocator_arg_t, const _Alloc& __a); |
| 1370 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1371 | 1284 | _LIBCPP_INLINE_VISIBILITY |
| 1372 | 1285 | promise(promise&& __rhs) _NOEXCEPT |
| 1373 | 1286 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| 1374 | 1287 | promise(const promise& __rhs) = delete; |
| 1375 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1376 | private: | |
| 1377 | promise(const promise& __rhs); | |
| 1378 | public: | |
| 1379 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1380 | 1288 | ~promise(); |
| 1381 | 1289 | |
| 1382 | 1290 | // assignment |
| 1383 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1384 | 1291 | _LIBCPP_INLINE_VISIBILITY |
| 1385 | 1292 | promise& operator=(promise&& __rhs) _NOEXCEPT |
| 1386 | 1293 | { |
| 1387 | promise(std::move(__rhs)).swap(*this); | |
| 1294 | promise(_VSTD::move(__rhs)).swap(*this); | |
| 1388 | 1295 | return *this; |
| 1389 | 1296 | } |
| 1390 | 1297 | promise& operator=(const promise& __rhs) = delete; |
| 1391 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1392 | private: | |
| 1393 | promise& operator=(const promise& __rhs); | |
| 1394 | public: | |
| 1395 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1298 | ||
| 1396 | 1299 | _LIBCPP_INLINE_VISIBILITY |
| 1397 | 1300 | void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} |
| 1398 | 1301 | |
| ... | ... | @@ -1401,16 +1304,12 @@ public: |
| 1401 | 1304 | |
| 1402 | 1305 | // setting the result |
| 1403 | 1306 | void set_value(const _Rp& __r); |
| 1404 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1405 | 1307 | void set_value(_Rp&& __r); |
| 1406 | #endif | |
| 1407 | 1308 | void set_exception(exception_ptr __p); |
| 1408 | 1309 | |
| 1409 | 1310 | // setting the result with deferred notification |
| 1410 | 1311 | void set_value_at_thread_exit(const _Rp& __r); |
| 1411 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1412 | 1312 | void set_value_at_thread_exit(_Rp&& __r); |
| 1413 | #endif | |
| 1414 | 1313 | void set_exception_at_thread_exit(exception_ptr __p); |
| 1415 | 1314 | }; |
| 1416 | 1315 | |
| ... | ... | @@ -1429,7 +1328,7 @@ promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0) |
| 1429 | 1328 | typedef __allocator_destructor<_A2> _D2; |
| 1430 | 1329 | _A2 __a(__a0); |
| 1431 | 1330 | unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); |
| 1432 | ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0); | |
| 1331 | ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); | |
| 1433 | 1332 | __state_ = _VSTD::addressof(*__hold.release()); |
| 1434 | 1333 | } |
| 1435 | 1334 | |
| ... | ... | @@ -1464,8 +1363,6 @@ promise<_Rp>::set_value(const _Rp& __r) |
| 1464 | 1363 | __state_->set_value(__r); |
| 1465 | 1364 | } |
| 1466 | 1365 | |
| 1467 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1468 | ||
| 1469 | 1366 | template <class _Rp> |
| 1470 | 1367 | void |
| 1471 | 1368 | promise<_Rp>::set_value(_Rp&& __r) |
| ... | ... | @@ -1475,8 +1372,6 @@ promise<_Rp>::set_value(_Rp&& __r) |
| 1475 | 1372 | __state_->set_value(_VSTD::move(__r)); |
| 1476 | 1373 | } |
| 1477 | 1374 | |
| 1478 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1479 | ||
| 1480 | 1375 | template <class _Rp> |
| 1481 | 1376 | void |
| 1482 | 1377 | promise<_Rp>::set_exception(exception_ptr __p) |
| ... | ... | @@ -1496,8 +1391,6 @@ promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) |
| 1496 | 1391 | __state_->set_value_at_thread_exit(__r); |
| 1497 | 1392 | } |
| 1498 | 1393 | |
| 1499 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1500 | ||
| 1501 | 1394 | template <class _Rp> |
| 1502 | 1395 | void |
| 1503 | 1396 | promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) |
| ... | ... | @@ -1507,8 +1400,6 @@ promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) |
| 1507 | 1400 | __state_->set_value_at_thread_exit(_VSTD::move(__r)); |
| 1508 | 1401 | } |
| 1509 | 1402 | |
| 1510 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1511 | ||
| 1512 | 1403 | template <class _Rp> |
| 1513 | 1404 | void |
| 1514 | 1405 | promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) |
| ... | ... | @@ -1535,32 +1426,21 @@ public: |
| 1535 | 1426 | promise(); |
| 1536 | 1427 | template <class _Allocator> |
| 1537 | 1428 | promise(allocator_arg_t, const _Allocator& __a); |
| 1538 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1539 | 1429 | _LIBCPP_INLINE_VISIBILITY |
| 1540 | 1430 | promise(promise&& __rhs) _NOEXCEPT |
| 1541 | 1431 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| 1542 | 1432 | promise(const promise& __rhs) = delete; |
| 1543 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1544 | private: | |
| 1545 | promise(const promise& __rhs); | |
| 1546 | public: | |
| 1547 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1548 | 1433 | ~promise(); |
| 1549 | 1434 | |
| 1550 | 1435 | // assignment |
| 1551 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1552 | 1436 | _LIBCPP_INLINE_VISIBILITY |
| 1553 | 1437 | promise& operator=(promise&& __rhs) _NOEXCEPT |
| 1554 | 1438 | { |
| 1555 | promise(std::move(__rhs)).swap(*this); | |
| 1439 | promise(_VSTD::move(__rhs)).swap(*this); | |
| 1556 | 1440 | return *this; |
| 1557 | 1441 | } |
| 1558 | 1442 | promise& operator=(const promise& __rhs) = delete; |
| 1559 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1560 | private: | |
| 1561 | promise& operator=(const promise& __rhs); | |
| 1562 | public: | |
| 1563 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1443 | ||
| 1564 | 1444 | _LIBCPP_INLINE_VISIBILITY |
| 1565 | 1445 | void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} |
| 1566 | 1446 | |
| ... | ... | @@ -1591,7 +1471,7 @@ promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0) |
| 1591 | 1471 | typedef __allocator_destructor<_A2> _D2; |
| 1592 | 1472 | _A2 __a(__a0); |
| 1593 | 1473 | unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); |
| 1594 | ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0); | |
| 1474 | ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); | |
| 1595 | 1475 | __state_ = _VSTD::addressof(*__hold.release()); |
| 1596 | 1476 | } |
| 1597 | 1477 | |
| ... | ... | @@ -1672,32 +1552,21 @@ public: |
| 1672 | 1552 | template <class _Allocator> |
| 1673 | 1553 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS |
| 1674 | 1554 | promise(allocator_arg_t, const _Allocator& __a); |
| 1675 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1676 | 1555 | _LIBCPP_INLINE_VISIBILITY |
| 1677 | 1556 | promise(promise&& __rhs) _NOEXCEPT |
| 1678 | 1557 | : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;} |
| 1679 | 1558 | promise(const promise& __rhs) = delete; |
| 1680 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1681 | private: | |
| 1682 | promise(const promise& __rhs); | |
| 1683 | public: | |
| 1684 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1685 | 1559 | ~promise(); |
| 1686 | 1560 | |
| 1687 | 1561 | // assignment |
| 1688 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1689 | 1562 | _LIBCPP_INLINE_VISIBILITY |
| 1690 | 1563 | promise& operator=(promise&& __rhs) _NOEXCEPT |
| 1691 | 1564 | { |
| 1692 | promise(std::move(__rhs)).swap(*this); | |
| 1565 | promise(_VSTD::move(__rhs)).swap(*this); | |
| 1693 | 1566 | return *this; |
| 1694 | 1567 | } |
| 1695 | 1568 | promise& operator=(const promise& __rhs) = delete; |
| 1696 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1697 | private: | |
| 1698 | promise& operator=(const promise& __rhs); | |
| 1699 | public: | |
| 1700 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 1569 | ||
| 1701 | 1570 | _LIBCPP_INLINE_VISIBILITY |
| 1702 | 1571 | void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);} |
| 1703 | 1572 | |
| ... | ... | @@ -1721,7 +1590,7 @@ promise<void>::promise(allocator_arg_t, const _Alloc& __a0) |
| 1721 | 1590 | typedef __allocator_destructor<_A2> _D2; |
| 1722 | 1591 | _A2 __a(__a0); |
| 1723 | 1592 | unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); |
| 1724 | ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0); | |
| 1593 | ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); | |
| 1725 | 1594 | __state_ = _VSTD::addressof(*__hold.release()); |
| 1726 | 1595 | } |
| 1727 | 1596 | |
| ... | ... | @@ -1737,8 +1606,6 @@ template <class _Rp, class _Alloc> |
| 1737 | 1606 | struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc> |
| 1738 | 1607 | : public true_type {}; |
| 1739 | 1608 | |
| 1740 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 1741 | ||
| 1742 | 1609 | // packaged_task |
| 1743 | 1610 | |
| 1744 | 1611 | template<class _Fp> class __packaged_task_base; |
| ... | ... | @@ -1788,7 +1655,7 @@ void |
| 1788 | 1655 | __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( |
| 1789 | 1656 | __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT |
| 1790 | 1657 | { |
| 1791 | ::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); | |
| 1658 | ::new ((void*)__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); | |
| 1792 | 1659 | } |
| 1793 | 1660 | |
| 1794 | 1661 | template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> |
| ... | ... | @@ -1823,6 +1690,10 @@ template<class _Rp, class ..._ArgTypes> |
| 1823 | 1690 | class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)> |
| 1824 | 1691 | { |
| 1825 | 1692 | typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; |
| 1693 | ||
| 1694 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_NO_CFI | |
| 1695 | __base* __get_buf() { return (__base*)&__buf_; } | |
| 1696 | ||
| 1826 | 1697 | typename aligned_storage<3*sizeof(void*)>::type __buf_; |
| 1827 | 1698 | __base* __f_; |
| 1828 | 1699 | |
| ... | ... | @@ -1856,10 +1727,10 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged |
| 1856 | 1727 | { |
| 1857 | 1728 | if (__f.__f_ == nullptr) |
| 1858 | 1729 | __f_ = nullptr; |
| 1859 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 1730 | else if (__f.__f_ == __f.__get_buf()) | |
| 1860 | 1731 | { |
| 1732 | __f.__f_->__move_to(__get_buf()); | |
| 1861 | 1733 | __f_ = (__base*)&__buf_; |
| 1862 | __f.__f_->__move_to(__f_); | |
| 1863 | 1734 | } |
| 1864 | 1735 | else |
| 1865 | 1736 | { |
| ... | ... | @@ -1877,8 +1748,8 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) |
| 1877 | 1748 | typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; |
| 1878 | 1749 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1879 | 1750 | { |
| 1751 | ::new ((void*)&__buf_) _FF(_VSTD::forward<_Fp>(__f)); | |
| 1880 | 1752 | __f_ = (__base*)&__buf_; |
| 1881 | ::new (__f_) _FF(_VSTD::forward<_Fp>(__f)); | |
| 1882 | 1753 | } |
| 1883 | 1754 | else |
| 1884 | 1755 | { |
| ... | ... | @@ -1886,7 +1757,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) |
| 1886 | 1757 | _Ap __a; |
| 1887 | 1758 | typedef __allocator_destructor<_Ap> _Dp; |
| 1888 | 1759 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1889 | ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); | |
| 1760 | ::new ((void*)__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); | |
| 1890 | 1761 | __f_ = __hold.release(); |
| 1891 | 1762 | } |
| 1892 | 1763 | } |
| ... | ... | @@ -1902,7 +1773,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( |
| 1902 | 1773 | if (sizeof(_FF) <= sizeof(__buf_)) |
| 1903 | 1774 | { |
| 1904 | 1775 | __f_ = (__base*)&__buf_; |
| 1905 | ::new (__f_) _FF(_VSTD::forward<_Fp>(__f)); | |
| 1776 | ::new ((void*)__f_) _FF(_VSTD::forward<_Fp>(__f)); | |
| 1906 | 1777 | } |
| 1907 | 1778 | else |
| 1908 | 1779 | { |
| ... | ... | @@ -1910,7 +1781,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( |
| 1910 | 1781 | _Ap __a(__a0); |
| 1911 | 1782 | typedef __allocator_destructor<_Ap> _Dp; |
| 1912 | 1783 | unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); |
| 1913 | ::new (static_cast<void*>(_VSTD::addressof(*__hold.get()))) | |
| 1784 | ::new ((void*)_VSTD::addressof(*__hold.get())) | |
| 1914 | 1785 | _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a)); |
| 1915 | 1786 | __f_ = _VSTD::addressof(*__hold.release()); |
| 1916 | 1787 | } |
| ... | ... | @@ -1920,17 +1791,17 @@ template<class _Rp, class ..._ArgTypes> |
| 1920 | 1791 | __packaged_task_function<_Rp(_ArgTypes...)>& |
| 1921 | 1792 | __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT |
| 1922 | 1793 | { |
| 1923 | if (__f_ == (__base*)&__buf_) | |
| 1794 | if (__f_ == __get_buf()) | |
| 1924 | 1795 | __f_->destroy(); |
| 1925 | 1796 | else if (__f_) |
| 1926 | 1797 | __f_->destroy_deallocate(); |
| 1927 | 1798 | __f_ = nullptr; |
| 1928 | 1799 | if (__f.__f_ == nullptr) |
| 1929 | 1800 | __f_ = nullptr; |
| 1930 | else if (__f.__f_ == (__base*)&__f.__buf_) | |
| 1801 | else if (__f.__f_ == __f.__get_buf()) | |
| 1931 | 1802 | { |
| 1932 | __f_ = (__base*)&__buf_; | |
| 1933 | __f.__f_->__move_to(__f_); | |
| 1803 | __f.__f_->__move_to(__get_buf()); | |
| 1804 | __f_ = __get_buf(); | |
| 1934 | 1805 | } |
| 1935 | 1806 | else |
| 1936 | 1807 | { |
| ... | ... | @@ -1943,13 +1814,14 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function& |
| 1943 | 1814 | template<class _Rp, class ..._ArgTypes> |
| 1944 | 1815 | __packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function() |
| 1945 | 1816 | { |
| 1946 | if (__f_ == (__base*)&__buf_) | |
| 1817 | if (__f_ == __get_buf()) | |
| 1947 | 1818 | __f_->destroy(); |
| 1948 | 1819 | else if (__f_) |
| 1949 | 1820 | __f_->destroy_deallocate(); |
| 1950 | 1821 | } |
| 1951 | 1822 | |
| 1952 | 1823 | template<class _Rp, class ..._ArgTypes> |
| 1824 | _LIBCPP_NO_CFI | |
| 1953 | 1825 | void |
| 1954 | 1826 | __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT |
| 1955 | 1827 | { |
| ... | ... | @@ -2268,11 +2140,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc> |
| 2268 | 2140 | |
| 2269 | 2141 | template <class _Rp, class _Fp> |
| 2270 | 2142 | _LIBCPP_INLINE_VISIBILITY future<_Rp> |
| 2271 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2272 | 2143 | __make_deferred_assoc_state(_Fp&& __f) |
| 2273 | #else | |
| 2274 | __make_deferred_assoc_state(_Fp __f) | |
| 2275 | #endif | |
| 2276 | 2144 | { |
| 2277 | 2145 | unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count> |
| 2278 | 2146 | __h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f))); |
| ... | ... | @@ -2281,11 +2149,7 @@ __make_deferred_assoc_state(_Fp __f) |
| 2281 | 2149 | |
| 2282 | 2150 | template <class _Rp, class _Fp> |
| 2283 | 2151 | _LIBCPP_INLINE_VISIBILITY future<_Rp> |
| 2284 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2285 | 2152 | __make_async_assoc_state(_Fp&& __f) |
| 2286 | #else | |
| 2287 | __make_async_assoc_state(_Fp __f) | |
| 2288 | #endif | |
| 2289 | 2153 | { |
| 2290 | 2154 | unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count> |
| 2291 | 2155 | __h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f))); |
| ... | ... | @@ -2293,6 +2157,8 @@ __make_async_assoc_state(_Fp __f) |
| 2293 | 2157 | return future<_Rp>(__h.get()); |
| 2294 | 2158 | } |
| 2295 | 2159 | |
| 2160 | #ifndef _LIBCPP_CXX03_LANG | |
| 2161 | ||
| 2296 | 2162 | template <class _Fp, class... _Args> |
| 2297 | 2163 | class _LIBCPP_HIDDEN __async_func |
| 2298 | 2164 | { |
| ... | ... | @@ -2360,7 +2226,7 @@ async(_Fp&& __f, _Args&&... __args) |
| 2360 | 2226 | _VSTD::forward<_Args>(__args)...); |
| 2361 | 2227 | } |
| 2362 | 2228 | |
| 2363 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 2229 | #endif // C++03 | |
| 2364 | 2230 | |
| 2365 | 2231 | // shared_future |
| 2366 | 2232 | |
| ... | ... | @@ -2375,24 +2241,20 @@ public: |
| 2375 | 2241 | _LIBCPP_INLINE_VISIBILITY |
| 2376 | 2242 | shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_) |
| 2377 | 2243 | {if (__state_) __state_->__add_shared();} |
| 2378 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2379 | 2244 | _LIBCPP_INLINE_VISIBILITY |
| 2380 | 2245 | shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_) |
| 2381 | 2246 | {__f.__state_ = nullptr;} |
| 2382 | 2247 | _LIBCPP_INLINE_VISIBILITY |
| 2383 | 2248 | shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) |
| 2384 | 2249 | {__rhs.__state_ = nullptr;} |
| 2385 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2386 | 2250 | ~shared_future(); |
| 2387 | 2251 | shared_future& operator=(const shared_future& __rhs) _NOEXCEPT; |
| 2388 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2389 | 2252 | _LIBCPP_INLINE_VISIBILITY |
| 2390 | 2253 | shared_future& operator=(shared_future&& __rhs) _NOEXCEPT |
| 2391 | 2254 | { |
| 2392 | shared_future(std::move(__rhs)).swap(*this); | |
| 2255 | shared_future(_VSTD::move(__rhs)).swap(*this); | |
| 2393 | 2256 | return *this; |
| 2394 | 2257 | } |
| 2395 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2396 | 2258 | |
| 2397 | 2259 | // retrieving the value |
| 2398 | 2260 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2449,24 +2311,20 @@ public: |
| 2449 | 2311 | _LIBCPP_INLINE_VISIBILITY |
| 2450 | 2312 | shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) |
| 2451 | 2313 | {if (__state_) __state_->__add_shared();} |
| 2452 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2453 | 2314 | _LIBCPP_INLINE_VISIBILITY |
| 2454 | 2315 | shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_) |
| 2455 | 2316 | {__f.__state_ = nullptr;} |
| 2456 | 2317 | _LIBCPP_INLINE_VISIBILITY |
| 2457 | 2318 | shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) |
| 2458 | 2319 | {__rhs.__state_ = nullptr;} |
| 2459 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2460 | 2320 | ~shared_future(); |
| 2461 | 2321 | shared_future& operator=(const shared_future& __rhs); |
| 2462 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2463 | 2322 | _LIBCPP_INLINE_VISIBILITY |
| 2464 | 2323 | shared_future& operator=(shared_future&& __rhs) _NOEXCEPT |
| 2465 | 2324 | { |
| 2466 | shared_future(std::move(__rhs)).swap(*this); | |
| 2325 | shared_future(_VSTD::move(__rhs)).swap(*this); | |
| 2467 | 2326 | return *this; |
| 2468 | 2327 | } |
| 2469 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2470 | 2328 | |
| 2471 | 2329 | // retrieving the value |
| 2472 | 2330 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2523,24 +2381,20 @@ public: |
| 2523 | 2381 | _LIBCPP_INLINE_VISIBILITY |
| 2524 | 2382 | shared_future(const shared_future& __rhs) : __state_(__rhs.__state_) |
| 2525 | 2383 | {if (__state_) __state_->__add_shared();} |
| 2526 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2527 | 2384 | _LIBCPP_INLINE_VISIBILITY |
| 2528 | 2385 | shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_) |
| 2529 | 2386 | {__f.__state_ = nullptr;} |
| 2530 | 2387 | _LIBCPP_INLINE_VISIBILITY |
| 2531 | 2388 | shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_) |
| 2532 | 2389 | {__rhs.__state_ = nullptr;} |
| 2533 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2534 | 2390 | ~shared_future(); |
| 2535 | 2391 | shared_future& operator=(const shared_future& __rhs); |
| 2536 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2537 | 2392 | _LIBCPP_INLINE_VISIBILITY |
| 2538 | 2393 | shared_future& operator=(shared_future&& __rhs) _NOEXCEPT |
| 2539 | 2394 | { |
| 2540 | shared_future(std::move(__rhs)).swap(*this); | |
| 2395 | shared_future(_VSTD::move(__rhs)).swap(*this); | |
| 2541 | 2396 | return *this; |
| 2542 | 2397 | } |
| 2543 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2544 | 2398 | |
| 2545 | 2399 | // retrieving the value |
| 2546 | 2400 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -2591,8 +2445,6 @@ future<_Rp&>::share() _NOEXCEPT |
| 2591 | 2445 | return shared_future<_Rp&>(_VSTD::move(*this)); |
| 2592 | 2446 | } |
| 2593 | 2447 | |
| 2594 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2595 | ||
| 2596 | 2448 | inline |
| 2597 | 2449 | shared_future<void> |
| 2598 | 2450 | future<void>::share() _NOEXCEPT |
| ... | ... | @@ -2600,8 +2452,6 @@ future<void>::share() _NOEXCEPT |
| 2600 | 2452 | return shared_future<void>(_VSTD::move(*this)); |
| 2601 | 2453 | } |
| 2602 | 2454 | |
| 2603 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 2604 | ||
| 2605 | 2455 | _LIBCPP_END_NAMESPACE_STD |
| 2606 | 2456 | |
| 2607 | 2457 | #endif // !_LIBCPP_HAS_NO_THREADS |
lib/libcxx/include/iomanip+1-1| ... | ... | @@ -514,7 +514,7 @@ put_time(const tm* __tm, const _CharT* __fmt) |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | template <class _CharT, class _Traits, class _ForwardIterator> |
| 517 | std::basic_ostream<_CharT, _Traits> & | |
| 517 | basic_ostream<_CharT, _Traits> & | |
| 518 | 518 | __quoted_output ( basic_ostream<_CharT, _Traits> &__os, |
| 519 | 519 | _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape ) |
| 520 | 520 | { |
lib/libcxx/include/ios+2-29| ... | ... | @@ -710,7 +710,7 @@ void |
| 710 | 710 | basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) |
| 711 | 711 | { |
| 712 | 712 | ios_base::init(__sb); |
| 713 | __tie_ = 0; | |
| 713 | __tie_ = nullptr; | |
| 714 | 714 | __fill_ = traits_type::eof(); |
| 715 | 715 | } |
| 716 | 716 | |
| ... | ... | @@ -821,7 +821,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) |
| 821 | 821 | { |
| 822 | 822 | ios_base::move(__rhs); |
| 823 | 823 | __tie_ = __rhs.__tie_; |
| 824 | __rhs.__tie_ = 0; | |
| 824 | __rhs.__tie_ = nullptr; | |
| 825 | 825 | __fill_ = __rhs.__fill_; |
| 826 | 826 | } |
| 827 | 827 | |
| ... | ... | @@ -1035,33 +1035,6 @@ defaultfloat(ios_base& __str) |
| 1035 | 1035 | return __str; |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | template <class _CharT, class _Traits> | |
| 1039 | class __save_flags | |
| 1040 | { | |
| 1041 | typedef basic_ios<_CharT, _Traits> __stream_type; | |
| 1042 | typedef typename __stream_type::fmtflags fmtflags; | |
| 1043 | ||
| 1044 | __stream_type& __stream_; | |
| 1045 | fmtflags __fmtflags_; | |
| 1046 | _CharT __fill_; | |
| 1047 | ||
| 1048 | __save_flags(const __save_flags&); | |
| 1049 | __save_flags& operator=(const __save_flags&); | |
| 1050 | public: | |
| 1051 | _LIBCPP_INLINE_VISIBILITY | |
| 1052 | explicit __save_flags(__stream_type& __stream) | |
| 1053 | : __stream_(__stream), | |
| 1054 | __fmtflags_(__stream.flags()), | |
| 1055 | __fill_(__stream.fill()) | |
| 1056 | {} | |
| 1057 | _LIBCPP_INLINE_VISIBILITY | |
| 1058 | ~__save_flags() | |
| 1059 | { | |
| 1060 | __stream_.flags(__fmtflags_); | |
| 1061 | __stream_.fill(__fill_); | |
| 1062 | } | |
| 1063 | }; | |
| 1064 | ||
| 1065 | 1038 | _LIBCPP_END_NAMESPACE_STD |
| 1066 | 1039 | |
| 1067 | 1040 | #endif // _LIBCPP_IOS |
lib/libcxx/include/iosfwd+59| ... | ... | @@ -185,6 +185,36 @@ typedef basic_ifstream<wchar_t> wifstream; |
| 185 | 185 | typedef basic_ofstream<wchar_t> wofstream; |
| 186 | 186 | typedef basic_fstream<wchar_t> wfstream; |
| 187 | 187 | |
| 188 | template <class _CharT, class _Traits> | |
| 189 | class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_PREFERRED_NAME(wios) basic_ios; | |
| 190 | ||
| 191 | template <class _CharT, class _Traits> | |
| 192 | class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_PREFERRED_NAME(wstreambuf) basic_streambuf; | |
| 193 | template <class _CharT, class _Traits> | |
| 194 | class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_PREFERRED_NAME(wistream) basic_istream; | |
| 195 | template <class _CharT, class _Traits> | |
| 196 | class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_PREFERRED_NAME(wostream) basic_ostream; | |
| 197 | template <class _CharT, class _Traits> | |
| 198 | class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_PREFERRED_NAME(wiostream) basic_iostream; | |
| 199 | ||
| 200 | template <class _CharT, class _Traits, class _Allocator> | |
| 201 | class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_PREFERRED_NAME(wstringbuf) basic_stringbuf; | |
| 202 | template <class _CharT, class _Traits, class _Allocator> | |
| 203 | class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_PREFERRED_NAME(wistringstream) basic_istringstream; | |
| 204 | template <class _CharT, class _Traits, class _Allocator> | |
| 205 | class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_PREFERRED_NAME(wostringstream) basic_ostringstream; | |
| 206 | template <class _CharT, class _Traits, class _Allocator> | |
| 207 | class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_PREFERRED_NAME(wstringstream) basic_stringstream; | |
| 208 | ||
| 209 | template <class _CharT, class _Traits> | |
| 210 | class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_PREFERRED_NAME(wfilebuf) basic_filebuf; | |
| 211 | template <class _CharT, class _Traits> | |
| 212 | class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_PREFERRED_NAME(wifstream) basic_ifstream; | |
| 213 | template <class _CharT, class _Traits> | |
| 214 | class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_PREFERRED_NAME(wofstream) basic_ofstream; | |
| 215 | template <class _CharT, class _Traits> | |
| 216 | class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_PREFERRED_NAME(wfstream) basic_fstream; | |
| 217 | ||
| 188 | 218 | template <class _State> class _LIBCPP_TEMPLATE_VIS fpos; |
| 189 | 219 | typedef fpos<mbstate_t> streampos; |
| 190 | 220 | typedef fpos<mbstate_t> wstreampos; |
| ... | ... | @@ -210,11 +240,40 @@ template <class _CharT, // for <stdexcept> |
| 210 | 240 | typedef basic_string<char, char_traits<char>, allocator<char> > string; |
| 211 | 241 | typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; |
| 212 | 242 | |
| 243 | template <class _CharT, class _Traits, class _Allocator> | |
| 244 | class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_PREFERRED_NAME(wstring) basic_string; | |
| 213 | 245 | |
| 214 | 246 | // Include other forward declarations here |
| 215 | 247 | template <class _Tp, class _Alloc = allocator<_Tp> > |
| 216 | 248 | class _LIBCPP_TEMPLATE_VIS vector; |
| 217 | 249 | |
| 250 | template <class _CharT, class _Traits> | |
| 251 | class __save_flags | |
| 252 | { | |
| 253 | typedef basic_ios<_CharT, _Traits> __stream_type; | |
| 254 | typedef typename __stream_type::fmtflags fmtflags; | |
| 255 | ||
| 256 | __stream_type& __stream_; | |
| 257 | fmtflags __fmtflags_; | |
| 258 | _CharT __fill_; | |
| 259 | ||
| 260 | __save_flags(const __save_flags&); | |
| 261 | __save_flags& operator=(const __save_flags&); | |
| 262 | public: | |
| 263 | _LIBCPP_INLINE_VISIBILITY | |
| 264 | explicit __save_flags(__stream_type& __stream) | |
| 265 | : __stream_(__stream), | |
| 266 | __fmtflags_(__stream.flags()), | |
| 267 | __fill_(__stream.fill()) | |
| 268 | {} | |
| 269 | _LIBCPP_INLINE_VISIBILITY | |
| 270 | ~__save_flags() | |
| 271 | { | |
| 272 | __stream_.flags(__fmtflags_); | |
| 273 | __stream_.fill(__fill_); | |
| 274 | } | |
| 275 | }; | |
| 276 | ||
| 218 | 277 | _LIBCPP_END_NAMESPACE_STD |
| 219 | 278 | |
| 220 | 279 | #endif // _LIBCPP_IOSFWD |
lib/libcxx/include/istream+21-13| ... | ... | @@ -150,9 +150,9 @@ template <class charT, class traits> |
| 150 | 150 | basic_istream<charT,traits>& |
| 151 | 151 | ws(basic_istream<charT,traits>& is); |
| 152 | 152 | |
| 153 | template <class charT, class traits, class T> | |
| 154 | basic_istream<charT, traits>& | |
| 155 | operator>>(basic_istream<charT, traits>&& is, T& x); | |
| 153 | // rvalue stream extraction | |
| 154 | template <class Stream, class T> | |
| 155 | Stream&& operator>>(Stream&& is, T&& x); | |
| 156 | 156 | |
| 157 | 157 | } // std |
| 158 | 158 | |
| ... | ... | @@ -1142,7 +1142,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c) |
| 1142 | 1142 | try |
| 1143 | 1143 | { |
| 1144 | 1144 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1145 | if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) | |
| 1145 | if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof()) | |
| 1146 | 1146 | __state |= ios_base::badbit; |
| 1147 | 1147 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1148 | 1148 | } |
| ... | ... | @@ -1179,7 +1179,7 @@ basic_istream<_CharT, _Traits>::unget() |
| 1179 | 1179 | try |
| 1180 | 1180 | { |
| 1181 | 1181 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1182 | if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) | |
| 1182 | if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof()) | |
| 1183 | 1183 | __state |= ios_base::badbit; |
| 1184 | 1184 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 1185 | 1185 | } |
| ... | ... | @@ -1215,7 +1215,7 @@ basic_istream<_CharT, _Traits>::sync() |
| 1215 | 1215 | try |
| 1216 | 1216 | { |
| 1217 | 1217 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 1218 | if (this->rdbuf() == 0) | |
| 1218 | if (this->rdbuf() == nullptr) | |
| 1219 | 1219 | return -1; |
| 1220 | 1220 | if (this->rdbuf()->pubsync() == -1) |
| 1221 | 1221 | { |
| ... | ... | @@ -1378,13 +1378,23 @@ ws(basic_istream<_CharT, _Traits>& __is) |
| 1378 | 1378 | |
| 1379 | 1379 | #ifndef _LIBCPP_CXX03_LANG |
| 1380 | 1380 | |
| 1381 | template <class _CharT, class _Traits, class _Tp> | |
| 1382 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1383 | basic_istream<_CharT, _Traits>& | |
| 1384 | operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) | |
| 1381 | template <class _Stream, class _Tp, class = void> | |
| 1382 | struct __is_istreamable : false_type { }; | |
| 1383 | ||
| 1384 | template <class _Stream, class _Tp> | |
| 1385 | struct __is_istreamable<_Stream, _Tp, decltype( | |
| 1386 | _VSTD::declval<_Stream>() >> _VSTD::declval<_Tp>(), void() | |
| 1387 | )> : true_type { }; | |
| 1388 | ||
| 1389 | template <class _Stream, class _Tp, class = typename enable_if< | |
| 1390 | _And<is_base_of<ios_base, _Stream>, | |
| 1391 | __is_istreamable<_Stream&, _Tp&&>>::value | |
| 1392 | >::type> | |
| 1393 | _LIBCPP_INLINE_VISIBILITY | |
| 1394 | _Stream&& operator>>(_Stream&& __is, _Tp&& __x) | |
| 1385 | 1395 | { |
| 1386 | 1396 | __is >> _VSTD::forward<_Tp>(__x); |
| 1387 | return __is; | |
| 1397 | return _VSTD::move(__is); | |
| 1388 | 1398 | } |
| 1389 | 1399 | |
| 1390 | 1400 | #endif // _LIBCPP_CXX03_LANG |
| ... | ... | @@ -1638,11 +1648,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) |
| 1638 | 1648 | return __is; |
| 1639 | 1649 | } |
| 1640 | 1650 | |
| 1641 | #ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB | |
| 1642 | 1651 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>) |
| 1643 | 1652 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>) |
| 1644 | 1653 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>) |
| 1645 | #endif | |
| 1646 | 1654 | |
| 1647 | 1655 | _LIBCPP_END_NAMESPACE_STD |
| 1648 | 1656 |
lib/libcxx/include/iterator+69-52| ... | ... | @@ -420,10 +420,8 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; |
| 420 | 420 | #include <type_traits> |
| 421 | 421 | #include <cstddef> |
| 422 | 422 | #include <initializer_list> |
| 423 | #include <__memory/base.h> | |
| 423 | 424 | #include <version> |
| 424 | #ifdef __APPLE__ | |
| 425 | #include <Availability.h> | |
| 426 | #endif | |
| 427 | 425 | |
| 428 | 426 | #include <__debug> |
| 429 | 427 | |
| ... | ... | @@ -498,12 +496,11 @@ struct __has_iterator_typedefs |
| 498 | 496 | private: |
| 499 | 497 | struct __two {char __lx; char __lxx;}; |
| 500 | 498 | template <class _Up> static __two __test(...); |
| 501 | template <class _Up> static char __test(typename std::__void_t<typename _Up::iterator_category>::type* = 0, | |
| 502 | 										typename std::__void_t<typename _Up::difference_type>::type* = 0, | |
| 503 | 										typename std::__void_t<typename _Up::value_type>::type* = 0, | |
| 504 | 										typename std::__void_t<typename _Up::reference>::type* = 0, | |
| 505 | 										typename std::__void_t<typename _Up::pointer>::type* = 0 | |
| 506 | 										); | |
| 499 | template <class _Up> static char __test(typename __void_t<typename _Up::iterator_category>::type* = 0, | |
| 500 | typename __void_t<typename _Up::difference_type>::type* = 0, | |
| 501 | typename __void_t<typename _Up::value_type>::type* = 0, | |
| 502 | typename __void_t<typename _Up::reference>::type* = 0, | |
| 503 | typename __void_t<typename _Up::pointer>::type* = 0); | |
| 507 | 504 | public: |
| 508 | 505 | static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1; |
| 509 | 506 | }; |
| ... | ... | @@ -515,9 +512,9 @@ struct __has_iterator_category |
| 515 | 512 | private: |
| 516 | 513 | struct __two {char __lx; char __lxx;}; |
| 517 | 514 | template <class _Up> static __two __test(...); |
| 518 | template <class _Up> static char __test(typename _Up::iterator_category* = 0); | |
| 515 | template <class _Up> static char __test(typename _Up::iterator_category* = nullptr); | |
| 519 | 516 | public: |
| 520 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | |
| 517 | static const bool value = sizeof(__test<_Tp>(nullptr)) == 1; | |
| 521 | 518 | }; |
| 522 | 519 | |
| 523 | 520 | template <class _Iter, bool> struct __iterator_traits_impl {}; |
| ... | ... | @@ -667,9 +664,9 @@ void advance(_InputIter& __i, _Distance __orig_n) |
| 667 | 664 | { |
| 668 | 665 | _LIBCPP_ASSERT(__orig_n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value, |
| 669 | 666 | "Attempt to advance(it, n) with negative n on a non-bidirectional iterator"); |
| 670 | typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; | |
| 667 | typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize; | |
| 671 | 668 | _IntegralSize __n = __orig_n; |
| 672 | __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); | |
| 669 | _VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); | |
| 673 | 670 | } |
| 674 | 671 | |
| 675 | 672 | template <class _InputIter> |
| ... | ... | @@ -696,7 +693,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 |
| 696 | 693 | typename iterator_traits<_InputIter>::difference_type |
| 697 | 694 | distance(_InputIter __first, _InputIter __last) |
| 698 | 695 | { |
| 699 | return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); | |
| 696 | return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); | |
| 700 | 697 | } |
| 701 | 698 | |
| 702 | 699 | template <class _InputIter> |
| ... | ... | @@ -998,11 +995,11 @@ private: |
| 998 | 995 | istream_type* __in_stream_; |
| 999 | 996 | _Tp __value_; |
| 1000 | 997 | public: |
| 1001 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {} | |
| 998 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {} | |
| 1002 | 999 | _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s)) |
| 1003 | 1000 | { |
| 1004 | 1001 | if (!(*__in_stream_ >> __value_)) |
| 1005 | __in_stream_ = 0; | |
| 1002 | __in_stream_ = nullptr; | |
| 1006 | 1003 | } |
| 1007 | 1004 | |
| 1008 | 1005 | _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;} |
| ... | ... | @@ -1010,7 +1007,7 @@ public: |
| 1010 | 1007 | _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++() |
| 1011 | 1008 | { |
| 1012 | 1009 | if (!(*__in_stream_ >> __value_)) |
| 1013 | __in_stream_ = 0; | |
| 1010 | __in_stream_ = nullptr; | |
| 1014 | 1011 | return *this; |
| 1015 | 1012 | } |
| 1016 | 1013 | _LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int) |
| ... | ... | @@ -1052,15 +1049,25 @@ class _LIBCPP_TEMPLATE_VIS ostream_iterator |
| 1052 | 1049 | : public iterator<output_iterator_tag, void, void, void, void> |
| 1053 | 1050 | { |
| 1054 | 1051 | public: |
| 1055 | typedef _CharT char_type; | |
| 1056 | typedef _Traits traits_type; | |
| 1057 | typedef basic_ostream<_CharT,_Traits> ostream_type; | |
| 1052 | typedef output_iterator_tag iterator_category; | |
| 1053 | typedef void value_type; | |
| 1054 | #if _LIBCPP_STD_VER > 17 | |
| 1055 | typedef std::ptrdiff_t difference_type; | |
| 1056 | #else | |
| 1057 | typedef void difference_type; | |
| 1058 | #endif | |
| 1059 | typedef void pointer; | |
| 1060 | typedef void reference; | |
| 1061 | typedef _CharT char_type; | |
| 1062 | typedef _Traits traits_type; | |
| 1063 | typedef basic_ostream<_CharT, _Traits> ostream_type; | |
| 1064 | ||
| 1058 | 1065 | private: |
| 1059 | 1066 | ostream_type* __out_stream_; |
| 1060 | 1067 | const char_type* __delim_; |
| 1061 | 1068 | public: |
| 1062 | 1069 | _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT |
| 1063 | : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {} | |
| 1070 | : __out_stream_(_VSTD::addressof(__s)), __delim_(nullptr) {} | |
| 1064 | 1071 | _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT |
| 1065 | 1072 | : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {} |
| 1066 | 1073 | _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) |
| ... | ... | @@ -1106,11 +1113,11 @@ private: |
| 1106 | 1113 | bool __test_for_eof() const |
| 1107 | 1114 | { |
| 1108 | 1115 | if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) |
| 1109 | __sbuf_ = 0; | |
| 1110 | return __sbuf_ == 0; | |
| 1116 | __sbuf_ = nullptr; | |
| 1117 | return __sbuf_ == nullptr; | |
| 1111 | 1118 | } |
| 1112 | 1119 | public: |
| 1113 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} | |
| 1120 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {} | |
| 1114 | 1121 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT |
| 1115 | 1122 | : __sbuf_(__s.rdbuf()) {} |
| 1116 | 1123 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT |
| ... | ... | @@ -1151,10 +1158,20 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator |
| 1151 | 1158 | : public iterator<output_iterator_tag, void, void, void, void> |
| 1152 | 1159 | { |
| 1153 | 1160 | public: |
| 1154 | typedef _CharT char_type; | |
| 1155 | typedef _Traits traits_type; | |
| 1156 | typedef basic_streambuf<_CharT,_Traits> streambuf_type; | |
| 1157 | typedef basic_ostream<_CharT,_Traits> ostream_type; | |
| 1161 | typedef output_iterator_tag iterator_category; | |
| 1162 | typedef void value_type; | |
| 1163 | #if _LIBCPP_STD_VER > 17 | |
| 1164 | typedef std::ptrdiff_t difference_type; | |
| 1165 | #else | |
| 1166 | typedef void difference_type; | |
| 1167 | #endif | |
| 1168 | typedef void pointer; | |
| 1169 | typedef void reference; | |
| 1170 | typedef _CharT char_type; | |
| 1171 | typedef _Traits traits_type; | |
| 1172 | typedef basic_streambuf<_CharT, _Traits> streambuf_type; | |
| 1173 | typedef basic_ostream<_CharT, _Traits> ostream_type; | |
| 1174 | ||
| 1158 | 1175 | private: |
| 1159 | 1176 | streambuf_type* __sbuf_; |
| 1160 | 1177 | public: |
| ... | ... | @@ -1165,13 +1182,13 @@ public: |
| 1165 | 1182 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) |
| 1166 | 1183 | { |
| 1167 | 1184 | if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof())) |
| 1168 | __sbuf_ = 0; | |
| 1185 | __sbuf_ = nullptr; | |
| 1169 | 1186 | return *this; |
| 1170 | 1187 | } |
| 1171 | 1188 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} |
| 1172 | 1189 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;} |
| 1173 | 1190 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} |
| 1174 | _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} | |
| 1191 | _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == nullptr;} | |
| 1175 | 1192 | |
| 1176 | 1193 | template <class _Ch, class _Tr> |
| 1177 | 1194 | friend |
| ... | ... | @@ -1373,13 +1390,13 @@ operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOE |
| 1373 | 1390 | |
| 1374 | 1391 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op); |
| 1375 | 1392 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2); |
| 1376 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); | |
| 1377 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); | |
| 1393 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move(_Ip, _Ip, _Op); | |
| 1394 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move_backward(_B1, _B1, _B2); | |
| 1378 | 1395 | |
| 1379 | 1396 | #if _LIBCPP_DEBUG_LEVEL < 2 |
| 1380 | 1397 | |
| 1381 | 1398 | template <class _Tp> |
| 1382 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1399 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1383 | 1400 | typename enable_if |
| 1384 | 1401 | < |
| 1385 | 1402 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1390,7 +1407,7 @@ __unwrap_iter(__wrap_iter<_Tp*>); |
| 1390 | 1407 | #else |
| 1391 | 1408 | |
| 1392 | 1409 | template <class _Tp> |
| 1393 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1410 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1394 | 1411 | typename enable_if |
| 1395 | 1412 | < |
| 1396 | 1413 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1418,20 +1435,20 @@ public: |
| 1418 | 1435 | : __i{} |
| 1419 | 1436 | #endif |
| 1420 | 1437 | { |
| 1421 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1438 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1422 | 1439 | __get_db()->__insert_i(this); |
| 1423 | 1440 | #endif |
| 1424 | 1441 | } |
| 1425 | 1442 | template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1426 | 1443 | __wrap_iter(const __wrap_iter<_Up>& __u, |
| 1427 | typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT | |
| 1444 | typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT | |
| 1428 | 1445 | : __i(__u.base()) |
| 1429 | 1446 | { |
| 1430 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1447 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1431 | 1448 | __get_db()->__iterator_copy(this, &__u); |
| 1432 | 1449 | #endif |
| 1433 | 1450 | } |
| 1434 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1451 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1435 | 1452 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1436 | 1453 | __wrap_iter(const __wrap_iter& __x) |
| 1437 | 1454 | : __i(__x.base()) |
| ... | ... | @@ -1456,7 +1473,7 @@ public: |
| 1456 | 1473 | #endif |
| 1457 | 1474 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT |
| 1458 | 1475 | { |
| 1459 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1476 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1460 | 1477 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 1461 | 1478 | "Attempted to dereference a non-dereferenceable iterator"); |
| 1462 | 1479 | #endif |
| ... | ... | @@ -1464,7 +1481,7 @@ public: |
| 1464 | 1481 | } |
| 1465 | 1482 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT |
| 1466 | 1483 | { |
| 1467 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1484 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1468 | 1485 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 1469 | 1486 | "Attempted to dereference a non-dereferenceable iterator"); |
| 1470 | 1487 | #endif |
| ... | ... | @@ -1472,7 +1489,7 @@ public: |
| 1472 | 1489 | } |
| 1473 | 1490 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT |
| 1474 | 1491 | { |
| 1475 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1492 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1476 | 1493 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 1477 | 1494 | "Attempted to increment non-incrementable iterator"); |
| 1478 | 1495 | #endif |
| ... | ... | @@ -1484,7 +1501,7 @@ public: |
| 1484 | 1501 | |
| 1485 | 1502 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT |
| 1486 | 1503 | { |
| 1487 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1504 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1488 | 1505 | _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), |
| 1489 | 1506 | "Attempted to decrement non-decrementable iterator"); |
| 1490 | 1507 | #endif |
| ... | ... | @@ -1497,7 +1514,7 @@ public: |
| 1497 | 1514 | {__wrap_iter __w(*this); __w += __n; return __w;} |
| 1498 | 1515 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT |
| 1499 | 1516 | { |
| 1500 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1517 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1501 | 1518 | _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n), |
| 1502 | 1519 | "Attempted to add/subtract iterator outside of valid range"); |
| 1503 | 1520 | #endif |
| ... | ... | @@ -1510,7 +1527,7 @@ public: |
| 1510 | 1527 | {*this += -__n; return *this;} |
| 1511 | 1528 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT |
| 1512 | 1529 | { |
| 1513 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1530 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1514 | 1531 | _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n), |
| 1515 | 1532 | "Attempted to subscript iterator outside of valid range"); |
| 1516 | 1533 | #endif |
| ... | ... | @@ -1520,7 +1537,7 @@ public: |
| 1520 | 1537 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;} |
| 1521 | 1538 | |
| 1522 | 1539 | private: |
| 1523 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1540 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1524 | 1541 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x) |
| 1525 | 1542 | { |
| 1526 | 1543 | __get_db()->__insert_ic(this, __p); |
| ... | ... | @@ -1584,12 +1601,12 @@ private: |
| 1584 | 1601 | |
| 1585 | 1602 | template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op); |
| 1586 | 1603 | template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 copy_backward(_B1, _B1, _B2); |
| 1587 | template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); | |
| 1588 | template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); | |
| 1604 | template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op move(_Ip, _Ip, _Op); | |
| 1605 | template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 move_backward(_B1, _B1, _B2); | |
| 1589 | 1606 | |
| 1590 | 1607 | #if _LIBCPP_DEBUG_LEVEL < 2 |
| 1591 | 1608 | template <class _Tp> |
| 1592 | _LIBCPP_CONSTEXPR_IF_NODEBUG friend | |
| 1609 | _LIBCPP_CONSTEXPR friend | |
| 1593 | 1610 | typename enable_if |
| 1594 | 1611 | < |
| 1595 | 1612 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1598,7 +1615,7 @@ private: |
| 1598 | 1615 | __unwrap_iter(__wrap_iter<_Tp*>); |
| 1599 | 1616 | #else |
| 1600 | 1617 | template <class _Tp> |
| 1601 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG | |
| 1618 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR friend | |
| 1602 | 1619 | typename enable_if |
| 1603 | 1620 | < |
| 1604 | 1621 | is_trivially_copy_assignable<_Tp>::value, |
| ... | ... | @@ -1621,7 +1638,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1621 | 1638 | bool |
| 1622 | 1639 | operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT |
| 1623 | 1640 | { |
| 1624 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1641 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1625 | 1642 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), |
| 1626 | 1643 | "Attempted to compare incomparable iterators"); |
| 1627 | 1644 | #endif |
| ... | ... | @@ -1699,7 +1716,7 @@ auto |
| 1699 | 1716 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT |
| 1700 | 1717 | -> decltype(__x.base() - __y.base()) |
| 1701 | 1718 | { |
| 1702 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1719 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1703 | 1720 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), |
| 1704 | 1721 | "Attempted to subtract incompatible iterators"); |
| 1705 | 1722 | #endif |
| ... | ... | @@ -1711,7 +1728,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG |
| 1711 | 1728 | typename __wrap_iter<_Iter1>::difference_type |
| 1712 | 1729 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT |
| 1713 | 1730 | { |
| 1714 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1731 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1715 | 1732 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), |
| 1716 | 1733 | "Attempted to subtract incompatible iterators"); |
| 1717 | 1734 | #endif |
lib/libcxx/include/latch+8| ... | ... | @@ -19,6 +19,8 @@ namespace std |
| 19 | 19 | class latch |
| 20 | 20 | { |
| 21 | 21 | public: |
| 22 | static constexpr ptrdiff_t max() noexcept; | |
| 23 | ||
| 22 | 24 | constexpr explicit latch(ptrdiff_t __expected); |
| 23 | 25 | ~latch(); |
| 24 | 26 | |
| ... | ... | @@ -39,6 +41,7 @@ namespace std |
| 39 | 41 | */ |
| 40 | 42 | |
| 41 | 43 | #include <__config> |
| 44 | #include <__availability> | |
| 42 | 45 | #include <atomic> |
| 43 | 46 | |
| 44 | 47 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| ... | ... | @@ -49,6 +52,9 @@ namespace std |
| 49 | 52 | # error <latch> is not supported on this single threaded system |
| 50 | 53 | #endif |
| 51 | 54 | |
| 55 | _LIBCPP_PUSH_MACROS | |
| 56 | #include <__undef_macros> | |
| 57 | ||
| 52 | 58 | #if _LIBCPP_STD_VER >= 14 |
| 53 | 59 | |
| 54 | 60 | _LIBCPP_BEGIN_NAMESPACE_STD |
| ... | ... | @@ -101,4 +107,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 101 | 107 | |
| 102 | 108 | #endif // _LIBCPP_STD_VER >= 14 |
| 103 | 109 | |
| 110 | _LIBCPP_POP_MACROS | |
| 111 | ||
| 104 | 112 | #endif //_LIBCPP_LATCH |
lib/libcxx/include/list+93-93| ... | ... | @@ -293,7 +293,7 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator |
| 293 | 293 | |
| 294 | 294 | __link_pointer __ptr_; |
| 295 | 295 | |
| 296 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 296 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 297 | 297 | _LIBCPP_INLINE_VISIBILITY |
| 298 | 298 | explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT |
| 299 | 299 | : __ptr_(__p) |
| ... | ... | @@ -320,12 +320,12 @@ public: |
| 320 | 320 | _LIBCPP_INLINE_VISIBILITY |
| 321 | 321 | __list_iterator() _NOEXCEPT : __ptr_(nullptr) |
| 322 | 322 | { |
| 323 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 323 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 324 | 324 | __get_db()->__insert_i(this); |
| 325 | 325 | #endif |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 328 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 329 | 329 | |
| 330 | 330 | _LIBCPP_INLINE_VISIBILITY |
| 331 | 331 | __list_iterator(const __list_iterator& __p) |
| ... | ... | @@ -351,12 +351,12 @@ public: |
| 351 | 351 | return *this; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 354 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 355 | 355 | |
| 356 | 356 | _LIBCPP_INLINE_VISIBILITY |
| 357 | 357 | reference operator*() const |
| 358 | 358 | { |
| 359 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 359 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 360 | 360 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 361 | 361 | "Attempted to dereference a non-dereferenceable list::iterator"); |
| 362 | 362 | #endif |
| ... | ... | @@ -365,7 +365,7 @@ public: |
| 365 | 365 | _LIBCPP_INLINE_VISIBILITY |
| 366 | 366 | pointer operator->() const |
| 367 | 367 | { |
| 368 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 368 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 369 | 369 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 370 | 370 | "Attempted to dereference a non-dereferenceable list::iterator"); |
| 371 | 371 | #endif |
| ... | ... | @@ -375,7 +375,7 @@ public: |
| 375 | 375 | _LIBCPP_INLINE_VISIBILITY |
| 376 | 376 | __list_iterator& operator++() |
| 377 | 377 | { |
| 378 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 378 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 379 | 379 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 380 | 380 | "Attempted to increment non-incrementable list::iterator"); |
| 381 | 381 | #endif |
| ... | ... | @@ -388,7 +388,7 @@ public: |
| 388 | 388 | _LIBCPP_INLINE_VISIBILITY |
| 389 | 389 | __list_iterator& operator--() |
| 390 | 390 | { |
| 391 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 391 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 392 | 392 | _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), |
| 393 | 393 | "Attempted to decrement non-decrementable list::iterator"); |
| 394 | 394 | #endif |
| ... | ... | @@ -416,7 +416,7 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator |
| 416 | 416 | |
| 417 | 417 | __link_pointer __ptr_; |
| 418 | 418 | |
| 419 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 419 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 420 | 420 | _LIBCPP_INLINE_VISIBILITY |
| 421 | 421 | explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT |
| 422 | 422 | : __ptr_(__p) |
| ... | ... | @@ -440,7 +440,7 @@ public: |
| 440 | 440 | _LIBCPP_INLINE_VISIBILITY |
| 441 | 441 | __list_const_iterator() _NOEXCEPT : __ptr_(nullptr) |
| 442 | 442 | { |
| 443 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 443 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 444 | 444 | __get_db()->__insert_i(this); |
| 445 | 445 | #endif |
| 446 | 446 | } |
| ... | ... | @@ -448,12 +448,12 @@ public: |
| 448 | 448 | __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT |
| 449 | 449 | : __ptr_(__p.__ptr_) |
| 450 | 450 | { |
| 451 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 451 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 452 | 452 | __get_db()->__iterator_copy(this, &__p); |
| 453 | 453 | #endif |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 456 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 457 | 457 | |
| 458 | 458 | _LIBCPP_INLINE_VISIBILITY |
| 459 | 459 | __list_const_iterator(const __list_const_iterator& __p) |
| ... | ... | @@ -479,11 +479,11 @@ public: |
| 479 | 479 | return *this; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 482 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 483 | 483 | _LIBCPP_INLINE_VISIBILITY |
| 484 | 484 | reference operator*() const |
| 485 | 485 | { |
| 486 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 486 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 487 | 487 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 488 | 488 | "Attempted to dereference a non-dereferenceable list::const_iterator"); |
| 489 | 489 | #endif |
| ... | ... | @@ -492,7 +492,7 @@ public: |
| 492 | 492 | _LIBCPP_INLINE_VISIBILITY |
| 493 | 493 | pointer operator->() const |
| 494 | 494 | { |
| 495 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 495 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 496 | 496 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 497 | 497 | "Attempted to dereference a non-dereferenceable list::const_iterator"); |
| 498 | 498 | #endif |
| ... | ... | @@ -502,7 +502,7 @@ public: |
| 502 | 502 | _LIBCPP_INLINE_VISIBILITY |
| 503 | 503 | __list_const_iterator& operator++() |
| 504 | 504 | { |
| 505 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 505 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 506 | 506 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), |
| 507 | 507 | "Attempted to increment non-incrementable list::const_iterator"); |
| 508 | 508 | #endif |
| ... | ... | @@ -515,7 +515,7 @@ public: |
| 515 | 515 | _LIBCPP_INLINE_VISIBILITY |
| 516 | 516 | __list_const_iterator& operator--() |
| 517 | 517 | { |
| 518 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 518 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 519 | 519 | _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), |
| 520 | 520 | "Attempted to decrement non-decrementable list::const_iterator"); |
| 521 | 521 | #endif |
| ... | ... | @@ -614,7 +614,7 @@ protected: |
| 614 | 614 | _LIBCPP_INLINE_VISIBILITY |
| 615 | 615 | iterator begin() _NOEXCEPT |
| 616 | 616 | { |
| 617 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 617 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 618 | 618 | return iterator(__end_.__next_, this); |
| 619 | 619 | #else |
| 620 | 620 | return iterator(__end_.__next_); |
| ... | ... | @@ -623,7 +623,7 @@ protected: |
| 623 | 623 | _LIBCPP_INLINE_VISIBILITY |
| 624 | 624 | const_iterator begin() const _NOEXCEPT |
| 625 | 625 | { |
| 626 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 626 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 627 | 627 | return const_iterator(__end_.__next_, this); |
| 628 | 628 | #else |
| 629 | 629 | return const_iterator(__end_.__next_); |
| ... | ... | @@ -632,7 +632,7 @@ protected: |
| 632 | 632 | _LIBCPP_INLINE_VISIBILITY |
| 633 | 633 | iterator end() _NOEXCEPT |
| 634 | 634 | { |
| 635 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 635 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 636 | 636 | return iterator(__end_as_link(), this); |
| 637 | 637 | #else |
| 638 | 638 | return iterator(__end_as_link()); |
| ... | ... | @@ -641,7 +641,7 @@ protected: |
| 641 | 641 | _LIBCPP_INLINE_VISIBILITY |
| 642 | 642 | const_iterator end() const _NOEXCEPT |
| 643 | 643 | { |
| 644 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 644 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 645 | 645 | return const_iterator(__end_as_link(), this); |
| 646 | 646 | #else |
| 647 | 647 | return const_iterator(__end_as_link()); |
| ... | ... | @@ -696,7 +696,7 @@ private: |
| 696 | 696 | |
| 697 | 697 | _LIBCPP_INLINE_VISIBILITY |
| 698 | 698 | void __invalidate_all_iterators() { |
| 699 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 699 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 700 | 700 | __get_db()->__invalidate_all(this); |
| 701 | 701 | #endif |
| 702 | 702 | } |
| ... | ... | @@ -735,13 +735,13 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) |
| 735 | 735 | #ifndef _LIBCPP_CXX03_LANG |
| 736 | 736 | template <class _Tp, class _Alloc> |
| 737 | 737 | inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT |
| 738 | : __size_alloc_(0, std::move(__a)) {} | |
| 738 | : __size_alloc_(0, _VSTD::move(__a)) {} | |
| 739 | 739 | #endif |
| 740 | 740 | |
| 741 | 741 | template <class _Tp, class _Alloc> |
| 742 | 742 | __list_imp<_Tp, _Alloc>::~__list_imp() { |
| 743 | 743 | clear(); |
| 744 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 744 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 745 | 745 | __get_db()->__erase_c(this); |
| 746 | 746 | #endif |
| 747 | 747 | } |
| ... | ... | @@ -783,7 +783,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) |
| 783 | 783 | "list::swap: Either propagate_on_container_swap must be true" |
| 784 | 784 | " or the allocators must compare equal"); |
| 785 | 785 | using _VSTD::swap; |
| 786 | __swap_allocator(__node_alloc(), __c.__node_alloc()); | |
| 786 | _VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc()); | |
| 787 | 787 | swap(__sz(), __c.__sz()); |
| 788 | 788 | swap(__end_, __c.__end_); |
| 789 | 789 | if (__sz() == 0) |
| ... | ... | @@ -795,13 +795,13 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) |
| 795 | 795 | else |
| 796 | 796 | __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); |
| 797 | 797 | |
| 798 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 798 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 799 | 799 | __libcpp_db* __db = __get_db(); |
| 800 | 800 | __c_node* __cn1 = __db->__find_c_and_lock(this); |
| 801 | 801 | __c_node* __cn2 = __db->__find_c(&__c); |
| 802 | std::swap(__cn1->beg_, __cn2->beg_); | |
| 803 | std::swap(__cn1->end_, __cn2->end_); | |
| 804 | std::swap(__cn1->cap_, __cn2->cap_); | |
| 802 | _VSTD::swap(__cn1->beg_, __cn2->beg_); | |
| 803 | _VSTD::swap(__cn1->end_, __cn2->end_); | |
| 804 | _VSTD::swap(__cn1->cap_, __cn2->cap_); | |
| 805 | 805 | for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;) |
| 806 | 806 | { |
| 807 | 807 | --__p; |
| ... | ... | @@ -810,7 +810,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) |
| 810 | 810 | { |
| 811 | 811 | __cn2->__add(*__p); |
| 812 | 812 | if (--__cn1->end_ != __p) |
| 813 | memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*)); | |
| 813 | _VSTD::memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*)); | |
| 814 | 814 | } |
| 815 | 815 | else |
| 816 | 816 | (*__p)->__c_ = __cn1; |
| ... | ... | @@ -823,7 +823,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) |
| 823 | 823 | { |
| 824 | 824 | __cn1->__add(*__p); |
| 825 | 825 | if (--__cn2->end_ != __p) |
| 826 | memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); | |
| 826 | _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); | |
| 827 | 827 | } |
| 828 | 828 | else |
| 829 | 829 | (*__p)->__c_ = __cn2; |
| ... | ... | @@ -870,14 +870,14 @@ public: |
| 870 | 870 | list() |
| 871 | 871 | _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) |
| 872 | 872 | { |
| 873 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 873 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 874 | 874 | __get_db()->__insert_c(this); |
| 875 | 875 | #endif |
| 876 | 876 | } |
| 877 | 877 | _LIBCPP_INLINE_VISIBILITY |
| 878 | 878 | explicit list(const allocator_type& __a) : base(__a) |
| 879 | 879 | { |
| 880 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 880 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 881 | 881 | __get_db()->__insert_c(this); |
| 882 | 882 | #endif |
| 883 | 883 | } |
| ... | ... | @@ -937,7 +937,7 @@ public: |
| 937 | 937 | _LIBCPP_INLINE_VISIBILITY |
| 938 | 938 | size_type max_size() const _NOEXCEPT |
| 939 | 939 | { |
| 940 | return std::min<size_type>( | |
| 940 | return _VSTD::min<size_type>( | |
| 941 | 941 | base::__node_alloc_max_size(), |
| 942 | 942 | numeric_limits<difference_type >::max()); |
| 943 | 943 | } |
| ... | ... | @@ -1117,14 +1117,14 @@ public: |
| 1117 | 1117 | return __hold_pointer(__p, __node_destructor(__na, 1)); |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1120 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1121 | 1121 | |
| 1122 | 1122 | bool __dereferenceable(const const_iterator* __i) const; |
| 1123 | 1123 | bool __decrementable(const const_iterator* __i) const; |
| 1124 | 1124 | bool __addable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1125 | 1125 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1126 | 1126 | |
| 1127 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1127 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1128 | 1128 | |
| 1129 | 1129 | private: |
| 1130 | 1130 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1144,7 +1144,7 @@ private: |
| 1144 | 1144 | |
| 1145 | 1145 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 1146 | 1146 | template<class _InputIterator, |
| 1147 | class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 1147 | class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 1148 | 1148 | class = typename enable_if<__is_allocator<_Alloc>::value, void>::type |
| 1149 | 1149 | > |
| 1150 | 1150 | list(_InputIterator, _InputIterator) |
| ... | ... | @@ -1207,7 +1207,7 @@ list<_Tp, _Alloc>::__iterator(size_type __n) |
| 1207 | 1207 | template <class _Tp, class _Alloc> |
| 1208 | 1208 | list<_Tp, _Alloc>::list(size_type __n) |
| 1209 | 1209 | { |
| 1210 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1210 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1211 | 1211 | __get_db()->__insert_c(this); |
| 1212 | 1212 | #endif |
| 1213 | 1213 | for (; __n > 0; --__n) |
| ... | ... | @@ -1222,7 +1222,7 @@ list<_Tp, _Alloc>::list(size_type __n) |
| 1222 | 1222 | template <class _Tp, class _Alloc> |
| 1223 | 1223 | list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) |
| 1224 | 1224 | { |
| 1225 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1225 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1226 | 1226 | __get_db()->__insert_c(this); |
| 1227 | 1227 | #endif |
| 1228 | 1228 | for (; __n > 0; --__n) |
| ... | ... | @@ -1233,7 +1233,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) |
| 1233 | 1233 | template <class _Tp, class _Alloc> |
| 1234 | 1234 | list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) |
| 1235 | 1235 | { |
| 1236 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1236 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1237 | 1237 | __get_db()->__insert_c(this); |
| 1238 | 1238 | #endif |
| 1239 | 1239 | for (; __n > 0; --__n) |
| ... | ... | @@ -1244,7 +1244,7 @@ template <class _Tp, class _Alloc> |
| 1244 | 1244 | list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a) |
| 1245 | 1245 | : base(__a) |
| 1246 | 1246 | { |
| 1247 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1247 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1248 | 1248 | __get_db()->__insert_c(this); |
| 1249 | 1249 | #endif |
| 1250 | 1250 | for (; __n > 0; --__n) |
| ... | ... | @@ -1256,7 +1256,7 @@ template <class _InpIter> |
| 1256 | 1256 | list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, |
| 1257 | 1257 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) |
| 1258 | 1258 | { |
| 1259 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1259 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1260 | 1260 | __get_db()->__insert_c(this); |
| 1261 | 1261 | #endif |
| 1262 | 1262 | for (; __f != __l; ++__f) |
| ... | ... | @@ -1269,7 +1269,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, |
| 1269 | 1269 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) |
| 1270 | 1270 | : base(__a) |
| 1271 | 1271 | { |
| 1272 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1272 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1273 | 1273 | __get_db()->__insert_c(this); |
| 1274 | 1274 | #endif |
| 1275 | 1275 | for (; __f != __l; ++__f) |
| ... | ... | @@ -1280,7 +1280,7 @@ template <class _Tp, class _Alloc> |
| 1280 | 1280 | list<_Tp, _Alloc>::list(const list& __c) |
| 1281 | 1281 | : base(__node_alloc_traits::select_on_container_copy_construction( |
| 1282 | 1282 | __c.__node_alloc())) { |
| 1283 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1283 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1284 | 1284 | __get_db()->__insert_c(this); |
| 1285 | 1285 | #endif |
| 1286 | 1286 | for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) |
| ... | ... | @@ -1291,7 +1291,7 @@ template <class _Tp, class _Alloc> |
| 1291 | 1291 | list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) |
| 1292 | 1292 | : base(__a) |
| 1293 | 1293 | { |
| 1294 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1294 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1295 | 1295 | __get_db()->__insert_c(this); |
| 1296 | 1296 | #endif |
| 1297 | 1297 | for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) |
| ... | ... | @@ -1304,7 +1304,7 @@ template <class _Tp, class _Alloc> |
| 1304 | 1304 | list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) |
| 1305 | 1305 | : base(__a) |
| 1306 | 1306 | { |
| 1307 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1307 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1308 | 1308 | __get_db()->__insert_c(this); |
| 1309 | 1309 | #endif |
| 1310 | 1310 | for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), |
| ... | ... | @@ -1315,7 +1315,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& |
| 1315 | 1315 | template <class _Tp, class _Alloc> |
| 1316 | 1316 | list<_Tp, _Alloc>::list(initializer_list<value_type> __il) |
| 1317 | 1317 | { |
| 1318 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1318 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1319 | 1319 | __get_db()->__insert_c(this); |
| 1320 | 1320 | #endif |
| 1321 | 1321 | for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), |
| ... | ... | @@ -1327,7 +1327,7 @@ template <class _Tp, class _Alloc> |
| 1327 | 1327 | inline list<_Tp, _Alloc>::list(list&& __c) |
| 1328 | 1328 | _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) |
| 1329 | 1329 | : base(_VSTD::move(__c.__node_alloc())) { |
| 1330 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1330 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1331 | 1331 | __get_db()->__insert_c(this); |
| 1332 | 1332 | #endif |
| 1333 | 1333 | splice(end(), __c); |
| ... | ... | @@ -1338,7 +1338,7 @@ inline |
| 1338 | 1338 | list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a) |
| 1339 | 1339 | : base(__a) |
| 1340 | 1340 | { |
| 1341 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1341 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1342 | 1342 | __get_db()->__insert_c(this); |
| 1343 | 1343 | #endif |
| 1344 | 1344 | if (__a == __c.get_allocator()) |
| ... | ... | @@ -1415,7 +1415,7 @@ list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l, |
| 1415 | 1415 | insert(__e, __f, __l); |
| 1416 | 1416 | else |
| 1417 | 1417 | erase(__i, __e); |
| 1418 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1418 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1419 | 1419 | __get_db()->__invalidate_all(this); |
| 1420 | 1420 | #endif |
| 1421 | 1421 | } |
| ... | ... | @@ -1432,7 +1432,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) |
| 1432 | 1432 | insert(__e, __n, __x); |
| 1433 | 1433 | else |
| 1434 | 1434 | erase(__i, __e); |
| 1435 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1435 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1436 | 1436 | __get_db()->__invalidate_all(this); |
| 1437 | 1437 | #endif |
| 1438 | 1438 | } |
| ... | ... | @@ -1449,7 +1449,7 @@ template <class _Tp, class _Alloc> |
| 1449 | 1449 | typename list<_Tp, _Alloc>::iterator |
| 1450 | 1450 | list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) |
| 1451 | 1451 | { |
| 1452 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1452 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1453 | 1453 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1454 | 1454 | "list::insert(iterator, x) called with an iterator not" |
| 1455 | 1455 | " referring to this list"); |
| ... | ... | @@ -1459,7 +1459,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) |
| 1459 | 1459 | __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); |
| 1460 | 1460 | __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); |
| 1461 | 1461 | ++base::__sz(); |
| 1462 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1462 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1463 | 1463 | return iterator(__hold.release()->__as_link(), this); |
| 1464 | 1464 | #else |
| 1465 | 1465 | return iterator(__hold.release()->__as_link()); |
| ... | ... | @@ -1470,7 +1470,7 @@ template <class _Tp, class _Alloc> |
| 1470 | 1470 | typename list<_Tp, _Alloc>::iterator |
| 1471 | 1471 | list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) |
| 1472 | 1472 | { |
| 1473 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1473 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1474 | 1474 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1475 | 1475 | "list::insert(iterator, n, x) called with an iterator not" |
| 1476 | 1476 | " referring to this list"); |
| ... | ... | @@ -1485,7 +1485,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ |
| 1485 | 1485 | __hold_pointer __hold = __allocate_node(__na); |
| 1486 | 1486 | __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); |
| 1487 | 1487 | ++__ds; |
| 1488 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1488 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1489 | 1489 | __r = iterator(__hold->__as_link(), this); |
| 1490 | 1490 | #else |
| 1491 | 1491 | __r = iterator(__hold->__as_link()); |
| ... | ... | @@ -1515,7 +1515,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _ |
| 1515 | 1515 | __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); |
| 1516 | 1516 | if (__prev == 0) |
| 1517 | 1517 | break; |
| 1518 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1518 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1519 | 1519 | __e = iterator(__prev, this); |
| 1520 | 1520 | #else |
| 1521 | 1521 | __e = iterator(__prev); |
| ... | ... | @@ -1536,7 +1536,7 @@ typename list<_Tp, _Alloc>::iterator |
| 1536 | 1536 | list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, |
| 1537 | 1537 | typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) |
| 1538 | 1538 | { |
| 1539 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1539 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1540 | 1540 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1541 | 1541 | "list::insert(iterator, range) called with an iterator not" |
| 1542 | 1542 | " referring to this list"); |
| ... | ... | @@ -1551,7 +1551,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, |
| 1551 | 1551 | __hold_pointer __hold = __allocate_node(__na); |
| 1552 | 1552 | __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); |
| 1553 | 1553 | ++__ds; |
| 1554 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1554 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1555 | 1555 | __r = iterator(__hold.get()->__as_link(), this); |
| 1556 | 1556 | #else |
| 1557 | 1557 | __r = iterator(__hold.get()->__as_link()); |
| ... | ... | @@ -1581,7 +1581,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, |
| 1581 | 1581 | __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); |
| 1582 | 1582 | if (__prev == 0) |
| 1583 | 1583 | break; |
| 1584 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1584 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1585 | 1585 | __e = iterator(__prev, this); |
| 1586 | 1586 | #else |
| 1587 | 1587 | __e = iterator(__prev); |
| ... | ... | @@ -1695,7 +1695,7 @@ template <class... _Args> |
| 1695 | 1695 | typename list<_Tp, _Alloc>::iterator |
| 1696 | 1696 | list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) |
| 1697 | 1697 | { |
| 1698 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1698 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1699 | 1699 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1700 | 1700 | "list::emplace(iterator, args...) called with an iterator not" |
| 1701 | 1701 | " referring to this list"); |
| ... | ... | @@ -1707,7 +1707,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) |
| 1707 | 1707 | __link_nodes(__p.__ptr_, __nl, __nl); |
| 1708 | 1708 | ++base::__sz(); |
| 1709 | 1709 | __hold.release(); |
| 1710 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1710 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1711 | 1711 | return iterator(__nl, this); |
| 1712 | 1712 | #else |
| 1713 | 1713 | return iterator(__nl); |
| ... | ... | @@ -1718,7 +1718,7 @@ template <class _Tp, class _Alloc> |
| 1718 | 1718 | typename list<_Tp, _Alloc>::iterator |
| 1719 | 1719 | list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) |
| 1720 | 1720 | { |
| 1721 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1721 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1722 | 1722 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1723 | 1723 | "list::insert(iterator, x) called with an iterator not" |
| 1724 | 1724 | " referring to this list"); |
| ... | ... | @@ -1730,7 +1730,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) |
| 1730 | 1730 | __link_nodes(__p.__ptr_, __nl, __nl); |
| 1731 | 1731 | ++base::__sz(); |
| 1732 | 1732 | __hold.release(); |
| 1733 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1733 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1734 | 1734 | return iterator(__nl, this); |
| 1735 | 1735 | #else |
| 1736 | 1736 | return iterator(__nl); |
| ... | ... | @@ -1748,7 +1748,7 @@ list<_Tp, _Alloc>::pop_front() |
| 1748 | 1748 | __link_pointer __n = base::__end_.__next_; |
| 1749 | 1749 | base::__unlink_nodes(__n, __n); |
| 1750 | 1750 | --base::__sz(); |
| 1751 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1751 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1752 | 1752 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1753 | 1753 | for (__i_node** __p = __c->end_; __p != __c->beg_; ) |
| 1754 | 1754 | { |
| ... | ... | @@ -1758,7 +1758,7 @@ list<_Tp, _Alloc>::pop_front() |
| 1758 | 1758 | { |
| 1759 | 1759 | (*__p)->__c_ = nullptr; |
| 1760 | 1760 | if (--__c->end_ != __p) |
| 1761 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1761 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1762 | 1762 | } |
| 1763 | 1763 | } |
| 1764 | 1764 | __get_db()->unlock(); |
| ... | ... | @@ -1777,7 +1777,7 @@ list<_Tp, _Alloc>::pop_back() |
| 1777 | 1777 | __link_pointer __n = base::__end_.__prev_; |
| 1778 | 1778 | base::__unlink_nodes(__n, __n); |
| 1779 | 1779 | --base::__sz(); |
| 1780 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1780 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1781 | 1781 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1782 | 1782 | for (__i_node** __p = __c->end_; __p != __c->beg_; ) |
| 1783 | 1783 | { |
| ... | ... | @@ -1787,7 +1787,7 @@ list<_Tp, _Alloc>::pop_back() |
| 1787 | 1787 | { |
| 1788 | 1788 | (*__p)->__c_ = nullptr; |
| 1789 | 1789 | if (--__c->end_ != __p) |
| 1790 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1790 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1791 | 1791 | } |
| 1792 | 1792 | } |
| 1793 | 1793 | __get_db()->unlock(); |
| ... | ... | @@ -1801,7 +1801,7 @@ template <class _Tp, class _Alloc> |
| 1801 | 1801 | typename list<_Tp, _Alloc>::iterator |
| 1802 | 1802 | list<_Tp, _Alloc>::erase(const_iterator __p) |
| 1803 | 1803 | { |
| 1804 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1804 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1805 | 1805 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1806 | 1806 | "list::erase(iterator) called with an iterator not" |
| 1807 | 1807 | " referring to this list"); |
| ... | ... | @@ -1813,7 +1813,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p) |
| 1813 | 1813 | __link_pointer __r = __n->__next_; |
| 1814 | 1814 | base::__unlink_nodes(__n, __n); |
| 1815 | 1815 | --base::__sz(); |
| 1816 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1816 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1817 | 1817 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1818 | 1818 | for (__i_node** __ip = __c->end_; __ip != __c->beg_; ) |
| 1819 | 1819 | { |
| ... | ... | @@ -1823,7 +1823,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p) |
| 1823 | 1823 | { |
| 1824 | 1824 | (*__ip)->__c_ = nullptr; |
| 1825 | 1825 | if (--__c->end_ != __ip) |
| 1826 | memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*)); | |
| 1826 | _VSTD::memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*)); | |
| 1827 | 1827 | } |
| 1828 | 1828 | } |
| 1829 | 1829 | __get_db()->unlock(); |
| ... | ... | @@ -1831,7 +1831,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p) |
| 1831 | 1831 | __node_pointer __np = __n->__as_node(); |
| 1832 | 1832 | __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); |
| 1833 | 1833 | __node_alloc_traits::deallocate(__na, __np, 1); |
| 1834 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1834 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1835 | 1835 | return iterator(__r, this); |
| 1836 | 1836 | #else |
| 1837 | 1837 | return iterator(__r); |
| ... | ... | @@ -1842,7 +1842,7 @@ template <class _Tp, class _Alloc> |
| 1842 | 1842 | typename list<_Tp, _Alloc>::iterator |
| 1843 | 1843 | list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) |
| 1844 | 1844 | { |
| 1845 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1845 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1846 | 1846 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this, |
| 1847 | 1847 | "list::erase(iterator, iterator) called with an iterator not" |
| 1848 | 1848 | " referring to this list"); |
| ... | ... | @@ -1859,7 +1859,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) |
| 1859 | 1859 | __link_pointer __n = __f.__ptr_; |
| 1860 | 1860 | ++__f; |
| 1861 | 1861 | --base::__sz(); |
| 1862 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1862 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1863 | 1863 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1864 | 1864 | for (__i_node** __p = __c->end_; __p != __c->beg_; ) |
| 1865 | 1865 | { |
| ... | ... | @@ -1869,7 +1869,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) |
| 1869 | 1869 | { |
| 1870 | 1870 | (*__p)->__c_ = nullptr; |
| 1871 | 1871 | if (--__c->end_ != __p) |
| 1872 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1872 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1873 | 1873 | } |
| 1874 | 1874 | } |
| 1875 | 1875 | __get_db()->unlock(); |
| ... | ... | @@ -1879,7 +1879,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) |
| 1879 | 1879 | __node_alloc_traits::deallocate(__na, __np, 1); |
| 1880 | 1880 | } |
| 1881 | 1881 | } |
| 1882 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1882 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1883 | 1883 | return iterator(__l.__ptr_, this); |
| 1884 | 1884 | #else |
| 1885 | 1885 | return iterator(__l.__ptr_); |
| ... | ... | @@ -1900,7 +1900,7 @@ list<_Tp, _Alloc>::resize(size_type __n) |
| 1900 | 1900 | __hold_pointer __hold = __allocate_node(__na); |
| 1901 | 1901 | __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); |
| 1902 | 1902 | ++__ds; |
| 1903 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1903 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1904 | 1904 | iterator __r = iterator(__hold.release()->__as_link(), this); |
| 1905 | 1905 | #else |
| 1906 | 1906 | iterator __r = iterator(__hold.release()->__as_link()); |
| ... | ... | @@ -1929,7 +1929,7 @@ list<_Tp, _Alloc>::resize(size_type __n) |
| 1929 | 1929 | __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); |
| 1930 | 1930 | if (__prev == 0) |
| 1931 | 1931 | break; |
| 1932 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1932 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1933 | 1933 | __e = iterator(__prev, this); |
| 1934 | 1934 | #else |
| 1935 | 1935 | __e = iterator(__prev); |
| ... | ... | @@ -1958,7 +1958,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) |
| 1958 | 1958 | __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); |
| 1959 | 1959 | ++__ds; |
| 1960 | 1960 | __link_pointer __nl = __hold.release()->__as_link(); |
| 1961 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1961 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1962 | 1962 | iterator __r = iterator(__nl, this); |
| 1963 | 1963 | #else |
| 1964 | 1964 | iterator __r = iterator(__nl); |
| ... | ... | @@ -1987,7 +1987,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) |
| 1987 | 1987 | __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); |
| 1988 | 1988 | if (__prev == 0) |
| 1989 | 1989 | break; |
| 1990 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1990 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1991 | 1991 | __e = iterator(__prev, this); |
| 1992 | 1992 | #else |
| 1993 | 1993 | __e = iterator(__prev); |
| ... | ... | @@ -2007,7 +2007,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) |
| 2007 | 2007 | { |
| 2008 | 2008 | _LIBCPP_ASSERT(this != &__c, |
| 2009 | 2009 | "list::splice(iterator, list) called with this == &list"); |
| 2010 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2010 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2011 | 2011 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2012 | 2012 | "list::splice(iterator, list) called with an iterator not" |
| 2013 | 2013 | " referring to this list"); |
| ... | ... | @@ -2020,7 +2020,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) |
| 2020 | 2020 | __link_nodes(__p.__ptr_, __f, __l); |
| 2021 | 2021 | base::__sz() += __c.__sz(); |
| 2022 | 2022 | __c.__sz() = 0; |
| 2023 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2023 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2024 | 2024 | if (&__c != this) { |
| 2025 | 2025 | __libcpp_db* __db = __get_db(); |
| 2026 | 2026 | __c_node* __cn1 = __db->__find_c_and_lock(this); |
| ... | ... | @@ -2034,7 +2034,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) |
| 2034 | 2034 | __cn1->__add(*__ip); |
| 2035 | 2035 | (*__ip)->__c_ = __cn1; |
| 2036 | 2036 | if (--__cn2->end_ != __ip) |
| 2037 | memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2037 | _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2038 | 2038 | } |
| 2039 | 2039 | } |
| 2040 | 2040 | __db->unlock(); |
| ... | ... | @@ -2047,7 +2047,7 @@ template <class _Tp, class _Alloc> |
| 2047 | 2047 | void |
| 2048 | 2048 | list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) |
| 2049 | 2049 | { |
| 2050 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2050 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2051 | 2051 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2052 | 2052 | "list::splice(iterator, list, iterator) called with first iterator not" |
| 2053 | 2053 | " referring to this list"); |
| ... | ... | @@ -2056,7 +2056,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) |
| 2056 | 2056 | " referring to list argument"); |
| 2057 | 2057 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i), |
| 2058 | 2058 | "list::splice(iterator, list, iterator) called with second iterator not" |
| 2059 | " derefereceable"); | |
| 2059 | " dereferenceable"); | |
| 2060 | 2060 | #endif |
| 2061 | 2061 | if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) |
| 2062 | 2062 | { |
| ... | ... | @@ -2065,7 +2065,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) |
| 2065 | 2065 | __link_nodes(__p.__ptr_, __f, __f); |
| 2066 | 2066 | --__c.__sz(); |
| 2067 | 2067 | ++base::__sz(); |
| 2068 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2068 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2069 | 2069 | if (&__c != this) { |
| 2070 | 2070 | __libcpp_db* __db = __get_db(); |
| 2071 | 2071 | __c_node* __cn1 = __db->__find_c_and_lock(this); |
| ... | ... | @@ -2079,7 +2079,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) |
| 2079 | 2079 | __cn1->__add(*__ip); |
| 2080 | 2080 | (*__ip)->__c_ = __cn1; |
| 2081 | 2081 | if (--__cn2->end_ != __ip) |
| 2082 | memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2082 | _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2083 | 2083 | } |
| 2084 | 2084 | } |
| 2085 | 2085 | __db->unlock(); |
| ... | ... | @@ -2092,7 +2092,7 @@ template <class _Tp, class _Alloc> |
| 2092 | 2092 | void |
| 2093 | 2093 | list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) |
| 2094 | 2094 | { |
| 2095 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2095 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2096 | 2096 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 2097 | 2097 | "list::splice(iterator, list, iterator, iterator) called with first iterator not" |
| 2098 | 2098 | " referring to this list"); |
| ... | ... | @@ -2121,7 +2121,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con |
| 2121 | 2121 | } |
| 2122 | 2122 | base::__unlink_nodes(__first, __last); |
| 2123 | 2123 | __link_nodes(__p.__ptr_, __first, __last); |
| 2124 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2124 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2125 | 2125 | if (&__c != this) { |
| 2126 | 2126 | __libcpp_db* __db = __get_db(); |
| 2127 | 2127 | __c_node* __cn1 = __db->__find_c_and_lock(this); |
| ... | ... | @@ -2138,7 +2138,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con |
| 2138 | 2138 | __cn1->__add(*__ip); |
| 2139 | 2139 | (*__ip)->__c_ = __cn1; |
| 2140 | 2140 | if (--__cn2->end_ != __ip) |
| 2141 | memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2141 | _VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*)); | |
| 2142 | 2142 | } |
| 2143 | 2143 | } |
| 2144 | 2144 | } |
| ... | ... | @@ -2258,7 +2258,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) |
| 2258 | 2258 | ++__f1; |
| 2259 | 2259 | } |
| 2260 | 2260 | splice(__e1, __c); |
| 2261 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2261 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2262 | 2262 | __libcpp_db* __db = __get_db(); |
| 2263 | 2263 | __c_node* __cn1 = __db->__find_c_and_lock(this); |
| 2264 | 2264 | __c_node* __cn2 = __db->__find_c(&__c); |
| ... | ... | @@ -2271,7 +2271,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) |
| 2271 | 2271 | __cn1->__add(*__p); |
| 2272 | 2272 | (*__p)->__c_ = __cn1; |
| 2273 | 2273 | if (--__cn2->end_ != __p) |
| 2274 | memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); | |
| 2274 | _VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*)); | |
| 2275 | 2275 | } |
| 2276 | 2276 | } |
| 2277 | 2277 | __db->unlock(); |
| ... | ... | @@ -2382,7 +2382,7 @@ list<_Tp, _Alloc>::__invariants() const |
| 2382 | 2382 | return size() == _VSTD::distance(begin(), end()); |
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2385 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2386 | 2386 | |
| 2387 | 2387 | template <class _Tp, class _Alloc> |
| 2388 | 2388 | bool |
| ... | ... | @@ -2412,7 +2412,7 @@ list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const |
| 2412 | 2412 | return false; |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2415 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 2416 | 2416 | |
| 2417 | 2417 | template <class _Tp, class _Alloc> |
| 2418 | 2418 | inline _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/locale+63-67| ... | ... | @@ -197,10 +197,6 @@ template <class charT> class messages_byname; |
| 197 | 197 | #include <nl_types.h> |
| 198 | 198 | #endif |
| 199 | 199 | |
| 200 | #ifdef __APPLE__ | |
| 201 | #include <Availability.h> | |
| 202 | #endif | |
| 203 | ||
| 204 | 200 | #ifdef _LIBCPP_LOCALE__L_EXTENSIONS |
| 205 | 201 | #include <__bsd_locale_defaults.h> |
| 206 | 202 | #else |
| ... | ... | @@ -261,11 +257,11 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e, |
| 261 | 257 | const unsigned char __does_match = '\2'; |
| 262 | 258 | unsigned char __statbuf[100]; |
| 263 | 259 | unsigned char* __status = __statbuf; |
| 264 | unique_ptr<unsigned char, void(*)(void*)> __stat_hold(0, free); | |
| 260 | unique_ptr<unsigned char, void(*)(void*)> __stat_hold(nullptr, free); | |
| 265 | 261 | if (__nkw > sizeof(__statbuf)) |
| 266 | 262 | { |
| 267 | 263 | __status = (unsigned char*)malloc(__nkw); |
| 268 | if (__status == 0) | |
| 264 | if (__status == nullptr) | |
| 269 | 265 | __throw_bad_alloc(); |
| 270 | 266 | __stat_hold.reset(__status); |
| 271 | 267 | } |
| ... | ... | @@ -561,8 +557,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex |
| 561 | 557 | return 0; |
| 562 | 558 | } |
| 563 | 559 | |
| 564 | _LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>) | |
| 565 | _LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>) | |
| 560 | _LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>) | |
| 561 | _LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>) | |
| 566 | 562 | |
| 567 | 563 | template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > |
| 568 | 564 | class _LIBCPP_TEMPLATE_VIS num_get |
| ... | ... | @@ -877,8 +873,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 877 | 873 | const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc()); |
| 878 | 874 | typedef typename numpunct<_CharT>::string_type string_type; |
| 879 | 875 | const string_type __names[2] = {__np.truename(), __np.falsename()}; |
| 880 | const string_type* __i = __scan_keyword(__b, __e, __names, __names+2, | |
| 881 | __ct, __err); | |
| 876 | const string_type* __i = _VSTD::__scan_keyword(__b, __e, __names, __names+2, | |
| 877 | __ct, __err); | |
| 882 | 878 | __v = __i == __names; |
| 883 | 879 | return __b; |
| 884 | 880 | } |
| ... | ... | @@ -1099,8 +1095,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 1099 | 1095 | return __b; |
| 1100 | 1096 | } |
| 1101 | 1097 | |
| 1102 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>) | |
| 1103 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>) | |
| 1098 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>) | |
| 1099 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>) | |
| 1104 | 1100 | |
| 1105 | 1101 | struct _LIBCPP_TYPE_VIS __num_put_base |
| 1106 | 1102 | { |
| ... | ... | @@ -1249,8 +1245,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, |
| 1249 | 1245 | __op = __ob + (__np - __nb); |
| 1250 | 1246 | } |
| 1251 | 1247 | |
| 1252 | _LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>) | |
| 1253 | _LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>) | |
| 1248 | _LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>) | |
| 1249 | _LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>) | |
| 1254 | 1250 | |
| 1255 | 1251 | template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > |
| 1256 | 1252 | class _LIBCPP_TEMPLATE_VIS num_put |
| ... | ... | @@ -1427,7 +1423,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1427 | 1423 | return do_put(__s, __iob, __fl, (unsigned long)__v); |
| 1428 | 1424 | const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc()); |
| 1429 | 1425 | typedef typename numpunct<char_type>::string_type string_type; |
| 1430 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1426 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1431 | 1427 | string_type __tmp(__v ? __np.truename() : __np.falsename()); |
| 1432 | 1428 | string_type __nm = _VSTD::move(__tmp); |
| 1433 | 1429 | #else |
| ... | ... | @@ -1564,14 +1560,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1564 | 1560 | (int)__iob.precision(), __v); |
| 1565 | 1561 | else |
| 1566 | 1562 | __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); |
| 1567 | unique_ptr<char, void(*)(void*)> __nbh(0, free); | |
| 1563 | unique_ptr<char, void(*)(void*)> __nbh(nullptr, free); | |
| 1568 | 1564 | if (__nc > static_cast<int>(__nbuf-1)) |
| 1569 | 1565 | { |
| 1570 | 1566 | if (__specify_precision) |
| 1571 | 1567 | __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); |
| 1572 | 1568 | else |
| 1573 | 1569 | __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); |
| 1574 | if (__nb == 0) | |
| 1570 | if (__nb == nullptr) | |
| 1575 | 1571 | __throw_bad_alloc(); |
| 1576 | 1572 | __nbh.reset(__nb); |
| 1577 | 1573 | } |
| ... | ... | @@ -1615,14 +1611,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1615 | 1611 | (int)__iob.precision(), __v); |
| 1616 | 1612 | else |
| 1617 | 1613 | __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); |
| 1618 | unique_ptr<char, void(*)(void*)> __nbh(0, free); | |
| 1614 | unique_ptr<char, void(*)(void*)> __nbh(nullptr, free); | |
| 1619 | 1615 | if (__nc > static_cast<int>(__nbuf-1)) |
| 1620 | 1616 | { |
| 1621 | 1617 | if (__specify_precision) |
| 1622 | 1618 | __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); |
| 1623 | 1619 | else |
| 1624 | 1620 | __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); |
| 1625 | if (__nb == 0) | |
| 1621 | if (__nb == nullptr) | |
| 1626 | 1622 | __throw_bad_alloc(); |
| 1627 | 1623 | __nbh.reset(__nb); |
| 1628 | 1624 | } |
| ... | ... | @@ -1676,8 +1672,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, |
| 1676 | 1672 | return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); |
| 1677 | 1673 | } |
| 1678 | 1674 | |
| 1679 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>) | |
| 1680 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>) | |
| 1675 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>) | |
| 1676 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>) | |
| 1681 | 1677 | |
| 1682 | 1678 | template <class _CharT, class _InputIterator> |
| 1683 | 1679 | _LIBCPP_HIDDEN |
| ... | ... | @@ -1916,7 +1912,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w, |
| 1916 | 1912 | { |
| 1917 | 1913 | // Note: ignoring case comes from the POSIX strptime spec |
| 1918 | 1914 | const string_type* __wk = this->__weeks(); |
| 1919 | ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; | |
| 1915 | ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; | |
| 1920 | 1916 | if (__i < 14) |
| 1921 | 1917 | __w = __i % 7; |
| 1922 | 1918 | } |
| ... | ... | @@ -1930,7 +1926,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m, |
| 1930 | 1926 | { |
| 1931 | 1927 | // Note: ignoring case comes from the POSIX strptime spec |
| 1932 | 1928 | const string_type* __month = this->__months(); |
| 1933 | ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; | |
| 1929 | ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; | |
| 1934 | 1930 | if (__i < 24) |
| 1935 | 1931 | __m = __i % 12; |
| 1936 | 1932 | } |
| ... | ... | @@ -1942,7 +1938,7 @@ time_get<_CharT, _InputIterator>::__get_day(int& __d, |
| 1942 | 1938 | ios_base::iostate& __err, |
| 1943 | 1939 | const ctype<char_type>& __ct) const |
| 1944 | 1940 | { |
| 1945 | int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1941 | int __t = _VSTD::__get_up_to_n_digits(__b, __e, __err, __ct, 2); | |
| 1946 | 1942 | if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31) |
| 1947 | 1943 | __d = __t; |
| 1948 | 1944 | else |
| ... | ... | @@ -2102,7 +2098,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h, |
| 2102 | 2098 | __err |= ios_base::failbit; |
| 2103 | 2099 | return; |
| 2104 | 2100 | } |
| 2105 | ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; | |
| 2101 | ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; | |
| 2106 | 2102 | if (__i == 0 && __h == 12) |
| 2107 | 2103 | __h = 0; |
| 2108 | 2104 | else if (__i == 1 && __h < 12) |
| ... | ... | @@ -2362,8 +2358,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 2362 | 2358 | return __b; |
| 2363 | 2359 | } |
| 2364 | 2360 | |
| 2365 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>) | |
| 2366 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>) | |
| 2361 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>) | |
| 2362 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>) | |
| 2367 | 2363 | |
| 2368 | 2364 | class _LIBCPP_TYPE_VIS __time_get |
| 2369 | 2365 | { |
| ... | ... | @@ -2462,8 +2458,8 @@ private: |
| 2462 | 2458 | virtual const string_type& __X() const {return this->__X_;} |
| 2463 | 2459 | }; |
| 2464 | 2460 | |
| 2465 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>) | |
| 2466 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>) | |
| 2461 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>) | |
| 2462 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>) | |
| 2467 | 2463 | |
| 2468 | 2464 | class _LIBCPP_TYPE_VIS __time_put |
| 2469 | 2465 | { |
| ... | ... | @@ -2575,8 +2571,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, |
| 2575 | 2571 | return _VSTD::copy(__nb, __ne, __s); |
| 2576 | 2572 | } |
| 2577 | 2573 | |
| 2578 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>) | |
| 2579 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>) | |
| 2574 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>) | |
| 2575 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>) | |
| 2580 | 2576 | |
| 2581 | 2577 | template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > |
| 2582 | 2578 | class _LIBCPP_TEMPLATE_VIS time_put_byname |
| ... | ... | @@ -2596,8 +2592,8 @@ protected: |
| 2596 | 2592 | ~time_put_byname() {} |
| 2597 | 2593 | }; |
| 2598 | 2594 | |
| 2599 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>) | |
| 2600 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>) | |
| 2595 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>) | |
| 2596 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>) | |
| 2601 | 2597 | |
| 2602 | 2598 | // money_base |
| 2603 | 2599 | |
| ... | ... | @@ -2663,10 +2659,10 @@ template <class _CharT, bool _International> |
| 2663 | 2659 | const bool |
| 2664 | 2660 | moneypunct<_CharT, _International>::intl; |
| 2665 | 2661 | |
| 2666 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>) | |
| 2667 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>) | |
| 2668 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>) | |
| 2669 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>) | |
| 2662 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>) | |
| 2663 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>) | |
| 2664 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>) | |
| 2665 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>) | |
| 2670 | 2666 | |
| 2671 | 2667 | // moneypunct_byname |
| 2672 | 2668 | |
| ... | ... | @@ -2720,10 +2716,10 @@ template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char* |
| 2720 | 2716 | template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*); |
| 2721 | 2717 | template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*); |
| 2722 | 2718 | |
| 2723 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>) | |
| 2724 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>) | |
| 2725 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>) | |
| 2726 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>) | |
| 2719 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>) | |
| 2720 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>) | |
| 2721 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>) | |
| 2722 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>) | |
| 2727 | 2723 | |
| 2728 | 2724 | // money_get |
| 2729 | 2725 | |
| ... | ... | @@ -2779,8 +2775,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, |
| 2779 | 2775 | } |
| 2780 | 2776 | } |
| 2781 | 2777 | |
| 2782 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>) | |
| 2783 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>) | |
| 2778 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>) | |
| 2779 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>) | |
| 2784 | 2780 | |
| 2785 | 2781 | template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > |
| 2786 | 2782 | class _LIBCPP_TEMPLATE_VIS money_get |
| ... | ... | @@ -3108,11 +3104,11 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 3108 | 3104 | __ct.widen(__src, __src + (sizeof(__src)-1), __atoms); |
| 3109 | 3105 | char __nbuf[__bz]; |
| 3110 | 3106 | char* __nc = __nbuf; |
| 3111 | unique_ptr<char, void(*)(void*)> __h(0, free); | |
| 3107 | unique_ptr<char, void(*)(void*)> __h(nullptr, free); | |
| 3112 | 3108 | if (__wn - __wb.get() > __bz-2) |
| 3113 | 3109 | { |
| 3114 | 3110 | __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2))); |
| 3115 | if (__h.get() == 0) | |
| 3111 | if (__h.get() == nullptr) | |
| 3116 | 3112 | __throw_bad_alloc(); |
| 3117 | 3113 | __nc = __h.get(); |
| 3118 | 3114 | } |
| ... | ... | @@ -3162,8 +3158,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, |
| 3162 | 3158 | return __b; |
| 3163 | 3159 | } |
| 3164 | 3160 | |
| 3165 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>) | |
| 3166 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>) | |
| 3161 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>) | |
| 3162 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>) | |
| 3167 | 3163 | |
| 3168 | 3164 | // money_put |
| 3169 | 3165 | |
| ... | ... | @@ -3337,8 +3333,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m |
| 3337 | 3333 | __mi = __mb; |
| 3338 | 3334 | } |
| 3339 | 3335 | |
| 3340 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>) | |
| 3341 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>) | |
| 3336 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>) | |
| 3337 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>) | |
| 3342 | 3338 | |
| 3343 | 3339 | template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > |
| 3344 | 3340 | class _LIBCPP_TEMPLATE_VIS money_put |
| ... | ... | @@ -3397,13 +3393,13 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3397 | 3393 | char_type __digits[__bs]; |
| 3398 | 3394 | char_type* __db = __digits; |
| 3399 | 3395 | size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units)); |
| 3400 | unique_ptr<char, void(*)(void*)> __hn(0, free); | |
| 3396 | unique_ptr<char, void(*)(void*)> __hn(nullptr, free); | |
| 3401 | 3397 | unique_ptr<char_type, void(*)(void*)> __hd(0, free); |
| 3402 | 3398 | // secure memory for digit storage |
| 3403 | 3399 | if (__n > __bs-1) |
| 3404 | 3400 | { |
| 3405 | 3401 | __n = static_cast<size_t>(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units)); |
| 3406 | if (__bb == 0) | |
| 3402 | if (__bb == nullptr) | |
| 3407 | 3403 | __throw_bad_alloc(); |
| 3408 | 3404 | __hn.reset(__bb); |
| 3409 | 3405 | __hd.reset((char_type*)malloc(__n * sizeof(char_type))); |
| ... | ... | @@ -3490,8 +3486,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, |
| 3490 | 3486 | return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); |
| 3491 | 3487 | } |
| 3492 | 3488 | |
| 3493 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>) | |
| 3494 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>) | |
| 3489 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>) | |
| 3490 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>) | |
| 3495 | 3491 | |
| 3496 | 3492 | // messages |
| 3497 | 3493 | |
| ... | ... | @@ -3582,7 +3578,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, |
| 3582 | 3578 | char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str()); |
| 3583 | 3579 | string_type __w; |
| 3584 | 3580 | __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w), |
| 3585 | __n, __n + strlen(__n)); | |
| 3581 | __n, __n + _VSTD::strlen(__n)); | |
| 3586 | 3582 | return __w; |
| 3587 | 3583 | #else // !_LIBCPP_HAS_CATOPEN |
| 3588 | 3584 | _LIBCPP_UNUSED_VAR(__c); |
| ... | ... | @@ -3606,8 +3602,8 @@ messages<_CharT>::do_close(catalog __c) const |
| 3606 | 3602 | #endif // _LIBCPP_HAS_CATOPEN |
| 3607 | 3603 | } |
| 3608 | 3604 | |
| 3609 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>) | |
| 3610 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>) | |
| 3605 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>) | |
| 3606 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>) | |
| 3611 | 3607 | |
| 3612 | 3608 | template <class _CharT> |
| 3613 | 3609 | class _LIBCPP_TEMPLATE_VIS messages_byname |
| ... | ... | @@ -3630,8 +3626,8 @@ protected: |
| 3630 | 3626 | ~messages_byname() {} |
| 3631 | 3627 | }; |
| 3632 | 3628 | |
| 3633 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>) | |
| 3634 | _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>) | |
| 3629 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>) | |
| 3630 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>) | |
| 3635 | 3631 | |
| 3636 | 3632 | template<class _Codecvt, class _Elem = wchar_t, |
| 3637 | 3633 | class _Wide_alloc = allocator<_Elem>, |
| ... | ... | @@ -3923,7 +3919,7 @@ private: |
| 3923 | 3919 | wbuffer_convert(const wbuffer_convert&); |
| 3924 | 3920 | wbuffer_convert& operator=(const wbuffer_convert&); |
| 3925 | 3921 | public: |
| 3926 | _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0, | |
| 3922 | _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = nullptr, | |
| 3927 | 3923 | _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); |
| 3928 | 3924 | ~wbuffer_convert(); |
| 3929 | 3925 | |
| ... | ... | @@ -3961,9 +3957,9 @@ private: |
| 3961 | 3957 | template <class _Codecvt, class _Elem, class _Tr> |
| 3962 | 3958 | wbuffer_convert<_Codecvt, _Elem, _Tr>:: |
| 3963 | 3959 | wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state) |
| 3964 | : __extbuf_(0), | |
| 3965 | __extbufnext_(0), | |
| 3966 | __extbufend_(0), | |
| 3960 | : __extbuf_(nullptr), | |
| 3961 | __extbufnext_(nullptr), | |
| 3962 | __extbufend_(nullptr), | |
| 3967 | 3963 | __ebs_(0), |
| 3968 | 3964 | __intbuf_(0), |
| 3969 | 3965 | __ibs_(0), |
| ... | ... | @@ -4003,7 +3999,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() |
| 4003 | 3999 | int_type __c = traits_type::eof(); |
| 4004 | 4000 | if (this->gptr() == this->egptr()) |
| 4005 | 4001 | { |
| 4006 | memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); | |
| 4002 | _VSTD::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); | |
| 4007 | 4003 | if (__always_noconv_) |
| 4008 | 4004 | { |
| 4009 | 4005 | streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz); |
| ... | ... | @@ -4020,7 +4016,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() |
| 4020 | 4016 | { |
| 4021 | 4017 | _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); |
| 4022 | 4018 | if (__extbufend_ != __extbufnext_) |
| 4023 | memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); | |
| 4019 | _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); | |
| 4024 | 4020 | __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); |
| 4025 | 4021 | __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); |
| 4026 | 4022 | streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz), |
| ... | ... | @@ -4336,12 +4332,12 @@ template <class _Codecvt, class _Elem, class _Tr> |
| 4336 | 4332 | wbuffer_convert<_Codecvt, _Elem, _Tr>* |
| 4337 | 4333 | wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() |
| 4338 | 4334 | { |
| 4339 | wbuffer_convert* __rt = 0; | |
| 4340 | if (__cv_ != 0 && __bufptr_ != 0) | |
| 4335 | wbuffer_convert* __rt = nullptr; | |
| 4336 | if (__cv_ != nullptr && __bufptr_ != nullptr) | |
| 4341 | 4337 | { |
| 4342 | 4338 | __rt = this; |
| 4343 | 4339 | if ((__cm_ & ios_base::out) && sync()) |
| 4344 | __rt = 0; | |
| 4340 | __rt = nullptr; | |
| 4345 | 4341 | } |
| 4346 | 4342 | return __rt; |
| 4347 | 4343 | } |
lib/libcxx/include/locale.h+5-1| ... | ... | @@ -35,8 +35,12 @@ Functions: |
| 35 | 35 | |
| 36 | 36 | #include <__config> |
| 37 | 37 | |
| 38 | #if defined(_LIBCPP_HAS_NO_LOCALIZATION) | |
| 39 | # error "Localization is not supported by this configuration of libc++" | |
| 40 | #endif | |
| 41 | ||
| 38 | 42 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 39 | #pragma GCC system_header | |
| 43 | # pragma GCC system_header | |
| 40 | 44 | #endif |
| 41 | 45 | |
| 42 | 46 | #include_next <locale.h> |
lib/libcxx/include/map+25-25| ... | ... | @@ -1230,7 +1230,7 @@ public: |
| 1230 | 1230 | return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, |
| 1231 | 1231 | _VSTD::piecewise_construct, |
| 1232 | 1232 | _VSTD::forward_as_tuple(__k), |
| 1233 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); | |
| 1233 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)).first; | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | template <class... _Args> |
| ... | ... | @@ -1240,7 +1240,7 @@ public: |
| 1240 | 1240 | return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k, |
| 1241 | 1241 | _VSTD::piecewise_construct, |
| 1242 | 1242 | _VSTD::forward_as_tuple(_VSTD::move(__k)), |
| 1243 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); | |
| 1243 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)).first; | |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | 1246 | template <class _Vp> |
| ... | ... | @@ -1270,30 +1270,30 @@ public: |
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | template <class _Vp> |
| 1273 | _LIBCPP_INLINE_VISIBILITY | |
| 1274 | iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) | |
| 1275 | { | |
| 1276 | iterator __p = lower_bound(__k); | |
| 1277 | if ( __p != end() && !key_comp()(__k, __p->first)) | |
| 1278 | { | |
| 1279 | __p->second = _VSTD::forward<_Vp>(__v); | |
| 1280 | return __p; | |
| 1281 | } | |
| 1282 | return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v)); | |
| 1283 | } | |
| 1273 | _LIBCPP_INLINE_VISIBILITY iterator insert_or_assign(const_iterator __h, | |
| 1274 | const key_type& __k, | |
| 1275 | _Vp&& __v) { | |
| 1276 | auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args( | |
| 1277 | __h.__i_, __k, __k, _VSTD::forward<_Vp>(__v)); | |
| 1278 | ||
| 1279 | if (!__inserted) | |
| 1280 | __r->__get_value().second = _VSTD::forward<_Vp>(__v); | |
| 1281 | ||
| 1282 | return __r; | |
| 1283 | } | |
| 1284 | 1284 | |
| 1285 | 1285 | template <class _Vp> |
| 1286 | _LIBCPP_INLINE_VISIBILITY | |
| 1287 | iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) | |
| 1288 | { | |
| 1289 | iterator __p = lower_bound(__k); | |
| 1290 | if ( __p != end() && !key_comp()(__k, __p->first)) | |
| 1291 | { | |
| 1292 | __p->second = _VSTD::forward<_Vp>(__v); | |
| 1293 | return __p; | |
| 1294 | } | |
| 1295 | return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); | |
| 1296 | } | |
| 1286 | _LIBCPP_INLINE_VISIBILITY iterator insert_or_assign(const_iterator __h, | |
| 1287 | key_type&& __k, | |
| 1288 | _Vp&& __v) { | |
| 1289 | auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args( | |
| 1290 | __h.__i_, __k, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); | |
| 1291 | ||
| 1292 | if (!__inserted) | |
| 1293 | __r->__get_value().second = _VSTD::forward<_Vp>(__v); | |
| 1294 | ||
| 1295 | return __r; | |
| 1296 | } | |
| 1297 | 1297 | |
| 1298 | 1298 | #endif // _LIBCPP_STD_VER > 14 |
| 1299 | 1299 | |
| ... | ... | @@ -1546,7 +1546,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& |
| 1546 | 1546 | __h.get_deleter().__first_constructed = true; |
| 1547 | 1547 | __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second)); |
| 1548 | 1548 | __h.get_deleter().__second_constructed = true; |
| 1549 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 1549 | return __h; | |
| 1550 | 1550 | } |
| 1551 | 1551 | |
| 1552 | 1552 | template <class _Key, class _Tp, class _Compare, class _Allocator> |
lib/libcxx/include/memory+365-1377| ... | ... | @@ -46,7 +46,7 @@ struct pointer_traits<T*> |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | template <class T> constexpr T* to_address(T* p) noexcept; // C++20 |
| 49 | template <class Ptr> auto to_address(const Ptr& p) noexcept; // C++20 | |
| 49 | template <class Ptr> constexpr auto to_address(const Ptr& p) noexcept; // C++20 | |
| 50 | 50 | |
| 51 | 51 | template <class Alloc> |
| 52 | 52 | struct allocator_traits |
| ... | ... | @@ -83,21 +83,19 @@ struct allocator_traits |
| 83 | 83 | template <class T> using rebind_alloc = Alloc::rebind<T>::other | Alloc<T, Args...>; |
| 84 | 84 | template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>; |
| 85 | 85 | |
| 86 | static pointer allocate(allocator_type& a, size_type n); // [[nodiscard]] in C++20 | |
| 87 | static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint); // [[nodiscard]] in C++20 | |
| 86 | static pointer allocate(allocator_type& a, size_type n); // constexpr and [[nodiscard]] in C++20 | |
| 87 | static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint); // constexpr and [[nodiscard]] in C++20 | |
| 88 | 88 | |
| 89 | static void deallocate(allocator_type& a, pointer p, size_type n) noexcept; | |
| 89 | static void deallocate(allocator_type& a, pointer p, size_type n) noexcept; // constexpr in C++20 | |
| 90 | 90 | |
| 91 | 91 | template <class T, class... Args> |
| 92 | static void construct(allocator_type& a, T* p, Args&&... args); | |
| 92 | static void construct(allocator_type& a, T* p, Args&&... args); // constexpr in C++20 | |
| 93 | 93 | |
| 94 | 94 | template <class T> |
| 95 | static void destroy(allocator_type& a, T* p); | |
| 95 | static void destroy(allocator_type& a, T* p); // constexpr in C++20 | |
| 96 | 96 | |
| 97 | static size_type max_size(const allocator_type& a); // noexcept in C++14 | |
| 98 | ||
| 99 | static allocator_type | |
| 100 | select_on_container_copy_construction(const allocator_type& a); | |
| 97 | static size_type max_size(const allocator_type& a); // noexcept in C++14, constexpr in C++20 | |
| 98 | static allocator_type select_on_container_copy_construction(const allocator_type& a); // constexpr in C++20 | |
| 101 | 99 | }; |
| 102 | 100 | |
| 103 | 101 | template <> |
| ... | ... | @@ -115,8 +113,8 @@ template <class T> |
| 115 | 113 | class allocator |
| 116 | 114 | { |
| 117 | 115 | public: |
| 118 | typedef size_t size_type; // deprecated in C++17, removed in C++20 | |
| 119 | typedef ptrdiff_t difference_type; // deprecated in C++17, removed in C++20 | |
| 116 | typedef size_t size_type; | |
| 117 | typedef ptrdiff_t difference_type; | |
| 120 | 118 | typedef T* pointer; // deprecated in C++17, removed in C++20 |
| 121 | 119 | typedef const T* const_pointer; // deprecated in C++17, removed in C++20 |
| 122 | 120 | typedef typename add_lvalue_reference<T>::type |
| ... | ... | @@ -135,12 +133,12 @@ public: |
| 135 | 133 | constexpr allocator(const allocator&) noexcept; // constexpr in C++20 |
| 136 | 134 | template <class U> |
| 137 | 135 | constexpr allocator(const allocator<U>&) noexcept; // constexpr in C++20 |
| 138 | ~allocator(); | |
| 136 | ~allocator(); // constexpr in C++20 | |
| 139 | 137 | pointer address(reference x) const noexcept; // deprecated in C++17, removed in C++20 |
| 140 | 138 | const_pointer address(const_reference x) const noexcept; // deprecated in C++17, removed in C++20 |
| 141 | 139 | T* allocate(size_t n, const void* hint); // deprecated in C++17, removed in C++20 |
| 142 | T* allocate(size_t n); | |
| 143 | void deallocate(T* p, size_t n) noexcept; | |
| 140 | T* allocate(size_t n); // constexpr in C++20 | |
| 141 | void deallocate(T* p, size_t n) noexcept; // constexpr in C++20 | |
| 144 | 142 | size_type max_size() const noexcept; // deprecated in C++17, removed in C++20 |
| 145 | 143 | template<class U, class... Args> |
| 146 | 144 | void construct(U* p, Args&&... args); // deprecated in C++17, removed in C++20 |
| ... | ... | @@ -149,10 +147,10 @@ public: |
| 149 | 147 | }; |
| 150 | 148 | |
| 151 | 149 | template <class T, class U> |
| 152 | bool operator==(const allocator<T>&, const allocator<U>&) noexcept; | |
| 150 | bool operator==(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20 | |
| 153 | 151 | |
| 154 | 152 | template <class T, class U> |
| 155 | bool operator!=(const allocator<T>&, const allocator<U>&) noexcept; | |
| 153 | bool operator!=(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20 | |
| 156 | 154 | |
| 157 | 155 | template <class OutputIterator, class T> |
| 158 | 156 | class raw_storage_iterator |
| ... | ... | @@ -191,14 +189,17 @@ template <class ForwardIterator, class Size, class T> |
| 191 | 189 | ForwardIterator |
| 192 | 190 | uninitialized_fill_n(ForwardIterator first, Size n, const T& x); |
| 193 | 191 | |
| 192 | template <class T, class ...Args> | |
| 193 | constexpr T* construct_at(T* location, Args&& ...args); // since C++20 | |
| 194 | ||
| 194 | 195 | template <class T> |
| 195 | void destroy_at(T* location); | |
| 196 | void destroy_at(T* location); // constexpr in C++20 | |
| 196 | 197 | |
| 197 | 198 | template <class ForwardIterator> |
| 198 | void destroy(ForwardIterator first, ForwardIterator last); | |
| 199 | void destroy(ForwardIterator first, ForwardIterator last); // constexpr in C++20 | |
| 199 | 200 | |
| 200 | 201 | template <class ForwardIterator, class Size> |
| 201 | ForwardIterator destroy_n(ForwardIterator first, Size n); | |
| 202 | ForwardIterator destroy_n(ForwardIterator first, Size n); // constexpr in C++20 | |
| 202 | 203 | |
| 203 | 204 | template <class InputIterator, class ForwardIterator> |
| 204 | 205 | ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result); |
| ... | ... | @@ -338,7 +339,7 @@ public: |
| 338 | 339 | pointer release() noexcept; |
| 339 | 340 | void reset(pointer p = pointer()) noexcept; |
| 340 | 341 | void reset(nullptr_t) noexcept; |
| 341 | template <class U> void reset(U) = delete; | |
| 342 | template <class U> void reset(U) = delete; | |
| 342 | 343 | void swap(unique_ptr& u) noexcept; |
| 343 | 344 | }; |
| 344 | 345 | |
| ... | ... | @@ -664,6 +665,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); |
| 664 | 665 | */ |
| 665 | 666 | |
| 666 | 667 | #include <__config> |
| 668 | #include <__availability> | |
| 667 | 669 | #include <type_traits> |
| 668 | 670 | #include <typeinfo> |
| 669 | 671 | #include <cstddef> |
| ... | ... | @@ -677,6 +679,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); |
| 677 | 679 | #include <tuple> |
| 678 | 680 | #include <stdexcept> |
| 679 | 681 | #include <cstring> |
| 682 | #include <__memory/allocator_traits.h> | |
| 683 | #include <__memory/base.h> | |
| 684 | #include <__memory/pointer_traits.h> | |
| 685 | #include <__memory/utilities.h> | |
| 680 | 686 | #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| 681 | 687 | # include <atomic> |
| 682 | 688 | #endif |
| ... | ... | @@ -716,413 +722,11 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) { |
| 716 | 722 | #endif |
| 717 | 723 | } |
| 718 | 724 | |
| 719 | // addressof moved to <type_traits> | |
| 720 | ||
| 721 | template <class _Tp> class allocator; | |
| 722 | ||
| 723 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 724 | template <> | |
| 725 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void> | |
| 726 | { | |
| 727 | public: | |
| 728 | typedef void* pointer; | |
| 729 | typedef const void* const_pointer; | |
| 730 | typedef void value_type; | |
| 731 | ||
| 732 | template <class _Up> struct rebind {typedef allocator<_Up> other;}; | |
| 733 | }; | |
| 734 | ||
| 735 | template <> | |
| 736 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void> | |
| 737 | { | |
| 738 | public: | |
| 739 | typedef const void* pointer; | |
| 740 | typedef const void* const_pointer; | |
| 741 | typedef const void value_type; | |
| 742 | ||
| 743 | template <class _Up> struct rebind {typedef allocator<_Up> other;}; | |
| 744 | }; | |
| 745 | #endif | |
| 746 | ||
| 747 | // pointer_traits | |
| 748 | ||
| 749 | template <class _Tp, class = void> | |
| 750 | struct __has_element_type : false_type {}; | |
| 751 | ||
| 752 | template <class _Tp> | |
| 753 | struct __has_element_type<_Tp, | |
| 754 | typename __void_t<typename _Tp::element_type>::type> : true_type {}; | |
| 755 | ||
| 756 | template <class _Ptr, bool = __has_element_type<_Ptr>::value> | |
| 757 | struct __pointer_traits_element_type; | |
| 758 | ||
| 759 | template <class _Ptr> | |
| 760 | struct __pointer_traits_element_type<_Ptr, true> | |
| 761 | { | |
| 762 | typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type; | |
| 763 | }; | |
| 764 | ||
| 765 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 766 | ||
| 767 | template <template <class, class...> class _Sp, class _Tp, class ..._Args> | |
| 768 | struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> | |
| 769 | { | |
| 770 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type; | |
| 771 | }; | |
| 772 | ||
| 773 | template <template <class, class...> class _Sp, class _Tp, class ..._Args> | |
| 774 | struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> | |
| 775 | { | |
| 776 | typedef _LIBCPP_NODEBUG_TYPE _Tp type; | |
| 777 | }; | |
| 778 | ||
| 779 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 780 | ||
| 781 | template <template <class> class _Sp, class _Tp> | |
| 782 | struct __pointer_traits_element_type<_Sp<_Tp>, true> | |
| 783 | { | |
| 784 | typedef typename _Sp<_Tp>::element_type type; | |
| 785 | }; | |
| 786 | ||
| 787 | template <template <class> class _Sp, class _Tp> | |
| 788 | struct __pointer_traits_element_type<_Sp<_Tp>, false> | |
| 789 | { | |
| 790 | typedef _Tp type; | |
| 791 | }; | |
| 792 | ||
| 793 | template <template <class, class> class _Sp, class _Tp, class _A0> | |
| 794 | struct __pointer_traits_element_type<_Sp<_Tp, _A0>, true> | |
| 795 | { | |
| 796 | typedef typename _Sp<_Tp, _A0>::element_type type; | |
| 797 | }; | |
| 798 | ||
| 799 | template <template <class, class> class _Sp, class _Tp, class _A0> | |
| 800 | struct __pointer_traits_element_type<_Sp<_Tp, _A0>, false> | |
| 801 | { | |
| 802 | typedef _Tp type; | |
| 803 | }; | |
| 804 | ||
| 805 | template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1> | |
| 806 | struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, true> | |
| 807 | { | |
| 808 | typedef typename _Sp<_Tp, _A0, _A1>::element_type type; | |
| 809 | }; | |
| 810 | ||
| 811 | template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1> | |
| 812 | struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, false> | |
| 813 | { | |
| 814 | typedef _Tp type; | |
| 815 | }; | |
| 816 | ||
| 817 | template <template <class, class, class, class> class _Sp, class _Tp, class _A0, | |
| 818 | class _A1, class _A2> | |
| 819 | struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, true> | |
| 820 | { | |
| 821 | typedef typename _Sp<_Tp, _A0, _A1, _A2>::element_type type; | |
| 822 | }; | |
| 823 | ||
| 824 | template <template <class, class, class, class> class _Sp, class _Tp, class _A0, | |
| 825 | class _A1, class _A2> | |
| 826 | struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, false> | |
| 827 | { | |
| 828 | typedef _Tp type; | |
| 829 | }; | |
| 830 | ||
| 831 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 832 | ||
| 833 | template <class _Tp, class = void> | |
| 834 | struct __has_difference_type : false_type {}; | |
| 835 | ||
| 836 | template <class _Tp> | |
| 837 | struct __has_difference_type<_Tp, | |
| 838 | typename __void_t<typename _Tp::difference_type>::type> : true_type {}; | |
| 839 | ||
| 840 | template <class _Ptr, bool = __has_difference_type<_Ptr>::value> | |
| 841 | struct __pointer_traits_difference_type | |
| 842 | { | |
| 843 | typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type; | |
| 844 | }; | |
| 845 | ||
| 846 | template <class _Ptr> | |
| 847 | struct __pointer_traits_difference_type<_Ptr, true> | |
| 848 | { | |
| 849 | typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type; | |
| 850 | }; | |
| 851 | ||
| 852 | template <class _Tp, class _Up> | |
| 853 | struct __has_rebind | |
| 854 | { | |
| 855 | private: | |
| 856 | struct __two {char __lx; char __lxx;}; | |
| 857 | template <class _Xp> static __two __test(...); | |
| 858 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 859 | template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0); | |
| 860 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 861 | public: | |
| 862 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | |
| 863 | }; | |
| 864 | ||
| 865 | template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> | |
| 866 | struct __pointer_traits_rebind | |
| 867 | { | |
| 868 | #ifndef _LIBCPP_CXX03_LANG | |
| 869 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type; | |
| 870 | #else | |
| 871 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; | |
| 872 | #endif | |
| 873 | }; | |
| 874 | ||
| 875 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 876 | ||
| 877 | template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> | |
| 878 | struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> | |
| 879 | { | |
| 880 | #ifndef _LIBCPP_CXX03_LANG | |
| 881 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type; | |
| 882 | #else | |
| 883 | typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type; | |
| 884 | #endif | |
| 885 | }; | |
| 886 | ||
| 887 | template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> | |
| 888 | struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> | |
| 889 | { | |
| 890 | typedef _Sp<_Up, _Args...> type; | |
| 891 | }; | |
| 892 | ||
| 893 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 894 | ||
| 895 | template <template <class> class _Sp, class _Tp, class _Up> | |
| 896 | struct __pointer_traits_rebind<_Sp<_Tp>, _Up, true> | |
| 897 | { | |
| 898 | #ifndef _LIBCPP_CXX03_LANG | |
| 899 | typedef typename _Sp<_Tp>::template rebind<_Up> type; | |
| 900 | #else | |
| 901 | typedef typename _Sp<_Tp>::template rebind<_Up>::other type; | |
| 902 | #endif | |
| 903 | }; | |
| 904 | ||
| 905 | template <template <class> class _Sp, class _Tp, class _Up> | |
| 906 | struct __pointer_traits_rebind<_Sp<_Tp>, _Up, false> | |
| 907 | { | |
| 908 | typedef _Sp<_Up> type; | |
| 909 | }; | |
| 910 | ||
| 911 | template <template <class, class> class _Sp, class _Tp, class _A0, class _Up> | |
| 912 | struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, true> | |
| 913 | { | |
| 914 | #ifndef _LIBCPP_CXX03_LANG | |
| 915 | typedef typename _Sp<_Tp, _A0>::template rebind<_Up> type; | |
| 916 | #else | |
| 917 | typedef typename _Sp<_Tp, _A0>::template rebind<_Up>::other type; | |
| 918 | #endif | |
| 919 | }; | |
| 920 | ||
| 921 | template <template <class, class> class _Sp, class _Tp, class _A0, class _Up> | |
| 922 | struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, false> | |
| 923 | { | |
| 924 | typedef _Sp<_Up, _A0> type; | |
| 925 | }; | |
| 926 | ||
| 927 | template <template <class, class, class> class _Sp, class _Tp, class _A0, | |
| 928 | class _A1, class _Up> | |
| 929 | struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, true> | |
| 930 | { | |
| 931 | #ifndef _LIBCPP_CXX03_LANG | |
| 932 | typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up> type; | |
| 933 | #else | |
| 934 | typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up>::other type; | |
| 935 | #endif | |
| 936 | }; | |
| 937 | ||
| 938 | template <template <class, class, class> class _Sp, class _Tp, class _A0, | |
| 939 | class _A1, class _Up> | |
| 940 | struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, false> | |
| 941 | { | |
| 942 | typedef _Sp<_Up, _A0, _A1> type; | |
| 943 | }; | |
| 944 | ||
| 945 | template <template <class, class, class, class> class _Sp, class _Tp, class _A0, | |
| 946 | class _A1, class _A2, class _Up> | |
| 947 | struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, true> | |
| 948 | { | |
| 949 | #ifndef _LIBCPP_CXX03_LANG | |
| 950 | typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up> type; | |
| 951 | #else | |
| 952 | typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type; | |
| 953 | #endif | |
| 954 | }; | |
| 955 | ||
| 956 | template <template <class, class, class, class> class _Sp, class _Tp, class _A0, | |
| 957 | class _A1, class _A2, class _Up> | |
| 958 | struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false> | |
| 959 | { | |
| 960 | typedef _Sp<_Up, _A0, _A1, _A2> type; | |
| 961 | }; | |
| 962 | ||
| 963 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 964 | ||
| 965 | template <class _Ptr> | |
| 966 | struct _LIBCPP_TEMPLATE_VIS pointer_traits | |
| 967 | { | |
| 968 | typedef _Ptr pointer; | |
| 969 | typedef typename __pointer_traits_element_type<pointer>::type element_type; | |
| 970 | typedef typename __pointer_traits_difference_type<pointer>::type difference_type; | |
| 971 | ||
| 972 | #ifndef _LIBCPP_CXX03_LANG | |
| 973 | template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type; | |
| 974 | #else | |
| 975 | template <class _Up> struct rebind | |
| 976 | {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;}; | |
| 977 | #endif // _LIBCPP_CXX03_LANG | |
| 978 | ||
| 979 | private: | |
| 980 | struct __nat {}; | |
| 981 | public: | |
| 982 | _LIBCPP_INLINE_VISIBILITY | |
| 983 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 984 | __nat, element_type>::type& __r) | |
| 985 | {return pointer::pointer_to(__r);} | |
| 986 | }; | |
| 987 | ||
| 988 | template <class _Tp> | |
| 989 | struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> | |
| 990 | { | |
| 991 | typedef _Tp* pointer; | |
| 992 | typedef _Tp element_type; | |
| 993 | typedef ptrdiff_t difference_type; | |
| 994 | ||
| 995 | #ifndef _LIBCPP_CXX03_LANG | |
| 996 | template <class _Up> using rebind = _Up*; | |
| 997 | #else | |
| 998 | template <class _Up> struct rebind {typedef _Up* other;}; | |
| 999 | #endif | |
| 1000 | ||
| 1001 | private: | |
| 1002 | struct __nat {}; | |
| 1003 | public: | |
| 1004 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1005 | static pointer pointer_to(typename conditional<is_void<element_type>::value, | |
| 1006 | __nat, element_type>::type& __r) _NOEXCEPT | |
| 1007 | {return _VSTD::addressof(__r);} | |
| 1008 | }; | |
| 1009 | ||
| 1010 | template <class _From, class _To> | |
| 1011 | struct __rebind_pointer { | |
| 1012 | #ifndef _LIBCPP_CXX03_LANG | |
| 1013 | typedef typename pointer_traits<_From>::template rebind<_To> type; | |
| 1014 | #else | |
| 1015 | typedef typename pointer_traits<_From>::template rebind<_To>::other type; | |
| 1016 | #endif | |
| 1017 | }; | |
| 1018 | ||
| 1019 | // allocator_traits | |
| 1020 | ||
| 1021 | template <class _Tp, class = void> | |
| 1022 | struct __has_pointer_type : false_type {}; | |
| 1023 | ||
| 1024 | template <class _Tp> | |
| 1025 | struct __has_pointer_type<_Tp, | |
| 1026 | typename __void_t<typename _Tp::pointer>::type> : true_type {}; | |
| 1027 | ||
| 1028 | namespace __pointer_type_imp | |
| 1029 | { | |
| 1030 | ||
| 1031 | template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value> | |
| 1032 | struct __pointer_type | |
| 1033 | { | |
| 1034 | typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type; | |
| 1035 | }; | |
| 1036 | ||
| 1037 | template <class _Tp, class _Dp> | |
| 1038 | struct __pointer_type<_Tp, _Dp, false> | |
| 1039 | { | |
| 1040 | typedef _LIBCPP_NODEBUG_TYPE _Tp* type; | |
| 1041 | }; | |
| 1042 | ||
| 1043 | } // __pointer_type_imp | |
| 1044 | ||
| 1045 | template <class _Tp, class _Dp> | |
| 1046 | struct __pointer_type | |
| 1047 | { | |
| 1048 | typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type; | |
| 1049 | }; | |
| 1050 | ||
| 1051 | template <class _Tp, class = void> | |
| 1052 | struct __has_const_pointer : false_type {}; | |
| 1053 | ||
| 1054 | template <class _Tp> | |
| 1055 | struct __has_const_pointer<_Tp, | |
| 1056 | typename __void_t<typename _Tp::const_pointer>::type> : true_type {}; | |
| 1057 | ||
| 1058 | template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value> | |
| 1059 | struct __const_pointer | |
| 1060 | { | |
| 1061 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type; | |
| 1062 | }; | |
| 1063 | ||
| 1064 | template <class _Tp, class _Ptr, class _Alloc> | |
| 1065 | struct __const_pointer<_Tp, _Ptr, _Alloc, false> | |
| 1066 | { | |
| 1067 | #ifndef _LIBCPP_CXX03_LANG | |
| 1068 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type; | |
| 1069 | #else | |
| 1070 | typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type; | |
| 1071 | #endif | |
| 1072 | }; | |
| 1073 | ||
| 1074 | template <class _Tp, class = void> | |
| 1075 | struct __has_void_pointer : false_type {}; | |
| 1076 | ||
| 1077 | template <class _Tp> | |
| 1078 | struct __has_void_pointer<_Tp, | |
| 1079 | typename __void_t<typename _Tp::void_pointer>::type> : true_type {}; | |
| 1080 | ||
| 1081 | template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value> | |
| 1082 | struct __void_pointer | |
| 1083 | { | |
| 1084 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type; | |
| 1085 | }; | |
| 1086 | ||
| 1087 | template <class _Ptr, class _Alloc> | |
| 1088 | struct __void_pointer<_Ptr, _Alloc, false> | |
| 1089 | { | |
| 1090 | #ifndef _LIBCPP_CXX03_LANG | |
| 1091 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type; | |
| 1092 | #else | |
| 1093 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type; | |
| 1094 | #endif | |
| 1095 | }; | |
| 1096 | ||
| 1097 | template <class _Tp, class = void> | |
| 1098 | struct __has_const_void_pointer : false_type {}; | |
| 1099 | ||
| 1100 | template <class _Tp> | |
| 1101 | struct __has_const_void_pointer<_Tp, | |
| 1102 | typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {}; | |
| 1103 | ||
| 1104 | template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value> | |
| 1105 | struct __const_void_pointer | |
| 1106 | { | |
| 1107 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type; | |
| 1108 | }; | |
| 1109 | ||
| 1110 | template <class _Ptr, class _Alloc> | |
| 1111 | struct __const_void_pointer<_Ptr, _Alloc, false> | |
| 1112 | { | |
| 1113 | #ifndef _LIBCPP_CXX03_LANG | |
| 1114 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type; | |
| 1115 | #else | |
| 1116 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type; | |
| 1117 | #endif | |
| 1118 | }; | |
| 1119 | ||
| 1120 | ||
| 1121 | 725 | template <bool _UsePointerTraits> struct __to_address_helper; |
| 1122 | 726 | |
| 1123 | 727 | template <> struct __to_address_helper<true> { |
| 1124 | 728 | template <class _Pointer> |
| 1125 | using __return_type = decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())); | |
| 729 | using __return_type = decltype(pointer_traits<_Pointer>::to_address(_VSTD::declval<const _Pointer&>())); | |
| 1126 | 730 | |
| 1127 | 731 | template <class _Pointer> |
| 1128 | 732 | _LIBCPP_CONSTEXPR |
| ... | ... | @@ -1157,7 +761,7 @@ template <> struct __to_address_helper<false> { |
| 1157 | 761 | template <class _Pointer> |
| 1158 | 762 | _LIBCPP_CONSTEXPR |
| 1159 | 763 | static __return_type<_Pointer> |
| 1160 | __do_it(const _Pointer &__p) _NOEXCEPT { return std::__to_address(__p.operator->()); } | |
| 764 | __do_it(const _Pointer &__p) _NOEXCEPT { return _VSTD::__to_address(__p.operator->()); } | |
| 1161 | 765 | }; |
| 1162 | 766 | |
| 1163 | 767 | |
| ... | ... | @@ -1172,7 +776,7 @@ to_address(_Tp* __p) _NOEXCEPT |
| 1172 | 776 | } |
| 1173 | 777 | |
| 1174 | 778 | template <class _Pointer> |
| 1175 | inline _LIBCPP_INLINE_VISIBILITY | |
| 779 | inline _LIBCPP_INLINE_VISIBILITY constexpr | |
| 1176 | 780 | auto |
| 1177 | 781 | to_address(const _Pointer& __p) _NOEXCEPT |
| 1178 | 782 | { |
| ... | ... | @@ -1180,635 +784,112 @@ to_address(const _Pointer& __p) _NOEXCEPT |
| 1180 | 784 | } |
| 1181 | 785 | #endif |
| 1182 | 786 | |
| 1183 | template <class _Tp, class = void> | |
| 1184 | struct __has_size_type : false_type {}; | |
| 1185 | ||
| 1186 | template <class _Tp> | |
| 1187 | struct __has_size_type<_Tp, | |
| 1188 | typename __void_t<typename _Tp::size_type>::type> : true_type {}; | |
| 787 | template <class _Tp> class allocator; | |
| 1189 | 788 | |
| 1190 | template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value> | |
| 1191 | struct __size_type | |
| 789 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 790 | template <> | |
| 791 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void> | |
| 1192 | 792 | { |
| 1193 | typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type; | |
| 1194 | }; | |
| 793 | public: | |
| 794 | typedef void* pointer; | |
| 795 | typedef const void* const_pointer; | |
| 796 | typedef void value_type; | |
| 1195 | 797 | |
| 1196 | template <class _Alloc, class _DiffType> | |
| 1197 | struct __size_type<_Alloc, _DiffType, true> | |
| 1198 | { | |
| 1199 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type; | |
| 798 | template <class _Up> struct rebind {typedef allocator<_Up> other;}; | |
| 1200 | 799 | }; |
| 1201 | 800 | |
| 1202 | template <class _Tp, class = void> | |
| 1203 | struct __has_propagate_on_container_copy_assignment : false_type {}; | |
| 1204 | ||
| 1205 | template <class _Tp> | |
| 1206 | struct __has_propagate_on_container_copy_assignment<_Tp, | |
| 1207 | typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type> | |
| 1208 | : true_type {}; | |
| 1209 | ||
| 1210 | template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value> | |
| 1211 | struct __propagate_on_container_copy_assignment | |
| 801 | template <> | |
| 802 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void> | |
| 1212 | 803 | { |
| 1213 | typedef _LIBCPP_NODEBUG_TYPE false_type type; | |
| 1214 | }; | |
| 804 | public: | |
| 805 | typedef const void* pointer; | |
| 806 | typedef const void* const_pointer; | |
| 807 | typedef const void value_type; | |
| 1215 | 808 | |
| 1216 | template <class _Alloc> | |
| 1217 | struct __propagate_on_container_copy_assignment<_Alloc, true> | |
| 1218 | { | |
| 1219 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type; | |
| 809 | template <class _Up> struct rebind {typedef allocator<_Up> other;}; | |
| 1220 | 810 | }; |
| 811 | #endif | |
| 1221 | 812 | |
| 1222 | template <class _Tp, class = void> | |
| 1223 | struct __has_propagate_on_container_move_assignment : false_type {}; | |
| 813 | // allocator | |
| 1224 | 814 | |
| 1225 | 815 | template <class _Tp> |
| 1226 | struct __has_propagate_on_container_move_assignment<_Tp, | |
| 1227 | typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type> | |
| 1228 | : true_type {}; | |
| 1229 | ||
| 1230 | template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value> | |
| 1231 | struct __propagate_on_container_move_assignment | |
| 816 | class _LIBCPP_TEMPLATE_VIS allocator | |
| 1232 | 817 | { |
| 1233 | typedef false_type type; | |
| 1234 | }; | |
| 1235 | ||
| 1236 | template <class _Alloc> | |
| 1237 | struct __propagate_on_container_move_assignment<_Alloc, true> | |
| 1238 | { | |
| 1239 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type; | |
| 1240 | }; | |
| 1241 | ||
| 1242 | template <class _Tp, class = void> | |
| 1243 | struct __has_propagate_on_container_swap : false_type {}; | |
| 1244 | ||
| 1245 | template <class _Tp> | |
| 1246 | struct __has_propagate_on_container_swap<_Tp, | |
| 1247 | typename __void_t<typename _Tp::propagate_on_container_swap>::type> | |
| 1248 | : true_type {}; | |
| 1249 | ||
| 1250 | template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value> | |
| 1251 | struct __propagate_on_container_swap | |
| 1252 | { | |
| 1253 | typedef false_type type; | |
| 1254 | }; | |
| 1255 | ||
| 1256 | template <class _Alloc> | |
| 1257 | struct __propagate_on_container_swap<_Alloc, true> | |
| 1258 | { | |
| 1259 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type; | |
| 1260 | }; | |
| 1261 | ||
| 1262 | template <class _Tp, class = void> | |
| 1263 | struct __has_is_always_equal : false_type {}; | |
| 1264 | ||
| 1265 | template <class _Tp> | |
| 1266 | struct __has_is_always_equal<_Tp, | |
| 1267 | typename __void_t<typename _Tp::is_always_equal>::type> | |
| 1268 | : true_type {}; | |
| 1269 | ||
| 1270 | template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value> | |
| 1271 | struct __is_always_equal | |
| 1272 | { | |
| 1273 | typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type; | |
| 1274 | }; | |
| 1275 | ||
| 1276 | template <class _Alloc> | |
| 1277 | struct __is_always_equal<_Alloc, true> | |
| 1278 | { | |
| 1279 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type; | |
| 1280 | }; | |
| 1281 | ||
| 1282 | template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> | |
| 1283 | struct __has_rebind_other | |
| 1284 | { | |
| 1285 | private: | |
| 1286 | struct __two {char __lx; char __lxx;}; | |
| 1287 | template <class _Xp> static __two __test(...); | |
| 1288 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1289 | template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0); | |
| 1290 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1291 | 818 | public: |
| 1292 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | |
| 1293 | }; | |
| 1294 | ||
| 1295 | template <class _Tp, class _Up> | |
| 1296 | struct __has_rebind_other<_Tp, _Up, false> | |
| 1297 | { | |
| 1298 | static const bool value = false; | |
| 1299 | }; | |
| 1300 | ||
| 1301 | template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value> | |
| 1302 | struct __allocator_traits_rebind | |
| 1303 | { | |
| 1304 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1305 | typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type; | |
| 1306 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1307 | }; | |
| 1308 | ||
| 1309 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> | |
| 1310 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> | |
| 1311 | { | |
| 1312 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1313 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type; | |
| 1314 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1315 | }; | |
| 1316 | ||
| 1317 | template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> | |
| 1318 | struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> | |
| 1319 | { | |
| 1320 | typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type; | |
| 1321 | }; | |
| 1322 | ||
| 1323 | #ifndef _LIBCPP_CXX03_LANG | |
| 1324 | ||
| 1325 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1326 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 1327 | auto | |
| 1328 | __has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) | |
| 1329 | -> decltype((void)__a.allocate(__sz, __p), true_type()); | |
| 1330 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1331 | ||
| 1332 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 1333 | auto | |
| 1334 | __has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) | |
| 1335 | -> false_type; | |
| 1336 | ||
| 1337 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 1338 | struct __has_allocate_hint | |
| 1339 | : decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(), | |
| 1340 | declval<_SizeType>(), | |
| 1341 | declval<_ConstVoidPtr>())) | |
| 1342 | { | |
| 1343 | }; | |
| 1344 | ||
| 1345 | #else // _LIBCPP_CXX03_LANG | |
| 1346 | ||
| 1347 | template <class _Alloc, class _SizeType, class _ConstVoidPtr> | |
| 1348 | struct __has_allocate_hint | |
| 1349 | : true_type | |
| 1350 | { | |
| 1351 | }; | |
| 1352 | ||
| 1353 | #endif // _LIBCPP_CXX03_LANG | |
| 1354 | ||
| 1355 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1356 | template <class _Alloc, class ..._Args, | |
| 1357 | class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))> | |
| 1358 | static true_type __test_has_construct(int); | |
| 1359 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1360 | ||
| 1361 | template <class _Alloc, class...> | |
| 1362 | static false_type __test_has_construct(...); | |
| 1363 | ||
| 1364 | template <class _Alloc, class ..._Args> | |
| 1365 | struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {}; | |
| 1366 | ||
| 1367 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 1368 | ||
| 1369 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1370 | template <class _Alloc, class _Pointer> | |
| 1371 | auto | |
| 1372 | __has_destroy_test(_Alloc&& __a, _Pointer&& __p) | |
| 1373 | -> decltype(__a.destroy(__p), true_type()); | |
| 1374 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1375 | ||
| 1376 | template <class _Alloc, class _Pointer> | |
| 1377 | auto | |
| 1378 | __has_destroy_test(const _Alloc& __a, _Pointer&& __p) | |
| 1379 | -> false_type; | |
| 1380 | ||
| 1381 | template <class _Alloc, class _Pointer> | |
| 1382 | struct __has_destroy | |
| 1383 | : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(), | |
| 1384 | declval<_Pointer>())) | |
| 1385 | { | |
| 1386 | }; | |
| 1387 | ||
| 1388 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1389 | template <class _Alloc> | |
| 1390 | auto | |
| 1391 | __has_max_size_test(_Alloc&& __a) | |
| 1392 | -> decltype(__a.max_size(), true_type()); | |
| 1393 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1394 | ||
| 1395 | template <class _Alloc> | |
| 1396 | auto | |
| 1397 | __has_max_size_test(const volatile _Alloc& __a) | |
| 1398 | -> false_type; | |
| 1399 | ||
| 1400 | template <class _Alloc> | |
| 1401 | struct __has_max_size | |
| 1402 | : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>())) | |
| 1403 | { | |
| 1404 | }; | |
| 1405 | ||
| 1406 | template <class _Alloc> | |
| 1407 | auto | |
| 1408 | __has_select_on_container_copy_construction_test(_Alloc&& __a) | |
| 1409 | -> decltype(__a.select_on_container_copy_construction(), true_type()); | |
| 1410 | ||
| 1411 | template <class _Alloc> | |
| 1412 | auto | |
| 1413 | __has_select_on_container_copy_construction_test(const volatile _Alloc& __a) | |
| 1414 | -> false_type; | |
| 1415 | ||
| 1416 | template <class _Alloc> | |
| 1417 | struct __has_select_on_container_copy_construction | |
| 1418 | : decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>())) | |
| 1419 | { | |
| 1420 | }; | |
| 1421 | ||
| 1422 | #else // _LIBCPP_CXX03_LANG | |
| 1423 | ||
| 1424 | template <class _Alloc, class _Pointer, class = void> | |
| 1425 | struct __has_destroy : false_type {}; | |
| 1426 | ||
| 1427 | template <class _Alloc, class _Pointer> | |
| 1428 | struct __has_destroy<_Alloc, _Pointer, typename __void_t< | |
| 1429 | decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>())) | |
| 1430 | >::type> : std::true_type {}; | |
| 1431 | ||
| 1432 | template <class _Alloc> | |
| 1433 | struct __has_max_size | |
| 1434 | : true_type | |
| 1435 | { | |
| 1436 | }; | |
| 1437 | ||
| 1438 | template <class _Alloc> | |
| 1439 | struct __has_select_on_container_copy_construction | |
| 1440 | : false_type | |
| 1441 | { | |
| 1442 | }; | |
| 1443 | ||
| 1444 | #endif // _LIBCPP_CXX03_LANG | |
| 1445 | ||
| 1446 | template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value> | |
| 1447 | struct __alloc_traits_difference_type | |
| 1448 | { | |
| 1449 | typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type; | |
| 1450 | }; | |
| 819 | typedef size_t size_type; | |
| 820 | typedef ptrdiff_t difference_type; | |
| 821 | typedef _Tp value_type; | |
| 822 | typedef true_type propagate_on_container_move_assignment; | |
| 823 | typedef true_type is_always_equal; | |
| 1451 | 824 | |
| 1452 | template <class _Alloc, class _Ptr> | |
| 1453 | struct __alloc_traits_difference_type<_Alloc, _Ptr, true> | |
| 1454 | { | |
| 1455 | typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type; | |
| 1456 | }; | |
| 1457 | ||
| 1458 | template <class _Tp> | |
| 1459 | struct __is_default_allocator : false_type {}; | |
| 1460 | ||
| 1461 | template <class _Tp> | |
| 1462 | struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {}; | |
| 1463 | ||
| 1464 | ||
| 1465 | ||
| 1466 | template <class _Alloc, | |
| 1467 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value | |
| 1468 | > | |
| 1469 | struct __is_cpp17_move_insertable; | |
| 1470 | template <class _Alloc> | |
| 1471 | struct __is_cpp17_move_insertable<_Alloc, true> : std::true_type {}; | |
| 1472 | template <class _Alloc> | |
| 1473 | struct __is_cpp17_move_insertable<_Alloc, false> : std::is_move_constructible<typename _Alloc::value_type> {}; | |
| 1474 | ||
| 1475 | template <class _Alloc, | |
| 1476 | bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value | |
| 1477 | > | |
| 1478 | struct __is_cpp17_copy_insertable; | |
| 1479 | template <class _Alloc> | |
| 1480 | struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {}; | |
| 1481 | template <class _Alloc> | |
| 1482 | struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool, | |
| 1483 | std::is_copy_constructible<typename _Alloc::value_type>::value && | |
| 1484 | __is_cpp17_move_insertable<_Alloc>::value> | |
| 1485 | {}; | |
| 1486 | ||
| 1487 | ||
| 1488 | ||
| 1489 | template <class _Alloc> | |
| 1490 | struct _LIBCPP_TEMPLATE_VIS allocator_traits | |
| 1491 | { | |
| 1492 | typedef _Alloc allocator_type; | |
| 1493 | typedef typename allocator_type::value_type value_type; | |
| 1494 | ||
| 1495 | typedef typename __pointer_type<value_type, allocator_type>::type pointer; | |
| 1496 | typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer; | |
| 1497 | typedef typename __void_pointer<pointer, allocator_type>::type void_pointer; | |
| 1498 | typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer; | |
| 1499 | ||
| 1500 | typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type; | |
| 1501 | typedef typename __size_type<allocator_type, difference_type>::type size_type; | |
| 1502 | ||
| 1503 | typedef typename __propagate_on_container_copy_assignment<allocator_type>::type | |
| 1504 | propagate_on_container_copy_assignment; | |
| 1505 | typedef typename __propagate_on_container_move_assignment<allocator_type>::type | |
| 1506 | propagate_on_container_move_assignment; | |
| 1507 | typedef typename __propagate_on_container_swap<allocator_type>::type | |
| 1508 | propagate_on_container_swap; | |
| 1509 | typedef typename __is_always_equal<allocator_type>::type | |
| 1510 | is_always_equal; | |
| 1511 | ||
| 1512 | #ifndef _LIBCPP_CXX03_LANG | |
| 1513 | template <class _Tp> using rebind_alloc = | |
| 1514 | typename __allocator_traits_rebind<allocator_type, _Tp>::type; | |
| 1515 | template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >; | |
| 1516 | #else // _LIBCPP_CXX03_LANG | |
| 1517 | template <class _Tp> struct rebind_alloc | |
| 1518 | {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;}; | |
| 1519 | template <class _Tp> struct rebind_traits | |
| 1520 | {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;}; | |
| 1521 | #endif // _LIBCPP_CXX03_LANG | |
| 1522 | ||
| 1523 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1524 | static pointer allocate(allocator_type& __a, size_type __n) | |
| 1525 | {return __a.allocate(__n);} | |
| 1526 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1527 | static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) | |
| 1528 | {return __allocate(__a, __n, __hint, | |
| 1529 | __has_allocate_hint<allocator_type, size_type, const_void_pointer>());} | |
| 1530 | ||
| 1531 | _LIBCPP_INLINE_VISIBILITY | |
| 1532 | static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT | |
| 1533 | {__a.deallocate(__p, __n);} | |
| 1534 | ||
| 1535 | template <class _Tp, class... _Args> | |
| 1536 | _LIBCPP_INLINE_VISIBILITY | |
| 1537 | static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) | |
| 1538 | {__construct(__has_construct<allocator_type, _Tp*, _Args...>(), | |
| 1539 | __a, __p, _VSTD::forward<_Args>(__args)...);} | |
| 1540 | ||
| 1541 | template <class _Tp> | |
| 1542 | _LIBCPP_INLINE_VISIBILITY | |
| 1543 | static void destroy(allocator_type& __a, _Tp* __p) | |
| 1544 | {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);} | |
| 1545 | ||
| 1546 | _LIBCPP_INLINE_VISIBILITY | |
| 1547 | static size_type max_size(const allocator_type& __a) _NOEXCEPT | |
| 1548 | {return __max_size(__has_max_size<const allocator_type>(), __a);} | |
| 1549 | ||
| 1550 | _LIBCPP_INLINE_VISIBILITY | |
| 1551 | static allocator_type | |
| 1552 | select_on_container_copy_construction(const allocator_type& __a) | |
| 1553 | {return __select_on_container_copy_construction( | |
| 1554 | __has_select_on_container_copy_construction<const allocator_type>(), | |
| 1555 | __a);} | |
| 1556 | ||
| 1557 | template <class _Ptr> | |
| 1558 | _LIBCPP_INLINE_VISIBILITY | |
| 1559 | static | |
| 1560 | void | |
| 1561 | __construct_forward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) | |
| 1562 | { | |
| 1563 | static_assert(__is_cpp17_move_insertable<allocator_type>::value, | |
| 1564 | "The specified type does not meet the requirements of Cpp17MoveInsertible"); | |
| 1565 | for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) | |
| 1566 | construct(__a, _VSTD::__to_address(__begin2), | |
| 1567 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1568 | _VSTD::move(*__begin1) | |
| 1569 | #else | |
| 1570 | _VSTD::move_if_noexcept(*__begin1) | |
| 1571 | #endif | |
| 1572 | ); | |
| 1573 | } | |
| 1574 | ||
| 1575 | template <class _Tp> | |
| 1576 | _LIBCPP_INLINE_VISIBILITY | |
| 1577 | static | |
| 1578 | typename enable_if | |
| 1579 | < | |
| 1580 | (__is_default_allocator<allocator_type>::value | |
| 1581 | || !__has_construct<allocator_type, _Tp*, _Tp>::value) && | |
| 1582 | is_trivially_move_constructible<_Tp>::value, | |
| 1583 | void | |
| 1584 | >::type | |
| 1585 | __construct_forward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) | |
| 1586 | { | |
| 1587 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1588 | if (_Np > 0) | |
| 1589 | { | |
| 1590 | _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); | |
| 1591 | __begin2 += _Np; | |
| 1592 | } | |
| 1593 | } | |
| 1594 | ||
| 1595 | template <class _Iter, class _Ptr> | |
| 1596 | _LIBCPP_INLINE_VISIBILITY | |
| 1597 | static | |
| 1598 | void | |
| 1599 | __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) | |
| 1600 | { | |
| 1601 | for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) | |
| 1602 | construct(__a, _VSTD::__to_address(__begin2), *__begin1); | |
| 1603 | } | |
| 1604 | ||
| 1605 | template <class _SourceTp, class _DestTp, | |
| 1606 | class _RawSourceTp = typename remove_const<_SourceTp>::type, | |
| 1607 | class _RawDestTp = typename remove_const<_DestTp>::type> | |
| 1608 | _LIBCPP_INLINE_VISIBILITY | |
| 1609 | static | |
| 1610 | typename enable_if | |
| 1611 | < | |
| 1612 | is_trivially_copy_constructible<_DestTp>::value && | |
| 1613 | is_same<_RawSourceTp, _RawDestTp>::value && | |
| 1614 | (__is_default_allocator<allocator_type>::value || | |
| 1615 | !__has_construct<allocator_type, _DestTp*, _SourceTp&>::value), | |
| 1616 | void | |
| 1617 | >::type | |
| 1618 | __construct_range_forward(allocator_type&, _SourceTp* __begin1, _SourceTp* __end1, _DestTp*& __begin2) | |
| 1619 | { | |
| 1620 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1621 | if (_Np > 0) | |
| 1622 | { | |
| 1623 | _VSTD::memcpy(const_cast<_RawDestTp*>(__begin2), __begin1, _Np * sizeof(_DestTp)); | |
| 1624 | __begin2 += _Np; | |
| 1625 | } | |
| 1626 | } | |
| 825 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 826 | allocator() _NOEXCEPT { } | |
| 1627 | 827 | |
| 1628 | template <class _Ptr> | |
| 1629 | _LIBCPP_INLINE_VISIBILITY | |
| 1630 | static | |
| 1631 | void | |
| 1632 | __construct_backward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) | |
| 1633 | { | |
| 1634 | static_assert(__is_cpp17_move_insertable<allocator_type>::value, | |
| 1635 | "The specified type does not meet the requirements of Cpp17MoveInsertable"); | |
| 1636 | while (__end1 != __begin1) | |
| 1637 | { | |
| 1638 | construct(__a, _VSTD::__to_address(__end2 - 1), | |
| 1639 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1640 | _VSTD::move(*--__end1) | |
| 1641 | #else | |
| 1642 | _VSTD::move_if_noexcept(*--__end1) | |
| 1643 | #endif | |
| 1644 | ); | |
| 1645 | --__end2; | |
| 1646 | } | |
| 1647 | } | |
| 828 | template <class _Up> | |
| 829 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 830 | allocator(const allocator<_Up>&) _NOEXCEPT { } | |
| 1648 | 831 | |
| 1649 | template <class _Tp> | |
| 1650 | _LIBCPP_INLINE_VISIBILITY | |
| 1651 | static | |
| 1652 | typename enable_if | |
| 1653 | < | |
| 1654 | (__is_default_allocator<allocator_type>::value | |
| 1655 | || !__has_construct<allocator_type, _Tp*, _Tp>::value) && | |
| 1656 | is_trivially_move_constructible<_Tp>::value, | |
| 1657 | void | |
| 1658 | >::type | |
| 1659 | __construct_backward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) | |
| 1660 | { | |
| 1661 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1662 | __end2 -= _Np; | |
| 1663 | if (_Np > 0) | |
| 1664 | _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp)); | |
| 832 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 833 | _Tp* allocate(size_t __n) { | |
| 834 | if (__n > allocator_traits<allocator>::max_size(*this)) | |
| 835 | __throw_length_error("allocator<T>::allocate(size_t n)" | |
| 836 | " 'n' exceeds maximum supported size"); | |
| 837 | if (__libcpp_is_constant_evaluated()) { | |
| 838 | return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); | |
| 839 | } else { | |
| 840 | return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); | |
| 1665 | 841 | } |
| 842 | } | |
| 1666 | 843 | |
| 1667 | private: | |
| 1668 | ||
| 1669 | _LIBCPP_INLINE_VISIBILITY | |
| 1670 | static pointer __allocate(allocator_type& __a, size_type __n, | |
| 1671 | const_void_pointer __hint, true_type) | |
| 1672 | { | |
| 1673 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1674 | return __a.allocate(__n, __hint); | |
| 1675 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 844 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 845 | void deallocate(_Tp* __p, size_t __n) _NOEXCEPT { | |
| 846 | if (__libcpp_is_constant_evaluated()) { | |
| 847 | ::operator delete(__p); | |
| 848 | } else { | |
| 849 | _VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 1676 | 850 | } |
| 1677 | _LIBCPP_INLINE_VISIBILITY | |
| 1678 | static pointer __allocate(allocator_type& __a, size_type __n, | |
| 1679 | const_void_pointer, false_type) | |
| 1680 | {return __a.allocate(__n);} | |
| 1681 | ||
| 1682 | template <class _Tp, class... _Args> | |
| 1683 | _LIBCPP_INLINE_VISIBILITY | |
| 1684 | static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args) | |
| 1685 | { | |
| 1686 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1687 | __a.construct(__p, _VSTD::forward<_Args>(__args)...); | |
| 1688 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1689 | } | |
| 1690 | ||
| 1691 | template <class _Tp, class... _Args> | |
| 1692 | _LIBCPP_INLINE_VISIBILITY | |
| 1693 | static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args) | |
| 1694 | { | |
| 1695 | ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...); | |
| 1696 | } | |
| 1697 | ||
| 1698 | template <class _Tp> | |
| 1699 | _LIBCPP_INLINE_VISIBILITY | |
| 1700 | static void __destroy(true_type, allocator_type& __a, _Tp* __p) | |
| 1701 | { | |
| 1702 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1703 | __a.destroy(__p); | |
| 1704 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1705 | } | |
| 1706 | template <class _Tp> | |
| 1707 | _LIBCPP_INLINE_VISIBILITY | |
| 1708 | static void __destroy(false_type, allocator_type&, _Tp* __p) | |
| 1709 | { | |
| 1710 | __p->~_Tp(); | |
| 1711 | } | |
| 1712 | ||
| 1713 | _LIBCPP_INLINE_VISIBILITY | |
| 1714 | static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT | |
| 1715 | { | |
| 1716 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 1717 | return __a.max_size(); | |
| 1718 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 1719 | } | |
| 1720 | ||
| 1721 | _LIBCPP_INLINE_VISIBILITY | |
| 1722 | static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT | |
| 1723 | {return numeric_limits<size_type>::max() / sizeof(value_type);} | |
| 1724 | ||
| 1725 | _LIBCPP_INLINE_VISIBILITY | |
| 1726 | static allocator_type | |
| 1727 | __select_on_container_copy_construction(true_type, const allocator_type& __a) | |
| 1728 | {return __a.select_on_container_copy_construction();} | |
| 1729 | _LIBCPP_INLINE_VISIBILITY | |
| 1730 | static allocator_type | |
| 1731 | __select_on_container_copy_construction(false_type, const allocator_type& __a) | |
| 1732 | {return __a;} | |
| 1733 | }; | |
| 1734 | ||
| 1735 | template <class _Traits, class _Tp> | |
| 1736 | struct __rebind_alloc_helper | |
| 1737 | { | |
| 1738 | #ifndef _LIBCPP_CXX03_LANG | |
| 1739 | typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type; | |
| 1740 | #else | |
| 1741 | typedef typename _Traits::template rebind_alloc<_Tp>::other type; | |
| 1742 | #endif | |
| 1743 | }; | |
| 1744 | ||
| 1745 | // allocator | |
| 851 | } | |
| 1746 | 852 | |
| 1747 | template <class _Tp> | |
| 1748 | class _LIBCPP_TEMPLATE_VIS allocator | |
| 1749 | { | |
| 1750 | public: | |
| 853 | // C++20 Removed members | |
| 1751 | 854 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) |
| 1752 | _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t size_type; | |
| 1753 | _LIBCPP_DEPRECATED_IN_CXX17 typedef ptrdiff_t difference_type; | |
| 1754 | 855 | _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer; |
| 1755 | 856 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; |
| 1756 | 857 | _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference; |
| 1757 | 858 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; |
| 1758 | 859 | |
| 1759 | template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; | |
| 1760 | #endif | |
| 1761 | ||
| 1762 | typedef _Tp value_type; | |
| 1763 | ||
| 1764 | typedef true_type propagate_on_container_move_assignment; | |
| 1765 | typedef true_type is_always_equal; | |
| 1766 | ||
| 1767 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1768 | allocator() _NOEXCEPT {} | |
| 1769 | ||
| 1770 | 860 | template <class _Up> |
| 1771 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1772 | allocator(const allocator<_Up>&) _NOEXCEPT {} | |
| 861 | struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { | |
| 862 | typedef allocator<_Up> other; | |
| 863 | }; | |
| 1773 | 864 | |
| 1774 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1775 | 865 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY |
| 1776 | pointer address(reference __x) const _NOEXCEPT | |
| 1777 | {return _VSTD::addressof(__x);} | |
| 866 | pointer address(reference __x) const _NOEXCEPT { | |
| 867 | return _VSTD::addressof(__x); | |
| 868 | } | |
| 1778 | 869 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY |
| 1779 | const_pointer address(const_reference __x) const _NOEXCEPT | |
| 1780 | {return _VSTD::addressof(__x);} | |
| 1781 | #endif | |
| 1782 | ||
| 1783 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _Tp* allocate(size_t __n) | |
| 1784 | { | |
| 1785 | // TODO(mpark): Replace with `allocator_traits<allocator>::max_size(*this)`. | |
| 1786 | if (__n > (size_t(~0) / sizeof(_Tp))) | |
| 1787 | __throw_length_error("allocator<T>::allocate(size_t n)" | |
| 1788 | " 'n' exceeds maximum supported size"); | |
| 1789 | return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); | |
| 1790 | } | |
| 870 | const_pointer address(const_reference __x) const _NOEXCEPT { | |
| 871 | return _VSTD::addressof(__x); | |
| 872 | } | |
| 1791 | 873 | |
| 1792 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1793 | 874 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 |
| 1794 | _Tp* allocate(size_t __n, const void*) { return allocate(__n); } | |
| 1795 | #endif | |
| 1796 | ||
| 1797 | _LIBCPP_INLINE_VISIBILITY void deallocate(_Tp* __p, size_t __n) _NOEXCEPT | |
| 1798 | {_VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));} | |
| 875 | _Tp* allocate(size_t __n, const void*) { | |
| 876 | return allocate(__n); | |
| 877 | } | |
| 1799 | 878 | |
| 1800 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1801 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT | |
| 1802 | {return size_type(~0) / sizeof(_Tp);} | |
| 879 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT { | |
| 880 | return size_type(~0) / sizeof(_Tp); | |
| 881 | } | |
| 1803 | 882 | |
| 1804 | 883 | template <class _Up, class... _Args> |
| 1805 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1806 | void | |
| 1807 | construct(_Up* __p, _Args&&... __args) | |
| 1808 | { | |
| 1809 | ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); | |
| 1810 | } | |
| 1811 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();} | |
| 884 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 885 | void construct(_Up* __p, _Args&&... __args) { | |
| 886 | ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); | |
| 887 | } | |
| 888 | ||
| 889 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 890 | void destroy(pointer __p) { | |
| 891 | __p->~_Tp(); | |
| 892 | } | |
| 1812 | 893 | #endif |
| 1813 | 894 | }; |
| 1814 | 895 | |
| ... | ... | @@ -1816,129 +897,174 @@ template <class _Tp> |
| 1816 | 897 | class _LIBCPP_TEMPLATE_VIS allocator<const _Tp> |
| 1817 | 898 | { |
| 1818 | 899 | public: |
| 1819 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1820 | _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t size_type; | |
| 1821 | _LIBCPP_DEPRECATED_IN_CXX17 typedef ptrdiff_t difference_type; | |
| 1822 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; | |
| 1823 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; | |
| 1824 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference; | |
| 1825 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; | |
| 1826 | ||
| 1827 | template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;}; | |
| 1828 | #endif | |
| 1829 | ||
| 1830 | typedef const _Tp value_type; | |
| 1831 | ||
| 1832 | typedef true_type propagate_on_container_move_assignment; | |
| 1833 | typedef true_type is_always_equal; | |
| 900 | typedef size_t size_type; | |
| 901 | typedef ptrdiff_t difference_type; | |
| 902 | typedef const _Tp value_type; | |
| 903 | typedef true_type propagate_on_container_move_assignment; | |
| 904 | typedef true_type is_always_equal; | |
| 1834 | 905 | |
| 1835 | 906 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 1836 | allocator() _NOEXCEPT {} | |
| 907 | allocator() _NOEXCEPT { } | |
| 1837 | 908 | |
| 1838 | 909 | template <class _Up> |
| 1839 | 910 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 |
| 1840 | allocator(const allocator<_Up>&) _NOEXCEPT {} | |
| 1841 | ||
| 1842 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1843 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1844 | const_pointer address(const_reference __x) const _NOEXCEPT | |
| 1845 | {return _VSTD::addressof(__x);} | |
| 1846 | #endif | |
| 911 | allocator(const allocator<_Up>&) _NOEXCEPT { } | |
| 1847 | 912 | |
| 1848 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const _Tp* allocate(size_t __n) | |
| 1849 | { | |
| 1850 | // TODO(mpark): Replace with `allocator_traits<allocator>::max_size(*this)`. | |
| 1851 | if (__n > (size_t(~0) / sizeof(_Tp))) | |
| 913 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 914 | const _Tp* allocate(size_t __n) { | |
| 915 | if (__n > allocator_traits<allocator>::max_size(*this)) | |
| 1852 | 916 | __throw_length_error("allocator<const T>::allocate(size_t n)" |
| 1853 | 917 | " 'n' exceeds maximum supported size"); |
| 1854 | return static_cast<const _Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); | |
| 918 | if (__libcpp_is_constant_evaluated()) { | |
| 919 | return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp))); | |
| 920 | } else { | |
| 921 | return static_cast<const _Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); | |
| 922 | } | |
| 923 | } | |
| 924 | ||
| 925 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 926 | void deallocate(const _Tp* __p, size_t __n) { | |
| 927 | if (__libcpp_is_constant_evaluated()) { | |
| 928 | ::operator delete(const_cast<_Tp*>(__p)); | |
| 929 | } else { | |
| 930 | _VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); | |
| 931 | } | |
| 1855 | 932 | } |
| 1856 | 933 | |
| 934 | // C++20 Removed members | |
| 1857 | 935 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) |
| 1858 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 | |
| 1859 | const _Tp* allocate(size_t __n, const void*) { return allocate(__n); } | |
| 1860 | #endif | |
| 936 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; | |
| 937 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; | |
| 938 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference; | |
| 939 | _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; | |
| 1861 | 940 | |
| 1862 | _LIBCPP_INLINE_VISIBILITY void deallocate(const _Tp* __p, size_t __n) | |
| 1863 | {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));} | |
| 941 | template <class _Up> | |
| 942 | struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { | |
| 943 | typedef allocator<_Up> other; | |
| 944 | }; | |
| 1864 | 945 | |
| 1865 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) | |
| 1866 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT | |
| 1867 | {return size_type(~0) / sizeof(_Tp);} | |
| 946 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 947 | const_pointer address(const_reference __x) const _NOEXCEPT { | |
| 948 | return _VSTD::addressof(__x); | |
| 949 | } | |
| 950 | ||
| 951 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 | |
| 952 | const _Tp* allocate(size_t __n, const void*) { | |
| 953 | return allocate(__n); | |
| 954 | } | |
| 955 | ||
| 956 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT { | |
| 957 | return size_type(~0) / sizeof(_Tp); | |
| 958 | } | |
| 1868 | 959 | |
| 1869 | #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) | |
| 1870 | 960 | template <class _Up, class... _Args> |
| 1871 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 1872 | void | |
| 1873 | construct(_Up* __p, _Args&&... __args) | |
| 1874 | { | |
| 1875 | ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); | |
| 1876 | } | |
| 1877 | #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) | |
| 1878 | _LIBCPP_INLINE_VISIBILITY | |
| 1879 | void | |
| 1880 | construct(pointer __p) | |
| 1881 | { | |
| 1882 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(); | |
| 1883 | } | |
| 1884 | # if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) | |
| 961 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 962 | void construct(_Up* __p, _Args&&... __args) { | |
| 963 | ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); | |
| 964 | } | |
| 1885 | 965 | |
| 1886 | template <class _A0> | |
| 1887 | _LIBCPP_INLINE_VISIBILITY | |
| 1888 | void | |
| 1889 | construct(pointer __p, _A0& __a0) | |
| 1890 | { | |
| 1891 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); | |
| 1892 | } | |
| 1893 | template <class _A0> | |
| 1894 | _LIBCPP_INLINE_VISIBILITY | |
| 1895 | void | |
| 1896 | construct(pointer __p, const _A0& __a0) | |
| 1897 | { | |
| 1898 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); | |
| 1899 | } | |
| 1900 | # endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) | |
| 1901 | template <class _A0, class _A1> | |
| 1902 | _LIBCPP_INLINE_VISIBILITY | |
| 1903 | void | |
| 1904 | construct(pointer __p, _A0& __a0, _A1& __a1) | |
| 1905 | { | |
| 1906 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); | |
| 1907 | } | |
| 1908 | template <class _A0, class _A1> | |
| 1909 | _LIBCPP_INLINE_VISIBILITY | |
| 1910 | void | |
| 1911 | construct(pointer __p, const _A0& __a0, _A1& __a1) | |
| 1912 | { | |
| 1913 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); | |
| 1914 | } | |
| 1915 | template <class _A0, class _A1> | |
| 1916 | _LIBCPP_INLINE_VISIBILITY | |
| 1917 | void | |
| 1918 | construct(pointer __p, _A0& __a0, const _A1& __a1) | |
| 1919 | { | |
| 1920 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); | |
| 1921 | } | |
| 1922 | template <class _A0, class _A1> | |
| 1923 | _LIBCPP_INLINE_VISIBILITY | |
| 1924 | void | |
| 1925 | construct(pointer __p, const _A0& __a0, const _A1& __a1) | |
| 1926 | { | |
| 1927 | ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); | |
| 1928 | } | |
| 1929 | #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) | |
| 1930 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();} | |
| 966 | _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY | |
| 967 | void destroy(pointer __p) { | |
| 968 | __p->~_Tp(); | |
| 969 | } | |
| 1931 | 970 | #endif |
| 1932 | 971 | }; |
| 1933 | 972 | |
| 1934 | 973 | template <class _Tp, class _Up> |
| 1935 | inline _LIBCPP_INLINE_VISIBILITY | |
| 974 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1936 | 975 | bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;} |
| 1937 | 976 | |
| 1938 | 977 | template <class _Tp, class _Up> |
| 1939 | inline _LIBCPP_INLINE_VISIBILITY | |
| 978 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1940 | 979 | bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;} |
| 1941 | 980 | |
| 981 | template <class _Alloc, class _Ptr> | |
| 982 | _LIBCPP_INLINE_VISIBILITY | |
| 983 | void __construct_forward_with_exception_guarantees(_Alloc& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) { | |
| 984 | static_assert(__is_cpp17_move_insertable<_Alloc>::value, | |
| 985 | "The specified type does not meet the requirements of Cpp17MoveInsertable"); | |
| 986 | typedef allocator_traits<_Alloc> _Traits; | |
| 987 | for (; __begin1 != __end1; ++__begin1, (void)++__begin2) { | |
| 988 | _Traits::construct(__a, _VSTD::__to_address(__begin2), | |
| 989 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 990 | _VSTD::move(*__begin1) | |
| 991 | #else | |
| 992 | _VSTD::move_if_noexcept(*__begin1) | |
| 993 | #endif | |
| 994 | ); | |
| 995 | } | |
| 996 | } | |
| 997 | ||
| 998 | template <class _Alloc, class _Tp, typename enable_if< | |
| 999 | (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Tp*, _Tp>::value) && | |
| 1000 | is_trivially_move_constructible<_Tp>::value | |
| 1001 | >::type> | |
| 1002 | _LIBCPP_INLINE_VISIBILITY | |
| 1003 | void __construct_forward_with_exception_guarantees(_Alloc&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) { | |
| 1004 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1005 | if (_Np > 0) { | |
| 1006 | _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); | |
| 1007 | __begin2 += _Np; | |
| 1008 | } | |
| 1009 | } | |
| 1010 | ||
| 1011 | template <class _Alloc, class _Iter, class _Ptr> | |
| 1012 | _LIBCPP_INLINE_VISIBILITY | |
| 1013 | void __construct_range_forward(_Alloc& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) { | |
| 1014 | typedef allocator_traits<_Alloc> _Traits; | |
| 1015 | for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) { | |
| 1016 | _Traits::construct(__a, _VSTD::__to_address(__begin2), *__begin1); | |
| 1017 | } | |
| 1018 | } | |
| 1019 | ||
| 1020 | template <class _Alloc, class _Source, class _Dest, | |
| 1021 | class _RawSource = typename remove_const<_Source>::type, | |
| 1022 | class _RawDest = typename remove_const<_Dest>::type, | |
| 1023 | class = | |
| 1024 | typename enable_if< | |
| 1025 | is_trivially_copy_constructible<_Dest>::value && | |
| 1026 | is_same<_RawSource, _RawDest>::value && | |
| 1027 | (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Dest*, _Source&>::value) | |
| 1028 | >::type> | |
| 1029 | _LIBCPP_INLINE_VISIBILITY | |
| 1030 | void __construct_range_forward(_Alloc&, _Source* __begin1, _Source* __end1, _Dest*& __begin2) { | |
| 1031 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1032 | if (_Np > 0) { | |
| 1033 | _VSTD::memcpy(const_cast<_RawDest*>(__begin2), __begin1, _Np * sizeof(_Dest)); | |
| 1034 | __begin2 += _Np; | |
| 1035 | } | |
| 1036 | } | |
| 1037 | ||
| 1038 | template <class _Alloc, class _Ptr> | |
| 1039 | _LIBCPP_INLINE_VISIBILITY | |
| 1040 | void __construct_backward_with_exception_guarantees(_Alloc& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) { | |
| 1041 | static_assert(__is_cpp17_move_insertable<_Alloc>::value, | |
| 1042 | "The specified type does not meet the requirements of Cpp17MoveInsertable"); | |
| 1043 | typedef allocator_traits<_Alloc> _Traits; | |
| 1044 | while (__end1 != __begin1) { | |
| 1045 | _Traits::construct(__a, _VSTD::__to_address(__end2 - 1), | |
| 1046 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 1047 | _VSTD::move(*--__end1) | |
| 1048 | #else | |
| 1049 | _VSTD::move_if_noexcept(*--__end1) | |
| 1050 | #endif | |
| 1051 | ); | |
| 1052 | --__end2; | |
| 1053 | } | |
| 1054 | } | |
| 1055 | ||
| 1056 | template <class _Alloc, class _Tp, class = typename enable_if< | |
| 1057 | (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Tp*, _Tp>::value) && | |
| 1058 | is_trivially_move_constructible<_Tp>::value | |
| 1059 | >::type> | |
| 1060 | _LIBCPP_INLINE_VISIBILITY | |
| 1061 | void __construct_backward_with_exception_guarantees(_Alloc&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) { | |
| 1062 | ptrdiff_t _Np = __end1 - __begin1; | |
| 1063 | __end2 -= _Np; | |
| 1064 | if (_Np > 0) | |
| 1065 | _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp)); | |
| 1066 | } | |
| 1067 | ||
| 1942 | 1068 | template <class _OutputIterator, class _Tp> |
| 1943 | 1069 | class _LIBCPP_TEMPLATE_VIS raw_storage_iterator |
| 1944 | 1070 | : public iterator<output_iterator_tag, |
| ... | ... | @@ -1953,10 +1079,10 @@ public: |
| 1953 | 1079 | _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} |
| 1954 | 1080 | _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;} |
| 1955 | 1081 | _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element) |
| 1956 | {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;} | |
| 1082 | {::new ((void*)_VSTD::addressof(*__x_)) _Tp(__element); return *this;} | |
| 1957 | 1083 | #if _LIBCPP_STD_VER >= 14 |
| 1958 | 1084 | _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element) |
| 1959 | {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;} | |
| 1085 | {::new ((void*)_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;} | |
| 1960 | 1086 | #endif |
| 1961 | 1087 | _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;} |
| 1962 | 1088 | _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) |
| ... | ... | @@ -1982,8 +1108,8 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT |
| 1982 | 1108 | #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) |
| 1983 | 1109 | if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) |
| 1984 | 1110 | { |
| 1985 | std::align_val_t __al = | |
| 1986 | std::align_val_t(std::alignment_of<_Tp>::value); | |
| 1111 | align_val_t __al = | |
| 1112 | align_val_t(alignment_of<_Tp>::value); | |
| 1987 | 1113 | __r.first = static_cast<_Tp*>(::operator new( |
| 1988 | 1114 | __n * sizeof(_Tp), __al, nothrow)); |
| 1989 | 1115 | } else { |
| ... | ... | @@ -2052,7 +1178,7 @@ public: |
| 2052 | 1178 | _LIBCPP_INLINE_VISIBILITY _Tp* release() _NOEXCEPT |
| 2053 | 1179 | { |
| 2054 | 1180 | _Tp* __t = __ptr_; |
| 2055 | __ptr_ = 0; | |
| 1181 | __ptr_ = nullptr; | |
| 2056 | 1182 | return __t; |
| 2057 | 1183 | } |
| 2058 | 1184 | _LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) _NOEXCEPT |
| ... | ... | @@ -2168,7 +1294,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, |
| 2168 | 1294 | // (The exception is std::function where it is possible that the function |
| 2169 | 1295 | // object and the allocator have the same type). |
| 2170 | 1296 | static_assert((!is_same<_T1, _T2>::value), |
| 2171 | "__compressed_pair cannot be instantated when T1 and T2 are the same type; " | |
| 1297 | "__compressed_pair cannot be instantiated when T1 and T2 are the same type; " | |
| 2172 | 1298 | "The current implementation is NOT ABI-compatible with the previous " |
| 2173 | 1299 | "implementation for this configuration"); |
| 2174 | 1300 | |
| ... | ... | @@ -2185,7 +1311,7 @@ public: |
| 2185 | 1311 | template <class _U1, class _U2> |
| 2186 | 1312 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR |
| 2187 | 1313 | __compressed_pair(_U1&& __t1, _U2&& __t2) |
| 2188 | : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} | |
| 1314 | : _Base1(_VSTD::forward<_U1>(__t1)), _Base2(_VSTD::forward<_U2>(__t2)) {} | |
| 2189 | 1315 | |
| 2190 | 1316 | #ifndef _LIBCPP_CXX03_LANG |
| 2191 | 1317 | template <class... _Args1, class... _Args2> |
| ... | ... | @@ -2223,7 +1349,7 @@ public: |
| 2223 | 1349 | _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && |
| 2224 | 1350 | __is_nothrow_swappable<_T2>::value) |
| 2225 | 1351 | { |
| 2226 | using std::swap; | |
| 1352 | using _VSTD::swap; | |
| 2227 | 1353 | swap(first(), __x.first()); |
| 2228 | 1354 | swap(second(), __x.second()); |
| 2229 | 1355 | } |
| ... | ... | @@ -2316,8 +1442,14 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> { |
| 2316 | 1442 | typedef false_type __enable_rval_overload; |
| 2317 | 1443 | }; |
| 2318 | 1444 | |
| 1445 | #if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI) | |
| 1446 | # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((trivial_abi)) | |
| 1447 | #else | |
| 1448 | # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI | |
| 1449 | #endif | |
| 1450 | ||
| 2319 | 1451 | template <class _Tp, class _Dp = default_delete<_Tp> > |
| 2320 | class _LIBCPP_TEMPLATE_VIS unique_ptr { | |
| 1452 | class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr { | |
| 2321 | 1453 | public: |
| 2322 | 1454 | typedef _Tp element_type; |
| 2323 | 1455 | typedef _Dp deleter_type; |
| ... | ... | @@ -2525,7 +1657,7 @@ public: |
| 2525 | 1657 | |
| 2526 | 1658 | |
| 2527 | 1659 | template <class _Tp, class _Dp> |
| 2528 | class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> { | |
| 1660 | class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> { | |
| 2529 | 1661 | public: |
| 2530 | 1662 | typedef _Tp element_type; |
| 2531 | 1663 | typedef _Dp deleter_type; |
| ... | ... | @@ -2987,7 +2119,7 @@ public: |
| 2987 | 2119 | : __size_(__s) {} |
| 2988 | 2120 | |
| 2989 | 2121 | template <class _Tp> |
| 2990 | _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT | |
| 2122 | _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT | |
| 2991 | 2123 | {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} |
| 2992 | 2124 | |
| 2993 | 2125 | template <class _Tp> |
| ... | ... | @@ -3029,7 +2161,7 @@ uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r) |
| 3029 | 2161 | { |
| 3030 | 2162 | #endif |
| 3031 | 2163 | for (; __f != __l; ++__f, (void) ++__r) |
| 3032 | ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f); | |
| 2164 | ::new ((void*)_VSTD::addressof(*__r)) value_type(*__f); | |
| 3033 | 2165 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3034 | 2166 | } |
| 3035 | 2167 | catch (...) |
| ... | ... | @@ -3053,7 +2185,7 @@ uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r) |
| 3053 | 2185 | { |
| 3054 | 2186 | #endif |
| 3055 | 2187 | for (; __n > 0; ++__f, (void) ++__r, (void) --__n) |
| 3056 | ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f); | |
| 2188 | ::new ((void*)_VSTD::addressof(*__r)) value_type(*__f); | |
| 3057 | 2189 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3058 | 2190 | } |
| 3059 | 2191 | catch (...) |
| ... | ... | @@ -3077,7 +2209,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x) |
| 3077 | 2209 | { |
| 3078 | 2210 | #endif |
| 3079 | 2211 | for (; __f != __l; ++__f) |
| 3080 | ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x); | |
| 2212 | ::new ((void*)_VSTD::addressof(*__f)) value_type(__x); | |
| 3081 | 2213 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3082 | 2214 | } |
| 3083 | 2215 | catch (...) |
| ... | ... | @@ -3100,7 +2232,7 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x) |
| 3100 | 2232 | { |
| 3101 | 2233 | #endif |
| 3102 | 2234 | for (; __n > 0; ++__f, (void) --__n) |
| 3103 | ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x); | |
| 2235 | ::new ((void*)_VSTD::addressof(*__f)) value_type(__x); | |
| 3104 | 2236 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3105 | 2237 | } |
| 3106 | 2238 | catch (...) |
| ... | ... | @@ -3115,22 +2247,15 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x) |
| 3115 | 2247 | |
| 3116 | 2248 | #if _LIBCPP_STD_VER > 14 |
| 3117 | 2249 | |
| 3118 | template <class _Tp> | |
| 3119 | inline _LIBCPP_INLINE_VISIBILITY | |
| 3120 | void destroy_at(_Tp* __loc) { | |
| 3121 | _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at"); | |
| 3122 | __loc->~_Tp(); | |
| 3123 | } | |
| 3124 | ||
| 3125 | 2250 | template <class _ForwardIterator> |
| 3126 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2251 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3127 | 2252 | void destroy(_ForwardIterator __first, _ForwardIterator __last) { |
| 3128 | 2253 | for (; __first != __last; ++__first) |
| 3129 | 2254 | _VSTD::destroy_at(_VSTD::addressof(*__first)); |
| 3130 | 2255 | } |
| 3131 | 2256 | |
| 3132 | 2257 | template <class _ForwardIterator, class _Size> |
| 3133 | inline _LIBCPP_INLINE_VISIBILITY | |
| 2258 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 3134 | 2259 | _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) { |
| 3135 | 2260 | for (; __n > 0; (void)++__first, --__n) |
| 3136 | 2261 | _VSTD::destroy_at(_VSTD::addressof(*__first)); |
| ... | ... | @@ -3146,7 +2271,7 @@ void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator |
| 3146 | 2271 | try { |
| 3147 | 2272 | #endif |
| 3148 | 2273 | for (; __idx != __last; ++__idx) |
| 3149 | ::new((void*)_VSTD::addressof(*__idx)) _Vt; | |
| 2274 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt; | |
| 3150 | 2275 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3151 | 2276 | } catch (...) { |
| 3152 | 2277 | _VSTD::destroy(__first, __idx); |
| ... | ... | @@ -3164,7 +2289,7 @@ _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Si |
| 3164 | 2289 | try { |
| 3165 | 2290 | #endif |
| 3166 | 2291 | for (; __n > 0; (void)++__idx, --__n) |
| 3167 | ::new((void*)_VSTD::addressof(*__idx)) _Vt; | |
| 2292 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt; | |
| 3168 | 2293 | return __idx; |
| 3169 | 2294 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3170 | 2295 | } catch (...) { |
| ... | ... | @@ -3184,7 +2309,7 @@ void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __ |
| 3184 | 2309 | try { |
| 3185 | 2310 | #endif |
| 3186 | 2311 | for (; __idx != __last; ++__idx) |
| 3187 | ::new((void*)_VSTD::addressof(*__idx)) _Vt(); | |
| 2312 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt(); | |
| 3188 | 2313 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3189 | 2314 | } catch (...) { |
| 3190 | 2315 | _VSTD::destroy(__first, __idx); |
| ... | ... | @@ -3202,7 +2327,7 @@ _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size |
| 3202 | 2327 | try { |
| 3203 | 2328 | #endif |
| 3204 | 2329 | for (; __n > 0; (void)++__idx, --__n) |
| 3205 | ::new((void*)_VSTD::addressof(*__idx)) _Vt(); | |
| 2330 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt(); | |
| 3206 | 2331 | return __idx; |
| 3207 | 2332 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3208 | 2333 | } catch (...) { |
| ... | ... | @@ -3222,7 +2347,7 @@ _ForwardIt uninitialized_move(_InputIt __first, _InputIt __last, _ForwardIt __fi |
| 3222 | 2347 | try { |
| 3223 | 2348 | #endif |
| 3224 | 2349 | for (; __first != __last; (void)++__idx, ++__first) |
| 3225 | ::new((void*)_VSTD::addressof(*__idx)) _Vt(std::move(*__first)); | |
| 2350 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); | |
| 3226 | 2351 | return __idx; |
| 3227 | 2352 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3228 | 2353 | } catch (...) { |
| ... | ... | @@ -3242,7 +2367,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) { |
| 3242 | 2367 | try { |
| 3243 | 2368 | #endif |
| 3244 | 2369 | for (; __n > 0; ++__idx, (void)++__first, --__n) |
| 3245 | ::new((void*)_VSTD::addressof(*__idx)) _Vt(std::move(*__first)); | |
| 2370 | ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); | |
| 3246 | 2371 | return {__first, __idx}; |
| 3247 | 2372 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3248 | 2373 | } catch (...) { |
| ... | ... | @@ -3389,13 +2514,7 @@ public: |
| 3389 | 2514 | long use_count() const _NOEXCEPT {return __shared_count::use_count();} |
| 3390 | 2515 | __shared_weak_count* lock() _NOEXCEPT; |
| 3391 | 2516 | |
| 3392 | // Define the function out only if we build static libc++ without RTTI. | |
| 3393 | // Otherwise we may break clients who need to compile their projects with | |
| 3394 | // -fno-rtti and yet link against a libc++.dylib compiled | |
| 3395 | // without -fno-rtti. | |
| 3396 | #if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) | |
| 3397 | 2517 | virtual const void* __get_deleter(const type_info&) const _NOEXCEPT; |
| 3398 | #endif | |
| 3399 | 2518 | private: |
| 3400 | 2519 | virtual void __on_zero_shared_weak() _NOEXCEPT = 0; |
| 3401 | 2520 | }; |
| ... | ... | @@ -3452,68 +2571,47 @@ __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT |
| 3452 | 2571 | } |
| 3453 | 2572 | |
| 3454 | 2573 | template <class _Tp, class _Alloc> |
| 3455 | class __shared_ptr_emplace | |
| 3456 | : public __shared_weak_count | |
| 2574 | struct __shared_ptr_emplace | |
| 2575 | : __shared_weak_count | |
| 3457 | 2576 | { |
| 3458 | __compressed_pair<_Alloc, _Tp> __data_; | |
| 3459 | public: | |
| 2577 | _LIBCPP_HIDE_FROM_ABI | |
| 2578 | explicit __shared_ptr_emplace(_Alloc __a) | |
| 2579 | : __data_(_VSTD::move(__a), __value_init_tag()) | |
| 2580 | { } | |
| 3460 | 2581 | |
| 3461 | _LIBCPP_INLINE_VISIBILITY | |
| 3462 | __shared_ptr_emplace(_Alloc __a) | |
| 3463 | : __data_(_VSTD::move(__a), __value_init_tag()) {} | |
| 3464 | ||
| 3465 | ||
| 3466 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 3467 | 2582 | template <class ..._Args> |
| 3468 | _LIBCPP_INLINE_VISIBILITY | |
| 3469 | __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) | |
| 3470 | : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), | |
| 3471 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {} | |
| 3472 | #else // _LIBCPP_HAS_NO_VARIADICS | |
| 3473 | ||
| 3474 | template <class _A0> | |
| 3475 | _LIBCPP_INLINE_VISIBILITY | |
| 3476 | __shared_ptr_emplace(_Alloc __a, _A0& __a0) | |
| 3477 | : __data_(__a, _Tp(__a0)) {} | |
| 3478 | ||
| 3479 | template <class _A0, class _A1> | |
| 3480 | _LIBCPP_INLINE_VISIBILITY | |
| 3481 | __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1) | |
| 3482 | : __data_(__a, _Tp(__a0, __a1)) {} | |
| 2583 | _LIBCPP_HIDE_FROM_ABI | |
| 2584 | explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) | |
| 2585 | #ifndef _LIBCPP_CXX03_LANG | |
| 2586 | : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), | |
| 2587 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) | |
| 2588 | #else | |
| 2589 | : __data_(__a, _Tp(_VSTD::forward<_Args>(__args)...)) | |
| 2590 | #endif | |
| 2591 | { } | |
| 3483 | 2592 | |
| 3484 | template <class _A0, class _A1, class _A2> | |
| 3485 | _LIBCPP_INLINE_VISIBILITY | |
| 3486 | __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1, _A2& __a2) | |
| 3487 | : __data_(__a, _Tp(__a0, __a1, __a2)) {} | |
| 2593 | _LIBCPP_HIDE_FROM_ABI | |
| 2594 | _Tp* __get_elem() _NOEXCEPT { return _VSTD::addressof(__data_.second()); } | |
| 3488 | 2595 | |
| 3489 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 2596 | _LIBCPP_HIDE_FROM_ABI | |
| 2597 | _Alloc* __get_alloc() _NOEXCEPT { return _VSTD::addressof(__data_.first()); } | |
| 3490 | 2598 | |
| 3491 | 2599 | private: |
| 3492 | virtual void __on_zero_shared() _NOEXCEPT; | |
| 3493 | virtual void __on_zero_shared_weak() _NOEXCEPT; | |
| 3494 | public: | |
| 3495 | _LIBCPP_INLINE_VISIBILITY | |
| 3496 | _Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());} | |
| 3497 | }; | |
| 2600 | virtual void __on_zero_shared() _NOEXCEPT { | |
| 2601 | __get_elem()->~_Tp(); | |
| 2602 | } | |
| 3498 | 2603 | |
| 3499 | template <class _Tp, class _Alloc> | |
| 3500 | void | |
| 3501 | __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared() _NOEXCEPT | |
| 3502 | { | |
| 3503 | __data_.second().~_Tp(); | |
| 3504 | } | |
| 2604 | virtual void __on_zero_shared_weak() _NOEXCEPT { | |
| 2605 | using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type; | |
| 2606 | using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer; | |
| 2607 | _ControlBlockAlloc __tmp(*__get_alloc()); | |
| 2608 | __get_alloc()->~_Alloc(); | |
| 2609 | allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, | |
| 2610 | pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1); | |
| 2611 | } | |
| 3505 | 2612 | |
| 3506 | template <class _Tp, class _Alloc> | |
| 3507 | void | |
| 3508 | __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT | |
| 3509 | { | |
| 3510 | typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al; | |
| 3511 | typedef allocator_traits<_Al> _ATraits; | |
| 3512 | typedef pointer_traits<typename _ATraits::pointer> _PTraits; | |
| 3513 | _Al __a(__data_.first()); | |
| 3514 | __data_.first().~_Alloc(); | |
| 3515 | __a.deallocate(_PTraits::pointer_to(*this), 1); | |
| 3516 | } | |
| 2613 | __compressed_pair<_Alloc, _Tp> __data_; | |
| 2614 | }; | |
| 3517 | 2615 | |
| 3518 | 2616 | struct __shared_ptr_dummy_rebind_allocator_type; |
| 3519 | 2617 | template <> |
| ... | ... | @@ -3537,8 +2635,14 @@ struct __compatible_with |
| 3537 | 2635 | : is_convertible<_Tp*, _Up*> {}; |
| 3538 | 2636 | #endif // _LIBCPP_STD_VER > 14 |
| 3539 | 2637 | |
| 2638 | #if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI) | |
| 2639 | # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((trivial_abi)) | |
| 2640 | #else | |
| 2641 | # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI | |
| 2642 | #endif | |
| 2643 | ||
| 3540 | 2644 | template<class _Tp> |
| 3541 | class _LIBCPP_TEMPLATE_VIS shared_ptr | |
| 2645 | class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr | |
| 3542 | 2646 | { |
| 3543 | 2647 | public: |
| 3544 | 2648 | #if _LIBCPP_STD_VER > 14 |
| ... | ... | @@ -3577,25 +2681,17 @@ public: |
| 3577 | 2681 | shared_ptr(const shared_ptr<_Yp>& __r, |
| 3578 | 2682 | typename enable_if<__compatible_with<_Yp, element_type>::value, __nat>::type = __nat()) |
| 3579 | 2683 | _NOEXCEPT; |
| 3580 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3581 | 2684 | _LIBCPP_INLINE_VISIBILITY |
| 3582 | 2685 | shared_ptr(shared_ptr&& __r) _NOEXCEPT; |
| 3583 | 2686 | template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r, |
| 3584 | 2687 | typename enable_if<__compatible_with<_Yp, element_type>::value, __nat>::type = __nat()) |
| 3585 | 2688 | _NOEXCEPT; |
| 3586 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3587 | 2689 | template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r, |
| 3588 | 2690 | typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type= __nat()); |
| 3589 | 2691 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) |
| 3590 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3591 | 2692 | template<class _Yp> |
| 3592 | 2693 | shared_ptr(auto_ptr<_Yp>&& __r, |
| 3593 | 2694 | typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); |
| 3594 | #else | |
| 3595 | template<class _Yp> | |
| 3596 | shared_ptr(auto_ptr<_Yp> __r, | |
| 3597 | typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); | |
| 3598 | #endif | |
| 3599 | 2695 | #endif |
| 3600 | 2696 | template <class _Yp, class _Dp> |
| 3601 | 2697 | shared_ptr(unique_ptr<_Yp, _Dp>&&, |
| ... | ... | @@ -3628,7 +2724,6 @@ public: |
| 3628 | 2724 | >::type |
| 3629 | 2725 | _LIBCPP_INLINE_VISIBILITY |
| 3630 | 2726 | operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT; |
| 3631 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3632 | 2727 | _LIBCPP_INLINE_VISIBILITY |
| 3633 | 2728 | shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT; |
| 3634 | 2729 | template<class _Yp> |
| ... | ... | @@ -3649,19 +2744,6 @@ public: |
| 3649 | 2744 | shared_ptr |
| 3650 | 2745 | >::type& |
| 3651 | 2746 | operator=(auto_ptr<_Yp>&& __r); |
| 3652 | #endif | |
| 3653 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3654 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) | |
| 3655 | template<class _Yp> | |
| 3656 | _LIBCPP_INLINE_VISIBILITY | |
| 3657 | typename enable_if | |
| 3658 | < | |
| 3659 | !is_array<_Yp>::value && | |
| 3660 | is_convertible<_Yp*, element_type*>::value, | |
| 3661 | shared_ptr& | |
| 3662 | >::type | |
| 3663 | operator=(auto_ptr<_Yp> __r); | |
| 3664 | #endif | |
| 3665 | 2747 | #endif |
| 3666 | 2748 | template <class _Yp, class _Dp> |
| 3667 | 2749 | typename enable_if |
| ... | ... | @@ -3670,13 +2752,8 @@ public: |
| 3670 | 2752 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, |
| 3671 | 2753 | shared_ptr& |
| 3672 | 2754 | >::type |
| 3673 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3674 | 2755 | _LIBCPP_INLINE_VISIBILITY |
| 3675 | 2756 | operator=(unique_ptr<_Yp, _Dp>&& __r); |
| 3676 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3677 | _LIBCPP_INLINE_VISIBILITY | |
| 3678 | operator=(unique_ptr<_Yp, _Dp> __r); | |
| 3679 | #endif | |
| 3680 | 2757 | |
| 3681 | 2758 | _LIBCPP_INLINE_VISIBILITY |
| 3682 | 2759 | void swap(shared_ptr& __r) _NOEXCEPT; |
| ... | ... | @@ -3724,7 +2801,7 @@ public: |
| 3724 | 2801 | _LIBCPP_INLINE_VISIBILITY |
| 3725 | 2802 | bool unique() const _NOEXCEPT {return use_count() == 1;} |
| 3726 | 2803 | _LIBCPP_INLINE_VISIBILITY |
| 3727 | _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;} | |
| 2804 | _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != nullptr;} | |
| 3728 | 2805 | template <class _Up> |
| 3729 | 2806 | _LIBCPP_INLINE_VISIBILITY |
| 3730 | 2807 | bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT |
| ... | ... | @@ -3828,8 +2905,8 @@ template<class _Tp> |
| 3828 | 2905 | inline |
| 3829 | 2906 | _LIBCPP_CONSTEXPR |
| 3830 | 2907 | shared_ptr<_Tp>::shared_ptr() _NOEXCEPT |
| 3831 | : __ptr_(0), | |
| 3832 | __cntrl_(0) | |
| 2908 | : __ptr_(nullptr), | |
| 2909 | __cntrl_(nullptr) | |
| 3833 | 2910 | { |
| 3834 | 2911 | } |
| 3835 | 2912 | |
| ... | ... | @@ -3837,8 +2914,8 @@ template<class _Tp> |
| 3837 | 2914 | inline |
| 3838 | 2915 | _LIBCPP_CONSTEXPR |
| 3839 | 2916 | shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT |
| 3840 | : __ptr_(0), | |
| 3841 | __cntrl_(0) | |
| 2917 | : __ptr_(nullptr), | |
| 2918 | __cntrl_(nullptr) | |
| 3842 | 2919 | { |
| 3843 | 2920 | } |
| 3844 | 2921 | |
| ... | ... | @@ -3883,7 +2960,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, |
| 3883 | 2960 | template<class _Tp> |
| 3884 | 2961 | template<class _Dp> |
| 3885 | 2962 | shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) |
| 3886 | : __ptr_(0) | |
| 2963 | : __ptr_(nullptr) | |
| 3887 | 2964 | { |
| 3888 | 2965 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3889 | 2966 | try |
| ... | ... | @@ -3917,8 +2994,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, |
| 3917 | 2994 | typedef __allocator_destructor<_A2> _D2; |
| 3918 | 2995 | _A2 __a2(__a); |
| 3919 | 2996 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); |
| 3920 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 3921 | _CntrlBlk(__p, __d, __a); | |
| 2997 | ::new ((void*)_VSTD::addressof(*__hold2.get())) _CntrlBlk(__p, __d, __a); | |
| 3922 | 2998 | __cntrl_ = _VSTD::addressof(*__hold2.release()); |
| 3923 | 2999 | __enable_weak_this(__p, __p); |
| 3924 | 3000 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| ... | ... | @@ -3934,7 +3010,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, |
| 3934 | 3010 | template<class _Tp> |
| 3935 | 3011 | template<class _Dp, class _Alloc> |
| 3936 | 3012 | shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) |
| 3937 | : __ptr_(0) | |
| 3013 | : __ptr_(nullptr) | |
| 3938 | 3014 | { |
| 3939 | 3015 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3940 | 3016 | try |
| ... | ... | @@ -3945,8 +3021,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) |
| 3945 | 3021 | typedef __allocator_destructor<_A2> _D2; |
| 3946 | 3022 | _A2 __a2(__a); |
| 3947 | 3023 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); |
| 3948 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 3949 | _CntrlBlk(__p, __d, __a); | |
| 3024 | ::new ((void*)_VSTD::addressof(*__hold2.get())) _CntrlBlk(__p, __d, __a); | |
| 3950 | 3025 | __cntrl_ = _VSTD::addressof(*__hold2.release()); |
| 3951 | 3026 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3952 | 3027 | } |
| ... | ... | @@ -3992,16 +3067,14 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, |
| 3992 | 3067 | __cntrl_->__add_shared(); |
| 3993 | 3068 | } |
| 3994 | 3069 | |
| 3995 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 3996 | ||
| 3997 | 3070 | template<class _Tp> |
| 3998 | 3071 | inline |
| 3999 | 3072 | shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT |
| 4000 | 3073 | : __ptr_(__r.__ptr_), |
| 4001 | 3074 | __cntrl_(__r.__cntrl_) |
| 4002 | 3075 | { |
| 4003 | __r.__ptr_ = 0; | |
| 4004 | __r.__cntrl_ = 0; | |
| 3076 | __r.__ptr_ = nullptr; | |
| 3077 | __r.__cntrl_ = nullptr; | |
| 4005 | 3078 | } |
| 4006 | 3079 | |
| 4007 | 3080 | template<class _Tp> |
| ... | ... | @@ -4013,20 +3086,14 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r, |
| 4013 | 3086 | : __ptr_(__r.__ptr_), |
| 4014 | 3087 | __cntrl_(__r.__cntrl_) |
| 4015 | 3088 | { |
| 4016 | __r.__ptr_ = 0; | |
| 4017 | __r.__cntrl_ = 0; | |
| 3089 | __r.__ptr_ = nullptr; | |
| 3090 | __r.__cntrl_ = nullptr; | |
| 4018 | 3091 | } |
| 4019 | 3092 | |
| 4020 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4021 | ||
| 4022 | 3093 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) |
| 4023 | 3094 | template<class _Tp> |
| 4024 | 3095 | template<class _Yp> |
| 4025 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4026 | 3096 | shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r, |
| 4027 | #else | |
| 4028 | shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r, | |
| 4029 | #endif | |
| 4030 | 3097 | typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) |
| 4031 | 3098 | : __ptr_(__r.get()) |
| 4032 | 3099 | { |
| ... | ... | @@ -4121,8 +3188,6 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT |
| 4121 | 3188 | return *this; |
| 4122 | 3189 | } |
| 4123 | 3190 | |
| 4124 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4125 | ||
| 4126 | 3191 | template<class _Tp> |
| 4127 | 3192 | inline |
| 4128 | 3193 | shared_ptr<_Tp>& |
| ... | ... | @@ -4179,43 +3244,6 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r) |
| 4179 | 3244 | return *this; |
| 4180 | 3245 | } |
| 4181 | 3246 | |
| 4182 | #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4183 | ||
| 4184 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) | |
| 4185 | template<class _Tp> | |
| 4186 | template<class _Yp> | |
| 4187 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4188 | typename enable_if | |
| 4189 | < | |
| 4190 | !is_array<_Yp>::value && | |
| 4191 | is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, | |
| 4192 | shared_ptr<_Tp>& | |
| 4193 | >::type | |
| 4194 | shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r) | |
| 4195 | { | |
| 4196 | shared_ptr(__r).swap(*this); | |
| 4197 | return *this; | |
| 4198 | } | |
| 4199 | #endif | |
| 4200 | ||
| 4201 | template<class _Tp> | |
| 4202 | template <class _Yp, class _Dp> | |
| 4203 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4204 | typename enable_if | |
| 4205 | < | |
| 4206 | !is_array<_Yp>::value && | |
| 4207 | is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, | |
| 4208 | typename shared_ptr<_Tp>::element_type*>::value, | |
| 4209 | shared_ptr<_Tp>& | |
| 4210 | >::type | |
| 4211 | shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r) | |
| 4212 | { | |
| 4213 | shared_ptr(_VSTD::move(__r)).swap(*this); | |
| 4214 | return *this; | |
| 4215 | } | |
| 4216 | ||
| 4217 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4218 | ||
| 4219 | 3247 | template<class _Tp> |
| 4220 | 3248 | inline |
| 4221 | 3249 | void |
| ... | ... | @@ -4272,50 +3300,26 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a) |
| 4272 | 3300 | shared_ptr(__p, __d, __a).swap(*this); |
| 4273 | 3301 | } |
| 4274 | 3302 | |
| 4275 | template<class _Tp, class ..._Args> | |
| 4276 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4277 | typename enable_if | |
| 4278 | < | |
| 4279 | !is_array<_Tp>::value, | |
| 4280 | shared_ptr<_Tp> | |
| 4281 | >::type | |
| 4282 | make_shared(_Args&& ...__args) | |
| 3303 | // | |
| 3304 | // std::allocate_shared and std::make_shared | |
| 3305 | // | |
| 3306 | template<class _Tp, class _Alloc, class ..._Args, class = _EnableIf<!is_array<_Tp>::value> > | |
| 3307 | _LIBCPP_HIDE_FROM_ABI | |
| 3308 | shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args) | |
| 4283 | 3309 | { |
| 4284 | static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared"); | |
| 4285 | typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; | |
| 4286 | typedef allocator<_CntrlBlk> _A2; | |
| 4287 | typedef __allocator_destructor<_A2> _D2; | |
| 4288 | ||
| 4289 | _A2 __a2; | |
| 4290 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); | |
| 4291 | ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); | |
| 4292 | ||
| 4293 | _Tp *__ptr = __hold2.get()->get(); | |
| 4294 | return shared_ptr<_Tp>::__create_with_control_block(__ptr, __hold2.release()); | |
| 3310 | using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>; | |
| 3311 | using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; | |
| 3312 | __allocation_guard<_ControlBlockAllocator> __guard(__a, 1); | |
| 3313 | ::new ((void*)_VSTD::addressof(*__guard.__get())) _ControlBlock(__a, _VSTD::forward<_Args>(__args)...); | |
| 3314 | auto __control_block = __guard.__release_ptr(); | |
| 3315 | return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), _VSTD::addressof(*__control_block)); | |
| 4295 | 3316 | } |
| 4296 | 3317 | |
| 4297 | template<class _Tp, class _Alloc, class ..._Args> | |
| 4298 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4299 | typename enable_if | |
| 4300 | < | |
| 4301 | !is_array<_Tp>::value, | |
| 4302 | shared_ptr<_Tp> | |
| 4303 | >::type | |
| 4304 | allocate_shared(const _Alloc& __a, _Args&& ...__args) | |
| 3318 | template<class _Tp, class ..._Args, class = _EnableIf<!is_array<_Tp>::value> > | |
| 3319 | _LIBCPP_HIDE_FROM_ABI | |
| 3320 | shared_ptr<_Tp> make_shared(_Args&& ...__args) | |
| 4305 | 3321 | { |
| 4306 | static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared"); | |
| 4307 | ||
| 4308 | typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; | |
| 4309 | typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; | |
| 4310 | typedef __allocator_destructor<_A2> _D2; | |
| 4311 | ||
| 4312 | _A2 __a2(__a); | |
| 4313 | unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); | |
| 4314 | ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) | |
| 4315 | _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...); | |
| 4316 | ||
| 4317 | typename shared_ptr<_Tp>::element_type *__p = __hold2.get()->get(); | |
| 4318 | return shared_ptr<_Tp>::__create_with_control_block(__p, _VSTD::addressof(*__hold2.release())); | |
| 3322 | return _VSTD::allocate_shared<_Tp>(allocator<_Tp>(), _VSTD::forward<_Args>(__args)...); | |
| 4319 | 3323 | } |
| 4320 | 3324 | |
| 4321 | 3325 | template<class _Tp, class _Up> |
| ... | ... | @@ -4526,7 +3530,7 @@ get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT |
| 4526 | 3530 | #endif // _LIBCPP_NO_RTTI |
| 4527 | 3531 | |
| 4528 | 3532 | template<class _Tp> |
| 4529 | class _LIBCPP_TEMPLATE_VIS weak_ptr | |
| 3533 | class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr | |
| 4530 | 3534 | { |
| 4531 | 3535 | public: |
| 4532 | 3536 | typedef _Tp element_type; |
| ... | ... | @@ -4546,13 +3550,11 @@ public: |
| 4546 | 3550 | typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) |
| 4547 | 3551 | _NOEXCEPT; |
| 4548 | 3552 | |
| 4549 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4550 | 3553 | _LIBCPP_INLINE_VISIBILITY |
| 4551 | 3554 | weak_ptr(weak_ptr&& __r) _NOEXCEPT; |
| 4552 | 3555 | template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r, |
| 4553 | 3556 | typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) |
| 4554 | 3557 | _NOEXCEPT; |
| 4555 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4556 | 3558 | ~weak_ptr(); |
| 4557 | 3559 | |
| 4558 | 3560 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -4566,8 +3568,6 @@ public: |
| 4566 | 3568 | _LIBCPP_INLINE_VISIBILITY |
| 4567 | 3569 | operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT; |
| 4568 | 3570 | |
| 4569 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4570 | ||
| 4571 | 3571 | _LIBCPP_INLINE_VISIBILITY |
| 4572 | 3572 | weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT; |
| 4573 | 3573 | template<class _Yp> |
| ... | ... | @@ -4579,8 +3579,6 @@ public: |
| 4579 | 3579 | _LIBCPP_INLINE_VISIBILITY |
| 4580 | 3580 | operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT; |
| 4581 | 3581 | |
| 4582 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4583 | ||
| 4584 | 3582 | template<class _Yp> |
| 4585 | 3583 | typename enable_if |
| 4586 | 3584 | < |
| ... | ... | @@ -4600,7 +3598,7 @@ public: |
| 4600 | 3598 | {return __cntrl_ ? __cntrl_->use_count() : 0;} |
| 4601 | 3599 | _LIBCPP_INLINE_VISIBILITY |
| 4602 | 3600 | bool expired() const _NOEXCEPT |
| 4603 | {return __cntrl_ == 0 || __cntrl_->use_count() == 0;} | |
| 3601 | {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;} | |
| 4604 | 3602 | shared_ptr<_Tp> lock() const _NOEXCEPT; |
| 4605 | 3603 | template<class _Up> |
| 4606 | 3604 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -4624,8 +3622,8 @@ template<class _Tp> |
| 4624 | 3622 | inline |
| 4625 | 3623 | _LIBCPP_CONSTEXPR |
| 4626 | 3624 | weak_ptr<_Tp>::weak_ptr() _NOEXCEPT |
| 4627 | : __ptr_(0), | |
| 4628 | __cntrl_(0) | |
| 3625 | : __ptr_(nullptr), | |
| 3626 | __cntrl_(nullptr) | |
| 4629 | 3627 | { |
| 4630 | 3628 | } |
| 4631 | 3629 | |
| ... | ... | @@ -4665,16 +3663,14 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r, |
| 4665 | 3663 | __cntrl_->__add_weak(); |
| 4666 | 3664 | } |
| 4667 | 3665 | |
| 4668 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4669 | ||
| 4670 | 3666 | template<class _Tp> |
| 4671 | 3667 | inline |
| 4672 | 3668 | weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT |
| 4673 | 3669 | : __ptr_(__r.__ptr_), |
| 4674 | 3670 | __cntrl_(__r.__cntrl_) |
| 4675 | 3671 | { |
| 4676 | __r.__ptr_ = 0; | |
| 4677 | __r.__cntrl_ = 0; | |
| 3672 | __r.__ptr_ = nullptr; | |
| 3673 | __r.__cntrl_ = nullptr; | |
| 4678 | 3674 | } |
| 4679 | 3675 | |
| 4680 | 3676 | template<class _Tp> |
| ... | ... | @@ -4686,12 +3682,10 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r, |
| 4686 | 3682 | : __ptr_(__r.__ptr_), |
| 4687 | 3683 | __cntrl_(__r.__cntrl_) |
| 4688 | 3684 | { |
| 4689 | __r.__ptr_ = 0; | |
| 4690 | __r.__cntrl_ = 0; | |
| 3685 | __r.__ptr_ = nullptr; | |
| 3686 | __r.__cntrl_ = nullptr; | |
| 4691 | 3687 | } |
| 4692 | 3688 | |
| 4693 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4694 | ||
| 4695 | 3689 | template<class _Tp> |
| 4696 | 3690 | weak_ptr<_Tp>::~weak_ptr() |
| 4697 | 3691 | { |
| ... | ... | @@ -4722,8 +3716,6 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT |
| 4722 | 3716 | return *this; |
| 4723 | 3717 | } |
| 4724 | 3718 | |
| 4725 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4726 | ||
| 4727 | 3719 | template<class _Tp> |
| 4728 | 3720 | inline |
| 4729 | 3721 | weak_ptr<_Tp>& |
| ... | ... | @@ -4747,8 +3739,6 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT |
| 4747 | 3739 | return *this; |
| 4748 | 3740 | } |
| 4749 | 3741 | |
| 4750 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | |
| 4751 | ||
| 4752 | 3742 | template<class _Tp> |
| 4753 | 3743 | template<class _Yp> |
| 4754 | 3744 | inline |
| ... | ... | @@ -4795,7 +3785,7 @@ shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r, |
| 4795 | 3785 | : __ptr_(__r.__ptr_), |
| 4796 | 3786 | __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) |
| 4797 | 3787 | { |
| 4798 | if (__cntrl_ == 0) | |
| 3788 | if (__cntrl_ == nullptr) | |
| 4799 | 3789 | __throw_bad_weak_ptr(); |
| 4800 | 3790 | } |
| 4801 | 3791 | |
| ... | ... | @@ -5130,35 +4120,35 @@ _LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& |
| 5130 | 4120 | |
| 5131 | 4121 | // --- Helper for container swap -- |
| 5132 | 4122 | template <typename _Alloc> |
| 5133 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5134 | void __swap_allocator(_Alloc & __a1, _Alloc & __a2) | |
| 4123 | _LIBCPP_INLINE_VISIBILITY | |
| 4124 | void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type) | |
| 5135 | 4125 | #if _LIBCPP_STD_VER >= 14 |
| 5136 | 4126 | _NOEXCEPT |
| 5137 | 4127 | #else |
| 5138 | 4128 | _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) |
| 5139 | 4129 | #endif |
| 5140 | 4130 | { |
| 5141 | __swap_allocator(__a1, __a2, | |
| 5142 | integral_constant<bool, _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap::value>()); | |
| 4131 | using _VSTD::swap; | |
| 4132 | swap(__a1, __a2); | |
| 5143 | 4133 | } |
| 5144 | 4134 | |
| 5145 | 4135 | template <typename _Alloc> |
| 5146 | _LIBCPP_INLINE_VISIBILITY | |
| 5147 | void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type) | |
| 4136 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4137 | void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {} | |
| 4138 | ||
| 4139 | template <typename _Alloc> | |
| 4140 | inline _LIBCPP_INLINE_VISIBILITY | |
| 4141 | void __swap_allocator(_Alloc & __a1, _Alloc & __a2) | |
| 5148 | 4142 | #if _LIBCPP_STD_VER >= 14 |
| 5149 | 4143 | _NOEXCEPT |
| 5150 | 4144 | #else |
| 5151 | 4145 | _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) |
| 5152 | 4146 | #endif |
| 5153 | 4147 | { |
| 5154 | using _VSTD::swap; | |
| 5155 | swap(__a1, __a2); | |
| 4148 | _VSTD::__swap_allocator(__a1, __a2, | |
| 4149 | integral_constant<bool, _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap::value>()); | |
| 5156 | 4150 | } |
| 5157 | 4151 | |
| 5158 | template <typename _Alloc> | |
| 5159 | inline _LIBCPP_INLINE_VISIBILITY | |
| 5160 | void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {} | |
| 5161 | ||
| 5162 | 4152 | template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> > |
| 5163 | 4153 | struct __noexcept_move_assign_container : public integral_constant<bool, |
| 5164 | 4154 | _Traits::propagate_on_container_move_assignment::value |
| ... | ... | @@ -5170,7 +4160,6 @@ struct __noexcept_move_assign_container : public integral_constant<bool, |
| 5170 | 4160 | > {}; |
| 5171 | 4161 | |
| 5172 | 4162 | |
| 5173 | #ifndef _LIBCPP_HAS_NO_VARIADICS | |
| 5174 | 4163 | template <class _Tp, class _Alloc> |
| 5175 | 4164 | struct __temp_value { |
| 5176 | 4165 | typedef allocator_traits<_Alloc> _Traits; |
| ... | ... | @@ -5190,7 +4179,6 @@ struct __temp_value { |
| 5190 | 4179 | |
| 5191 | 4180 | ~__temp_value() { _Traits::destroy(__a, __addr()); } |
| 5192 | 4181 | }; |
| 5193 | #endif | |
| 5194 | 4182 | |
| 5195 | 4183 | template<typename _Alloc, typename = void, typename = void> |
| 5196 | 4184 | struct __is_allocator : false_type {}; |
| ... | ... | @@ -5214,7 +4202,7 @@ struct __builtin_new_allocator { |
| 5214 | 4202 | : __size_(__size), __align_(__align) {} |
| 5215 | 4203 | |
| 5216 | 4204 | void operator()(void* p) const _NOEXCEPT { |
| 5217 | std::__libcpp_deallocate(p, __size_, __align_); | |
| 4205 | _VSTD::__libcpp_deallocate(p, __size_, __align_); | |
| 5218 | 4206 | } |
| 5219 | 4207 | |
| 5220 | 4208 | private: |
| ... | ... | @@ -5225,13 +4213,13 @@ struct __builtin_new_allocator { |
| 5225 | 4213 | typedef unique_ptr<void, __builtin_new_deleter> __holder_t; |
| 5226 | 4214 | |
| 5227 | 4215 | static __holder_t __allocate_bytes(size_t __s, size_t __align) { |
| 5228 | return __holder_t(std::__libcpp_allocate(__s, __align), | |
| 4216 | return __holder_t(_VSTD::__libcpp_allocate(__s, __align), | |
| 5229 | 4217 | __builtin_new_deleter(__s, __align)); |
| 5230 | 4218 | } |
| 5231 | 4219 | |
| 5232 | 4220 | static void __deallocate_bytes(void* __p, size_t __s, |
| 5233 | 4221 | size_t __align) _NOEXCEPT { |
| 5234 | std::__libcpp_deallocate(__p, __s, __align); | |
| 4222 | _VSTD::__libcpp_deallocate(__p, __s, __align); | |
| 5235 | 4223 | } |
| 5236 | 4224 | |
| 5237 | 4225 | template <class _Tp> |
lib/libcxx/include/new+70-83| ... | ... | @@ -87,13 +87,12 @@ void operator delete[](void* ptr, void*) noexcept; |
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | 89 | #include <__config> |
| 90 | #include <__availability> | |
| 91 | #include <cstddef> | |
| 92 | #include <cstdlib> | |
| 90 | 93 | #include <exception> |
| 91 | 94 | #include <type_traits> |
| 92 | #include <cstddef> | |
| 93 | 95 | #include <version> |
| 94 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 95 | #include <cstdlib> | |
| 96 | #endif | |
| 97 | 96 | |
| 98 | 97 | #if defined(_LIBCPP_ABI_VCRUNTIME) |
| 99 | 98 | #include <new.h> |
| ... | ... | @@ -117,11 +116,6 @@ void operator delete[](void* ptr, void*) noexcept; |
| 117 | 116 | # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION |
| 118 | 117 | #endif |
| 119 | 118 | |
| 120 | #if !__has_builtin(__builtin_operator_new) || \ | |
| 121 | __has_builtin(__builtin_operator_new) < 201802L | |
| 122 | #define _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE | |
| 123 | #endif | |
| 124 | ||
| 125 | 119 | namespace std // purposefully not using versioning namespace |
| 126 | 120 | { |
| 127 | 121 | |
| ... | ... | @@ -234,31 +228,54 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new |
| 234 | 228 | #endif |
| 235 | 229 | } |
| 236 | 230 | |
| 237 | inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) { | |
| 231 | template <class ..._Args> | |
| 232 | _LIBCPP_INLINE_VISIBILITY | |
| 233 | void* __libcpp_operator_new(_Args ...__args) { | |
| 234 | #if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete) | |
| 235 | return __builtin_operator_new(__args...); | |
| 236 | #else | |
| 237 | return ::operator new(__args...); | |
| 238 | #endif | |
| 239 | } | |
| 240 | ||
| 241 | template <class ..._Args> | |
| 242 | _LIBCPP_INLINE_VISIBILITY | |
| 243 | void __libcpp_operator_delete(_Args ...__args) { | |
| 244 | #if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete) | |
| 245 | __builtin_operator_delete(__args...); | |
| 246 | #else | |
| 247 | ::operator delete(__args...); | |
| 248 | #endif | |
| 249 | } | |
| 250 | ||
| 251 | inline _LIBCPP_INLINE_VISIBILITY | |
| 252 | void *__libcpp_allocate(size_t __size, size_t __align) { | |
| 238 | 253 | #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION |
| 239 | 254 | if (__is_overaligned_for_new(__align)) { |
| 240 | 255 | const align_val_t __align_val = static_cast<align_val_t>(__align); |
| 241 | # ifdef _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE | |
| 242 | return ::operator new(__size, __align_val); | |
| 243 | # else | |
| 244 | return __builtin_operator_new(__size, __align_val); | |
| 245 | # endif | |
| 256 | return __libcpp_operator_new(__size, __align_val); | |
| 246 | 257 | } |
| 247 | #else | |
| 248 | ((void)__align); | |
| 249 | 258 | #endif |
| 250 | #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE | |
| 251 | return ::operator new(__size); | |
| 259 | ||
| 260 | (void)__align; | |
| 261 | return __libcpp_operator_new(__size); | |
| 262 | } | |
| 263 | ||
| 264 | template <class ..._Args> | |
| 265 | _LIBCPP_INLINE_VISIBILITY | |
| 266 | void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) { | |
| 267 | #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION | |
| 268 | (void)__size; | |
| 269 | return __libcpp_operator_delete(__ptr, __args...); | |
| 252 | 270 | #else |
| 253 | return __builtin_operator_new(__size); | |
| 271 | return __libcpp_operator_delete(__ptr, __size, __args...); | |
| 254 | 272 | #endif |
| 255 | 273 | } |
| 256 | 274 | |
| 257 | struct _DeallocateCaller { | |
| 258 | static inline _LIBCPP_INLINE_VISIBILITY | |
| 259 | void __do_deallocate_handle_size_align(void *__ptr, size_t __size, size_t __align) { | |
| 275 | inline _LIBCPP_INLINE_VISIBILITY | |
| 276 | void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) { | |
| 260 | 277 | #if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) |
| 261 | ((void)__align); | |
| 278 | (void)__align; | |
| 262 | 279 | return __do_deallocate_handle_size(__ptr, __size); |
| 263 | 280 | #else |
| 264 | 281 | if (__is_overaligned_for_new(__align)) { |
| ... | ... | @@ -268,81 +285,51 @@ struct _DeallocateCaller { |
| 268 | 285 | return __do_deallocate_handle_size(__ptr, __size); |
| 269 | 286 | } |
| 270 | 287 | #endif |
| 271 | } | |
| 288 | } | |
| 272 | 289 | |
| 273 | static inline _LIBCPP_INLINE_VISIBILITY | |
| 274 | void __do_deallocate_handle_align(void *__ptr, size_t __align) { | |
| 290 | inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) { | |
| 275 | 291 | #if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) |
| 276 | ((void)__align); | |
| 277 | return __do_call(__ptr); | |
| 292 | (void)__align; | |
| 293 | return __libcpp_operator_delete(__ptr); | |
| 278 | 294 | #else |
| 279 | 295 | if (__is_overaligned_for_new(__align)) { |
| 280 | 296 | const align_val_t __align_val = static_cast<align_val_t>(__align); |
| 281 | return __do_call(__ptr, __align_val); | |
| 297 | return __libcpp_operator_delete(__ptr, __align_val); | |
| 282 | 298 | } else { |
| 283 | return __do_call(__ptr); | |
| 299 | return __libcpp_operator_delete(__ptr); | |
| 284 | 300 | } |
| 285 | 301 | #endif |
| 286 | } | |
| 287 | ||
| 288 | private: | |
| 289 | static inline void __do_deallocate_handle_size(void *__ptr, size_t __size) { | |
| 290 | #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION | |
| 291 | ((void)__size); | |
| 292 | return __do_call(__ptr); | |
| 293 | #else | |
| 294 | return __do_call(__ptr, __size); | |
| 295 | #endif | |
| 296 | } | |
| 297 | ||
| 298 | #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION | |
| 299 | static inline void __do_deallocate_handle_size(void *__ptr, size_t __size, align_val_t __align) { | |
| 300 | #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION | |
| 301 | ((void)__size); | |
| 302 | return __do_call(__ptr, __align); | |
| 303 | #else | |
| 304 | return __do_call(__ptr, __size, __align); | |
| 305 | #endif | |
| 306 | } | |
| 307 | #endif | |
| 308 | ||
| 309 | private: | |
| 310 | template <class _A1, class _A2> | |
| 311 | static inline void __do_call(void *__ptr, _A1 __a1, _A2 __a2) { | |
| 312 | #if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \ | |
| 313 | defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE) | |
| 314 | return ::operator delete(__ptr, __a1, __a2); | |
| 315 | #else | |
| 316 | return __builtin_operator_delete(__ptr, __a1, __a2); | |
| 317 | #endif | |
| 318 | } | |
| 302 | } | |
| 319 | 303 | |
| 320 | template <class _A1> | |
| 321 | static inline void __do_call(void *__ptr, _A1 __a1) { | |
| 322 | #if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \ | |
| 323 | defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE) | |
| 324 | return ::operator delete(__ptr, __a1); | |
| 304 | #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) | |
| 305 | // Low-level helpers to call the aligned allocation and deallocation functions | |
| 306 | // on the target platform. This is used to implement libc++'s own memory | |
| 307 | // allocation routines -- if you need to allocate memory inside the library, | |
| 308 | // chances are that you want to use `__libcpp_allocate` instead. | |
| 309 | // | |
| 310 | // Returns the allocated memory, or `nullptr` on failure. | |
| 311 | inline _LIBCPP_INLINE_VISIBILITY | |
| 312 | void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { | |
| 313 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 314 | return ::_aligned_malloc(__size, __alignment); | |
| 325 | 315 | #else |
| 326 | return __builtin_operator_delete(__ptr, __a1); | |
| 316 | void* __result = nullptr; | |
| 317 | ::posix_memalign(&__result, __alignment, __size); | |
| 318 | // If posix_memalign fails, __result is unmodified so we still return `nullptr`. | |
| 319 | return __result; | |
| 327 | 320 | #endif |
| 328 | } | |
| 321 | } | |
| 329 | 322 | |
| 330 | static inline void __do_call(void *__ptr) { | |
| 331 | #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE | |
| 332 | return ::operator delete(__ptr); | |
| 323 | inline _LIBCPP_INLINE_VISIBILITY | |
| 324 | void __libcpp_aligned_free(void* __ptr) { | |
| 325 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 326 | ::_aligned_free(__ptr); | |
| 333 | 327 | #else |
| 334 | return __builtin_operator_delete(__ptr); | |
| 328 | ::free(__ptr); | |
| 335 | 329 | #endif |
| 336 | } | |
| 337 | }; | |
| 338 | ||
| 339 | inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) { | |
| 340 | _DeallocateCaller::__do_deallocate_handle_size_align(__ptr, __size, __align); | |
| 341 | 330 | } |
| 331 | #endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION | |
| 342 | 332 | |
| 343 | inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) { | |
| 344 | _DeallocateCaller::__do_deallocate_handle_align(__ptr, __align); | |
| 345 | } | |
| 346 | 333 | |
| 347 | 334 | template <class _Tp> |
| 348 | 335 | _LIBCPP_NODISCARD_AFTER_CXX17 inline |
lib/libcxx/include/numbers+1-1| ... | ... | @@ -100,7 +100,7 @@ template <class T> inline constexpr T egamma_v = __illformed<T>{}; |
| 100 | 100 | template <class T> inline constexpr T phi_v = __illformed<T>{}; |
| 101 | 101 | |
| 102 | 102 | template <class T> |
| 103 | concept __floating_point = std::is_floating_point_v<T>; | |
| 103 | concept __floating_point = is_floating_point_v<T>; | |
| 104 | 104 | |
| 105 | 105 | template <__floating_point T> inline constexpr T e_v<T> = 2.718281828459045235360287471352662; |
| 106 | 106 | template <__floating_point T> inline constexpr T log2e_v<T> = 1.442695040888963407359924681001892; |
lib/libcxx/include/numeric+118-73| ... | ... | @@ -17,115 +17,116 @@ namespace std |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | template <class InputIterator, class T> |
| 20 | T | |
| 20 | constexpr T // constexpr since C++20 | |
| 21 | 21 | accumulate(InputIterator first, InputIterator last, T init); |
| 22 | 22 | |
| 23 | 23 | template <class InputIterator, class T, class BinaryOperation> |
| 24 | T | |
| 24 | constexpr T // constexpr since C++20 | |
| 25 | 25 | accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); |
| 26 | 26 | |
| 27 | 27 | template<class InputIterator> |
| 28 | typename iterator_traits<InputIterator>::value_type | |
| 28 | constexpr typename iterator_traits<InputIterator>::value_type // constexpr since C++20 | |
| 29 | 29 | reduce(InputIterator first, InputIterator last); // C++17 |
| 30 | 30 | |
| 31 | 31 | template<class InputIterator, class T> |
| 32 | T | |
| 32 | constexpr T // constexpr since C++20 | |
| 33 | 33 | reduce(InputIterator first, InputIterator last, T init); // C++17 |
| 34 | 34 | |
| 35 | 35 | template<class InputIterator, class T, class BinaryOperation> |
| 36 | T | |
| 36 | constexpr T // constexpr since C++20 | |
| 37 | 37 | reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17 |
| 38 | 38 | |
| 39 | 39 | template <class InputIterator1, class InputIterator2, class T> |
| 40 | T | |
| 40 | constexpr T // constexpr since C++20 | |
| 41 | 41 | inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init); |
| 42 | 42 | |
| 43 | 43 | template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2> |
| 44 | T | |
| 44 | constexpr T // constexpr since C++20 | |
| 45 | 45 | inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, |
| 46 | 46 | T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | template<class InputIterator1, class InputIterator2, class T> |
| 50 | T | |
| 50 | constexpr T // constexpr since C++20 | |
| 51 | 51 | transform_reduce(InputIterator1 first1, InputIterator1 last1, |
| 52 | 52 | InputIterator2 first2, T init); // C++17 |
| 53 | 53 | |
| 54 | 54 | template<class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2> |
| 55 | T | |
| 55 | constexpr T // constexpr since C++20 | |
| 56 | 56 | transform_reduce(InputIterator1 first1, InputIterator1 last1, |
| 57 | 57 | InputIterator2 first2, T init, |
| 58 | 58 | BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17 |
| 59 | 59 | |
| 60 | 60 | template<class InputIterator, class T, class BinaryOperation, class UnaryOperation> |
| 61 | T | |
| 61 | constexpr T // constexpr since C++20 | |
| 62 | 62 | transform_reduce(InputIterator first, InputIterator last, T init, |
| 63 | 63 | BinaryOperation binary_op, UnaryOperation unary_op); // C++17 |
| 64 | 64 | |
| 65 | 65 | template <class InputIterator, class OutputIterator> |
| 66 | OutputIterator | |
| 66 | constexpr OutputIterator // constexpr since C++20 | |
| 67 | 67 | partial_sum(InputIterator first, InputIterator last, OutputIterator result); |
| 68 | 68 | |
| 69 | 69 | template <class InputIterator, class OutputIterator, class BinaryOperation> |
| 70 | OutputIterator | |
| 70 | constexpr OutputIterator // constexpr since C++20 | |
| 71 | 71 | partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op); |
| 72 | 72 | |
| 73 | 73 | template<class InputIterator, class OutputIterator, class T> |
| 74 | OutputIterator | |
| 74 | constexpr OutputIterator // constexpr since C++20 | |
| 75 | 75 | exclusive_scan(InputIterator first, InputIterator last, |
| 76 | 76 | OutputIterator result, T init); // C++17 |
| 77 | 77 | |
| 78 | 78 | template<class InputIterator, class OutputIterator, class T, class BinaryOperation> |
| 79 | OutputIterator | |
| 79 | constexpr OutputIterator // constexpr since C++20 | |
| 80 | 80 | exclusive_scan(InputIterator first, InputIterator last, |
| 81 | 81 | OutputIterator result, T init, BinaryOperation binary_op); // C++17 |
| 82 | 82 | |
| 83 | 83 | template<class InputIterator, class OutputIterator> |
| 84 | OutputIterator | |
| 84 | constexpr OutputIterator // constexpr since C++20 | |
| 85 | 85 | inclusive_scan(InputIterator first, InputIterator last, OutputIterator result); // C++17 |
| 86 | 86 | |
| 87 | 87 | template<class InputIterator, class OutputIterator, class BinaryOperation> |
| 88 | OutputIterator | |
| 88 | constexpr OutputIterator // constexpr since C++20 | |
| 89 | 89 | inclusive_scan(InputIterator first, InputIterator last, |
| 90 | 90 | OutputIterator result, BinaryOperation binary_op); // C++17 |
| 91 | 91 | |
| 92 | 92 | template<class InputIterator, class OutputIterator, class BinaryOperation, class T> |
| 93 | OutputIterator | |
| 93 | constexpr OutputIterator // constexpr since C++20 | |
| 94 | 94 | inclusive_scan(InputIterator first, InputIterator last, |
| 95 | 95 | OutputIterator result, BinaryOperation binary_op, T init); // C++17 |
| 96 | 96 | |
| 97 | 97 | template<class InputIterator, class OutputIterator, class T, |
| 98 | 98 | class BinaryOperation, class UnaryOperation> |
| 99 | OutputIterator | |
| 99 | constexpr OutputIterator // constexpr since C++20 | |
| 100 | 100 | transform_exclusive_scan(InputIterator first, InputIterator last, |
| 101 | 101 | OutputIterator result, T init, |
| 102 | 102 | BinaryOperation binary_op, UnaryOperation unary_op); // C++17 |
| 103 | 103 | |
| 104 | 104 | template<class InputIterator, class OutputIterator, |
| 105 | 105 | class BinaryOperation, class UnaryOperation> |
| 106 | OutputIterator | |
| 106 | constexpr OutputIterator // constexpr since C++20 | |
| 107 | 107 | transform_inclusive_scan(InputIterator first, InputIterator last, |
| 108 | 108 | OutputIterator result, |
| 109 | 109 | BinaryOperation binary_op, UnaryOperation unary_op); // C++17 |
| 110 | 110 | |
| 111 | 111 | template<class InputIterator, class OutputIterator, |
| 112 | 112 | class BinaryOperation, class UnaryOperation, class T> |
| 113 | OutputIterator | |
| 113 | constexpr OutputIterator // constexpr since C++20 | |
| 114 | 114 | transform_inclusive_scan(InputIterator first, InputIterator last, |
| 115 | 115 | OutputIterator result, |
| 116 | 116 | BinaryOperation binary_op, UnaryOperation unary_op, |
| 117 | 117 | T init); // C++17 |
| 118 | 118 | |
| 119 | 119 | template <class InputIterator, class OutputIterator> |
| 120 | OutputIterator | |
| 120 | constexpr OutputIterator // constexpr since C++20 | |
| 121 | 121 | adjacent_difference(InputIterator first, InputIterator last, OutputIterator result); |
| 122 | 122 | |
| 123 | 123 | template <class InputIterator, class OutputIterator, class BinaryOperation> |
| 124 | OutputIterator | |
| 124 | constexpr OutputIterator // constexpr since C++20 | |
| 125 | 125 | adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op); |
| 126 | 126 | |
| 127 | 127 | template <class ForwardIterator, class T> |
| 128 | void iota(ForwardIterator first, ForwardIterator last, T value); | |
| 128 | constexpr void // constexpr since C++20 | |
| 129 | iota(ForwardIterator first, ForwardIterator last, T value); | |
| 129 | 130 | |
| 130 | 131 | template <class M, class N> |
| 131 | 132 | constexpr common_type_t<M,N> gcd(M m, N n); // C++17 |
| ... | ... | @@ -133,9 +134,11 @@ template <class M, class N> |
| 133 | 134 | template <class M, class N> |
| 134 | 135 | constexpr common_type_t<M,N> lcm(M m, N n); // C++17 |
| 135 | 136 | |
| 136 | integer midpoint(integer a, integer b); // C++20 | |
| 137 | pointer midpoint(pointer a, pointer b); // C++20 | |
| 138 | floating_point midpoint(floating_point a, floating_point b); // C++20 | |
| 137 | template<class T> | |
| 138 | constexpr T midpoint(T a, T b) noexcept; // C++20 | |
| 139 | ||
| 140 | template<class T> | |
| 141 | constexpr T* midpoint(T* a, T* b); // C++20 | |
| 139 | 142 | |
| 140 | 143 | } // std |
| 141 | 144 | |
| ... | ... | @@ -158,28 +161,36 @@ _LIBCPP_PUSH_MACROS |
| 158 | 161 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 159 | 162 | |
| 160 | 163 | template <class _InputIterator, class _Tp> |
| 161 | inline _LIBCPP_INLINE_VISIBILITY | |
| 164 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 162 | 165 | _Tp |
| 163 | 166 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) |
| 164 | 167 | { |
| 165 | 168 | for (; __first != __last; ++__first) |
| 169 | #if _LIBCPP_STD_VER > 17 | |
| 170 | __init = _VSTD::move(__init) + *__first; | |
| 171 | #else | |
| 166 | 172 | __init = __init + *__first; |
| 173 | #endif | |
| 167 | 174 | return __init; |
| 168 | 175 | } |
| 169 | 176 | |
| 170 | 177 | template <class _InputIterator, class _Tp, class _BinaryOperation> |
| 171 | inline _LIBCPP_INLINE_VISIBILITY | |
| 178 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 172 | 179 | _Tp |
| 173 | 180 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) |
| 174 | 181 | { |
| 175 | 182 | for (; __first != __last; ++__first) |
| 183 | #if _LIBCPP_STD_VER > 17 | |
| 184 | __init = __binary_op(_VSTD::move(__init), *__first); | |
| 185 | #else | |
| 176 | 186 | __init = __binary_op(__init, *__first); |
| 187 | #endif | |
| 177 | 188 | return __init; |
| 178 | 189 | } |
| 179 | 190 | |
| 180 | 191 | #if _LIBCPP_STD_VER > 14 |
| 181 | 192 | template <class _InputIterator, class _Tp, class _BinaryOp> |
| 182 | inline _LIBCPP_INLINE_VISIBILITY | |
| 193 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 183 | 194 | _Tp |
| 184 | 195 | reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) |
| 185 | 196 | { |
| ... | ... | @@ -189,7 +200,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) |
| 189 | 200 | } |
| 190 | 201 | |
| 191 | 202 | template <class _InputIterator, class _Tp> |
| 192 | inline _LIBCPP_INLINE_VISIBILITY | |
| 203 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 193 | 204 | _Tp |
| 194 | 205 | reduce(_InputIterator __first, _InputIterator __last, _Tp __init) |
| 195 | 206 | { |
| ... | ... | @@ -197,7 +208,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init) |
| 197 | 208 | } |
| 198 | 209 | |
| 199 | 210 | template <class _InputIterator> |
| 200 | inline _LIBCPP_INLINE_VISIBILITY | |
| 211 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 201 | 212 | typename iterator_traits<_InputIterator>::value_type |
| 202 | 213 | reduce(_InputIterator __first, _InputIterator __last) |
| 203 | 214 | { |
| ... | ... | @@ -207,29 +218,37 @@ reduce(_InputIterator __first, _InputIterator __last) |
| 207 | 218 | #endif |
| 208 | 219 | |
| 209 | 220 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 210 | inline _LIBCPP_INLINE_VISIBILITY | |
| 221 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 211 | 222 | _Tp |
| 212 | 223 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) |
| 213 | 224 | { |
| 214 | 225 | for (; __first1 != __last1; ++__first1, (void) ++__first2) |
| 226 | #if _LIBCPP_STD_VER > 17 | |
| 227 | __init = _VSTD::move(__init) + *__first1 * *__first2; | |
| 228 | #else | |
| 215 | 229 | __init = __init + *__first1 * *__first2; |
| 230 | #endif | |
| 216 | 231 | return __init; |
| 217 | 232 | } |
| 218 | 233 | |
| 219 | 234 | template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> |
| 220 | inline _LIBCPP_INLINE_VISIBILITY | |
| 235 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 221 | 236 | _Tp |
| 222 | 237 | inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, |
| 223 | 238 | _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) |
| 224 | 239 | { |
| 225 | 240 | for (; __first1 != __last1; ++__first1, (void) ++__first2) |
| 241 | #if _LIBCPP_STD_VER > 17 | |
| 242 | __init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); | |
| 243 | #else | |
| 226 | 244 | __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); |
| 245 | #endif | |
| 227 | 246 | return __init; |
| 228 | 247 | } |
| 229 | 248 | |
| 230 | 249 | #if _LIBCPP_STD_VER > 14 |
| 231 | 250 | template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> |
| 232 | inline _LIBCPP_INLINE_VISIBILITY | |
| 251 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 233 | 252 | _Tp |
| 234 | 253 | transform_reduce(_InputIterator __first, _InputIterator __last, |
| 235 | 254 | _Tp __init, _BinaryOp __b, _UnaryOp __u) |
| ... | ... | @@ -241,7 +260,7 @@ transform_reduce(_InputIterator __first, _InputIterator __last, |
| 241 | 260 | |
| 242 | 261 | template <class _InputIterator1, class _InputIterator2, |
| 243 | 262 | class _Tp, class _BinaryOp1, class _BinaryOp2> |
| 244 | inline _LIBCPP_INLINE_VISIBILITY | |
| 263 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 245 | 264 | _Tp |
| 246 | 265 | transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, |
| 247 | 266 | _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2) |
| ... | ... | @@ -252,7 +271,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, |
| 252 | 271 | } |
| 253 | 272 | |
| 254 | 273 | template <class _InputIterator1, class _InputIterator2, class _Tp> |
| 255 | inline _LIBCPP_INLINE_VISIBILITY | |
| 274 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 256 | 275 | _Tp |
| 257 | 276 | transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, |
| 258 | 277 | _InputIterator2 __first2, _Tp __init) |
| ... | ... | @@ -263,7 +282,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, |
| 263 | 282 | #endif |
| 264 | 283 | |
| 265 | 284 | template <class _InputIterator, class _OutputIterator> |
| 266 | inline _LIBCPP_INLINE_VISIBILITY | |
| 285 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 267 | 286 | _OutputIterator |
| 268 | 287 | partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 269 | 288 | { |
| ... | ... | @@ -273,7 +292,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 273 | 292 | *__result = __t; |
| 274 | 293 | for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) |
| 275 | 294 | { |
| 295 | #if _LIBCPP_STD_VER > 17 | |
| 296 | __t = _VSTD::move(__t) + *__first; | |
| 297 | #else | |
| 276 | 298 | __t = __t + *__first; |
| 299 | #endif | |
| 277 | 300 | *__result = __t; |
| 278 | 301 | } |
| 279 | 302 | } |
| ... | ... | @@ -281,7 +304,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 281 | 304 | } |
| 282 | 305 | |
| 283 | 306 | template <class _InputIterator, class _OutputIterator, class _BinaryOperation> |
| 284 | inline _LIBCPP_INLINE_VISIBILITY | |
| 307 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 285 | 308 | _OutputIterator |
| 286 | 309 | partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 287 | 310 | _BinaryOperation __binary_op) |
| ... | ... | @@ -292,7 +315,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 292 | 315 | *__result = __t; |
| 293 | 316 | for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) |
| 294 | 317 | { |
| 318 | #if _LIBCPP_STD_VER > 17 | |
| 319 | __t = __binary_op(_VSTD::move(__t), *__first); | |
| 320 | #else | |
| 295 | 321 | __t = __binary_op(__t, *__first); |
| 322 | #endif | |
| 296 | 323 | *__result = __t; |
| 297 | 324 | } |
| 298 | 325 | } |
| ... | ... | @@ -301,27 +328,30 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res |
| 301 | 328 | |
| 302 | 329 | #if _LIBCPP_STD_VER > 14 |
| 303 | 330 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> |
| 304 | inline _LIBCPP_INLINE_VISIBILITY | |
| 331 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 305 | 332 | _OutputIterator |
| 306 | 333 | exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 307 | 334 | _OutputIterator __result, _Tp __init, _BinaryOp __b) |
| 308 | 335 | { |
| 309 | 336 | if (__first != __last) |
| 310 | 337 | { |
| 311 | _Tp __saved = __init; | |
| 312 | do | |
| 338 | _Tp __tmp(__b(__init, *__first)); | |
| 339 | while (true) | |
| 313 | 340 | { |
| 314 | __init = __b(__init, *__first); | |
| 315 | *__result = __saved; | |
| 316 | __saved = __init; | |
| 341 | *__result = _VSTD::move(__init); | |
| 317 | 342 | ++__result; |
| 318 | } while (++__first != __last); | |
| 343 | ++__first; | |
| 344 | if (__first == __last) | |
| 345 | break; | |
| 346 | __init = _VSTD::move(__tmp); | |
| 347 | __tmp = __b(__init, *__first); | |
| 348 | } | |
| 319 | 349 | } |
| 320 | 350 | return __result; |
| 321 | 351 | } |
| 322 | 352 | |
| 323 | 353 | template <class _InputIterator, class _OutputIterator, class _Tp> |
| 324 | inline _LIBCPP_INLINE_VISIBILITY | |
| 354 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 325 | 355 | _OutputIterator |
| 326 | 356 | exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 327 | 357 | _OutputIterator __result, _Tp __init) |
| ... | ... | @@ -330,40 +360,43 @@ exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 330 | 360 | } |
| 331 | 361 | |
| 332 | 362 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> |
| 363 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 333 | 364 | _OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 334 | 365 | _OutputIterator __result, _BinaryOp __b, _Tp __init) |
| 335 | 366 | { |
| 336 | 367 | for (; __first != __last; ++__first, (void) ++__result) { |
| 337 | 368 | __init = __b(__init, *__first); |
| 338 | 369 | *__result = __init; |
| 339 | } | |
| 370 | } | |
| 340 | 371 | return __result; |
| 341 | 372 | } |
| 342 | 373 | |
| 343 | 374 | template <class _InputIterator, class _OutputIterator, class _BinaryOp> |
| 375 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 344 | 376 | _OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 345 | 377 | _OutputIterator __result, _BinaryOp __b) |
| 346 | 378 | { |
| 347 | 379 | if (__first != __last) { |
| 348 | typename std::iterator_traits<_InputIterator>::value_type __init = *__first; | |
| 380 | typename iterator_traits<_InputIterator>::value_type __init = *__first; | |
| 349 | 381 | *__result++ = __init; |
| 350 | 382 | if (++__first != __last) |
| 351 | 383 | return _VSTD::inclusive_scan(__first, __last, __result, __b, __init); |
| 352 | } | |
| 384 | } | |
| 353 | 385 | |
| 354 | 386 | return __result; |
| 355 | 387 | } |
| 356 | 388 | |
| 357 | 389 | template <class _InputIterator, class _OutputIterator> |
| 390 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 358 | 391 | _OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, |
| 359 | 392 | _OutputIterator __result) |
| 360 | 393 | { |
| 361 | return _VSTD::inclusive_scan(__first, __last, __result, std::plus<>()); | |
| 394 | return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>()); | |
| 362 | 395 | } |
| 363 | 396 | |
| 364 | 397 | template <class _InputIterator, class _OutputIterator, class _Tp, |
| 365 | 398 | class _BinaryOp, class _UnaryOp> |
| 366 | inline _LIBCPP_INLINE_VISIBILITY | |
| 399 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 367 | 400 | _OutputIterator |
| 368 | 401 | transform_exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 369 | 402 | _OutputIterator __result, _Tp __init, |
| ... | ... | @@ -384,7 +417,9 @@ transform_exclusive_scan(_InputIterator __first, _InputIterator __last, |
| 384 | 417 | } |
| 385 | 418 | |
| 386 | 419 | template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> |
| 387 | _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last, | |
| 420 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 421 | _OutputIterator | |
| 422 | transform_inclusive_scan(_InputIterator __first, _InputIterator __last, | |
| 388 | 423 | _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) |
| 389 | 424 | { |
| 390 | 425 | for (; __first != __last; ++__first, (void) ++__result) { |
| ... | ... | @@ -396,61 +431,71 @@ _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator |
| 396 | 431 | } |
| 397 | 432 | |
| 398 | 433 | template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp> |
| 399 | _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last, | |
| 434 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 435 | _OutputIterator | |
| 436 | transform_inclusive_scan(_InputIterator __first, _InputIterator __last, | |
| 400 | 437 | _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) |
| 401 | 438 | { |
| 402 | 439 | if (__first != __last) { |
| 403 | typename std::iterator_traits<_InputIterator>::value_type __init = __u(*__first); | |
| 440 | typename iterator_traits<_InputIterator>::value_type __init = __u(*__first); | |
| 404 | 441 | *__result++ = __init; |
| 405 | 442 | if (++__first != __last) |
| 406 | 443 | return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init); |
| 407 | } | |
| 444 | } | |
| 408 | 445 | |
| 409 | 446 | return __result; |
| 410 | 447 | } |
| 411 | 448 | #endif |
| 412 | 449 | |
| 413 | 450 | template <class _InputIterator, class _OutputIterator> |
| 414 | inline _LIBCPP_INLINE_VISIBILITY | |
| 451 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 415 | 452 | _OutputIterator |
| 416 | 453 | adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) |
| 417 | 454 | { |
| 418 | 455 | if (__first != __last) |
| 419 | 456 | { |
| 420 | typename iterator_traits<_InputIterator>::value_type __t1(*__first); | |
| 421 | *__result = __t1; | |
| 457 | typename iterator_traits<_InputIterator>::value_type __acc(*__first); | |
| 458 | *__result = __acc; | |
| 422 | 459 | for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) |
| 423 | 460 | { |
| 424 | typename iterator_traits<_InputIterator>::value_type __t2(*__first); | |
| 425 | *__result = __t2 - __t1; | |
| 426 | __t1 = _VSTD::move(__t2); | |
| 461 | typename iterator_traits<_InputIterator>::value_type __val(*__first); | |
| 462 | #if _LIBCPP_STD_VER > 17 | |
| 463 | *__result = __val - _VSTD::move(__acc); | |
| 464 | #else | |
| 465 | *__result = __val - __acc; | |
| 466 | #endif | |
| 467 | __acc = _VSTD::move(__val); | |
| 427 | 468 | } |
| 428 | 469 | } |
| 429 | 470 | return __result; |
| 430 | 471 | } |
| 431 | 472 | |
| 432 | 473 | template <class _InputIterator, class _OutputIterator, class _BinaryOperation> |
| 433 | inline _LIBCPP_INLINE_VISIBILITY | |
| 474 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 434 | 475 | _OutputIterator |
| 435 | 476 | adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, |
| 436 | 477 | _BinaryOperation __binary_op) |
| 437 | 478 | { |
| 438 | 479 | if (__first != __last) |
| 439 | 480 | { |
| 440 | typename iterator_traits<_InputIterator>::value_type __t1(*__first); | |
| 441 | *__result = __t1; | |
| 481 | typename iterator_traits<_InputIterator>::value_type __acc(*__first); | |
| 482 | *__result = __acc; | |
| 442 | 483 | for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) |
| 443 | 484 | { |
| 444 | typename iterator_traits<_InputIterator>::value_type __t2(*__first); | |
| 445 | *__result = __binary_op(__t2, __t1); | |
| 446 | __t1 = _VSTD::move(__t2); | |
| 485 | typename iterator_traits<_InputIterator>::value_type __val(*__first); | |
| 486 | #if _LIBCPP_STD_VER > 17 | |
| 487 | *__result = __binary_op(__val, _VSTD::move(__acc)); | |
| 488 | #else | |
| 489 | *__result = __binary_op(__val, __acc); | |
| 490 | #endif | |
| 491 | __acc = _VSTD::move(__val); | |
| 447 | 492 | } |
| 448 | 493 | } |
| 449 | 494 | return __result; |
| 450 | 495 | } |
| 451 | 496 | |
| 452 | 497 | template <class _ForwardIterator, class _Tp> |
| 453 | inline _LIBCPP_INLINE_VISIBILITY | |
| 498 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 454 | 499 | void |
| 455 | 500 | iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) |
| 456 | 501 | { |
| ... | ... | @@ -467,9 +512,9 @@ struct __ct_abs<_Result, _Source, true> { |
| 467 | 512 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 468 | 513 | _Result operator()(_Source __t) const noexcept |
| 469 | 514 | { |
| 470 | if (__t >= 0) return __t; | |
| 471 | if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); | |
| 472 | return -__t; | |
| 515 | if (__t >= 0) return __t; | |
| 516 | if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); | |
| 517 | return -__t; | |
| 473 | 518 | } |
| 474 | 519 | }; |
| 475 | 520 | |
| ... | ... | @@ -531,8 +576,8 @@ enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_T |
| 531 | 576 | midpoint(_Tp __a, _Tp __b) noexcept |
| 532 | 577 | _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK |
| 533 | 578 | { |
| 534 | using _Up = std::make_unsigned_t<_Tp>; | |
| 535 | constexpr _Up __bitshift = std::numeric_limits<_Up>::digits - 1; | |
| 579 | using _Up = make_unsigned_t<_Tp>; | |
| 580 | constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1; | |
| 536 | 581 | |
| 537 | 582 | _Up __diff = _Up(__b) - _Up(__a); |
| 538 | 583 | _Up __sign_bit = __b < __a; |
lib/libcxx/include/optional+3-2| ... | ... | @@ -147,6 +147,7 @@ template<class T> |
| 147 | 147 | */ |
| 148 | 148 | |
| 149 | 149 | #include <__config> |
| 150 | #include <__availability> | |
| 150 | 151 | #include <__debug> |
| 151 | 152 | #include <__functional_base> |
| 152 | 153 | #include <functional> |
| ... | ... | @@ -320,7 +321,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> |
| 320 | 321 | void __construct(_Args&&... __args) |
| 321 | 322 | { |
| 322 | 323 | _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); |
| 323 | ::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); | |
| 324 | ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); | |
| 324 | 325 | this->__engaged_ = true; |
| 325 | 326 | } |
| 326 | 327 | |
| ... | ... | @@ -656,7 +657,7 @@ private: |
| 656 | 657 | } |
| 657 | 658 | template <class _Up, class _QUp = _QualUp> |
| 658 | 659 | static constexpr bool __enable_assign() { |
| 659 | // Construction and assignability of _Qup to _Tp has already been | |
| 660 | // Construction and assignability of _QUp to _Tp has already been | |
| 660 | 661 | // checked. |
| 661 | 662 | return !__check_constructible_from_opt<_Up>::value && |
| 662 | 663 | !__check_assignable_from_opt<_Up>::value; |
lib/libcxx/include/ostream+15-13| ... | ... | @@ -126,9 +126,8 @@ template <class charT, class traits> |
| 126 | 126 | basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os); |
| 127 | 127 | |
| 128 | 128 | // rvalue stream insertion |
| 129 | template <class charT, class traits, class T> | |
| 130 | basic_ostream<charT, traits>& | |
| 131 | operator<<(basic_ostream<charT, traits>&& os, const T& x); | |
| 129 | template <class Stream, class T> | |
| 130 | Stream&& operator<<(Stream&& os, const T& x); | |
| 132 | 131 | |
| 133 | 132 | } // std |
| 134 | 133 | |
| ... | ... | @@ -1028,15 +1027,20 @@ flush(basic_ostream<_CharT, _Traits>& __os) |
| 1028 | 1027 | |
| 1029 | 1028 | #ifndef _LIBCPP_CXX03_LANG |
| 1030 | 1029 | |
| 1030 | template <class _Stream, class _Tp, class = void> | |
| 1031 | struct __is_ostreamable : false_type { }; | |
| 1032 | ||
| 1031 | 1033 | template <class _Stream, class _Tp> |
| 1032 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1033 | typename enable_if | |
| 1034 | < | |
| 1035 | !is_lvalue_reference<_Stream>::value && | |
| 1036 | is_base_of<ios_base, _Stream>::value, | |
| 1037 | _Stream&& | |
| 1038 | >::type | |
| 1039 | operator<<(_Stream&& __os, const _Tp& __x) | |
| 1034 | struct __is_ostreamable<_Stream, _Tp, decltype( | |
| 1035 | _VSTD::declval<_Stream>() << _VSTD::declval<_Tp>(), void() | |
| 1036 | )> : true_type { }; | |
| 1037 | ||
| 1038 | template <class _Stream, class _Tp, class = typename enable_if< | |
| 1039 | _And<is_base_of<ios_base, _Stream>, | |
| 1040 | __is_ostreamable<_Stream&, const _Tp&>>::value | |
| 1041 | >::type> | |
| 1042 | _LIBCPP_INLINE_VISIBILITY | |
| 1043 | _Stream&& operator<<(_Stream&& __os, const _Tp& __x) | |
| 1040 | 1044 | { |
| 1041 | 1045 | __os << __x; |
| 1042 | 1046 | return _VSTD::move(__os); |
| ... | ... | @@ -1097,10 +1101,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) |
| 1097 | 1101 | use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); |
| 1098 | 1102 | } |
| 1099 | 1103 | |
| 1100 | #ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB | |
| 1101 | 1104 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>) |
| 1102 | 1105 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>) |
| 1103 | #endif | |
| 1104 | 1106 | |
| 1105 | 1107 | _LIBCPP_END_NAMESPACE_STD |
| 1106 | 1108 |
lib/libcxx/include/random+145-77| ... | ... | @@ -1642,8 +1642,7 @@ class piecewise_linear_distribution |
| 1642 | 1642 | #include <numeric> |
| 1643 | 1643 | #include <vector> |
| 1644 | 1644 | #include <string> |
| 1645 | #include <istream> | |
| 1646 | #include <ostream> | |
| 1645 | #include <iosfwd> | |
| 1647 | 1646 | |
| 1648 | 1647 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 1649 | 1648 | #pragma GCC system_header |
| ... | ... | @@ -1669,7 +1668,23 @@ struct __is_seed_sequence |
| 1669 | 1668 | |
| 1670 | 1669 | template <unsigned long long __a, unsigned long long __c, |
| 1671 | 1670 | unsigned long long __m, unsigned long long _Mp, |
| 1672 | bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a)> | |
| 1671 | bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a), | |
| 1672 | bool _OverflowOK = ((__m|__m-1) > __m), // m = 2^n | |
| 1673 | bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q | |
| 1674 | struct __lce_alg_picker | |
| 1675 | { | |
| 1676 | static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK, | |
| 1677 | "The current values of a, c, and m cannot generate a number " | |
| 1678 | "within bounds of linear_congruential_engine."); | |
| 1679 | ||
| 1680 | static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow && | |
| 1681 | !_OverflowOK && | |
| 1682 | _SchrageOK; | |
| 1683 | }; | |
| 1684 | ||
| 1685 | template <unsigned long long __a, unsigned long long __c, | |
| 1686 | unsigned long long __m, unsigned long long _Mp, | |
| 1687 | bool _UseSchrage = __lce_alg_picker<__a, __c, __m, _Mp>::__use_schrage> | |
| 1673 | 1688 | struct __lce_ta; |
| 1674 | 1689 | |
| 1675 | 1690 | // 64 |
| ... | ... | @@ -1843,6 +1858,7 @@ private: |
| 1843 | 1858 | |
| 1844 | 1859 | static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters"); |
| 1845 | 1860 | static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters"); |
| 1861 | static_assert(_VSTD::is_unsigned<_UIntType>::value, "_UIntType must be unsigned type"); | |
| 1846 | 1862 | public: |
| 1847 | 1863 | static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u; |
| 1848 | 1864 | static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u; |
| ... | ... | @@ -1982,7 +1998,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 1982 | 1998 | const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) |
| 1983 | 1999 | { |
| 1984 | 2000 | __save_flags<_CharT, _Traits> __lx(__os); |
| 1985 | __os.flags(ios_base::dec | ios_base::left); | |
| 2001 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 2002 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 1986 | 2003 | __os.fill(__os.widen(' ')); |
| 1987 | 2004 | return __os << __x.__x_; |
| 1988 | 2005 | } |
| ... | ... | @@ -1994,7 +2011,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 1994 | 2011 | linear_congruential_engine<_UIntType, __a, __c, __m>& __x) |
| 1995 | 2012 | { |
| 1996 | 2013 | __save_flags<_CharT, _Traits> __lx(__is); |
| 1997 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 2014 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 2015 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 1998 | 2016 | _UIntType __t; |
| 1999 | 2017 | __is >> __t; |
| 2000 | 2018 | if (!__is.fail()) |
| ... | ... | @@ -2453,7 +2471,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 2453 | 2471 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x) |
| 2454 | 2472 | { |
| 2455 | 2473 | __save_flags<_CharT, _Traits> __lx(__os); |
| 2456 | __os.flags(ios_base::dec | ios_base::left); | |
| 2474 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 2475 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 2457 | 2476 | _CharT __sp = __os.widen(' '); |
| 2458 | 2477 | __os.fill(__sp); |
| 2459 | 2478 | __os << __x.__x_[__x.__i_]; |
| ... | ... | @@ -2474,7 +2493,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 2474 | 2493 | _Bp, _Tp, _Cp, _Lp, _Fp>& __x) |
| 2475 | 2494 | { |
| 2476 | 2495 | __save_flags<_CharT, _Traits> __lx(__is); |
| 2477 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 2496 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 2497 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 2478 | 2498 | _UInt __t[_Np]; |
| 2479 | 2499 | for (size_t __i = 0; __i < _Np; ++__i) |
| 2480 | 2500 | __is >> __t[__i]; |
| ... | ... | @@ -2773,7 +2793,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 2773 | 2793 | const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) |
| 2774 | 2794 | { |
| 2775 | 2795 | __save_flags<_CharT, _Traits> __lx(__os); |
| 2776 | __os.flags(ios_base::dec | ios_base::left); | |
| 2796 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 2797 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 2777 | 2798 | _CharT __sp = __os.widen(' '); |
| 2778 | 2799 | __os.fill(__sp); |
| 2779 | 2800 | __os << __x.__x_[__x.__i_]; |
| ... | ... | @@ -2792,7 +2813,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 2792 | 2813 | subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) |
| 2793 | 2814 | { |
| 2794 | 2815 | __save_flags<_CharT, _Traits> __lx(__is); |
| 2795 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 2816 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 2817 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 2796 | 2818 | _UInt __t[_Rp+1]; |
| 2797 | 2819 | for (size_t __i = 0; __i < _Rp+1; ++__i) |
| 2798 | 2820 | __is >> __t[__i]; |
| ... | ... | @@ -2955,7 +2977,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 2955 | 2977 | const discard_block_engine<_Eng, _Pp, _Rp>& __x) |
| 2956 | 2978 | { |
| 2957 | 2979 | __save_flags<_CharT, _Traits> __lx(__os); |
| 2958 | __os.flags(ios_base::dec | ios_base::left); | |
| 2980 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 2981 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 2959 | 2982 | _CharT __sp = __os.widen(' '); |
| 2960 | 2983 | __os.fill(__sp); |
| 2961 | 2984 | return __os << __x.__e_ << __sp << __x.__n_; |
| ... | ... | @@ -2968,7 +2991,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 2968 | 2991 | discard_block_engine<_Eng, _Pp, _Rp>& __x) |
| 2969 | 2992 | { |
| 2970 | 2993 | __save_flags<_CharT, _Traits> __lx(__is); |
| 2971 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 2994 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 2995 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 2972 | 2996 | _Eng __e; |
| 2973 | 2997 | int __n; |
| 2974 | 2998 | __is >> __e >> __n; |
| ... | ... | @@ -3440,7 +3464,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 3440 | 3464 | const shuffle_order_engine<_Eng, _Kp>& __x) |
| 3441 | 3465 | { |
| 3442 | 3466 | __save_flags<_CharT, _Traits> __lx(__os); |
| 3443 | __os.flags(ios_base::dec | ios_base::left); | |
| 3467 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 3468 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 3444 | 3469 | _CharT __sp = __os.widen(' '); |
| 3445 | 3470 | __os.fill(__sp); |
| 3446 | 3471 | __os << __x.__e_ << __sp << __x._V_[0]; |
| ... | ... | @@ -3457,7 +3482,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 3457 | 3482 | { |
| 3458 | 3483 | typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type; |
| 3459 | 3484 | __save_flags<_CharT, _Traits> __lx(__is); |
| 3460 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 3485 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 3486 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 3461 | 3487 | _Eng __e; |
| 3462 | 3488 | result_type _Vp[_Kp+1]; |
| 3463 | 3489 | __is >> __e; |
| ... | ... | @@ -3477,6 +3503,8 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b; |
| 3477 | 3503 | |
| 3478 | 3504 | // random_device |
| 3479 | 3505 | |
| 3506 | #if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE) | |
| 3507 | ||
| 3480 | 3508 | class _LIBCPP_TYPE_VIS random_device |
| 3481 | 3509 | { |
| 3482 | 3510 | #ifdef _LIBCPP_USING_DEV_RANDOM |
| ... | ... | @@ -3511,6 +3539,8 @@ private: |
| 3511 | 3539 | random_device& operator=(const random_device&); // = delete; |
| 3512 | 3540 | }; |
| 3513 | 3541 | |
| 3542 | #endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE | |
| 3543 | ||
| 3514 | 3544 | // seed_seq |
| 3515 | 3545 | |
| 3516 | 3546 | class _LIBCPP_TEMPLATE_VIS seed_seq |
| ... | ... | @@ -3663,7 +3693,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 3663 | 3693 | const uniform_int_distribution<_IT>& __x) |
| 3664 | 3694 | { |
| 3665 | 3695 | __save_flags<_CharT, _Traits> __lx(__os); |
| 3666 | __os.flags(ios_base::dec | ios_base::left); | |
| 3696 | typedef basic_ostream<_CharT, _Traits> _Ostream; | |
| 3697 | __os.flags(_Ostream::dec | _Ostream::left); | |
| 3667 | 3698 | _CharT __sp = __os.widen(' '); |
| 3668 | 3699 | __os.fill(__sp); |
| 3669 | 3700 | return __os << __x.a() << __sp << __x.b(); |
| ... | ... | @@ -3678,7 +3709,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 3678 | 3709 | typedef typename _Eng::result_type result_type; |
| 3679 | 3710 | typedef typename _Eng::param_type param_type; |
| 3680 | 3711 | __save_flags<_CharT, _Traits> __lx(__is); |
| 3681 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 3712 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 3713 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 3682 | 3714 | result_type __a; |
| 3683 | 3715 | result_type __b; |
| 3684 | 3716 | __is >> __a >> __b; |
| ... | ... | @@ -3784,8 +3816,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 3784 | 3816 | const uniform_real_distribution<_RT>& __x) |
| 3785 | 3817 | { |
| 3786 | 3818 | __save_flags<_CharT, _Traits> __lx(__os); |
| 3787 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 3788 | ios_base::scientific); | |
| 3819 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 3820 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 3821 | _OStream::scientific); | |
| 3789 | 3822 | _CharT __sp = __os.widen(' '); |
| 3790 | 3823 | __os.fill(__sp); |
| 3791 | 3824 | return __os << __x.a() << __sp << __x.b(); |
| ... | ... | @@ -3800,7 +3833,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 3800 | 3833 | typedef typename _Eng::result_type result_type; |
| 3801 | 3834 | typedef typename _Eng::param_type param_type; |
| 3802 | 3835 | __save_flags<_CharT, _Traits> __lx(__is); |
| 3803 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 3836 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 3837 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 3804 | 3838 | result_type __a; |
| 3805 | 3839 | result_type __b; |
| 3806 | 3840 | __is >> __a >> __b; |
| ... | ... | @@ -3895,8 +3929,9 @@ basic_ostream<_CharT, _Traits>& |
| 3895 | 3929 | operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x) |
| 3896 | 3930 | { |
| 3897 | 3931 | __save_flags<_CharT, _Traits> __lx(__os); |
| 3898 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 3899 | ios_base::scientific); | |
| 3932 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 3933 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 3934 | _OStream::scientific); | |
| 3900 | 3935 | _CharT __sp = __os.widen(' '); |
| 3901 | 3936 | __os.fill(__sp); |
| 3902 | 3937 | return __os << __x.p(); |
| ... | ... | @@ -3909,7 +3944,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x) |
| 3909 | 3944 | typedef bernoulli_distribution _Eng; |
| 3910 | 3945 | typedef typename _Eng::param_type param_type; |
| 3911 | 3946 | __save_flags<_CharT, _Traits> __lx(__is); |
| 3912 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 3947 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 3948 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 3913 | 3949 | double __p; |
| 3914 | 3950 | __is >> __p; |
| 3915 | 3951 | if (!__is.fail()) |
| ... | ... | @@ -3999,12 +4035,12 @@ public: |
| 3999 | 4035 | {return !(__x == __y);} |
| 4000 | 4036 | }; |
| 4001 | 4037 | |
| 4002 | #ifndef _LIBCPP_MSVCRT | |
| 4038 | #ifndef _LIBCPP_MSVCRT_LIKE | |
| 4003 | 4039 | extern "C" double lgamma_r(double, int *); |
| 4004 | 4040 | #endif |
| 4005 | 4041 | |
| 4006 | 4042 | inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) { |
| 4007 | #if defined(_LIBCPP_MSVCRT) | |
| 4043 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 4008 | 4044 | return lgamma(__d); |
| 4009 | 4045 | #else |
| 4010 | 4046 | int __sign; |
| ... | ... | @@ -4079,8 +4115,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4079 | 4115 | const binomial_distribution<_IntType>& __x) |
| 4080 | 4116 | { |
| 4081 | 4117 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4082 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4083 | ios_base::scientific); | |
| 4118 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 4119 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 4120 | _OStream::scientific); | |
| 4084 | 4121 | _CharT __sp = __os.widen(' '); |
| 4085 | 4122 | __os.fill(__sp); |
| 4086 | 4123 | return __os << __x.t() << __sp << __x.p(); |
| ... | ... | @@ -4095,7 +4132,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4095 | 4132 | typedef typename _Eng::result_type result_type; |
| 4096 | 4133 | typedef typename _Eng::param_type param_type; |
| 4097 | 4134 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4098 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 4135 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 4136 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4099 | 4137 | result_type __t; |
| 4100 | 4138 | double __p; |
| 4101 | 4139 | __is >> __t >> __p; |
| ... | ... | @@ -4197,8 +4235,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4197 | 4235 | const exponential_distribution<_RealType>& __x) |
| 4198 | 4236 | { |
| 4199 | 4237 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4200 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4201 | ios_base::scientific); | |
| 4238 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 4239 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 4240 | _OStream::scientific); | |
| 4202 | 4241 | return __os << __x.lambda(); |
| 4203 | 4242 | } |
| 4204 | 4243 | |
| ... | ... | @@ -4211,7 +4250,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4211 | 4250 | typedef typename _Eng::result_type result_type; |
| 4212 | 4251 | typedef typename _Eng::param_type param_type; |
| 4213 | 4252 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4214 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 4253 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 4254 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4215 | 4255 | result_type __lambda; |
| 4216 | 4256 | __is >> __lambda; |
| 4217 | 4257 | if (!__is.fail()) |
| ... | ... | @@ -4351,8 +4391,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4351 | 4391 | const normal_distribution<_RT>& __x) |
| 4352 | 4392 | { |
| 4353 | 4393 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4354 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4355 | ios_base::scientific); | |
| 4394 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 4395 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 4396 | _OStream::scientific); | |
| 4356 | 4397 | _CharT __sp = __os.widen(' '); |
| 4357 | 4398 | __os.fill(__sp); |
| 4358 | 4399 | __os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_; |
| ... | ... | @@ -4370,7 +4411,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4370 | 4411 | typedef typename _Eng::result_type result_type; |
| 4371 | 4412 | typedef typename _Eng::param_type param_type; |
| 4372 | 4413 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4373 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 4414 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 4415 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4374 | 4416 | result_type __mean; |
| 4375 | 4417 | result_type __stddev; |
| 4376 | 4418 | result_type _Vp = 0; |
| ... | ... | @@ -4618,7 +4660,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean) |
| 4618 | 4660 | { |
| 4619 | 4661 | __s_ = _VSTD::sqrt(__mean_); |
| 4620 | 4662 | __d_ = 6 * __mean_ * __mean_; |
| 4621 | __l_ = std::trunc(__mean_ - 1.1484); | |
| 4663 | __l_ = _VSTD::trunc(__mean_ - 1.1484); | |
| 4622 | 4664 | __omega_ = .3989423 / __s_; |
| 4623 | 4665 | double __b1_ = .4166667E-1 / __mean_; |
| 4624 | 4666 | double __b2_ = .3 * __b1_ * __b1_; |
| ... | ... | @@ -4650,13 +4692,13 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4650 | 4692 | double __u; |
| 4651 | 4693 | if (__g > 0) |
| 4652 | 4694 | { |
| 4653 | __tx = std::trunc(__g); | |
| 4695 | __tx = _VSTD::trunc(__g); | |
| 4654 | 4696 | if (__tx >= __pr.__l_) |
| 4655 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4697 | return _VSTD::__clamp_to_integral<result_type>(__tx); | |
| 4656 | 4698 | __difmuk = __pr.__mean_ - __tx; |
| 4657 | 4699 | __u = __urd(__urng); |
| 4658 | 4700 | if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk) |
| 4659 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4701 | return _VSTD::__clamp_to_integral<result_type>(__tx); | |
| 4660 | 4702 | } |
| 4661 | 4703 | exponential_distribution<double> __edist; |
| 4662 | 4704 | for (bool __using_exp_dist = false; true; __using_exp_dist = true) |
| ... | ... | @@ -4672,7 +4714,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4672 | 4714 | __u += __u - 1; |
| 4673 | 4715 | __t = 1.8 + (__u < 0 ? -__e : __e); |
| 4674 | 4716 | } while (__t <= -.6744); |
| 4675 | __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t); | |
| 4717 | __tx = _VSTD::trunc(__pr.__mean_ + __pr.__s_ * __t); | |
| 4676 | 4718 | __difmuk = __pr.__mean_ - __tx; |
| 4677 | 4719 | __using_exp_dist = true; |
| 4678 | 4720 | } |
| ... | ... | @@ -4716,7 +4758,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr |
| 4716 | 4758 | } |
| 4717 | 4759 | } |
| 4718 | 4760 | } |
| 4719 | return std::__clamp_to_integral<result_type>(__tx); | |
| 4761 | return _VSTD::__clamp_to_integral<result_type>(__tx); | |
| 4720 | 4762 | } |
| 4721 | 4763 | |
| 4722 | 4764 | template <class _CharT, class _Traits, class _IntType> |
| ... | ... | @@ -4725,8 +4767,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4725 | 4767 | const poisson_distribution<_IntType>& __x) |
| 4726 | 4768 | { |
| 4727 | 4769 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4728 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4729 | ios_base::scientific); | |
| 4770 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 4771 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 4772 | _OStream::scientific); | |
| 4730 | 4773 | return __os << __x.mean(); |
| 4731 | 4774 | } |
| 4732 | 4775 | |
| ... | ... | @@ -4738,7 +4781,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4738 | 4781 | typedef poisson_distribution<_IntType> _Eng; |
| 4739 | 4782 | typedef typename _Eng::param_type param_type; |
| 4740 | 4783 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4741 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 4784 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 4785 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4742 | 4786 | double __mean; |
| 4743 | 4787 | __is >> __mean; |
| 4744 | 4788 | if (!__is.fail()) |
| ... | ... | @@ -4836,8 +4880,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4836 | 4880 | const weibull_distribution<_RT>& __x) |
| 4837 | 4881 | { |
| 4838 | 4882 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4839 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4840 | ios_base::scientific); | |
| 4883 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 4884 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 4885 | _OStream::scientific); | |
| 4841 | 4886 | _CharT __sp = __os.widen(' '); |
| 4842 | 4887 | __os.fill(__sp); |
| 4843 | 4888 | __os << __x.a() << __sp << __x.b(); |
| ... | ... | @@ -4853,7 +4898,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4853 | 4898 | typedef typename _Eng::result_type result_type; |
| 4854 | 4899 | typedef typename _Eng::param_type param_type; |
| 4855 | 4900 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4856 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 4901 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 4902 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4857 | 4903 | result_type __a; |
| 4858 | 4904 | result_type __b; |
| 4859 | 4905 | __is >> __a >> __b; |
| ... | ... | @@ -4955,8 +5001,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 4955 | 5001 | const extreme_value_distribution<_RT>& __x) |
| 4956 | 5002 | { |
| 4957 | 5003 | __save_flags<_CharT, _Traits> __lx(__os); |
| 4958 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 4959 | ios_base::scientific); | |
| 5004 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5005 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5006 | _OStream::scientific); | |
| 4960 | 5007 | _CharT __sp = __os.widen(' '); |
| 4961 | 5008 | __os.fill(__sp); |
| 4962 | 5009 | __os << __x.a() << __sp << __x.b(); |
| ... | ... | @@ -4972,7 +5019,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 4972 | 5019 | typedef typename _Eng::result_type result_type; |
| 4973 | 5020 | typedef typename _Eng::param_type param_type; |
| 4974 | 5021 | __save_flags<_CharT, _Traits> __lx(__is); |
| 4975 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5022 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5023 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 4976 | 5024 | result_type __a; |
| 4977 | 5025 | result_type __b; |
| 4978 | 5026 | __is >> __a >> __b; |
| ... | ... | @@ -5127,8 +5175,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5127 | 5175 | const gamma_distribution<_RT>& __x) |
| 5128 | 5176 | { |
| 5129 | 5177 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5130 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5131 | ios_base::scientific); | |
| 5178 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5179 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5180 | _OStream::scientific); | |
| 5132 | 5181 | _CharT __sp = __os.widen(' '); |
| 5133 | 5182 | __os.fill(__sp); |
| 5134 | 5183 | __os << __x.alpha() << __sp << __x.beta(); |
| ... | ... | @@ -5144,7 +5193,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5144 | 5193 | typedef typename _Eng::result_type result_type; |
| 5145 | 5194 | typedef typename _Eng::param_type param_type; |
| 5146 | 5195 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5147 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5196 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5197 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5148 | 5198 | result_type __alpha; |
| 5149 | 5199 | result_type __beta; |
| 5150 | 5200 | __is >> __alpha >> __beta; |
| ... | ... | @@ -5263,8 +5313,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5263 | 5313 | const negative_binomial_distribution<_IntType>& __x) |
| 5264 | 5314 | { |
| 5265 | 5315 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5266 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5267 | ios_base::scientific); | |
| 5316 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5317 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5318 | _OStream::scientific); | |
| 5268 | 5319 | _CharT __sp = __os.widen(' '); |
| 5269 | 5320 | __os.fill(__sp); |
| 5270 | 5321 | return __os << __x.k() << __sp << __x.p(); |
| ... | ... | @@ -5279,7 +5330,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5279 | 5330 | typedef typename _Eng::result_type result_type; |
| 5280 | 5331 | typedef typename _Eng::param_type param_type; |
| 5281 | 5332 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5282 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5333 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5334 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5283 | 5335 | result_type __k; |
| 5284 | 5336 | double __p; |
| 5285 | 5337 | __is >> __k >> __p; |
| ... | ... | @@ -5369,8 +5421,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5369 | 5421 | const geometric_distribution<_IntType>& __x) |
| 5370 | 5422 | { |
| 5371 | 5423 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5372 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5373 | ios_base::scientific); | |
| 5424 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5425 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5426 | _OStream::scientific); | |
| 5374 | 5427 | return __os << __x.p(); |
| 5375 | 5428 | } |
| 5376 | 5429 | |
| ... | ... | @@ -5382,7 +5435,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5382 | 5435 | typedef geometric_distribution<_IntType> _Eng; |
| 5383 | 5436 | typedef typename _Eng::param_type param_type; |
| 5384 | 5437 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5385 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5438 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5439 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5386 | 5440 | double __p; |
| 5387 | 5441 | __is >> __p; |
| 5388 | 5442 | if (!__is.fail()) |
| ... | ... | @@ -5473,8 +5527,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5473 | 5527 | const chi_squared_distribution<_RT>& __x) |
| 5474 | 5528 | { |
| 5475 | 5529 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5476 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5477 | ios_base::scientific); | |
| 5530 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5531 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5532 | _OStream::scientific); | |
| 5478 | 5533 | __os << __x.n(); |
| 5479 | 5534 | return __os; |
| 5480 | 5535 | } |
| ... | ... | @@ -5488,7 +5543,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5488 | 5543 | typedef typename _Eng::result_type result_type; |
| 5489 | 5544 | typedef typename _Eng::param_type param_type; |
| 5490 | 5545 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5491 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5546 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5547 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5492 | 5548 | result_type __n; |
| 5493 | 5549 | __is >> __n; |
| 5494 | 5550 | if (!__is.fail()) |
| ... | ... | @@ -5593,8 +5649,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5593 | 5649 | const cauchy_distribution<_RT>& __x) |
| 5594 | 5650 | { |
| 5595 | 5651 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5596 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5597 | ios_base::scientific); | |
| 5652 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5653 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5654 | _OStream::scientific); | |
| 5598 | 5655 | _CharT __sp = __os.widen(' '); |
| 5599 | 5656 | __os.fill(__sp); |
| 5600 | 5657 | __os << __x.a() << __sp << __x.b(); |
| ... | ... | @@ -5610,7 +5667,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5610 | 5667 | typedef typename _Eng::result_type result_type; |
| 5611 | 5668 | typedef typename _Eng::param_type param_type; |
| 5612 | 5669 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5613 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5670 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5671 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5614 | 5672 | result_type __a; |
| 5615 | 5673 | result_type __b; |
| 5616 | 5674 | __is >> __a >> __b; |
| ... | ... | @@ -5715,8 +5773,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5715 | 5773 | const fisher_f_distribution<_RT>& __x) |
| 5716 | 5774 | { |
| 5717 | 5775 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5718 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5719 | ios_base::scientific); | |
| 5776 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5777 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5778 | _OStream::scientific); | |
| 5720 | 5779 | _CharT __sp = __os.widen(' '); |
| 5721 | 5780 | __os.fill(__sp); |
| 5722 | 5781 | __os << __x.m() << __sp << __x.n(); |
| ... | ... | @@ -5732,7 +5791,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5732 | 5791 | typedef typename _Eng::result_type result_type; |
| 5733 | 5792 | typedef typename _Eng::param_type param_type; |
| 5734 | 5793 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5735 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5794 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5795 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5736 | 5796 | result_type __m; |
| 5737 | 5797 | result_type __n; |
| 5738 | 5798 | __is >> __m >> __n; |
| ... | ... | @@ -5831,8 +5891,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 5831 | 5891 | const student_t_distribution<_RT>& __x) |
| 5832 | 5892 | { |
| 5833 | 5893 | __save_flags<_CharT, _Traits> __lx(__os); |
| 5834 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 5835 | ios_base::scientific); | |
| 5894 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 5895 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 5896 | _OStream::scientific); | |
| 5836 | 5897 | __os << __x.n(); |
| 5837 | 5898 | return __os; |
| 5838 | 5899 | } |
| ... | ... | @@ -5846,7 +5907,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 5846 | 5907 | typedef typename _Eng::result_type result_type; |
| 5847 | 5908 | typedef typename _Eng::param_type param_type; |
| 5848 | 5909 | __save_flags<_CharT, _Traits> __lx(__is); |
| 5849 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 5910 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 5911 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 5850 | 5912 | result_type __n; |
| 5851 | 5913 | __is >> __n; |
| 5852 | 5914 | if (!__is.fail()) |
| ... | ... | @@ -6054,8 +6116,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 6054 | 6116 | const discrete_distribution<_IT>& __x) |
| 6055 | 6117 | { |
| 6056 | 6118 | __save_flags<_CharT, _Traits> __lx(__os); |
| 6057 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 6058 | ios_base::scientific); | |
| 6119 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 6120 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 6121 | _OStream::scientific); | |
| 6059 | 6122 | _CharT __sp = __os.widen(' '); |
| 6060 | 6123 | __os.fill(__sp); |
| 6061 | 6124 | size_t __n = __x.__p_.__p_.size(); |
| ... | ... | @@ -6071,7 +6134,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 6071 | 6134 | discrete_distribution<_IT>& __x) |
| 6072 | 6135 | { |
| 6073 | 6136 | __save_flags<_CharT, _Traits> __lx(__is); |
| 6074 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 6137 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 6138 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 6075 | 6139 | size_t __n; |
| 6076 | 6140 | __is >> __n; |
| 6077 | 6141 | vector<double> __p(__n); |
| ... | ... | @@ -6356,8 +6420,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 6356 | 6420 | const piecewise_constant_distribution<_RT>& __x) |
| 6357 | 6421 | { |
| 6358 | 6422 | __save_flags<_CharT, _Traits> __lx(__os); |
| 6359 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 6360 | ios_base::scientific); | |
| 6423 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 6424 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 6425 | _OStream::scientific); | |
| 6361 | 6426 | _CharT __sp = __os.widen(' '); |
| 6362 | 6427 | __os.fill(__sp); |
| 6363 | 6428 | size_t __n = __x.__p_.__b_.size(); |
| ... | ... | @@ -6383,7 +6448,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 6383 | 6448 | typedef piecewise_constant_distribution<_RT> _Eng; |
| 6384 | 6449 | typedef typename _Eng::result_type result_type; |
| 6385 | 6450 | __save_flags<_CharT, _Traits> __lx(__is); |
| 6386 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 6451 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 6452 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 6387 | 6453 | size_t __n; |
| 6388 | 6454 | __is >> __n; |
| 6389 | 6455 | vector<result_type> __b(__n); |
| ... | ... | @@ -6696,8 +6762,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 6696 | 6762 | const piecewise_linear_distribution<_RT>& __x) |
| 6697 | 6763 | { |
| 6698 | 6764 | __save_flags<_CharT, _Traits> __lx(__os); |
| 6699 | __os.flags(ios_base::dec | ios_base::left | ios_base::fixed | | |
| 6700 | ios_base::scientific); | |
| 6765 | typedef basic_ostream<_CharT, _Traits> _OStream; | |
| 6766 | __os.flags(_OStream::dec | _OStream::left | _OStream::fixed | | |
| 6767 | _OStream::scientific); | |
| 6701 | 6768 | _CharT __sp = __os.widen(' '); |
| 6702 | 6769 | __os.fill(__sp); |
| 6703 | 6770 | size_t __n = __x.__p_.__b_.size(); |
| ... | ... | @@ -6723,7 +6790,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, |
| 6723 | 6790 | typedef piecewise_linear_distribution<_RT> _Eng; |
| 6724 | 6791 | typedef typename _Eng::result_type result_type; |
| 6725 | 6792 | __save_flags<_CharT, _Traits> __lx(__is); |
| 6726 | __is.flags(ios_base::dec | ios_base::skipws); | |
| 6793 | typedef basic_istream<_CharT, _Traits> _Istream; | |
| 6794 | __is.flags(_Istream::dec | _Istream::skipws); | |
| 6727 | 6795 | size_t __n; |
| 6728 | 6796 | __is >> __n; |
| 6729 | 6797 | vector<result_type> __b(__n); |
lib/libcxx/include/regex+122-51| ... | ... | @@ -32,7 +32,8 @@ enum syntax_option_type |
| 32 | 32 | extended = unspecified, |
| 33 | 33 | awk = unspecified, |
| 34 | 34 | grep = unspecified, |
| 35 | egrep = unspecified | |
| 35 | egrep = unspecified, | |
| 36 | multiline = unspecified | |
| 36 | 37 | }; |
| 37 | 38 | |
| 38 | 39 | constexpr syntax_option_type operator~(syntax_option_type f); |
| ... | ... | @@ -142,6 +143,7 @@ public: |
| 142 | 143 | static constexpr regex_constants::syntax_option_type awk = regex_constants::awk; |
| 143 | 144 | static constexpr regex_constants::syntax_option_type grep = regex_constants::grep; |
| 144 | 145 | static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep; |
| 146 | static constexpr regex_constants::syntax_option_type multiline = regex_constants::multiline; | |
| 145 | 147 | |
| 146 | 148 | // construct/copy/destroy: |
| 147 | 149 | basic_regex(); |
| ... | ... | @@ -802,7 +804,9 @@ enum syntax_option_type |
| 802 | 804 | extended = 1 << 5, |
| 803 | 805 | awk = 1 << 6, |
| 804 | 806 | grep = 1 << 7, |
| 805 | egrep = 1 << 8 | |
| 807 | egrep = 1 << 8, | |
| 808 | // 1 << 9 may be used by ECMAScript | |
| 809 | multiline = 1 << 10 | |
| 806 | 810 | }; |
| 807 | 811 | |
| 808 | 812 | inline _LIBCPP_CONSTEXPR |
| ... | ... | @@ -1982,24 +1986,33 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const |
| 1982 | 1986 | // __l_anchor |
| 1983 | 1987 | |
| 1984 | 1988 | template <class _CharT> |
| 1985 | class __l_anchor | |
| 1989 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR | |
| 1990 | bool __is_eol(_CharT c) | |
| 1991 | { | |
| 1992 | return c == '\r' || c == '\n'; | |
| 1993 | } | |
| 1994 | ||
| 1995 | template <class _CharT> | |
| 1996 | class __l_anchor_multiline | |
| 1986 | 1997 | : public __owns_one_state<_CharT> |
| 1987 | 1998 | { |
| 1988 | 1999 | typedef __owns_one_state<_CharT> base; |
| 1989 | 2000 | |
| 2001 | bool __multiline; | |
| 2002 | ||
| 1990 | 2003 | public: |
| 1991 | 2004 | typedef _VSTD::__state<_CharT> __state; |
| 1992 | 2005 | |
| 1993 | 2006 | _LIBCPP_INLINE_VISIBILITY |
| 1994 | __l_anchor(__node<_CharT>* __s) | |
| 1995 | : base(__s) {} | |
| 2007 | __l_anchor_multiline(bool __multiline, __node<_CharT>* __s) | |
| 2008 | : base(__s), __multiline(__multiline) {} | |
| 1996 | 2009 | |
| 1997 | 2010 | virtual void __exec(__state&) const; |
| 1998 | 2011 | }; |
| 1999 | 2012 | |
| 2000 | 2013 | template <class _CharT> |
| 2001 | 2014 | void |
| 2002 | __l_anchor<_CharT>::__exec(__state& __s) const | |
| 2015 | __l_anchor_multiline<_CharT>::__exec(__state& __s) const | |
| 2003 | 2016 | { |
| 2004 | 2017 | if (__s.__at_first_ && __s.__current_ == __s.__first_ && |
| 2005 | 2018 | !(__s.__flags_ & regex_constants::match_not_bol)) |
| ... | ... | @@ -2007,6 +2020,13 @@ __l_anchor<_CharT>::__exec(__state& __s) const |
| 2007 | 2020 | __s.__do_ = __state::__accept_but_not_consume; |
| 2008 | 2021 | __s.__node_ = this->first(); |
| 2009 | 2022 | } |
| 2023 | else if (__multiline && | |
| 2024 | !__s.__at_first_ && | |
| 2025 | __is_eol(*_VSTD::prev(__s.__current_))) | |
| 2026 | { | |
| 2027 | __s.__do_ = __state::__accept_but_not_consume; | |
| 2028 | __s.__node_ = this->first(); | |
| 2029 | } | |
| 2010 | 2030 | else |
| 2011 | 2031 | { |
| 2012 | 2032 | __s.__do_ = __state::__reject; |
| ... | ... | @@ -2017,24 +2037,26 @@ __l_anchor<_CharT>::__exec(__state& __s) const |
| 2017 | 2037 | // __r_anchor |
| 2018 | 2038 | |
| 2019 | 2039 | template <class _CharT> |
| 2020 | class __r_anchor | |
| 2040 | class __r_anchor_multiline | |
| 2021 | 2041 | : public __owns_one_state<_CharT> |
| 2022 | 2042 | { |
| 2023 | 2043 | typedef __owns_one_state<_CharT> base; |
| 2024 | 2044 | |
| 2045 | bool __multiline; | |
| 2046 | ||
| 2025 | 2047 | public: |
| 2026 | 2048 | typedef _VSTD::__state<_CharT> __state; |
| 2027 | 2049 | |
| 2028 | 2050 | _LIBCPP_INLINE_VISIBILITY |
| 2029 | __r_anchor(__node<_CharT>* __s) | |
| 2030 | : base(__s) {} | |
| 2051 | __r_anchor_multiline(bool __multiline, __node<_CharT>* __s) | |
| 2052 | : base(__s), __multiline(__multiline) {} | |
| 2031 | 2053 | |
| 2032 | 2054 | virtual void __exec(__state&) const; |
| 2033 | 2055 | }; |
| 2034 | 2056 | |
| 2035 | 2057 | template <class _CharT> |
| 2036 | 2058 | void |
| 2037 | __r_anchor<_CharT>::__exec(__state& __s) const | |
| 2059 | __r_anchor_multiline<_CharT>::__exec(__state& __s) const | |
| 2038 | 2060 | { |
| 2039 | 2061 | if (__s.__current_ == __s.__last_ && |
| 2040 | 2062 | !(__s.__flags_ & regex_constants::match_not_eol)) |
| ... | ... | @@ -2042,6 +2064,11 @@ __r_anchor<_CharT>::__exec(__state& __s) const |
| 2042 | 2064 | __s.__do_ = __state::__accept_but_not_consume; |
| 2043 | 2065 | __s.__node_ = this->first(); |
| 2044 | 2066 | } |
| 2067 | else if (__multiline && __is_eol(*__s.__current_)) | |
| 2068 | { | |
| 2069 | __s.__do_ = __state::__accept_but_not_consume; | |
| 2070 | __s.__node_ = this->first(); | |
| 2071 | } | |
| 2045 | 2072 | else |
| 2046 | 2073 | { |
| 2047 | 2074 | __s.__do_ = __state::__reject; |
| ... | ... | @@ -2448,7 +2475,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const |
| 2448 | 2475 | { |
| 2449 | 2476 | const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_); |
| 2450 | 2477 | const bool __in_neg_chars = |
| 2451 | std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != | |
| 2478 | _VSTD::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) != | |
| 2452 | 2479 | __neg_chars_.end(); |
| 2453 | 2480 | if (!(__in_neg_mask || __in_neg_chars)) |
| 2454 | 2481 | { |
| ... | ... | @@ -2507,7 +2534,17 @@ __exit: |
| 2507 | 2534 | template <class _CharT, class _Traits> class __lookahead; |
| 2508 | 2535 | |
| 2509 | 2536 | template <class _CharT, class _Traits = regex_traits<_CharT> > |
| 2510 | class _LIBCPP_TEMPLATE_VIS basic_regex | |
| 2537 | class _LIBCPP_TEMPLATE_VIS basic_regex; | |
| 2538 | ||
| 2539 | typedef basic_regex<char> regex; | |
| 2540 | typedef basic_regex<wchar_t> wregex; | |
| 2541 | ||
| 2542 | template <class _CharT, class _Traits> | |
| 2543 | class | |
| 2544 | _LIBCPP_TEMPLATE_VIS | |
| 2545 | _LIBCPP_PREFERRED_NAME(regex) | |
| 2546 | _LIBCPP_PREFERRED_NAME(wregex) | |
| 2547 | basic_regex | |
| 2511 | 2548 | { |
| 2512 | 2549 | public: |
| 2513 | 2550 | // types: |
| ... | ... | @@ -2541,17 +2578,18 @@ public: |
| 2541 | 2578 | static const regex_constants::syntax_option_type awk = regex_constants::awk; |
| 2542 | 2579 | static const regex_constants::syntax_option_type grep = regex_constants::grep; |
| 2543 | 2580 | static const regex_constants::syntax_option_type egrep = regex_constants::egrep; |
| 2581 | static const regex_constants::syntax_option_type multiline = regex_constants::multiline; | |
| 2544 | 2582 | |
| 2545 | 2583 | // construct/copy/destroy: |
| 2546 | 2584 | _LIBCPP_INLINE_VISIBILITY |
| 2547 | 2585 | basic_regex() |
| 2548 | 2586 | : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2549 | __end_(0) | |
| 2587 | __end_(nullptr) | |
| 2550 | 2588 | {} |
| 2551 | 2589 | _LIBCPP_INLINE_VISIBILITY |
| 2552 | 2590 | explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript) |
| 2553 | 2591 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2554 | __end_(0) | |
| 2592 | __end_(nullptr) | |
| 2555 | 2593 | { |
| 2556 | 2594 | __init(__p, __p + __traits_.length(__p)); |
| 2557 | 2595 | } |
| ... | ... | @@ -2559,7 +2597,7 @@ public: |
| 2559 | 2597 | _LIBCPP_INLINE_VISIBILITY |
| 2560 | 2598 | basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript) |
| 2561 | 2599 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2562 | __end_(0) | |
| 2600 | __end_(nullptr) | |
| 2563 | 2601 | { |
| 2564 | 2602 | __init(__p, __p + __len); |
| 2565 | 2603 | } |
| ... | ... | @@ -2571,7 +2609,7 @@ public: |
| 2571 | 2609 | explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p, |
| 2572 | 2610 | flag_type __f = regex_constants::ECMAScript) |
| 2573 | 2611 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2574 | __end_(0) | |
| 2612 | __end_(nullptr) | |
| 2575 | 2613 | { |
| 2576 | 2614 | __init(__p.begin(), __p.end()); |
| 2577 | 2615 | } |
| ... | ... | @@ -2581,7 +2619,7 @@ public: |
| 2581 | 2619 | basic_regex(_ForwardIterator __first, _ForwardIterator __last, |
| 2582 | 2620 | flag_type __f = regex_constants::ECMAScript) |
| 2583 | 2621 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2584 | __end_(0) | |
| 2622 | __end_(nullptr) | |
| 2585 | 2623 | { |
| 2586 | 2624 | __init(__first, __last); |
| 2587 | 2625 | } |
| ... | ... | @@ -2590,7 +2628,7 @@ public: |
| 2590 | 2628 | basic_regex(initializer_list<value_type> __il, |
| 2591 | 2629 | flag_type __f = regex_constants::ECMAScript) |
| 2592 | 2630 | : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), |
| 2593 | __end_(0) | |
| 2631 | __end_(nullptr) | |
| 2594 | 2632 | { |
| 2595 | 2633 | __init(__il.begin(), __il.end()); |
| 2596 | 2634 | } |
| ... | ... | @@ -2707,6 +2745,12 @@ private: |
| 2707 | 2745 | _LIBCPP_INLINE_VISIBILITY |
| 2708 | 2746 | unsigned __loop_count() const {return __loop_count_;} |
| 2709 | 2747 | |
| 2748 | _LIBCPP_INLINE_VISIBILITY | |
| 2749 | bool __use_multiline() const | |
| 2750 | { | |
| 2751 | return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline); | |
| 2752 | } | |
| 2753 | ||
| 2710 | 2754 | template <class _ForwardIterator> |
| 2711 | 2755 | void |
| 2712 | 2756 | __init(_ForwardIterator __first, _ForwardIterator __last); |
| ... | ... | @@ -4119,7 +4163,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, |
| 4119 | 4163 | __first != __last && ( __val = __traits_.value(*__first, 10)) != -1; |
| 4120 | 4164 | ++__first) |
| 4121 | 4165 | { |
| 4122 | if (__c >= std::numeric_limits<int>::max() / 10) | |
| 4166 | if (__c >= numeric_limits<int>::max() / 10) | |
| 4123 | 4167 | __throw_regex_error<regex_constants::error_badbrace>(); |
| 4124 | 4168 | __c *= 10; |
| 4125 | 4169 | __c += __val; |
| ... | ... | @@ -4383,7 +4427,7 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, |
| 4383 | 4427 | for (++__first; |
| 4384 | 4428 | __first != __last && '0' <= *__first && *__first <= '9'; ++__first) |
| 4385 | 4429 | { |
| 4386 | if (__v >= std::numeric_limits<unsigned>::max() / 10) | |
| 4430 | if (__v >= numeric_limits<unsigned>::max() / 10) | |
| 4387 | 4431 | __throw_regex_error<regex_constants::error_backref>(); |
| 4388 | 4432 | __v = 10 * __v + *__first - '0'; |
| 4389 | 4433 | } |
| ... | ... | @@ -4746,7 +4790,7 @@ template <class _CharT, class _Traits> |
| 4746 | 4790 | void |
| 4747 | 4791 | basic_regex<_CharT, _Traits>::__push_l_anchor() |
| 4748 | 4792 | { |
| 4749 | __end_->first() = new __l_anchor<_CharT>(__end_->first()); | |
| 4793 | __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first()); | |
| 4750 | 4794 | __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first()); |
| 4751 | 4795 | } |
| 4752 | 4796 | |
| ... | ... | @@ -4754,7 +4798,7 @@ template <class _CharT, class _Traits> |
| 4754 | 4798 | void |
| 4755 | 4799 | basic_regex<_CharT, _Traits>::__push_r_anchor() |
| 4756 | 4800 | { |
| 4757 | __end_->first() = new __r_anchor<_CharT>(__end_->first()); | |
| 4801 | __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first()); | |
| 4758 | 4802 | __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first()); |
| 4759 | 4803 | } |
| 4760 | 4804 | |
| ... | ... | @@ -4845,13 +4889,21 @@ basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp, |
| 4845 | 4889 | __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first()); |
| 4846 | 4890 | } |
| 4847 | 4891 | |
| 4848 | typedef basic_regex<char> regex; | |
| 4849 | typedef basic_regex<wchar_t> wregex; | |
| 4850 | ||
| 4851 | 4892 | // sub_match |
| 4852 | 4893 | |
| 4894 | typedef sub_match<const char*> csub_match; | |
| 4895 | typedef sub_match<const wchar_t*> wcsub_match; | |
| 4896 | typedef sub_match<string::const_iterator> ssub_match; | |
| 4897 | typedef sub_match<wstring::const_iterator> wssub_match; | |
| 4898 | ||
| 4853 | 4899 | template <class _BidirectionalIterator> |
| 4854 | class _LIBCPP_TEMPLATE_VIS sub_match | |
| 4900 | class | |
| 4901 | _LIBCPP_TEMPLATE_VIS | |
| 4902 | _LIBCPP_PREFERRED_NAME(csub_match) | |
| 4903 | _LIBCPP_PREFERRED_NAME(wcsub_match) | |
| 4904 | _LIBCPP_PREFERRED_NAME(ssub_match) | |
| 4905 | _LIBCPP_PREFERRED_NAME(wssub_match) | |
| 4906 | sub_match | |
| 4855 | 4907 | : public pair<_BidirectionalIterator, _BidirectionalIterator> |
| 4856 | 4908 | { |
| 4857 | 4909 | public: |
| ... | ... | @@ -4886,11 +4938,6 @@ public: |
| 4886 | 4938 | {return str().compare(__s);} |
| 4887 | 4939 | }; |
| 4888 | 4940 | |
| 4889 | typedef sub_match<const char*> csub_match; | |
| 4890 | typedef sub_match<const wchar_t*> wcsub_match; | |
| 4891 | typedef sub_match<string::const_iterator> ssub_match; | |
| 4892 | typedef sub_match<wstring::const_iterator> wssub_match; | |
| 4893 | ||
| 4894 | 4941 | template <class _BiIter> |
| 4895 | 4942 | inline _LIBCPP_INLINE_VISIBILITY |
| 4896 | 4943 | bool |
| ... | ... | @@ -5273,8 +5320,19 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m) |
| 5273 | 5320 | return __os << __m.str(); |
| 5274 | 5321 | } |
| 5275 | 5322 | |
| 5323 | typedef match_results<const char*> cmatch; | |
| 5324 | typedef match_results<const wchar_t*> wcmatch; | |
| 5325 | typedef match_results<string::const_iterator> smatch; | |
| 5326 | typedef match_results<wstring::const_iterator> wsmatch; | |
| 5327 | ||
| 5276 | 5328 | template <class _BidirectionalIterator, class _Allocator> |
| 5277 | class _LIBCPP_TEMPLATE_VIS match_results | |
| 5329 | class | |
| 5330 | _LIBCPP_TEMPLATE_VIS | |
| 5331 | _LIBCPP_PREFERRED_NAME(cmatch) | |
| 5332 | _LIBCPP_PREFERRED_NAME(wcmatch) | |
| 5333 | _LIBCPP_PREFERRED_NAME(smatch) | |
| 5334 | _LIBCPP_PREFERRED_NAME(wsmatch) | |
| 5335 | match_results | |
| 5278 | 5336 | { |
| 5279 | 5337 | public: |
| 5280 | 5338 | typedef _Allocator allocator_type; |
| ... | ... | @@ -5556,7 +5614,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i |
| 5556 | 5614 | '0' <= __fmt_first[1] && __fmt_first[1] <= '9') |
| 5557 | 5615 | { |
| 5558 | 5616 | ++__fmt_first; |
| 5559 | if (__idx >= std::numeric_limits<size_t>::max() / 10) | |
| 5617 | if (__idx >= numeric_limits<size_t>::max() / 10) | |
| 5560 | 5618 | __throw_regex_error<regex_constants::error_escape>(); |
| 5561 | 5619 | __idx = 10 * __idx + *__fmt_first - '0'; |
| 5562 | 5620 | } |
| ... | ... | @@ -5594,11 +5652,6 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m) |
| 5594 | 5652 | swap(__ready_, __m.__ready_); |
| 5595 | 5653 | } |
| 5596 | 5654 | |
| 5597 | typedef match_results<const char*> cmatch; | |
| 5598 | typedef match_results<const wchar_t*> wcmatch; | |
| 5599 | typedef match_results<string::const_iterator> smatch; | |
| 5600 | typedef match_results<wstring::const_iterator> wsmatch; | |
| 5601 | ||
| 5602 | 5655 | template <class _BidirectionalIterator, class _Allocator> |
| 5603 | 5656 | bool |
| 5604 | 5657 | operator==(const match_results<_BidirectionalIterator, _Allocator>& __x, |
| ... | ... | @@ -6182,7 +6235,21 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s, |
| 6182 | 6235 | template <class _BidirectionalIterator, |
| 6183 | 6236 | class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type, |
| 6184 | 6237 | class _Traits = regex_traits<_CharT> > |
| 6185 | class _LIBCPP_TEMPLATE_VIS regex_iterator | |
| 6238 | class _LIBCPP_TEMPLATE_VIS regex_iterator; | |
| 6239 | ||
| 6240 | typedef regex_iterator<const char*> cregex_iterator; | |
| 6241 | typedef regex_iterator<const wchar_t*> wcregex_iterator; | |
| 6242 | typedef regex_iterator<string::const_iterator> sregex_iterator; | |
| 6243 | typedef regex_iterator<wstring::const_iterator> wsregex_iterator; | |
| 6244 | ||
| 6245 | template <class _BidirectionalIterator, class _CharT, class _Traits> | |
| 6246 | class | |
| 6247 | _LIBCPP_TEMPLATE_VIS | |
| 6248 | _LIBCPP_PREFERRED_NAME(cregex_iterator) | |
| 6249 | _LIBCPP_PREFERRED_NAME(wcregex_iterator) | |
| 6250 | _LIBCPP_PREFERRED_NAME(sregex_iterator) | |
| 6251 | _LIBCPP_PREFERRED_NAME(wsregex_iterator) | |
| 6252 | regex_iterator | |
| 6186 | 6253 | { |
| 6187 | 6254 | public: |
| 6188 | 6255 | typedef basic_regex<_CharT, _Traits> regex_type; |
| ... | ... | @@ -6291,17 +6358,26 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() |
| 6291 | 6358 | return *this; |
| 6292 | 6359 | } |
| 6293 | 6360 | |
| 6294 | typedef regex_iterator<const char*> cregex_iterator; | |
| 6295 | typedef regex_iterator<const wchar_t*> wcregex_iterator; | |
| 6296 | typedef regex_iterator<string::const_iterator> sregex_iterator; | |
| 6297 | typedef regex_iterator<wstring::const_iterator> wsregex_iterator; | |
| 6298 | ||
| 6299 | 6361 | // regex_token_iterator |
| 6300 | 6362 | |
| 6301 | 6363 | template <class _BidirectionalIterator, |
| 6302 | 6364 | class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type, |
| 6303 | 6365 | class _Traits = regex_traits<_CharT> > |
| 6304 | class _LIBCPP_TEMPLATE_VIS regex_token_iterator | |
| 6366 | class _LIBCPP_TEMPLATE_VIS regex_token_iterator; | |
| 6367 | ||
| 6368 | typedef regex_token_iterator<const char*> cregex_token_iterator; | |
| 6369 | typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; | |
| 6370 | typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; | |
| 6371 | typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; | |
| 6372 | ||
| 6373 | template <class _BidirectionalIterator, class _CharT, class _Traits> | |
| 6374 | class | |
| 6375 | _LIBCPP_TEMPLATE_VIS | |
| 6376 | _LIBCPP_PREFERRED_NAME(cregex_token_iterator) | |
| 6377 | _LIBCPP_PREFERRED_NAME(wcregex_token_iterator) | |
| 6378 | _LIBCPP_PREFERRED_NAME(sregex_token_iterator) | |
| 6379 | _LIBCPP_PREFERRED_NAME(wsregex_token_iterator) | |
| 6380 | regex_token_iterator | |
| 6305 | 6381 | { |
| 6306 | 6382 | public: |
| 6307 | 6383 | typedef basic_regex<_CharT, _Traits> regex_type; |
| ... | ... | @@ -6367,7 +6443,7 @@ public: |
| 6367 | 6443 | regex_constants::match_flag_type __m = |
| 6368 | 6444 | regex_constants::match_default); |
| 6369 | 6445 | #if _LIBCPP_STD_VER > 11 |
| 6370 | template <std::size_t _Np> | |
| 6446 | template <size_t _Np> | |
| 6371 | 6447 | regex_token_iterator(_BidirectionalIterator __a, |
| 6372 | 6448 | _BidirectionalIterator __b, |
| 6373 | 6449 | const regex_type&& __re, |
| ... | ... | @@ -6579,11 +6655,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() |
| 6579 | 6655 | return *this; |
| 6580 | 6656 | } |
| 6581 | 6657 | |
| 6582 | typedef regex_token_iterator<const char*> cregex_token_iterator; | |
| 6583 | typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; | |
| 6584 | typedef regex_token_iterator<string::const_iterator> sregex_token_iterator; | |
| 6585 | typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; | |
| 6586 | ||
| 6587 | 6658 | // regex_replace |
| 6588 | 6659 | |
| 6589 | 6660 | template <class _OutputIterator, class _BidirectionalIterator, |
lib/libcxx/include/semaphore+7-2| ... | ... | @@ -46,9 +46,9 @@ using binary_semaphore = counting_semaphore<1>; |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | 48 | #include <__config> |
| 49 | #include <__availability> | |
| 49 | 50 | #include <__threading_support> |
| 50 | 51 | #include <atomic> |
| 51 | #include <cassert> | |
| 52 | 52 | |
| 53 | 53 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 54 | 54 | #pragma GCC system_header |
| ... | ... | @@ -58,6 +58,9 @@ using binary_semaphore = counting_semaphore<1>; |
| 58 | 58 | # error <semaphore> is not supported on this single threaded system |
| 59 | 59 | #endif |
| 60 | 60 | |
| 61 | _LIBCPP_PUSH_MACROS | |
| 62 | #include <__undef_macros> | |
| 63 | ||
| 61 | 64 | #if _LIBCPP_STD_VER >= 14 |
| 62 | 65 | |
| 63 | 66 | _LIBCPP_BEGIN_NAMESPACE_STD |
| ... | ... | @@ -68,7 +71,7 @@ __atomic_semaphore_base is the general-case implementation, to be used for |
| 68 | 71 | user-requested least-max values that exceed the OS implementation support |
| 69 | 72 | (incl. when the OS has no support of its own) and for binary semaphores. |
| 70 | 73 | |
| 71 | It is a typical Dijsktra semaphore algorithm over atomics, wait and notify | |
| 74 | It is a typical Dijkstra semaphore algorithm over atomics, wait and notify | |
| 72 | 75 | functions. It avoids contention against users' own use of those facilities. |
| 73 | 76 | |
| 74 | 77 | */ |
| ... | ... | @@ -232,4 +235,6 @@ _LIBCPP_END_NAMESPACE_STD |
| 232 | 235 | |
| 233 | 236 | #endif // _LIBCPP_STD_VER >= 14 |
| 234 | 237 | |
| 238 | _LIBCPP_POP_MACROS | |
| 239 | ||
| 235 | 240 | #endif //_LIBCPP_SEMAPHORE |
lib/libcxx/include/shared_mutex+1| ... | ... | @@ -123,6 +123,7 @@ template <class Mutex> |
| 123 | 123 | */ |
| 124 | 124 | |
| 125 | 125 | #include <__config> |
| 126 | #include <__availability> | |
| 126 | 127 | #include <version> |
| 127 | 128 | |
| 128 | 129 | _LIBCPP_PUSH_MACROS |
lib/libcxx/include/span+6-1| ... | ... | @@ -132,11 +132,14 @@ template<class Container> |
| 132 | 132 | #pragma GCC system_header |
| 133 | 133 | #endif |
| 134 | 134 | |
| 135 | _LIBCPP_PUSH_MACROS | |
| 136 | #include <__undef_macros> | |
| 137 | ||
| 135 | 138 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 136 | 139 | |
| 137 | 140 | #if _LIBCPP_STD_VER > 17 |
| 138 | 141 | |
| 139 | inline constexpr size_t dynamic_extent = (numeric_limits<size_t>::max)(); | |
| 142 | inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); | |
| 140 | 143 | template <typename _Tp, size_t _Extent = dynamic_extent> class span; |
| 141 | 144 | |
| 142 | 145 | |
| ... | ... | @@ -546,4 +549,6 @@ template<class _Container> |
| 546 | 549 | |
| 547 | 550 | _LIBCPP_END_NAMESPACE_STD |
| 548 | 551 | |
| 552 | _LIBCPP_POP_MACROS | |
| 553 | ||
| 549 | 554 | #endif // _LIBCPP_SPAN |
lib/libcxx/include/sstream+148-283| ... | ... | @@ -208,17 +208,23 @@ private: |
| 208 | 208 | |
| 209 | 209 | public: |
| 210 | 210 | // 27.8.1.1 Constructors: |
| 211 | inline _LIBCPP_INLINE_VISIBILITY | |
| 212 | explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 213 | inline _LIBCPP_INLINE_VISIBILITY | |
| 211 | _LIBCPP_INLINE_VISIBILITY | |
| 212 | explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out) | |
| 213 | : __hm_(nullptr), __mode_(__wch) | |
| 214 | { } | |
| 215 | ||
| 216 | _LIBCPP_INLINE_VISIBILITY | |
| 214 | 217 | explicit basic_stringbuf(const string_type& __s, |
| 215 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 216 | #ifndef _LIBCPP_CXX03_LANG | |
| 218 | ios_base::openmode __wch = ios_base::in | ios_base::out) | |
| 219 | : __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch) | |
| 220 | { | |
| 221 | str(__s); | |
| 222 | } | |
| 223 | ||
| 217 | 224 | basic_stringbuf(basic_stringbuf&& __rhs); |
| 218 | 225 | |
| 219 | 226 | // 27.8.1.2 Assign and swap: |
| 220 | 227 | basic_stringbuf& operator=(basic_stringbuf&& __rhs); |
| 221 | #endif | |
| 222 | 228 | void swap(basic_stringbuf& __rhs); |
| 223 | 229 | |
| 224 | 230 | // 27.8.1.3 Get and set: |
| ... | ... | @@ -232,30 +238,13 @@ protected: |
| 232 | 238 | virtual int_type overflow (int_type __c = traits_type::eof()); |
| 233 | 239 | virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, |
| 234 | 240 | ios_base::openmode __wch = ios_base::in | ios_base::out); |
| 235 | inline _LIBCPP_INLINE_VISIBILITY | |
| 241 | _LIBCPP_INLINE_VISIBILITY | |
| 236 | 242 | virtual pos_type seekpos(pos_type __sp, |
| 237 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 243 | ios_base::openmode __wch = ios_base::in | ios_base::out) { | |
| 244 | return seekoff(__sp, ios_base::beg, __wch); | |
| 245 | } | |
| 238 | 246 | }; |
| 239 | 247 | |
| 240 | template <class _CharT, class _Traits, class _Allocator> | |
| 241 | basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch) | |
| 242 | : __hm_(0), | |
| 243 | __mode_(__wch) | |
| 244 | { | |
| 245 | } | |
| 246 | ||
| 247 | template <class _CharT, class _Traits, class _Allocator> | |
| 248 | basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, | |
| 249 | ios_base::openmode __wch) | |
| 250 | : __str_(__s.get_allocator()), | |
| 251 | __hm_(0), | |
| 252 | __mode_(__wch) | |
| 253 | { | |
| 254 | str(__s); | |
| 255 | } | |
| 256 | ||
| 257 | #ifndef _LIBCPP_CXX03_LANG | |
| 258 | ||
| 259 | 248 | template <class _CharT, class _Traits, class _Allocator> |
| 260 | 249 | basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) |
| 261 | 250 | : __mode_(__rhs.__mode_) |
| ... | ... | @@ -345,8 +334,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) |
| 345 | 334 | return *this; |
| 346 | 335 | } |
| 347 | 336 | |
| 348 | #endif // _LIBCPP_CXX03_LANG | |
| 349 | ||
| 350 | 337 | template <class _CharT, class _Traits, class _Allocator> |
| 351 | 338 | void |
| 352 | 339 | basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) |
| ... | ... | @@ -453,7 +440,7 @@ void |
| 453 | 440 | basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s) |
| 454 | 441 | { |
| 455 | 442 | __str_ = __s; |
| 456 | __hm_ = 0; | |
| 443 | __hm_ = nullptr; | |
| 457 | 444 | if (__mode_ & ios_base::in) |
| 458 | 445 | { |
| 459 | 446 | __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size(); |
| ... | ... | @@ -600,9 +587,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, |
| 600 | 587 | return pos_type(-1); |
| 601 | 588 | if (__noff != 0) |
| 602 | 589 | { |
| 603 | if ((__wch & ios_base::in) && this->gptr() == 0) | |
| 590 | if ((__wch & ios_base::in) && this->gptr() == nullptr) | |
| 604 | 591 | return pos_type(-1); |
| 605 | if ((__wch & ios_base::out) && this->pptr() == 0) | |
| 592 | if ((__wch & ios_base::out) && this->pptr() == nullptr) | |
| 606 | 593 | return pos_type(-1); |
| 607 | 594 | } |
| 608 | 595 | if (__wch & ios_base::in) |
| ... | ... | @@ -615,14 +602,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, |
| 615 | 602 | return pos_type(__noff); |
| 616 | 603 | } |
| 617 | 604 | |
| 618 | template <class _CharT, class _Traits, class _Allocator> | |
| 619 | typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type | |
| 620 | basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp, | |
| 621 | ios_base::openmode __wch) | |
| 622 | { | |
| 623 | return seekoff(__sp, ios_base::beg, __wch); | |
| 624 | } | |
| 625 | ||
| 626 | 605 | // basic_istringstream |
| 627 | 606 | |
| 628 | 607 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -644,73 +623,53 @@ private: |
| 644 | 623 | |
| 645 | 624 | public: |
| 646 | 625 | // 27.8.2.1 Constructors: |
| 647 | inline _LIBCPP_INLINE_VISIBILITY | |
| 648 | explicit basic_istringstream(ios_base::openmode __wch = ios_base::in); | |
| 649 | inline _LIBCPP_INLINE_VISIBILITY | |
| 626 | _LIBCPP_INLINE_VISIBILITY | |
| 627 | explicit basic_istringstream(ios_base::openmode __wch = ios_base::in) | |
| 628 | : basic_istream<_CharT, _Traits>(&__sb_) | |
| 629 | , __sb_(__wch | ios_base::in) | |
| 630 | { } | |
| 631 | _LIBCPP_INLINE_VISIBILITY | |
| 650 | 632 | explicit basic_istringstream(const string_type& __s, |
| 651 | ios_base::openmode __wch = ios_base::in); | |
| 652 | #ifndef _LIBCPP_CXX03_LANG | |
| 653 | inline _LIBCPP_INLINE_VISIBILITY | |
| 654 | basic_istringstream(basic_istringstream&& __rhs); | |
| 633 | ios_base::openmode __wch = ios_base::in) | |
| 634 | : basic_istream<_CharT, _Traits>(&__sb_) | |
| 635 | , __sb_(__s, __wch | ios_base::in) | |
| 636 | { } | |
| 637 | ||
| 638 | _LIBCPP_INLINE_VISIBILITY | |
| 639 | basic_istringstream(basic_istringstream&& __rhs) | |
| 640 | : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)) | |
| 641 | , __sb_(_VSTD::move(__rhs.__sb_)) | |
| 642 | { | |
| 643 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 644 | } | |
| 655 | 645 | |
| 656 | 646 | // 27.8.2.2 Assign and swap: |
| 657 | basic_istringstream& operator=(basic_istringstream&& __rhs); | |
| 658 | #endif // _LIBCPP_CXX03_LANG | |
| 659 | inline _LIBCPP_INLINE_VISIBILITY | |
| 660 | void swap(basic_istringstream& __rhs); | |
| 647 | basic_istringstream& operator=(basic_istringstream&& __rhs) { | |
| 648 | basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 649 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 650 | return *this; | |
| 651 | } | |
| 652 | _LIBCPP_INLINE_VISIBILITY | |
| 653 | void swap(basic_istringstream& __rhs) { | |
| 654 | basic_istream<char_type, traits_type>::swap(__rhs); | |
| 655 | __sb_.swap(__rhs.__sb_); | |
| 656 | } | |
| 661 | 657 | |
| 662 | 658 | // 27.8.2.3 Members: |
| 663 | inline _LIBCPP_INLINE_VISIBILITY | |
| 664 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; | |
| 665 | inline _LIBCPP_INLINE_VISIBILITY | |
| 666 | string_type str() const; | |
| 667 | inline _LIBCPP_INLINE_VISIBILITY | |
| 668 | void str(const string_type& __s); | |
| 659 | _LIBCPP_INLINE_VISIBILITY | |
| 660 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { | |
| 661 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 662 | } | |
| 663 | _LIBCPP_INLINE_VISIBILITY | |
| 664 | string_type str() const { | |
| 665 | return __sb_.str(); | |
| 666 | } | |
| 667 | _LIBCPP_INLINE_VISIBILITY | |
| 668 | void str(const string_type& __s) { | |
| 669 | __sb_.str(__s); | |
| 670 | } | |
| 669 | 671 | }; |
| 670 | 672 | |
| 671 | template <class _CharT, class _Traits, class _Allocator> | |
| 672 | basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch) | |
| 673 | : basic_istream<_CharT, _Traits>(&__sb_), | |
| 674 | __sb_(__wch | ios_base::in) | |
| 675 | { | |
| 676 | } | |
| 677 | ||
| 678 | template <class _CharT, class _Traits, class _Allocator> | |
| 679 | basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s, | |
| 680 | ios_base::openmode __wch) | |
| 681 | : basic_istream<_CharT, _Traits>(&__sb_), | |
| 682 | __sb_(__s, __wch | ios_base::in) | |
| 683 | { | |
| 684 | } | |
| 685 | ||
| 686 | #ifndef _LIBCPP_CXX03_LANG | |
| 687 | ||
| 688 | template <class _CharT, class _Traits, class _Allocator> | |
| 689 | basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) | |
| 690 | : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)), | |
| 691 | __sb_(_VSTD::move(__rhs.__sb_)) | |
| 692 | { | |
| 693 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 694 | } | |
| 695 | ||
| 696 | template <class _CharT, class _Traits, class _Allocator> | |
| 697 | basic_istringstream<_CharT, _Traits, _Allocator>& | |
| 698 | basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) | |
| 699 | { | |
| 700 | basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 701 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 702 | return *this; | |
| 703 | } | |
| 704 | ||
| 705 | #endif // _LIBCPP_CXX03_LANG | |
| 706 | ||
| 707 | template <class _CharT, class _Traits, class _Allocator> | |
| 708 | void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) | |
| 709 | { | |
| 710 | basic_istream<char_type, traits_type>::swap(__rhs); | |
| 711 | __sb_.swap(__rhs.__sb_); | |
| 712 | } | |
| 713 | ||
| 714 | 673 | template <class _CharT, class _Traits, class _Allocator> |
| 715 | 674 | inline _LIBCPP_INLINE_VISIBILITY |
| 716 | 675 | void |
| ... | ... | @@ -720,26 +679,6 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, |
| 720 | 679 | __x.swap(__y); |
| 721 | 680 | } |
| 722 | 681 | |
| 723 | template <class _CharT, class _Traits, class _Allocator> | |
| 724 | basic_stringbuf<_CharT, _Traits, _Allocator>* | |
| 725 | basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const | |
| 726 | { | |
| 727 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 728 | } | |
| 729 | ||
| 730 | template <class _CharT, class _Traits, class _Allocator> | |
| 731 | basic_string<_CharT, _Traits, _Allocator> | |
| 732 | basic_istringstream<_CharT, _Traits, _Allocator>::str() const | |
| 733 | { | |
| 734 | return __sb_.str(); | |
| 735 | } | |
| 736 | ||
| 737 | template <class _CharT, class _Traits, class _Allocator> | |
| 738 | void basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) | |
| 739 | { | |
| 740 | __sb_.str(__s); | |
| 741 | } | |
| 742 | ||
| 743 | 682 | // basic_ostringstream |
| 744 | 683 | |
| 745 | 684 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -761,74 +700,55 @@ private: |
| 761 | 700 | |
| 762 | 701 | public: |
| 763 | 702 | // 27.8.2.1 Constructors: |
| 764 | inline _LIBCPP_INLINE_VISIBILITY | |
| 765 | explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out); | |
| 766 | inline _LIBCPP_INLINE_VISIBILITY | |
| 703 | _LIBCPP_INLINE_VISIBILITY | |
| 704 | explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out) | |
| 705 | : basic_ostream<_CharT, _Traits>(&__sb_) | |
| 706 | , __sb_(__wch | ios_base::out) | |
| 707 | { } | |
| 708 | ||
| 709 | _LIBCPP_INLINE_VISIBILITY | |
| 767 | 710 | explicit basic_ostringstream(const string_type& __s, |
| 768 | ios_base::openmode __wch = ios_base::out); | |
| 769 | #ifndef _LIBCPP_CXX03_LANG | |
| 770 | inline _LIBCPP_INLINE_VISIBILITY | |
| 771 | basic_ostringstream(basic_ostringstream&& __rhs); | |
| 711 | ios_base::openmode __wch = ios_base::out) | |
| 712 | : basic_ostream<_CharT, _Traits>(&__sb_) | |
| 713 | , __sb_(__s, __wch | ios_base::out) | |
| 714 | { } | |
| 715 | ||
| 716 | _LIBCPP_INLINE_VISIBILITY | |
| 717 | basic_ostringstream(basic_ostringstream&& __rhs) | |
| 718 | : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)) | |
| 719 | , __sb_(_VSTD::move(__rhs.__sb_)) | |
| 720 | { | |
| 721 | basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 722 | } | |
| 772 | 723 | |
| 773 | 724 | // 27.8.2.2 Assign and swap: |
| 774 | basic_ostringstream& operator=(basic_ostringstream&& __rhs); | |
| 775 | #endif // _LIBCPP_CXX03_LANG | |
| 776 | inline _LIBCPP_INLINE_VISIBILITY | |
| 777 | void swap(basic_ostringstream& __rhs); | |
| 725 | basic_ostringstream& operator=(basic_ostringstream&& __rhs) { | |
| 726 | basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 727 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 728 | return *this; | |
| 729 | } | |
| 730 | ||
| 731 | _LIBCPP_INLINE_VISIBILITY | |
| 732 | void swap(basic_ostringstream& __rhs) { | |
| 733 | basic_ostream<char_type, traits_type>::swap(__rhs); | |
| 734 | __sb_.swap(__rhs.__sb_); | |
| 735 | } | |
| 778 | 736 | |
| 779 | 737 | // 27.8.2.3 Members: |
| 780 | inline _LIBCPP_INLINE_VISIBILITY | |
| 781 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; | |
| 782 | inline _LIBCPP_INLINE_VISIBILITY | |
| 783 | string_type str() const; | |
| 784 | inline _LIBCPP_INLINE_VISIBILITY | |
| 785 | void str(const string_type& __s); | |
| 738 | _LIBCPP_INLINE_VISIBILITY | |
| 739 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { | |
| 740 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 741 | } | |
| 742 | _LIBCPP_INLINE_VISIBILITY | |
| 743 | string_type str() const { | |
| 744 | return __sb_.str(); | |
| 745 | } | |
| 746 | _LIBCPP_INLINE_VISIBILITY | |
| 747 | void str(const string_type& __s) { | |
| 748 | __sb_.str(__s); | |
| 749 | } | |
| 786 | 750 | }; |
| 787 | 751 | |
| 788 | template <class _CharT, class _Traits, class _Allocator> | |
| 789 | basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch) | |
| 790 | : basic_ostream<_CharT, _Traits>(&__sb_), | |
| 791 | __sb_(__wch | ios_base::out) | |
| 792 | { | |
| 793 | } | |
| 794 | ||
| 795 | template <class _CharT, class _Traits, class _Allocator> | |
| 796 | basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s, | |
| 797 | ios_base::openmode __wch) | |
| 798 | : basic_ostream<_CharT, _Traits>(&__sb_), | |
| 799 | __sb_(__s, __wch | ios_base::out) | |
| 800 | { | |
| 801 | } | |
| 802 | ||
| 803 | #ifndef _LIBCPP_CXX03_LANG | |
| 804 | ||
| 805 | template <class _CharT, class _Traits, class _Allocator> | |
| 806 | basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) | |
| 807 | : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)), | |
| 808 | __sb_(_VSTD::move(__rhs.__sb_)) | |
| 809 | { | |
| 810 | basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 811 | } | |
| 812 | ||
| 813 | template <class _CharT, class _Traits, class _Allocator> | |
| 814 | basic_ostringstream<_CharT, _Traits, _Allocator>& | |
| 815 | basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) | |
| 816 | { | |
| 817 | basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 818 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 819 | return *this; | |
| 820 | } | |
| 821 | ||
| 822 | #endif // _LIBCPP_CXX03_LANG | |
| 823 | ||
| 824 | template <class _CharT, class _Traits, class _Allocator> | |
| 825 | void | |
| 826 | basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs) | |
| 827 | { | |
| 828 | basic_ostream<char_type, traits_type>::swap(__rhs); | |
| 829 | __sb_.swap(__rhs.__sb_); | |
| 830 | } | |
| 831 | ||
| 832 | 752 | template <class _CharT, class _Traits, class _Allocator> |
| 833 | 753 | inline _LIBCPP_INLINE_VISIBILITY |
| 834 | 754 | void |
| ... | ... | @@ -838,27 +758,6 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, |
| 838 | 758 | __x.swap(__y); |
| 839 | 759 | } |
| 840 | 760 | |
| 841 | template <class _CharT, class _Traits, class _Allocator> | |
| 842 | basic_stringbuf<_CharT, _Traits, _Allocator>* | |
| 843 | basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const | |
| 844 | { | |
| 845 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 846 | } | |
| 847 | ||
| 848 | template <class _CharT, class _Traits, class _Allocator> | |
| 849 | basic_string<_CharT, _Traits, _Allocator> | |
| 850 | basic_ostringstream<_CharT, _Traits, _Allocator>::str() const | |
| 851 | { | |
| 852 | return __sb_.str(); | |
| 853 | } | |
| 854 | ||
| 855 | template <class _CharT, class _Traits, class _Allocator> | |
| 856 | void | |
| 857 | basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) | |
| 858 | { | |
| 859 | __sb_.str(__s); | |
| 860 | } | |
| 861 | ||
| 862 | 761 | // basic_stringstream |
| 863 | 762 | |
| 864 | 763 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -880,74 +779,54 @@ private: |
| 880 | 779 | |
| 881 | 780 | public: |
| 882 | 781 | // 27.8.2.1 Constructors: |
| 883 | inline _LIBCPP_INLINE_VISIBILITY | |
| 884 | explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 885 | inline _LIBCPP_INLINE_VISIBILITY | |
| 782 | _LIBCPP_INLINE_VISIBILITY | |
| 783 | explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out) | |
| 784 | : basic_iostream<_CharT, _Traits>(&__sb_) | |
| 785 | , __sb_(__wch) | |
| 786 | { } | |
| 787 | ||
| 788 | _LIBCPP_INLINE_VISIBILITY | |
| 886 | 789 | explicit basic_stringstream(const string_type& __s, |
| 887 | ios_base::openmode __wch = ios_base::in | ios_base::out); | |
| 888 | #ifndef _LIBCPP_CXX03_LANG | |
| 889 | inline _LIBCPP_INLINE_VISIBILITY | |
| 890 | basic_stringstream(basic_stringstream&& __rhs); | |
| 790 | ios_base::openmode __wch = ios_base::in | ios_base::out) | |
| 791 | : basic_iostream<_CharT, _Traits>(&__sb_) | |
| 792 | , __sb_(__s, __wch) | |
| 793 | { } | |
| 794 | ||
| 795 | _LIBCPP_INLINE_VISIBILITY | |
| 796 | basic_stringstream(basic_stringstream&& __rhs) | |
| 797 | : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)) | |
| 798 | , __sb_(_VSTD::move(__rhs.__sb_)) | |
| 799 | { | |
| 800 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 801 | } | |
| 891 | 802 | |
| 892 | 803 | // 27.8.2.2 Assign and swap: |
| 893 | basic_stringstream& operator=(basic_stringstream&& __rhs); | |
| 894 | #endif // _LIBCPP_CXX03_LANG | |
| 895 | inline _LIBCPP_INLINE_VISIBILITY | |
| 896 | void swap(basic_stringstream& __rhs); | |
| 804 | basic_stringstream& operator=(basic_stringstream&& __rhs) { | |
| 805 | basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 806 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 807 | return *this; | |
| 808 | } | |
| 809 | _LIBCPP_INLINE_VISIBILITY | |
| 810 | void swap(basic_stringstream& __rhs) { | |
| 811 | basic_iostream<char_type, traits_type>::swap(__rhs); | |
| 812 | __sb_.swap(__rhs.__sb_); | |
| 813 | } | |
| 897 | 814 | |
| 898 | 815 | // 27.8.2.3 Members: |
| 899 | inline _LIBCPP_INLINE_VISIBILITY | |
| 900 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; | |
| 901 | inline _LIBCPP_INLINE_VISIBILITY | |
| 902 | string_type str() const; | |
| 903 | inline _LIBCPP_INLINE_VISIBILITY | |
| 904 | void str(const string_type& __s); | |
| 816 | _LIBCPP_INLINE_VISIBILITY | |
| 817 | basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const { | |
| 818 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 819 | } | |
| 820 | _LIBCPP_INLINE_VISIBILITY | |
| 821 | string_type str() const { | |
| 822 | return __sb_.str(); | |
| 823 | } | |
| 824 | _LIBCPP_INLINE_VISIBILITY | |
| 825 | void str(const string_type& __s) { | |
| 826 | __sb_.str(__s); | |
| 827 | } | |
| 905 | 828 | }; |
| 906 | 829 | |
| 907 | template <class _CharT, class _Traits, class _Allocator> | |
| 908 | basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch) | |
| 909 | : basic_iostream<_CharT, _Traits>(&__sb_), | |
| 910 | __sb_(__wch) | |
| 911 | { | |
| 912 | } | |
| 913 | ||
| 914 | template <class _CharT, class _Traits, class _Allocator> | |
| 915 | basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s, | |
| 916 | ios_base::openmode __wch) | |
| 917 | : basic_iostream<_CharT, _Traits>(&__sb_), | |
| 918 | __sb_(__s, __wch) | |
| 919 | { | |
| 920 | } | |
| 921 | ||
| 922 | #ifndef _LIBCPP_CXX03_LANG | |
| 923 | ||
| 924 | template <class _CharT, class _Traits, class _Allocator> | |
| 925 | basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) | |
| 926 | : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)), | |
| 927 | __sb_(_VSTD::move(__rhs.__sb_)) | |
| 928 | { | |
| 929 | basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); | |
| 930 | } | |
| 931 | ||
| 932 | template <class _CharT, class _Traits, class _Allocator> | |
| 933 | basic_stringstream<_CharT, _Traits, _Allocator>& | |
| 934 | basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) | |
| 935 | { | |
| 936 | basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); | |
| 937 | __sb_ = _VSTD::move(__rhs.__sb_); | |
| 938 | return *this; | |
| 939 | } | |
| 940 | ||
| 941 | #endif // _LIBCPP_CXX03_LANG | |
| 942 | ||
| 943 | template <class _CharT, class _Traits, class _Allocator> | |
| 944 | void | |
| 945 | basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs) | |
| 946 | { | |
| 947 | basic_iostream<char_type, traits_type>::swap(__rhs); | |
| 948 | __sb_.swap(__rhs.__sb_); | |
| 949 | } | |
| 950 | ||
| 951 | 830 | template <class _CharT, class _Traits, class _Allocator> |
| 952 | 831 | inline _LIBCPP_INLINE_VISIBILITY |
| 953 | 832 | void |
| ... | ... | @@ -957,26 +836,12 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, |
| 957 | 836 | __x.swap(__y); |
| 958 | 837 | } |
| 959 | 838 | |
| 960 | template <class _CharT, class _Traits, class _Allocator> | |
| 961 | basic_stringbuf<_CharT, _Traits, _Allocator>* | |
| 962 | basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const | |
| 963 | { | |
| 964 | return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); | |
| 965 | } | |
| 966 | ||
| 967 | template <class _CharT, class _Traits, class _Allocator> | |
| 968 | basic_string<_CharT, _Traits, _Allocator> | |
| 969 | basic_stringstream<_CharT, _Traits, _Allocator>::str() const | |
| 970 | { | |
| 971 | return __sb_.str(); | |
| 972 | } | |
| 973 | ||
| 974 | template <class _CharT, class _Traits, class _Allocator> | |
| 975 | void | |
| 976 | basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) | |
| 977 | { | |
| 978 | __sb_.str(__s); | |
| 979 | } | |
| 839 | #if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1) | |
| 840 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>) | |
| 841 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>) | |
| 842 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>) | |
| 843 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>) | |
| 844 | #endif | |
| 980 | 845 | |
| 981 | 846 | _LIBCPP_END_NAMESPACE_STD |
| 982 | 847 |
lib/libcxx/include/stdexcept+1-3| ... | ... | @@ -42,11 +42,9 @@ public: |
| 42 | 42 | */ |
| 43 | 43 | |
| 44 | 44 | #include <__config> |
| 45 | #include <cstdlib> | |
| 45 | 46 | #include <exception> |
| 46 | 47 | #include <iosfwd> // for string forward decl |
| 47 | #ifdef _LIBCPP_NO_EXCEPTIONS | |
| 48 | #include <cstdlib> | |
| 49 | #endif | |
| 50 | 48 | |
| 51 | 49 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 52 | 50 | #pragma GCC system_header |
lib/libcxx/include/streambuf+6-8| ... | ... | @@ -308,12 +308,12 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf() |
| 308 | 308 | |
| 309 | 309 | template <class _CharT, class _Traits> |
| 310 | 310 | basic_streambuf<_CharT, _Traits>::basic_streambuf() |
| 311 | : __binp_(0), | |
| 312 | __ninp_(0), | |
| 313 | __einp_(0), | |
| 314 | __bout_(0), | |
| 315 | __nout_(0), | |
| 316 | __eout_(0) | |
| 311 | : __binp_(nullptr), | |
| 312 | __ninp_(nullptr), | |
| 313 | __einp_(nullptr), | |
| 314 | __bout_(nullptr), | |
| 315 | __nout_(nullptr), | |
| 316 | __eout_(nullptr) | |
| 317 | 317 | { |
| 318 | 318 | } |
| 319 | 319 | |
| ... | ... | @@ -485,13 +485,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type) |
| 485 | 485 | return traits_type::eof(); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | #ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB | |
| 489 | 488 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>) |
| 490 | 489 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>) |
| 491 | 490 | |
| 492 | 491 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>) |
| 493 | 492 | _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>) |
| 494 | #endif | |
| 495 | 493 | |
| 496 | 494 | _LIBCPP_END_NAMESPACE_STD |
| 497 | 495 |
lib/libcxx/include/string+174-138| ... | ... | @@ -153,7 +153,8 @@ public: |
| 153 | 153 | void resize(size_type n, value_type c); |
| 154 | 154 | void resize(size_type n); |
| 155 | 155 | |
| 156 | void reserve(size_type res_arg = 0); | |
| 156 | void reserve(size_type res_arg); | |
| 157 | void reserve(); // deprecated in C++20 | |
| 157 | 158 | void shrink_to_fit(); |
| 158 | 159 | void clear() noexcept; |
| 159 | 160 | bool empty() const noexcept; |
| ... | ... | @@ -448,15 +449,15 @@ typedef basic_string<wchar_t> wstring; |
| 448 | 449 | typedef basic_string<char16_t> u16string; |
| 449 | 450 | typedef basic_string<char32_t> u32string; |
| 450 | 451 | |
| 451 | int stoi (const string& str, size_t* idx = 0, int base = 10); | |
| 452 | long stol (const string& str, size_t* idx = 0, int base = 10); | |
| 453 | unsigned long stoul (const string& str, size_t* idx = 0, int base = 10); | |
| 454 | long long stoll (const string& str, size_t* idx = 0, int base = 10); | |
| 455 | unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10); | |
| 452 | int stoi (const string& str, size_t* idx = nullptr, int base = 10); | |
| 453 | long stol (const string& str, size_t* idx = nullptr, int base = 10); | |
| 454 | unsigned long stoul (const string& str, size_t* idx = nullptr, int base = 10); | |
| 455 | long long stoll (const string& str, size_t* idx = nullptr, int base = 10); | |
| 456 | unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10); | |
| 456 | 457 | |
| 457 | float stof (const string& str, size_t* idx = 0); | |
| 458 | double stod (const string& str, size_t* idx = 0); | |
| 459 | long double stold(const string& str, size_t* idx = 0); | |
| 458 | float stof (const string& str, size_t* idx = nullptr); | |
| 459 | double stod (const string& str, size_t* idx = nullptr); | |
| 460 | long double stold(const string& str, size_t* idx = nullptr); | |
| 460 | 461 | |
| 461 | 462 | string to_string(int val); |
| 462 | 463 | string to_string(unsigned val); |
| ... | ... | @@ -468,15 +469,15 @@ string to_string(float val); |
| 468 | 469 | string to_string(double val); |
| 469 | 470 | string to_string(long double val); |
| 470 | 471 | |
| 471 | int stoi (const wstring& str, size_t* idx = 0, int base = 10); | |
| 472 | long stol (const wstring& str, size_t* idx = 0, int base = 10); | |
| 473 | unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10); | |
| 474 | long long stoll (const wstring& str, size_t* idx = 0, int base = 10); | |
| 475 | unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10); | |
| 472 | int stoi (const wstring& str, size_t* idx = nullptr, int base = 10); | |
| 473 | long stol (const wstring& str, size_t* idx = nullptr, int base = 10); | |
| 474 | unsigned long stoul (const wstring& str, size_t* idx = nullptr, int base = 10); | |
| 475 | long long stoll (const wstring& str, size_t* idx = nullptr, int base = 10); | |
| 476 | unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10); | |
| 476 | 477 | |
| 477 | float stof (const wstring& str, size_t* idx = 0); | |
| 478 | double stod (const wstring& str, size_t* idx = 0); | |
| 479 | long double stold(const wstring& str, size_t* idx = 0); | |
| 478 | float stof (const wstring& str, size_t* idx = nullptr); | |
| 479 | double stod (const wstring& str, size_t* idx = nullptr); | |
| 480 | long double stold(const wstring& str, size_t* idx = nullptr); | |
| 480 | 481 | |
| 481 | 482 | wstring to_wstring(int val); |
| 482 | 483 | wstring to_wstring(unsigned val); |
| ... | ... | @@ -665,8 +666,26 @@ struct __padding<_CharT, 1> |
| 665 | 666 | |
| 666 | 667 | #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT |
| 667 | 668 | |
| 669 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 670 | typedef basic_string<char8_t> u8string; | |
| 671 | #endif | |
| 672 | ||
| 673 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS | |
| 674 | typedef basic_string<char16_t> u16string; | |
| 675 | typedef basic_string<char32_t> u32string; | |
| 676 | #endif // _LIBCPP_HAS_NO_UNICODE_CHARS | |
| 677 | ||
| 668 | 678 | template<class _CharT, class _Traits, class _Allocator> |
| 669 | class _LIBCPP_TEMPLATE_VIS basic_string | |
| 679 | class | |
| 680 | _LIBCPP_TEMPLATE_VIS | |
| 681 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 682 | _LIBCPP_PREFERRED_NAME(u8string) | |
| 683 | #endif | |
| 684 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS | |
| 685 | _LIBCPP_PREFERRED_NAME(u16string) | |
| 686 | _LIBCPP_PREFERRED_NAME(u32string) | |
| 687 | #endif | |
| 688 | basic_string | |
| 670 | 689 | : private __basic_string_common<true> |
| 671 | 690 | { |
| 672 | 691 | public: |
| ... | ... | @@ -816,7 +835,7 @@ public: |
| 816 | 835 | basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { |
| 817 | 836 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); |
| 818 | 837 | __init(__s, traits_type::length(__s)); |
| 819 | # if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 838 | # if _LIBCPP_DEBUG_LEVEL == 2 | |
| 820 | 839 | __get_db()->__insert_c(this); |
| 821 | 840 | # endif |
| 822 | 841 | } |
| ... | ... | @@ -890,7 +909,7 @@ public: |
| 890 | 909 | _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} |
| 891 | 910 | basic_string& operator=(value_type __c); |
| 892 | 911 | |
| 893 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 912 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 894 | 913 | _LIBCPP_INLINE_VISIBILITY |
| 895 | 914 | iterator begin() _NOEXCEPT |
| 896 | 915 | {return iterator(this, __get_pointer());} |
| ... | ... | @@ -916,7 +935,7 @@ public: |
| 916 | 935 | _LIBCPP_INLINE_VISIBILITY |
| 917 | 936 | const_iterator end() const _NOEXCEPT |
| 918 | 937 | {return const_iterator(__get_pointer() + size());} |
| 919 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 938 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 920 | 939 | _LIBCPP_INLINE_VISIBILITY |
| 921 | 940 | reverse_iterator rbegin() _NOEXCEPT |
| 922 | 941 | {return reverse_iterator(end());} |
| ... | ... | @@ -954,13 +973,13 @@ public: |
| 954 | 973 | void resize(size_type __n, value_type __c); |
| 955 | 974 | _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} |
| 956 | 975 | |
| 957 | void reserve(size_type __res_arg); | |
| 976 | void reserve(size_type __requested_capacity); | |
| 958 | 977 | _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n); |
| 959 | 978 | |
| 979 | _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY | |
| 980 | void reserve() _NOEXCEPT {shrink_to_fit();} | |
| 960 | 981 | _LIBCPP_INLINE_VISIBILITY |
| 961 | void reserve() _NOEXCEPT {reserve(0);} | |
| 962 | _LIBCPP_INLINE_VISIBILITY | |
| 963 | void shrink_to_fit() _NOEXCEPT {reserve();} | |
| 982 | void shrink_to_fit() _NOEXCEPT; | |
| 964 | 983 | _LIBCPP_INLINE_VISIBILITY |
| 965 | 984 | void clear() _NOEXCEPT; |
| 966 | 985 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1418,18 +1437,20 @@ public: |
| 1418 | 1437 | |
| 1419 | 1438 | _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT; |
| 1420 | 1439 | |
| 1440 | _LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity); | |
| 1441 | ||
| 1421 | 1442 | _LIBCPP_INLINE_VISIBILITY |
| 1422 | 1443 | bool __is_long() const _NOEXCEPT |
| 1423 | 1444 | {return bool(__r_.first().__s.__size_ & __short_mask);} |
| 1424 | 1445 | |
| 1425 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1446 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1426 | 1447 | |
| 1427 | 1448 | bool __dereferenceable(const const_iterator* __i) const; |
| 1428 | 1449 | bool __decrementable(const const_iterator* __i) const; |
| 1429 | 1450 | bool __addable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1430 | 1451 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; |
| 1431 | 1452 | |
| 1432 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1453 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1433 | 1454 | |
| 1434 | 1455 | private: |
| 1435 | 1456 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1726,21 +1747,21 @@ inline |
| 1726 | 1747 | void |
| 1727 | 1748 | basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators() |
| 1728 | 1749 | { |
| 1729 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1750 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1730 | 1751 | __get_db()->__invalidate_all(this); |
| 1731 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1752 | #endif | |
| 1732 | 1753 | } |
| 1733 | 1754 | |
| 1734 | 1755 | template <class _CharT, class _Traits, class _Allocator> |
| 1735 | 1756 | inline |
| 1736 | 1757 | void |
| 1737 | 1758 | basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type |
| 1738 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1759 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1739 | 1760 | __pos |
| 1740 | 1761 | #endif |
| 1741 | 1762 | ) |
| 1742 | 1763 | { |
| 1743 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1764 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1744 | 1765 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 1745 | 1766 | if (__c) |
| 1746 | 1767 | { |
| ... | ... | @@ -1753,12 +1774,12 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type |
| 1753 | 1774 | { |
| 1754 | 1775 | (*__p)->__c_ = nullptr; |
| 1755 | 1776 | if (--__c->end_ != __p) |
| 1756 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1777 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 1757 | 1778 | } |
| 1758 | 1779 | } |
| 1759 | 1780 | __get_db()->unlock(); |
| 1760 | 1781 | } |
| 1761 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1782 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1762 | 1783 | } |
| 1763 | 1784 | |
| 1764 | 1785 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -1767,7 +1788,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string() |
| 1767 | 1788 | _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 1768 | 1789 | : __r_(__default_init_tag(), __default_init_tag()) |
| 1769 | 1790 | { |
| 1770 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1791 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1771 | 1792 | __get_db()->__insert_c(this); |
| 1772 | 1793 | #endif |
| 1773 | 1794 | __zero(); |
| ... | ... | @@ -1783,7 +1804,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ |
| 1783 | 1804 | #endif |
| 1784 | 1805 | : __r_(__default_init_tag(), __a) |
| 1785 | 1806 | { |
| 1786 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1807 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1787 | 1808 | __get_db()->__insert_c(this); |
| 1788 | 1809 | #endif |
| 1789 | 1810 | __zero(); |
| ... | ... | @@ -1845,7 +1866,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const |
| 1845 | 1866 | { |
| 1846 | 1867 | _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); |
| 1847 | 1868 | __init(__s, traits_type::length(__s)); |
| 1848 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1869 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1849 | 1870 | __get_db()->__insert_c(this); |
| 1850 | 1871 | #endif |
| 1851 | 1872 | } |
| ... | ... | @@ -1857,7 +1878,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ |
| 1857 | 1878 | { |
| 1858 | 1879 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); |
| 1859 | 1880 | __init(__s, __n); |
| 1860 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1881 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1861 | 1882 | __get_db()->__insert_c(this); |
| 1862 | 1883 | #endif |
| 1863 | 1884 | } |
| ... | ... | @@ -1869,7 +1890,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ |
| 1869 | 1890 | { |
| 1870 | 1891 | _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); |
| 1871 | 1892 | __init(__s, __n); |
| 1872 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1893 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1873 | 1894 | __get_db()->__insert_c(this); |
| 1874 | 1895 | #endif |
| 1875 | 1896 | } |
| ... | ... | @@ -1884,7 +1905,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 1884 | 1905 | __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()), |
| 1885 | 1906 | __str.__get_long_size()); |
| 1886 | 1907 | |
| 1887 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1908 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1888 | 1909 | __get_db()->__insert_c(this); |
| 1889 | 1910 | #endif |
| 1890 | 1911 | } |
| ... | ... | @@ -1899,7 +1920,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 1899 | 1920 | else |
| 1900 | 1921 | __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()), |
| 1901 | 1922 | __str.__get_long_size()); |
| 1902 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1923 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1903 | 1924 | __get_db()->__insert_c(this); |
| 1904 | 1925 | #endif |
| 1905 | 1926 | } |
| ... | ... | @@ -1936,7 +1957,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) |
| 1936 | 1957 | : __r_(_VSTD::move(__str.__r_)) |
| 1937 | 1958 | { |
| 1938 | 1959 | __str.__zero(); |
| 1939 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1960 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1940 | 1961 | __get_db()->__insert_c(this); |
| 1941 | 1962 | if (__is_long()) |
| 1942 | 1963 | __get_db()->swap(this, &__str); |
| ... | ... | @@ -1955,7 +1976,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co |
| 1955 | 1976 | __r_.first().__r = __str.__r_.first().__r; |
| 1956 | 1977 | __str.__zero(); |
| 1957 | 1978 | } |
| 1958 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1979 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1959 | 1980 | __get_db()->__insert_c(this); |
| 1960 | 1981 | if (__is_long()) |
| 1961 | 1982 | __get_db()->swap(this, &__str); |
| ... | ... | @@ -1994,7 +2015,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ |
| 1994 | 2015 | : __r_(__default_init_tag(), __default_init_tag()) |
| 1995 | 2016 | { |
| 1996 | 2017 | __init(__n, __c); |
| 1997 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2018 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1998 | 2019 | __get_db()->__insert_c(this); |
| 1999 | 2020 | #endif |
| 2000 | 2021 | } |
| ... | ... | @@ -2005,7 +2026,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ |
| 2005 | 2026 | : __r_(__default_init_tag(), __a) |
| 2006 | 2027 | { |
| 2007 | 2028 | __init(__n, __c); |
| 2008 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2029 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2009 | 2030 | __get_db()->__insert_c(this); |
| 2010 | 2031 | #endif |
| 2011 | 2032 | } |
| ... | ... | @@ -2020,7 +2041,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 2020 | 2041 | if (__pos > __str_sz) |
| 2021 | 2042 | this->__throw_out_of_range(); |
| 2022 | 2043 | __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos)); |
| 2023 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2044 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2024 | 2045 | __get_db()->__insert_c(this); |
| 2025 | 2046 | #endif |
| 2026 | 2047 | } |
| ... | ... | @@ -2035,7 +2056,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| 2035 | 2056 | if (__pos > __str_sz) |
| 2036 | 2057 | this->__throw_out_of_range(); |
| 2037 | 2058 | __init(__str.data() + __pos, __str_sz - __pos); |
| 2038 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2059 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2039 | 2060 | __get_db()->__insert_c(this); |
| 2040 | 2061 | #endif |
| 2041 | 2062 | } |
| ... | ... | @@ -2049,7 +2070,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2049 | 2070 | __self_view __sv0 = __t; |
| 2050 | 2071 | __self_view __sv = __sv0.substr(__pos, __n); |
| 2051 | 2072 | __init(__sv.data(), __sv.size()); |
| 2052 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2073 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2053 | 2074 | __get_db()->__insert_c(this); |
| 2054 | 2075 | #endif |
| 2055 | 2076 | } |
| ... | ... | @@ -2061,7 +2082,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) |
| 2061 | 2082 | { |
| 2062 | 2083 | __self_view __sv = __t; |
| 2063 | 2084 | __init(__sv.data(), __sv.size()); |
| 2064 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2085 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2065 | 2086 | __get_db()->__insert_c(this); |
| 2066 | 2087 | #endif |
| 2067 | 2088 | } |
| ... | ... | @@ -2073,7 +2094,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _ |
| 2073 | 2094 | { |
| 2074 | 2095 | __self_view __sv = __t; |
| 2075 | 2096 | __init(__sv.data(), __sv.size()); |
| 2076 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2097 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2077 | 2098 | __get_db()->__insert_c(this); |
| 2078 | 2099 | #endif |
| 2079 | 2100 | } |
| ... | ... | @@ -2141,7 +2162,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, |
| 2141 | 2162 | : __r_(__default_init_tag(), __default_init_tag()) |
| 2142 | 2163 | { |
| 2143 | 2164 | __init(__first, __last); |
| 2144 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2165 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2145 | 2166 | __get_db()->__insert_c(this); |
| 2146 | 2167 | #endif |
| 2147 | 2168 | } |
| ... | ... | @@ -2154,7 +2175,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, |
| 2154 | 2175 | : __r_(__default_init_tag(), __a) |
| 2155 | 2176 | { |
| 2156 | 2177 | __init(__first, __last); |
| 2157 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2178 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2158 | 2179 | __get_db()->__insert_c(this); |
| 2159 | 2180 | #endif |
| 2160 | 2181 | } |
| ... | ... | @@ -2168,7 +2189,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2168 | 2189 | : __r_(__default_init_tag(), __default_init_tag()) |
| 2169 | 2190 | { |
| 2170 | 2191 | __init(__il.begin(), __il.end()); |
| 2171 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2192 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2172 | 2193 | __get_db()->__insert_c(this); |
| 2173 | 2194 | #endif |
| 2174 | 2195 | } |
| ... | ... | @@ -2181,7 +2202,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2181 | 2202 | : __r_(__default_init_tag(), __a) |
| 2182 | 2203 | { |
| 2183 | 2204 | __init(__il.begin(), __il.end()); |
| 2184 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2205 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2185 | 2206 | __get_db()->__insert_c(this); |
| 2186 | 2207 | #endif |
| 2187 | 2208 | } |
| ... | ... | @@ -2191,7 +2212,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( |
| 2191 | 2212 | template <class _CharT, class _Traits, class _Allocator> |
| 2192 | 2213 | basic_string<_CharT, _Traits, _Allocator>::~basic_string() |
| 2193 | 2214 | { |
| 2194 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2215 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2195 | 2216 | __get_db()->__erase_c(this); |
| 2196 | 2217 | #endif |
| 2197 | 2218 | if (__is_long()) |
| ... | ... | @@ -2768,7 +2789,7 @@ _EnableIf |
| 2768 | 2789 | > |
| 2769 | 2790 | basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last) |
| 2770 | 2791 | { |
| 2771 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2792 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2772 | 2793 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, |
| 2773 | 2794 | "string::insert(iterator, range) called with an iterator not" |
| 2774 | 2795 | " referring to this string"); |
| ... | ... | @@ -2787,7 +2808,7 @@ _EnableIf |
| 2787 | 2808 | > |
| 2788 | 2809 | basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last) |
| 2789 | 2810 | { |
| 2790 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2811 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2791 | 2812 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, |
| 2792 | 2813 | "string::insert(iterator, range) called with an iterator not" |
| 2793 | 2814 | " referring to this string"); |
| ... | ... | @@ -2903,7 +2924,7 @@ inline |
| 2903 | 2924 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 2904 | 2925 | basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c) |
| 2905 | 2926 | { |
| 2906 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2927 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2907 | 2928 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, |
| 2908 | 2929 | "string::insert(iterator, n, value) called with an iterator not" |
| 2909 | 2930 | " referring to this string"); |
| ... | ... | @@ -3137,7 +3158,7 @@ inline |
| 3137 | 3158 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 3138 | 3159 | basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) |
| 3139 | 3160 | { |
| 3140 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 3161 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 3141 | 3162 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, |
| 3142 | 3163 | "string::erase(iterator) called with an iterator not" |
| 3143 | 3164 | " referring to this string"); |
| ... | ... | @@ -3155,7 +3176,7 @@ inline |
| 3155 | 3176 | typename basic_string<_CharT, _Traits, _Allocator>::iterator |
| 3156 | 3177 | basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last) |
| 3157 | 3178 | { |
| 3158 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 3179 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 3159 | 3180 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, |
| 3160 | 3181 | "string::erase(iterator, iterator) called with an iterator not" |
| 3161 | 3182 | " referring to this string"); |
| ... | ... | @@ -3262,65 +3283,88 @@ basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT |
| 3262 | 3283 | |
| 3263 | 3284 | template <class _CharT, class _Traits, class _Allocator> |
| 3264 | 3285 | void |
| 3265 | basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg) | |
| 3286 | basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) | |
| 3266 | 3287 | { |
| 3267 | if (__res_arg > max_size()) | |
| 3288 | if (__requested_capacity > max_size()) | |
| 3268 | 3289 | this->__throw_length_error(); |
| 3290 | ||
| 3291 | #if _LIBCPP_STD_VER > 17 | |
| 3292 | // Reserve never shrinks as of C++20. | |
| 3293 | if (__requested_capacity <= capacity()) return; | |
| 3294 | #endif | |
| 3295 | ||
| 3296 | size_type __target_capacity = _VSTD::max(__requested_capacity, size()); | |
| 3297 | __target_capacity = __recommend(__target_capacity); | |
| 3298 | if (__target_capacity == capacity()) return; | |
| 3299 | ||
| 3300 | __shrink_or_extend(__target_capacity); | |
| 3301 | } | |
| 3302 | ||
| 3303 | template <class _CharT, class _Traits, class _Allocator> | |
| 3304 | void | |
| 3305 | basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT | |
| 3306 | { | |
| 3307 | size_type __target_capacity = __recommend(size()); | |
| 3308 | if (__target_capacity == capacity()) return; | |
| 3309 | ||
| 3310 | __shrink_or_extend(__target_capacity); | |
| 3311 | } | |
| 3312 | ||
| 3313 | template <class _CharT, class _Traits, class _Allocator> | |
| 3314 | void | |
| 3315 | basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) | |
| 3316 | { | |
| 3269 | 3317 | size_type __cap = capacity(); |
| 3270 | 3318 | size_type __sz = size(); |
| 3271 | __res_arg = _VSTD::max(__res_arg, __sz); | |
| 3272 | __res_arg = __recommend(__res_arg); | |
| 3273 | if (__res_arg != __cap) | |
| 3319 | ||
| 3320 | pointer __new_data, __p; | |
| 3321 | bool __was_long, __now_long; | |
| 3322 | if (__target_capacity == __min_cap - 1) | |
| 3274 | 3323 | { |
| 3275 | pointer __new_data, __p; | |
| 3276 | bool __was_long, __now_long; | |
| 3277 | if (__res_arg == __min_cap - 1) | |
| 3278 | { | |
| 3279 | __was_long = true; | |
| 3280 | __now_long = false; | |
| 3281 | __new_data = __get_short_pointer(); | |
| 3282 | __p = __get_long_pointer(); | |
| 3283 | } | |
| 3324 | __was_long = true; | |
| 3325 | __now_long = false; | |
| 3326 | __new_data = __get_short_pointer(); | |
| 3327 | __p = __get_long_pointer(); | |
| 3328 | } | |
| 3329 | else | |
| 3330 | { | |
| 3331 | if (__target_capacity > __cap) | |
| 3332 | __new_data = __alloc_traits::allocate(__alloc(), __target_capacity+1); | |
| 3284 | 3333 | else |
| 3285 | 3334 | { |
| 3286 | if (__res_arg > __cap) | |
| 3287 | __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1); | |
| 3288 | else | |
| 3335 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 3336 | try | |
| 3289 | 3337 | { |
| 3290 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 3291 | try | |
| 3292 | { | |
| 3293 | #endif // _LIBCPP_NO_EXCEPTIONS | |
| 3294 | __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1); | |
| 3295 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 3296 | } | |
| 3297 | catch (...) | |
| 3298 | { | |
| 3299 | return; | |
| 3300 | } | |
| 3301 | #else // _LIBCPP_NO_EXCEPTIONS | |
| 3302 | if (__new_data == nullptr) | |
| 3303 | return; | |
| 3304 | #endif // _LIBCPP_NO_EXCEPTIONS | |
| 3338 | #endif // _LIBCPP_NO_EXCEPTIONS | |
| 3339 | __new_data = __alloc_traits::allocate(__alloc(), __target_capacity+1); | |
| 3340 | #ifndef _LIBCPP_NO_EXCEPTIONS | |
| 3305 | 3341 | } |
| 3306 | __now_long = true; | |
| 3307 | __was_long = __is_long(); | |
| 3308 | __p = __get_pointer(); | |
| 3309 | } | |
| 3310 | traits_type::copy(_VSTD::__to_address(__new_data), | |
| 3311 | _VSTD::__to_address(__p), size()+1); | |
| 3312 | if (__was_long) | |
| 3313 | __alloc_traits::deallocate(__alloc(), __p, __cap+1); | |
| 3314 | if (__now_long) | |
| 3315 | { | |
| 3316 | __set_long_cap(__res_arg+1); | |
| 3317 | __set_long_size(__sz); | |
| 3318 | __set_long_pointer(__new_data); | |
| 3342 | catch (...) | |
| 3343 | { | |
| 3344 | return; | |
| 3345 | } | |
| 3346 | #else // _LIBCPP_NO_EXCEPTIONS | |
| 3347 | if (__new_data == nullptr) | |
| 3348 | return; | |
| 3349 | #endif // _LIBCPP_NO_EXCEPTIONS | |
| 3319 | 3350 | } |
| 3320 | else | |
| 3321 | __set_short_size(__sz); | |
| 3322 | __invalidate_all_iterators(); | |
| 3351 | __now_long = true; | |
| 3352 | __was_long = __is_long(); | |
| 3353 | __p = __get_pointer(); | |
| 3323 | 3354 | } |
| 3355 | traits_type::copy(_VSTD::__to_address(__new_data), | |
| 3356 | _VSTD::__to_address(__p), size()+1); | |
| 3357 | if (__was_long) | |
| 3358 | __alloc_traits::deallocate(__alloc(), __p, __cap+1); | |
| 3359 | if (__now_long) | |
| 3360 | { | |
| 3361 | __set_long_cap(__target_capacity+1); | |
| 3362 | __set_long_size(__sz); | |
| 3363 | __set_long_pointer(__new_data); | |
| 3364 | } | |
| 3365 | else | |
| 3366 | __set_short_size(__sz); | |
| 3367 | __invalidate_all_iterators(); | |
| 3324 | 3368 | } |
| 3325 | 3369 | |
| 3326 | 3370 | template <class _CharT, class _Traits, class _Allocator> |
| ... | ... | @@ -3426,7 +3470,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) |
| 3426 | 3470 | __is_nothrow_swappable<allocator_type>::value) |
| 3427 | 3471 | #endif |
| 3428 | 3472 | { |
| 3429 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 3473 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 3430 | 3474 | if (!__is_long()) |
| 3431 | 3475 | __get_db()->__invalidate_all(this); |
| 3432 | 3476 | if (!__str.__is_long()) |
| ... | ... | @@ -3438,7 +3482,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) |
| 3438 | 3482 | __alloc_traits::is_always_equal::value || |
| 3439 | 3483 | __alloc() == __str.__alloc(), "swapping non-equal allocators"); |
| 3440 | 3484 | _VSTD::swap(__r_.first(), __str.__r_.first()); |
| 3441 | __swap_allocator(__alloc(), __str.__alloc()); | |
| 3485 | _VSTD::__swap_allocator(__alloc(), __str.__alloc()); | |
| 3442 | 3486 | } |
| 3443 | 3487 | |
| 3444 | 3488 | // find |
| ... | ... | @@ -3939,9 +3983,9 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const |
| 3939 | 3983 | return false; |
| 3940 | 3984 | if (capacity() < __min_cap - 1) |
| 3941 | 3985 | return false; |
| 3942 | if (data() == 0) | |
| 3986 | if (data() == nullptr) | |
| 3943 | 3987 | return false; |
| 3944 | if (data()[size()] != value_type(0)) | |
| 3988 | if (data()[size()] != value_type()) | |
| 3945 | 3989 | return false; |
| 3946 | 3990 | return true; |
| 3947 | 3991 | } |
| ... | ... | @@ -3959,6 +4003,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT |
| 3959 | 4003 | __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); |
| 3960 | 4004 | __set_long_cap(0); |
| 3961 | 4005 | __set_short_size(0); |
| 4006 | traits_type::assign(*__get_short_pointer(), value_type()); | |
| 3962 | 4007 | } |
| 3963 | 4008 | } |
| 3964 | 4009 | |
| ... | ... | @@ -4300,24 +4345,15 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, |
| 4300 | 4345 | __lhs.swap(__rhs); |
| 4301 | 4346 | } |
| 4302 | 4347 | |
| 4303 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 4304 | typedef basic_string<char8_t> u8string; | |
| 4305 | #endif | |
| 4306 | ||
| 4307 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS | |
| 4308 | typedef basic_string<char16_t> u16string; | |
| 4309 | typedef basic_string<char32_t> u32string; | |
| 4310 | #endif // _LIBCPP_HAS_NO_UNICODE_CHARS | |
| 4311 | ||
| 4312 | _LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = 0, int __base = 10); | |
| 4313 | _LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = 0, int __base = 10); | |
| 4314 | _LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = 0, int __base = 10); | |
| 4315 | _LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = 0, int __base = 10); | |
| 4316 | _LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10); | |
| 4348 | _LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4349 | _LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4350 | _LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4351 | _LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4352 | _LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4317 | 4353 | |
| 4318 | _LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = 0); | |
| 4319 | _LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = 0); | |
| 4320 | _LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = 0); | |
| 4354 | _LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = nullptr); | |
| 4355 | _LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = nullptr); | |
| 4356 | _LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = nullptr); | |
| 4321 | 4357 | |
| 4322 | 4358 | _LIBCPP_FUNC_VIS string to_string(int __val); |
| 4323 | 4359 | _LIBCPP_FUNC_VIS string to_string(unsigned __val); |
| ... | ... | @@ -4329,15 +4365,15 @@ _LIBCPP_FUNC_VIS string to_string(float __val); |
| 4329 | 4365 | _LIBCPP_FUNC_VIS string to_string(double __val); |
| 4330 | 4366 | _LIBCPP_FUNC_VIS string to_string(long double __val); |
| 4331 | 4367 | |
| 4332 | _LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = 0, int __base = 10); | |
| 4333 | _LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = 0, int __base = 10); | |
| 4334 | _LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = 0, int __base = 10); | |
| 4335 | _LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = 0, int __base = 10); | |
| 4336 | _LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10); | |
| 4368 | _LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4369 | _LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4370 | _LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4371 | _LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4372 | _LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10); | |
| 4337 | 4373 | |
| 4338 | _LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = 0); | |
| 4339 | _LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = 0); | |
| 4340 | _LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = 0); | |
| 4374 | _LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = nullptr); | |
| 4375 | _LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = nullptr); | |
| 4376 | _LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = nullptr); | |
| 4341 | 4377 | |
| 4342 | 4378 | _LIBCPP_FUNC_VIS wstring to_wstring(int __val); |
| 4343 | 4379 | _LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val); |
| ... | ... | @@ -4425,7 +4461,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 4425 | 4461 | } |
| 4426 | 4462 | #endif |
| 4427 | 4463 | |
| 4428 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 4464 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 4429 | 4465 | |
| 4430 | 4466 | template<class _CharT, class _Traits, class _Allocator> |
| 4431 | 4467 | bool |
| ... | ... | @@ -4459,7 +4495,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* |
| 4459 | 4495 | return this->data() <= __p && __p < this->data() + this->size(); |
| 4460 | 4496 | } |
| 4461 | 4497 | |
| 4462 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 4498 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 4463 | 4499 | |
| 4464 | 4500 | #if _LIBCPP_STD_VER > 11 |
| 4465 | 4501 | // Literal suffixes for basic_string [basic.string.literals] |
lib/libcxx/include/string_view+24-11| ... | ... | @@ -192,7 +192,26 @@ _LIBCPP_PUSH_MACROS |
| 192 | 192 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 193 | 193 | |
| 194 | 194 | template<class _CharT, class _Traits = char_traits<_CharT> > |
| 195 | class _LIBCPP_TEMPLATE_VIS basic_string_view { | |
| 195 | class _LIBCPP_TEMPLATE_VIS basic_string_view; | |
| 196 | ||
| 197 | typedef basic_string_view<char> string_view; | |
| 198 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 199 | typedef basic_string_view<char8_t> u8string_view; | |
| 200 | #endif | |
| 201 | typedef basic_string_view<char16_t> u16string_view; | |
| 202 | typedef basic_string_view<char32_t> u32string_view; | |
| 203 | typedef basic_string_view<wchar_t> wstring_view; | |
| 204 | ||
| 205 | template<class _CharT, class _Traits> | |
| 206 | class | |
| 207 | _LIBCPP_PREFERRED_NAME(string_view) | |
| 208 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 209 | _LIBCPP_PREFERRED_NAME(u8string_view) | |
| 210 | #endif | |
| 211 | _LIBCPP_PREFERRED_NAME(u16string_view) | |
| 212 | _LIBCPP_PREFERRED_NAME(u32string_view) | |
| 213 | _LIBCPP_PREFERRED_NAME(wstring_view) | |
| 214 | basic_string_view { | |
| 196 | 215 | public: |
| 197 | 216 | // types |
| 198 | 217 | typedef _Traits traits_type; |
| ... | ... | @@ -236,7 +255,7 @@ public: |
| 236 | 255 | |
| 237 | 256 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 238 | 257 | basic_string_view(const _CharT* __s) |
| 239 | : __data(__s), __size(std::__char_traits_length_checked<_Traits>(__s)) {} | |
| 258 | : __data(__s), __size(_VSTD::__char_traits_length_checked<_Traits>(__s)) {} | |
| 240 | 259 | |
| 241 | 260 | // [string.view.iterators], iterators |
| 242 | 261 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -278,7 +297,9 @@ public: |
| 278 | 297 | |
| 279 | 298 | // [string.view.access], element access |
| 280 | 299 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 281 | const_reference operator[](size_type __pos) const _NOEXCEPT { return __data[__pos]; } | |
| 300 | const_reference operator[](size_type __pos) const _NOEXCEPT { | |
| 301 | return _LIBCPP_ASSERT(__pos < size(), "string_view[] index out of bounds"), __data[__pos]; | |
| 302 | } | |
| 282 | 303 | |
| 283 | 304 | _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY |
| 284 | 305 | const_reference at(size_type __pos) const |
| ... | ... | @@ -774,14 +795,6 @@ basic_ostream<_CharT, _Traits>& |
| 774 | 795 | operator<<(basic_ostream<_CharT, _Traits>& __os, |
| 775 | 796 | basic_string_view<_CharT, _Traits> __str); |
| 776 | 797 | |
| 777 | typedef basic_string_view<char> string_view; | |
| 778 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 779 | typedef basic_string_view<char8_t> u8string_view; | |
| 780 | #endif | |
| 781 | typedef basic_string_view<char16_t> u16string_view; | |
| 782 | typedef basic_string_view<char32_t> u32string_view; | |
| 783 | typedef basic_string_view<wchar_t> wstring_view; | |
| 784 | ||
| 785 | 798 | // [string.view.hash] |
| 786 | 799 | template<class _CharT> |
| 787 | 800 | struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > > |
lib/libcxx/include/strstream+8-8| ... | ... | @@ -19,12 +19,12 @@ class strstreambuf |
| 19 | 19 | public: |
| 20 | 20 | explicit strstreambuf(streamsize alsize_arg = 0); |
| 21 | 21 | strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*)); |
| 22 | strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0); | |
| 22 | strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); | |
| 23 | 23 | strstreambuf(const char* gnext_arg, streamsize n); |
| 24 | 24 | |
| 25 | strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0); | |
| 25 | strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr); | |
| 26 | 26 | strstreambuf(const signed char* gnext_arg, streamsize n); |
| 27 | strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0); | |
| 27 | strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr); | |
| 28 | 28 | strstreambuf(const unsigned char* gnext_arg, streamsize n); |
| 29 | 29 | |
| 30 | 30 | strstreambuf(strstreambuf&& rhs); |
| ... | ... | @@ -142,12 +142,12 @@ class _LIBCPP_TYPE_VIS strstreambuf |
| 142 | 142 | public: |
| 143 | 143 | explicit strstreambuf(streamsize __alsize = 0); |
| 144 | 144 | strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*)); |
| 145 | strstreambuf(char* __gnext, streamsize __n, char* __pbeg = 0); | |
| 145 | strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr); | |
| 146 | 146 | strstreambuf(const char* __gnext, streamsize __n); |
| 147 | 147 | |
| 148 | strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0); | |
| 148 | strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr); | |
| 149 | 149 | strstreambuf(const signed char* __gnext, streamsize __n); |
| 150 | strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0); | |
| 150 | strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr); | |
| 151 | 151 | strstreambuf(const unsigned char* __gnext, streamsize __n); |
| 152 | 152 | |
| 153 | 153 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -290,7 +290,7 @@ public: |
| 290 | 290 | _LIBCPP_INLINE_VISIBILITY |
| 291 | 291 | ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out) |
| 292 | 292 | : ostream(&__sb_), |
| 293 | __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) | |
| 293 | __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0)) | |
| 294 | 294 | {} |
| 295 | 295 | |
| 296 | 296 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -350,7 +350,7 @@ public: |
| 350 | 350 | _LIBCPP_INLINE_VISIBILITY |
| 351 | 351 | strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out) |
| 352 | 352 | : iostream(&__sb_), |
| 353 | __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) | |
| 353 | __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0)) | |
| 354 | 354 | {} |
| 355 | 355 | |
| 356 | 356 | #ifndef _LIBCPP_CXX03_LANG |
lib/libcxx/include/support/ibm/nanosleep.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===----------------------------------------------------------------------===// | |
| 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_SUPPORT_IBM_NANOSLEEP_H | |
| 11 | #define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H | |
| 12 | ||
| 13 | #include <unistd.h> | |
| 14 | ||
| 15 | inline int nanosleep(const struct timespec* req, struct timespec* rem) | |
| 16 | { | |
| 17 | // The nanosleep() function is not available on z/OS. Therefore, we will call | |
| 18 | // sleep() to sleep for whole seconds and usleep() to sleep for any remaining | |
| 19 | // fraction of a second. Any remaining nanoseconds will round up to the next | |
| 20 | // microsecond. | |
| 21 | ||
| 22 | useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000; | |
| 23 | if (__micro_sec > 999999) | |
| 24 | { | |
| 25 | ++rem->tv_sec; | |
| 26 | __micro_sec -= 1000000; | |
| 27 | } | |
| 28 | while (rem->tv_sec) | |
| 29 | rem->tv_sec = sleep(rem->tv_sec); | |
| 30 | if (__micro_sec) { | |
| 31 | rem->tv_nsec = __micro_sec * 1000; | |
| 32 | return usleep(__micro_sec); | |
| 33 | } | |
| 34 | rem->tv_nsec = 0; | |
| 35 | return 0; | |
| 36 | } | |
| 37 | ||
| 38 | #endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H |
lib/libcxx/include/support/ibm/xlocale.h+9-4| ... | ... | @@ -11,13 +11,13 @@ |
| 11 | 11 | #define _LIBCPP_SUPPORT_IBM_XLOCALE_H |
| 12 | 12 | #include <support/ibm/locale_mgmt_aix.h> |
| 13 | 13 | |
| 14 | #if defined(_AIX) | |
| 15 | 14 | #include "cstdlib" |
| 16 | 15 | |
| 17 | 16 | #ifdef __cplusplus |
| 18 | 17 | extern "C" { |
| 19 | 18 | #endif |
| 20 | 19 | |
| 20 | #if defined(_AIX) | |
| 21 | 21 | #if !defined(_AIX71) |
| 22 | 22 | // AIX 7.1 and higher has these definitions. Definitions and stubs |
| 23 | 23 | // are provied here as a temporary workaround on AIX 6.1. |
| ... | ... | @@ -207,14 +207,20 @@ size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n, |
| 207 | 207 | } |
| 208 | 208 | #endif // !defined(_AIX71) |
| 209 | 209 | |
| 210 | // strftime_l() is defined by POSIX. However, AIX 7.1 does not have it | |
| 211 | // implemented yet. | |
| 210 | // strftime_l() is defined by POSIX. However, AIX 7.1 and z/OS do not have it | |
| 211 | // implemented yet. z/OS retrieves it from the POSIX fallbacks. | |
| 212 | 212 | static inline |
| 213 | 213 | size_t strftime_l(char *__s, size_t __size, const char *__fmt, |
| 214 | 214 | const struct tm *__tm, locale_t locale) { |
| 215 | 215 | return __xstrftime(locale, __s, __size, __fmt, __tm); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | #elif defined(__MVS__) | |
| 219 | #include <wctype.h> | |
| 220 | // POSIX routines | |
| 221 | #include <support/xlocale/__posix_l_fallback.h> | |
| 222 | #endif // defined(__MVS__) | |
| 223 | ||
| 218 | 224 | // The following are not POSIX routines. These are quick-and-dirty hacks |
| 219 | 225 | // to make things pretend to work |
| 220 | 226 | static inline |
| ... | ... | @@ -266,5 +272,4 @@ int vasprintf(char **strp, const char *fmt, va_list ap) |
| 266 | 272 | #ifdef __cplusplus |
| 267 | 273 | } |
| 268 | 274 | #endif |
| 269 | #endif // defined(_AIX) | |
| 270 | 275 | #endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H |
lib/libcxx/include/support/nuttx/xlocale.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | // -*- C++ -*- | |
| 2 | //===-------------------- support/nuttx/xlocale.h -------------------------===// | |
| 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_SUPPORT_NUTTX_XLOCALE_H | |
| 11 | #define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H | |
| 12 | ||
| 13 | #if defined(__NuttX__) | |
| 14 | #include <support/xlocale/__posix_l_fallback.h> | |
| 15 | #include <support/xlocale/__strtonum_fallback.h> | |
| 16 | #endif // __NuttX__ | |
| 17 | ||
| 18 | #endif |
lib/libcxx/include/support/win32/locale_win32.h+2-2| ... | ... | @@ -201,8 +201,8 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); |
| 201 | 201 | #define strtof_l _strtof_l |
| 202 | 202 | #define strtold_l _strtold_l |
| 203 | 203 | #else |
| 204 | float strtof_l(const char*, char**, locale_t); | |
| 205 | long double strtold_l(const char*, char**, locale_t); | |
| 204 | _LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t); | |
| 205 | _LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t); | |
| 206 | 206 | #endif |
| 207 | 207 | inline _LIBCPP_INLINE_VISIBILITY |
| 208 | 208 | int |
lib/libcxx/include/system_error+2-2| ... | ... | @@ -253,7 +253,7 @@ public: |
| 253 | 253 | template <class _Ep> |
| 254 | 254 | _LIBCPP_INLINE_VISIBILITY |
| 255 | 255 | error_condition(_Ep __e, |
| 256 | typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0 | |
| 256 | typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr | |
| 257 | 257 | ) _NOEXCEPT |
| 258 | 258 | {*this = make_error_condition(__e);} |
| 259 | 259 | |
| ... | ... | @@ -325,7 +325,7 @@ public: |
| 325 | 325 | template <class _Ep> |
| 326 | 326 | _LIBCPP_INLINE_VISIBILITY |
| 327 | 327 | error_code(_Ep __e, |
| 328 | typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0 | |
| 328 | typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr | |
| 329 | 329 | ) _NOEXCEPT |
| 330 | 330 | {*this = make_error_code(__e);} |
| 331 | 331 |
lib/libcxx/include/thread+21-24| ... | ... | @@ -277,18 +277,18 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 277 | 277 | void |
| 278 | 278 | __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) |
| 279 | 279 | { |
| 280 | __invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...); | |
| 280 | _VSTD::__invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...); | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | template <class _Fp> |
| 284 | 284 | _LIBCPP_INLINE_VISIBILITY |
| 285 | 285 | void* __thread_proxy(void* __vp) |
| 286 | 286 | { |
| 287 | // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...> | |
| 288 | std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); | |
| 289 | __thread_local_data().set_pointer(_VSTD::get<0>(*__p).release()); | |
| 287 | // _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...> | |
| 288 | unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); | |
| 289 | __thread_local_data().set_pointer(_VSTD::get<0>(*__p.get()).release()); | |
| 290 | 290 | typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index; |
| 291 | __thread_execute(*__p, _Index()); | |
| 291 | _VSTD::__thread_execute(*__p.get(), _Index()); | |
| 292 | 292 | return nullptr; |
| 293 | 293 | } |
| 294 | 294 | |
| ... | ... | @@ -300,11 +300,11 @@ thread::thread(_Fp&& __f, _Args&&... __args) |
| 300 | 300 | typedef unique_ptr<__thread_struct> _TSPtr; |
| 301 | 301 | _TSPtr __tsp(new __thread_struct); |
| 302 | 302 | typedef tuple<_TSPtr, typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp; |
| 303 | _VSTD::unique_ptr<_Gp> __p( | |
| 304 | new _Gp(std::move(__tsp), | |
| 305 | __decay_copy(_VSTD::forward<_Fp>(__f)), | |
| 306 | __decay_copy(_VSTD::forward<_Args>(__args))...)); | |
| 307 | int __ec = __libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get()); | |
| 303 | unique_ptr<_Gp> __p( | |
| 304 | new _Gp(_VSTD::move(__tsp), | |
| 305 | _VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), | |
| 306 | _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); | |
| 307 | int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get()); | |
| 308 | 308 | if (__ec == 0) |
| 309 | 309 | __p.release(); |
| 310 | 310 | else |
| ... | ... | @@ -326,7 +326,7 @@ struct __thread_invoke_pair { |
| 326 | 326 | template <class _Fp> |
| 327 | 327 | void* __thread_proxy_cxx03(void* __vp) |
| 328 | 328 | { |
| 329 | std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); | |
| 329 | unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); | |
| 330 | 330 | __thread_local_data().set_pointer(__p->__tsp_.release()); |
| 331 | 331 | (__p->__fn_)(); |
| 332 | 332 | return nullptr; |
| ... | ... | @@ -337,9 +337,9 @@ thread::thread(_Fp __f) |
| 337 | 337 | { |
| 338 | 338 | |
| 339 | 339 | typedef __thread_invoke_pair<_Fp> _InvokePair; |
| 340 | typedef std::unique_ptr<_InvokePair> _PairPtr; | |
| 340 | typedef unique_ptr<_InvokePair> _PairPtr; | |
| 341 | 341 | _PairPtr __pp(new _InvokePair(__f)); |
| 342 | int __ec = __libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get()); | |
| 342 | int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get()); | |
| 343 | 343 | if (__ec == 0) |
| 344 | 344 | __pp.release(); |
| 345 | 345 | else |
| ... | ... | @@ -360,25 +360,24 @@ template <class _Rep, class _Period> |
| 360 | 360 | void |
| 361 | 361 | sleep_for(const chrono::duration<_Rep, _Period>& __d) |
| 362 | 362 | { |
| 363 | using namespace chrono; | |
| 364 | if (__d > duration<_Rep, _Period>::zero()) | |
| 363 | if (__d > chrono::duration<_Rep, _Period>::zero()) | |
| 365 | 364 | { |
| 366 | 365 | #if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__) |
| 367 | 366 | // GCC's long double const folding is incomplete for IBM128 long doubles. |
| 368 | _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ; | |
| 367 | _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::duration<long double>(ULLONG_MAX/1000000000ULL) ; | |
| 369 | 368 | #else |
| 370 | _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max(); | |
| 369 | _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::nanoseconds::max(); | |
| 371 | 370 | #endif |
| 372 | nanoseconds __ns; | |
| 371 | chrono::nanoseconds __ns; | |
| 373 | 372 | if (__d < _Max) |
| 374 | 373 | { |
| 375 | __ns = duration_cast<nanoseconds>(__d); | |
| 374 | __ns = chrono::duration_cast<chrono::nanoseconds>(__d); | |
| 376 | 375 | if (__ns < __d) |
| 377 | 376 | ++__ns; |
| 378 | 377 | } |
| 379 | 378 | else |
| 380 | __ns = nanoseconds::max(); | |
| 381 | sleep_for(__ns); | |
| 379 | __ns = chrono::nanoseconds::max(); | |
| 380 | this_thread::sleep_for(__ns); | |
| 382 | 381 | } |
| 383 | 382 | } |
| 384 | 383 | |
| ... | ... | @@ -386,7 +385,6 @@ template <class _Clock, class _Duration> |
| 386 | 385 | void |
| 387 | 386 | sleep_until(const chrono::time_point<_Clock, _Duration>& __t) |
| 388 | 387 | { |
| 389 | using namespace chrono; | |
| 390 | 388 | mutex __mut; |
| 391 | 389 | condition_variable __cv; |
| 392 | 390 | unique_lock<mutex> __lk(__mut); |
| ... | ... | @@ -399,8 +397,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 399 | 397 | void |
| 400 | 398 | sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t) |
| 401 | 399 | { |
| 402 | using namespace chrono; | |
| 403 | sleep_for(__t - steady_clock::now()); | |
| 400 | this_thread::sleep_for(__t - chrono::steady_clock::now()); | |
| 404 | 401 | } |
| 405 | 402 | |
| 406 | 403 | inline _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/tuple+1-1| ... | ... | @@ -1393,7 +1393,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> |
| 1393 | 1393 | |
| 1394 | 1394 | template <class _T1, class _T2> |
| 1395 | 1395 | template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2> |
| 1396 | inline _LIBCPP_INLINE_VISIBILITY | |
| 1396 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 1397 | 1397 | pair<_T1, _T2>::pair(piecewise_construct_t, |
| 1398 | 1398 | tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, |
| 1399 | 1399 | __tuple_indices<_I1...>, __tuple_indices<_I2...>) |
lib/libcxx/include/type_traits+93-238| ... | ... | @@ -514,7 +514,7 @@ template <template <class...> class, class ...> |
| 514 | 514 | false_type __sfinae_test_impl(...); |
| 515 | 515 | |
| 516 | 516 | template <template <class ...> class _Templ, class ..._Args> |
| 517 | using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0)); | |
| 517 | using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(__sfinae_test_impl<_Templ, _Args...>(0)); | |
| 518 | 518 | |
| 519 | 519 | template <class> |
| 520 | 520 | struct __void_t { typedef void type; }; |
| ... | ... | @@ -595,75 +595,6 @@ using __is_primary_template = _IsValidExpansion< |
| 595 | 595 | __test_for_primary_template, _Tp |
| 596 | 596 | >; |
| 597 | 597 | |
| 598 | // addressof | |
| 599 | #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF | |
| 600 | ||
| 601 | template <class _Tp> | |
| 602 | inline _LIBCPP_CONSTEXPR_AFTER_CXX14 | |
| 603 | _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY | |
| 604 | _Tp* | |
| 605 | addressof(_Tp& __x) _NOEXCEPT | |
| 606 | { | |
| 607 | return __builtin_addressof(__x); | |
| 608 | } | |
| 609 | ||
| 610 | #else | |
| 611 | ||
| 612 | template <class _Tp> | |
| 613 | inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY | |
| 614 | _Tp* | |
| 615 | addressof(_Tp& __x) _NOEXCEPT | |
| 616 | { | |
| 617 | return reinterpret_cast<_Tp *>( | |
| 618 | const_cast<char *>(&reinterpret_cast<const volatile char &>(__x))); | |
| 619 | } | |
| 620 | ||
| 621 | #endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF | |
| 622 | ||
| 623 | #if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF) | |
| 624 | // Objective-C++ Automatic Reference Counting uses qualified pointers | |
| 625 | // that require special addressof() signatures. When | |
| 626 | // _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler | |
| 627 | // itself is providing these definitions. Otherwise, we provide them. | |
| 628 | template <class _Tp> | |
| 629 | inline _LIBCPP_INLINE_VISIBILITY | |
| 630 | __strong _Tp* | |
| 631 | addressof(__strong _Tp& __x) _NOEXCEPT | |
| 632 | { | |
| 633 | return &__x; | |
| 634 | } | |
| 635 | ||
| 636 | #ifdef _LIBCPP_HAS_OBJC_ARC_WEAK | |
| 637 | template <class _Tp> | |
| 638 | inline _LIBCPP_INLINE_VISIBILITY | |
| 639 | __weak _Tp* | |
| 640 | addressof(__weak _Tp& __x) _NOEXCEPT | |
| 641 | { | |
| 642 | return &__x; | |
| 643 | } | |
| 644 | #endif | |
| 645 | ||
| 646 | template <class _Tp> | |
| 647 | inline _LIBCPP_INLINE_VISIBILITY | |
| 648 | __autoreleasing _Tp* | |
| 649 | addressof(__autoreleasing _Tp& __x) _NOEXCEPT | |
| 650 | { | |
| 651 | return &__x; | |
| 652 | } | |
| 653 | ||
| 654 | template <class _Tp> | |
| 655 | inline _LIBCPP_INLINE_VISIBILITY | |
| 656 | __unsafe_unretained _Tp* | |
| 657 | addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT | |
| 658 | { | |
| 659 | return &__x; | |
| 660 | } | |
| 661 | #endif | |
| 662 | ||
| 663 | #if !defined(_LIBCPP_CXX03_LANG) | |
| 664 | template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete; | |
| 665 | #endif | |
| 666 | ||
| 667 | 598 | struct __two {char __lx[2];}; |
| 668 | 599 | |
| 669 | 600 | // helper class: |
| ... | ... | @@ -1821,7 +1752,7 @@ template <typename _Tp> |
| 1821 | 1752 | static void __test_noexcept(_Tp) noexcept; |
| 1822 | 1753 | |
| 1823 | 1754 | template<typename _Fm, typename _To> |
| 1824 | static bool_constant<noexcept(__test_noexcept<_To>(declval<_Fm>()))> | |
| 1755 | static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(declval<_Fm>()))> | |
| 1825 | 1756 | __is_nothrow_convertible_test(); |
| 1826 | 1757 | |
| 1827 | 1758 | template <typename _Fm, typename _To> |
| ... | ... | @@ -2550,7 +2481,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v = __is_destructible( |
| 2550 | 2481 | // if it's a function, return false |
| 2551 | 2482 | // if it's void, return false |
| 2552 | 2483 | // if it's an array of unknown bound, return false |
| 2553 | // Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed | |
| 2484 | // Otherwise, return "declval<_Up&>().~_Up()" is well-formed | |
| 2554 | 2485 | // where _Up is remove_all_extents<_Tp>::type |
| 2555 | 2486 | |
| 2556 | 2487 | template <class> |
| ... | ... | @@ -2876,167 +2807,13 @@ struct __member_pointer_class_type<_Ret _ClassType::*> { |
| 2876 | 2807 | typedef _ClassType type; |
| 2877 | 2808 | }; |
| 2878 | 2809 | |
| 2879 | // result_of | |
| 2880 | ||
| 2881 | template <class _Callable> class result_of; | |
| 2882 | ||
| 2883 | #ifdef _LIBCPP_HAS_NO_VARIADICS | |
| 2884 | ||
| 2885 | template <class _Fn, bool, bool> | |
| 2886 | class __result_of | |
| 2887 | { | |
| 2888 | }; | |
| 2889 | ||
| 2890 | template <class _Fn> | |
| 2891 | class __result_of<_Fn(), true, false> | |
| 2892 | { | |
| 2893 | public: | |
| 2894 | typedef decltype(declval<_Fn>()()) type; | |
| 2895 | }; | |
| 2896 | ||
| 2897 | template <class _Fn, class _A0> | |
| 2898 | class __result_of<_Fn(_A0), true, false> | |
| 2899 | { | |
| 2900 | public: | |
| 2901 | typedef decltype(declval<_Fn>()(declval<_A0>())) type; | |
| 2902 | }; | |
| 2903 | ||
| 2904 | template <class _Fn, class _A0, class _A1> | |
| 2905 | class __result_of<_Fn(_A0, _A1), true, false> | |
| 2906 | { | |
| 2907 | public: | |
| 2908 | typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; | |
| 2909 | }; | |
| 2910 | ||
| 2911 | template <class _Fn, class _A0, class _A1, class _A2> | |
| 2912 | class __result_of<_Fn(_A0, _A1, _A2), true, false> | |
| 2913 | { | |
| 2914 | public: | |
| 2915 | typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; | |
| 2916 | }; | |
| 2917 | ||
| 2918 | template <class _MP, class _Tp, bool _IsMemberFunctionPtr> | |
| 2919 | struct __result_of_mp; | |
| 2920 | ||
| 2921 | // member function pointer | |
| 2922 | ||
| 2923 | template <class _MP, class _Tp> | |
| 2924 | struct __result_of_mp<_MP, _Tp, true> | |
| 2925 | : public __identity<typename __member_pointer_traits<_MP>::_ReturnType> | |
| 2926 | { | |
| 2927 | }; | |
| 2928 | ||
| 2929 | // member data pointer | |
| 2930 | ||
| 2931 | template <class _MP, class _Tp, bool> | |
| 2932 | struct __result_of_mdp; | |
| 2933 | ||
| 2934 | template <class _Rp, class _Class, class _Tp> | |
| 2935 | struct __result_of_mdp<_Rp _Class::*, _Tp, false> | |
| 2936 | { | |
| 2937 | typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; | |
| 2938 | }; | |
| 2939 | ||
| 2940 | template <class _Rp, class _Class, class _Tp> | |
| 2941 | struct __result_of_mdp<_Rp _Class::*, _Tp, true> | |
| 2942 | { | |
| 2943 | typedef typename __apply_cv<_Tp, _Rp>::type& type; | |
| 2944 | }; | |
| 2945 | ||
| 2946 | template <class _Rp, class _Class, class _Tp> | |
| 2947 | struct __result_of_mp<_Rp _Class::*, _Tp, false> | |
| 2948 | : public __result_of_mdp<_Rp _Class::*, _Tp, | |
| 2949 | is_base_of<_Class, typename remove_reference<_Tp>::type>::value> | |
| 2950 | { | |
| 2951 | }; | |
| 2952 | ||
| 2953 | ||
| 2954 | ||
| 2955 | template <class _Fn, class _Tp> | |
| 2956 | class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer | |
| 2957 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 2958 | _Tp, | |
| 2959 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 2960 | { | |
| 2961 | }; | |
| 2962 | ||
| 2963 | template <class _Fn, class _Tp, class _A0> | |
| 2964 | class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer | |
| 2965 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 2966 | _Tp, | |
| 2967 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 2968 | { | |
| 2969 | }; | |
| 2970 | ||
| 2971 | template <class _Fn, class _Tp, class _A0, class _A1> | |
| 2972 | class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer | |
| 2973 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 2974 | _Tp, | |
| 2975 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 2976 | { | |
| 2977 | }; | |
| 2978 | ||
| 2979 | template <class _Fn, class _Tp, class _A0, class _A1, class _A2> | |
| 2980 | class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer | |
| 2981 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 2982 | _Tp, | |
| 2983 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 2984 | { | |
| 2985 | }; | |
| 2986 | ||
| 2987 | // result_of | |
| 2988 | ||
| 2989 | template <class _Fn> | |
| 2990 | class _LIBCPP_TEMPLATE_VIS result_of<_Fn()> | |
| 2991 | : public __result_of<_Fn(), | |
| 2992 | is_class<typename remove_reference<_Fn>::type>::value || | |
| 2993 | is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, | |
| 2994 | is_member_pointer<typename remove_reference<_Fn>::type>::value | |
| 2995 | > | |
| 2996 | { | |
| 2997 | }; | |
| 2998 | ||
| 2999 | template <class _Fn, class _A0> | |
| 3000 | class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0)> | |
| 3001 | : public __result_of<_Fn(_A0), | |
| 3002 | is_class<typename remove_reference<_Fn>::type>::value || | |
| 3003 | is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, | |
| 3004 | is_member_pointer<typename remove_reference<_Fn>::type>::value | |
| 3005 | > | |
| 3006 | { | |
| 3007 | }; | |
| 3008 | ||
| 3009 | template <class _Fn, class _A0, class _A1> | |
| 3010 | class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1)> | |
| 3011 | : public __result_of<_Fn(_A0, _A1), | |
| 3012 | is_class<typename remove_reference<_Fn>::type>::value || | |
| 3013 | is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, | |
| 3014 | is_member_pointer<typename remove_reference<_Fn>::type>::value | |
| 3015 | > | |
| 3016 | { | |
| 3017 | }; | |
| 3018 | ||
| 3019 | template <class _Fn, class _A0, class _A1, class _A2> | |
| 3020 | class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1, _A2)> | |
| 3021 | : public __result_of<_Fn(_A0, _A1, _A2), | |
| 3022 | is_class<typename remove_reference<_Fn>::type>::value || | |
| 3023 | is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, | |
| 3024 | is_member_pointer<typename remove_reference<_Fn>::type>::value | |
| 3025 | > | |
| 3026 | { | |
| 3027 | }; | |
| 3028 | ||
| 3029 | #endif // _LIBCPP_HAS_NO_VARIADICS | |
| 3030 | ||
| 3031 | 2810 | // template <class T, class... Args> struct is_constructible; |
| 3032 | 2811 | |
| 3033 | namespace __is_construct | |
| 3034 | { | |
| 3035 | struct __nat {}; | |
| 3036 | } | |
| 2812 | #if defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW >= 10000 | |
| 2813 | # define _LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE | |
| 2814 | #endif | |
| 3037 | 2815 | |
| 3038 | #if !defined(_LIBCPP_CXX03_LANG) && (!__has_feature(is_constructible) || \ | |
| 3039 | defined(_LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE)) | |
| 2816 | #if !defined(_LIBCPP_CXX03_LANG) && !__has_feature(is_constructible) && !defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE) | |
| 3040 | 2817 | |
| 3041 | 2818 | template <class _Tp, class... _Args> |
| 3042 | 2819 | struct __libcpp_is_constructible; |
| ... | ... | @@ -3151,7 +2928,7 @@ struct __libcpp_is_constructible<_Tp&&, _A0> |
| 3151 | 2928 | |
| 3152 | 2929 | #endif |
| 3153 | 2930 | |
| 3154 | #if __has_feature(is_constructible) | |
| 2931 | #if __has_feature(is_constructible) || defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE) | |
| 3155 | 2932 | template <class _Tp, class ..._Args> |
| 3156 | 2933 | struct _LIBCPP_TEMPLATE_VIS is_constructible |
| 3157 | 2934 | : public integral_constant<bool, __is_constructible(_Tp, _Args...)> |
| ... | ... | @@ -3442,7 +3219,7 @@ void __implicit_conversion_to(_Tp) noexcept { } |
| 3442 | 3219 | |
| 3443 | 3220 | template <class _Tp, class _Arg> |
| 3444 | 3221 | struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> |
| 3445 | : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))> | |
| 3222 | : public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(declval<_Arg>()))> | |
| 3446 | 3223 | { |
| 3447 | 3224 | }; |
| 3448 | 3225 | |
| ... | ... | @@ -3982,14 +3759,97 @@ struct __invoke_of |
| 3982 | 3759 | { |
| 3983 | 3760 | }; |
| 3984 | 3761 | |
| 3762 | #endif // _LIBCPP_CXX03_LANG | |
| 3763 | ||
| 3985 | 3764 | // result_of |
| 3986 | 3765 | |
| 3766 | template <class _Callable> class result_of; | |
| 3767 | ||
| 3768 | #ifndef _LIBCPP_CXX03_LANG | |
| 3769 | ||
| 3987 | 3770 | template <class _Fp, class ..._Args> |
| 3988 | 3771 | class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> |
| 3989 | 3772 | : public __invoke_of<_Fp, _Args...> |
| 3990 | 3773 | { |
| 3991 | 3774 | }; |
| 3992 | 3775 | |
| 3776 | #else // C++03 | |
| 3777 | ||
| 3778 | template <class _Fn, bool, bool> | |
| 3779 | class __result_of | |
| 3780 | { | |
| 3781 | }; | |
| 3782 | ||
| 3783 | template <class _Fn, class ..._Args> | |
| 3784 | class __result_of<_Fn(_Args...), true, false> | |
| 3785 | { | |
| 3786 | public: | |
| 3787 | typedef decltype(declval<_Fn>()(declval<_Args>()...)) type; | |
| 3788 | }; | |
| 3789 | ||
| 3790 | template <class _MP, class _Tp, bool _IsMemberFunctionPtr> | |
| 3791 | struct __result_of_mp; | |
| 3792 | ||
| 3793 | // member function pointer | |
| 3794 | ||
| 3795 | template <class _MP, class _Tp> | |
| 3796 | struct __result_of_mp<_MP, _Tp, true> | |
| 3797 | : public __identity<typename __member_pointer_traits<_MP>::_ReturnType> | |
| 3798 | { | |
| 3799 | }; | |
| 3800 | ||
| 3801 | // member data pointer | |
| 3802 | ||
| 3803 | template <class _MP, class _Tp, bool> | |
| 3804 | struct __result_of_mdp; | |
| 3805 | ||
| 3806 | template <class _Rp, class _Class, class _Tp> | |
| 3807 | struct __result_of_mdp<_Rp _Class::*, _Tp, false> | |
| 3808 | { | |
| 3809 | typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; | |
| 3810 | }; | |
| 3811 | ||
| 3812 | template <class _Rp, class _Class, class _Tp> | |
| 3813 | struct __result_of_mdp<_Rp _Class::*, _Tp, true> | |
| 3814 | { | |
| 3815 | typedef typename __apply_cv<_Tp, _Rp>::type& type; | |
| 3816 | }; | |
| 3817 | ||
| 3818 | template <class _Rp, class _Class, class _Tp> | |
| 3819 | struct __result_of_mp<_Rp _Class::*, _Tp, false> | |
| 3820 | : public __result_of_mdp<_Rp _Class::*, _Tp, | |
| 3821 | is_base_of<_Class, typename remove_reference<_Tp>::type>::value> | |
| 3822 | { | |
| 3823 | }; | |
| 3824 | ||
| 3825 | template <class _Fn, class _Tp> | |
| 3826 | class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer | |
| 3827 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 3828 | _Tp, | |
| 3829 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 3830 | { | |
| 3831 | }; | |
| 3832 | ||
| 3833 | template <class _Fn, class _Tp, class ..._Args> | |
| 3834 | class __result_of<_Fn(_Tp, _Args...), false, true> // _Fn must be member pointer | |
| 3835 | : public __result_of_mp<typename remove_reference<_Fn>::type, | |
| 3836 | _Tp, | |
| 3837 | is_member_function_pointer<typename remove_reference<_Fn>::type>::value> | |
| 3838 | { | |
| 3839 | }; | |
| 3840 | ||
| 3841 | template <class _Fn, class ..._Args> | |
| 3842 | class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_Args...)> | |
| 3843 | : public __result_of<_Fn(_Args...), | |
| 3844 | is_class<typename remove_reference<_Fn>::type>::value || | |
| 3845 | is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value, | |
| 3846 | is_member_pointer<typename remove_reference<_Fn>::type>::value | |
| 3847 | > | |
| 3848 | { | |
| 3849 | }; | |
| 3850 | ||
| 3851 | #endif // C++03 | |
| 3852 | ||
| 3993 | 3853 | #if _LIBCPP_STD_VER > 11 |
| 3994 | 3854 | template <class _Tp> using result_of_t = typename result_of<_Tp>::type; |
| 3995 | 3855 | #endif |
| ... | ... | @@ -4045,8 +3905,6 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v |
| 4045 | 3905 | |
| 4046 | 3906 | #endif // _LIBCPP_STD_VER > 14 |
| 4047 | 3907 | |
| 4048 | #endif // !defined(_LIBCPP_CXX03_LANG) | |
| 4049 | ||
| 4050 | 3908 | template <class _Tp> struct __is_swappable; |
| 4051 | 3909 | template <class _Tp> struct __is_nothrow_swappable; |
| 4052 | 3910 | |
| ... | ... | @@ -4341,7 +4199,6 @@ _LIBCPP_INLINE_VAR constexpr bool negation_v |
| 4341 | 4199 | #endif // _LIBCPP_STD_VER > 14 |
| 4342 | 4200 | |
| 4343 | 4201 | // These traits are used in __tree and __hash_table |
| 4344 | #ifndef _LIBCPP_CXX03_LANG | |
| 4345 | 4202 | struct __extract_key_fail_tag {}; |
| 4346 | 4203 | struct __extract_key_self_tag {}; |
| 4347 | 4204 | struct __extract_key_first_tag {}; |
| ... | ... | @@ -4353,7 +4210,7 @@ struct __can_extract_key |
| 4353 | 4210 | __extract_key_fail_tag>::type {}; |
| 4354 | 4211 | |
| 4355 | 4212 | template <class _Pair, class _Key, class _First, class _Second> |
| 4356 | struct __can_extract_key<_Pair, _Key, pair<_First, _Second>> | |
| 4213 | struct __can_extract_key<_Pair, _Key, pair<_First, _Second> > | |
| 4357 | 4214 | : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value, |
| 4358 | 4215 | __extract_key_first_tag, __extract_key_fail_tag>::type {}; |
| 4359 | 4216 | |
| ... | ... | @@ -4371,8 +4228,6 @@ template <class _ValTy, class _Key, class _RawValTy> |
| 4371 | 4228 | struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> |
| 4372 | 4229 | : false_type {}; |
| 4373 | 4230 | |
| 4374 | #endif | |
| 4375 | ||
| 4376 | 4231 | #ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED |
| 4377 | 4232 | #if _LIBCPP_STD_VER > 17 |
| 4378 | 4233 | _LIBCPP_INLINE_VISIBILITY |
lib/libcxx/include/typeinfo+24-5| ... | ... | @@ -57,6 +57,7 @@ public: |
| 57 | 57 | */ |
| 58 | 58 | |
| 59 | 59 | #include <__config> |
| 60 | #include <__availability> | |
| 60 | 61 | #include <exception> |
| 61 | 62 | #include <cstddef> |
| 62 | 63 | #include <cstdint> |
| ... | ... | @@ -141,7 +142,7 @@ public: |
| 141 | 142 | // comparison is equal. |
| 142 | 143 | // -------------------------------------------------------------------------- // |
| 143 | 144 | // NonUniqueARMRTTIBit |
| 144 | // (selected on ARM64 regardless of _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION) | |
| 145 | // (_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 3) | |
| 145 | 146 | // -------------------------------------------------------------------------- // |
| 146 | 147 | // This implementation of type_info does not assume always a unique copy of |
| 147 | 148 | // the RTTI for a given type inside a program. It packs the pointer to the |
| ... | ... | @@ -160,6 +161,24 @@ public: |
| 160 | 161 | // the pointer when it constructs the type_info, depending on whether it can |
| 161 | 162 | // guarantee uniqueness for that specific type_info. |
| 162 | 163 | |
| 164 | // This value can be overriden in the __config_site. When it's not overriden, | |
| 165 | // we pick a default implementation based on the platform here. | |
| 166 | #ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION | |
| 167 | ||
| 168 | // Windows binaries can't merge typeinfos, so use the NonUnique implementation. | |
| 169 | # ifdef _LIBCPP_OBJECT_FORMAT_COFF | |
| 170 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2 | |
| 171 | ||
| 172 | // On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation. | |
| 173 | # elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) | |
| 174 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3 | |
| 175 | ||
| 176 | // On all other platforms, assume the Itanium C++ ABI and use the Unique implementation. | |
| 177 | # else | |
| 178 | # define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1 | |
| 179 | # endif | |
| 180 | #endif | |
| 181 | ||
| 163 | 182 | struct __type_info_implementations { |
| 164 | 183 | struct __string_impl_base { |
| 165 | 184 | typedef const char* __type_name_t; |
| ... | ... | @@ -243,7 +262,7 @@ struct __type_info_implementations { |
| 243 | 262 | private: |
| 244 | 263 | // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when |
| 245 | 264 | // this implementation is actually used. |
| 246 | typedef std::integral_constant<__type_name_t, | |
| 265 | typedef integral_constant<__type_name_t, | |
| 247 | 266 | (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit; |
| 248 | 267 | |
| 249 | 268 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -257,12 +276,12 @@ struct __type_info_implementations { |
| 257 | 276 | }; |
| 258 | 277 | |
| 259 | 278 | typedef |
| 260 | #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) | |
| 261 | __non_unique_arm_rtti_bit_impl | |
| 262 | #elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1 | |
| 279 | #if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1 | |
| 263 | 280 | __unique_impl |
| 264 | 281 | #elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2 |
| 265 | 282 | __non_unique_impl |
| 283 | #elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3 | |
| 284 | __non_unique_arm_rtti_bit_impl | |
| 266 | 285 | #else |
| 267 | 286 | # error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION |
| 268 | 287 | #endif |
lib/libcxx/include/unordered_map+203-67| ... | ... | @@ -173,10 +173,22 @@ public: |
| 173 | 173 | |
| 174 | 174 | iterator find(const key_type& k); |
| 175 | 175 | const_iterator find(const key_type& k) const; |
| 176 | template<typename K> | |
| 177 | iterator find(const K& x); // C++20 | |
| 178 | template<typename K> | |
| 179 | const_iterator find(const K& x) const; // C++20 | |
| 176 | 180 | size_type count(const key_type& k) const; |
| 181 | template<typename K> | |
| 182 | size_type count(const K& k) const; // C++20 | |
| 177 | 183 | bool contains(const key_type& k) const; // C++20 |
| 184 | template<typename K> | |
| 185 | bool contains(const K& k) const; // C++20 | |
| 178 | 186 | pair<iterator, iterator> equal_range(const key_type& k); |
| 179 | 187 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 188 | template<typename K> | |
| 189 | pair<iterator, iterator> equal_range(const K& k); // C++20 | |
| 190 | template<typename K> | |
| 191 | pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 | |
| 180 | 192 | |
| 181 | 193 | mapped_type& operator[](const key_type& k); |
| 182 | 194 | mapped_type& operator[](key_type&& k); |
| ... | ... | @@ -355,10 +367,22 @@ public: |
| 355 | 367 | |
| 356 | 368 | iterator find(const key_type& k); |
| 357 | 369 | const_iterator find(const key_type& k) const; |
| 370 | template<typename K> | |
| 371 | iterator find(const K& x); // C++20 | |
| 372 | template<typename K> | |
| 373 | const_iterator find(const K& x) const; // C++20 | |
| 358 | 374 | size_type count(const key_type& k) const; |
| 375 | template<typename K> | |
| 376 | size_type count(const K& k) const; // C++20 | |
| 359 | 377 | bool contains(const key_type& k) const; // C++20 |
| 378 | template<typename K> | |
| 379 | bool contains(const K& k) const; // C++20 | |
| 360 | 380 | pair<iterator, iterator> equal_range(const key_type& k); |
| 361 | 381 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 382 | template<typename K> | |
| 383 | pair<iterator, iterator> equal_range(const K& k); // C++20 | |
| 384 | template<typename K> | |
| 385 | pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 | |
| 362 | 386 | |
| 363 | 387 | size_type bucket_count() const noexcept; |
| 364 | 388 | size_type max_bucket_count() const noexcept; |
| ... | ... | @@ -423,7 +447,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> |
| 423 | 447 | |
| 424 | 448 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 425 | 449 | |
| 426 | template <class _Key, class _Cp, class _Hash, | |
| 450 | template <class _Key, class _Cp, class _Hash, class _Pred, | |
| 427 | 451 | bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value> |
| 428 | 452 | class __unordered_map_hasher |
| 429 | 453 | : private _Hash |
| ... | ... | @@ -445,6 +469,12 @@ public: |
| 445 | 469 | _LIBCPP_INLINE_VISIBILITY |
| 446 | 470 | size_t operator()(const _Key& __x) const |
| 447 | 471 | {return static_cast<const _Hash&>(*this)(__x);} |
| 472 | #if _LIBCPP_STD_VER > 17 | |
| 473 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 474 | _LIBCPP_INLINE_VISIBILITY | |
| 475 | size_t operator()(const _K2& __x) const | |
| 476 | {return static_cast<const _Hash&>(*this)(__x);} | |
| 477 | #endif | |
| 448 | 478 | void swap(__unordered_map_hasher&__y) |
| 449 | 479 | _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) |
| 450 | 480 | { |
| ... | ... | @@ -453,8 +483,8 @@ public: |
| 453 | 483 | } |
| 454 | 484 | }; |
| 455 | 485 | |
| 456 | template <class _Key, class _Cp, class _Hash> | |
| 457 | class __unordered_map_hasher<_Key, _Cp, _Hash, false> | |
| 486 | template <class _Key, class _Cp, class _Hash, class _Pred> | |
| 487 | class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> | |
| 458 | 488 | { |
| 459 | 489 | _Hash __hash_; |
| 460 | 490 | public: |
| ... | ... | @@ -474,6 +504,12 @@ public: |
| 474 | 504 | _LIBCPP_INLINE_VISIBILITY |
| 475 | 505 | size_t operator()(const _Key& __x) const |
| 476 | 506 | {return __hash_(__x);} |
| 507 | #if _LIBCPP_STD_VER > 17 | |
| 508 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 509 | _LIBCPP_INLINE_VISIBILITY | |
| 510 | size_t operator()(const _K2& __x) const | |
| 511 | {return __hash_(__x);} | |
| 512 | #endif | |
| 477 | 513 | void swap(__unordered_map_hasher&__y) |
| 478 | 514 | _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) |
| 479 | 515 | { |
| ... | ... | @@ -482,17 +518,17 @@ public: |
| 482 | 518 | } |
| 483 | 519 | }; |
| 484 | 520 | |
| 485 | template <class _Key, class _Cp, class _Hash, bool __b> | |
| 521 | template <class _Key, class _Cp, class _Hash, class _Pred, bool __b> | |
| 486 | 522 | inline _LIBCPP_INLINE_VISIBILITY |
| 487 | 523 | void |
| 488 | swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x, | |
| 489 | __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y) | |
| 524 | swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x, | |
| 525 | __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) | |
| 490 | 526 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| 491 | 527 | { |
| 492 | 528 | __x.swap(__y); |
| 493 | 529 | } |
| 494 | 530 | |
| 495 | template <class _Key, class _Cp, class _Pred, | |
| 531 | template <class _Key, class _Cp, class _Pred, class _Hash, | |
| 496 | 532 | bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value> |
| 497 | 533 | class __unordered_map_equal |
| 498 | 534 | : private _Pred |
| ... | ... | @@ -517,6 +553,24 @@ public: |
| 517 | 553 | _LIBCPP_INLINE_VISIBILITY |
| 518 | 554 | bool operator()(const _Key& __x, const _Cp& __y) const |
| 519 | 555 | {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} |
| 556 | #if _LIBCPP_STD_VER > 17 | |
| 557 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 558 | _LIBCPP_INLINE_VISIBILITY | |
| 559 | bool operator()(const _Cp& __x, const _K2& __y) const | |
| 560 | {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} | |
| 561 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 562 | _LIBCPP_INLINE_VISIBILITY | |
| 563 | bool operator()(const _K2& __x, const _Cp& __y) const | |
| 564 | {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} | |
| 565 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 566 | _LIBCPP_INLINE_VISIBILITY | |
| 567 | bool operator()(const _Key& __x, const _K2& __y) const | |
| 568 | {return static_cast<const _Pred&>(*this)(__x, __y);} | |
| 569 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 570 | _LIBCPP_INLINE_VISIBILITY | |
| 571 | bool operator()(const _K2& __x, const _Key& __y) const | |
| 572 | {return static_cast<const _Pred&>(*this)(__x, __y);} | |
| 573 | #endif | |
| 520 | 574 | void swap(__unordered_map_equal&__y) |
| 521 | 575 | _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) |
| 522 | 576 | { |
| ... | ... | @@ -525,8 +579,8 @@ public: |
| 525 | 579 | } |
| 526 | 580 | }; |
| 527 | 581 | |
| 528 | template <class _Key, class _Cp, class _Pred> | |
| 529 | class __unordered_map_equal<_Key, _Cp, _Pred, false> | |
| 582 | template <class _Key, class _Cp, class _Pred, class _Hash> | |
| 583 | class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> | |
| 530 | 584 | { |
| 531 | 585 | _Pred __pred_; |
| 532 | 586 | public: |
| ... | ... | @@ -549,6 +603,24 @@ public: |
| 549 | 603 | _LIBCPP_INLINE_VISIBILITY |
| 550 | 604 | bool operator()(const _Key& __x, const _Cp& __y) const |
| 551 | 605 | {return __pred_(__x, __y.__get_value().first);} |
| 606 | #if _LIBCPP_STD_VER > 17 | |
| 607 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 608 | _LIBCPP_INLINE_VISIBILITY | |
| 609 | bool operator()(const _Cp& __x, const _K2& __y) const | |
| 610 | {return __pred_(__x.__get_value().first, __y);} | |
| 611 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 612 | _LIBCPP_INLINE_VISIBILITY | |
| 613 | bool operator()(const _K2& __x, const _Cp& __y) const | |
| 614 | {return __pred_(__x, __y.__get_value().first);} | |
| 615 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 616 | _LIBCPP_INLINE_VISIBILITY | |
| 617 | bool operator()(const _Key& __x, const _K2& __y) const | |
| 618 | {return __pred_(__x, __y);} | |
| 619 | template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> | |
| 620 | _LIBCPP_INLINE_VISIBILITY | |
| 621 | bool operator()(const _K2& __x, const _Key& __y) const | |
| 622 | {return __pred_(__x, __y);} | |
| 623 | #endif | |
| 552 | 624 | void swap(__unordered_map_equal&__y) |
| 553 | 625 | _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) |
| 554 | 626 | { |
| ... | ... | @@ -557,11 +629,11 @@ public: |
| 557 | 629 | } |
| 558 | 630 | }; |
| 559 | 631 | |
| 560 | template <class _Key, class _Cp, class _Pred, bool __b> | |
| 632 | template <class _Key, class _Cp, class _Pred, class _Hash, bool __b> | |
| 561 | 633 | inline _LIBCPP_INLINE_VISIBILITY |
| 562 | 634 | void |
| 563 | swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x, | |
| 564 | __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y) | |
| 635 | swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, | |
| 636 | __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y) | |
| 565 | 637 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
| 566 | 638 | { |
| 567 | 639 | __x.swap(__y); |
| ... | ... | @@ -858,11 +930,11 @@ public: |
| 858 | 930 | "Invalid allocator::value_type"); |
| 859 | 931 | |
| 860 | 932 | private: |
| 861 | typedef __hash_value_type<key_type, mapped_type> __value_type; | |
| 862 | typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; | |
| 863 | typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; | |
| 933 | typedef __hash_value_type<key_type, mapped_type> __value_type; | |
| 934 | typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; | |
| 935 | typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; | |
| 864 | 936 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, |
| 865 | __value_type>::type __allocator_type; | |
| 937 | __value_type>::type __allocator_type; | |
| 866 | 938 | |
| 867 | 939 | typedef __hash_table<__value_type, __hasher, |
| 868 | 940 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -906,7 +978,7 @@ public: |
| 906 | 978 | unordered_map() |
| 907 | 979 | _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) |
| 908 | 980 | { |
| 909 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 981 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 910 | 982 | __get_db()->__insert_c(this); |
| 911 | 983 | #endif |
| 912 | 984 | } |
| ... | ... | @@ -1025,7 +1097,7 @@ public: |
| 1025 | 1097 | {return __table_.__insert_unique(__x);} |
| 1026 | 1098 | |
| 1027 | 1099 | iterator insert(const_iterator __p, const value_type& __x) { |
| 1028 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1100 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1029 | 1101 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1030 | 1102 | "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" |
| 1031 | 1103 | " referring to this unordered_map"); |
| ... | ... | @@ -1049,7 +1121,7 @@ public: |
| 1049 | 1121 | {return __table_.__insert_unique(_VSTD::move(__x));} |
| 1050 | 1122 | |
| 1051 | 1123 | iterator insert(const_iterator __p, value_type&& __x) { |
| 1052 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1124 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1053 | 1125 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1054 | 1126 | "unordered_map::insert(const_iterator, const value_type&) called with an iterator not" |
| 1055 | 1127 | " referring to this unordered_map"); |
| ... | ... | @@ -1070,7 +1142,7 @@ public: |
| 1070 | 1142 | _LIBCPP_INLINE_VISIBILITY |
| 1071 | 1143 | iterator insert(const_iterator __p, _Pp&& __x) |
| 1072 | 1144 | { |
| 1073 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1145 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1074 | 1146 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1075 | 1147 | "unordered_map::insert(const_iterator, value_type&&) called with an iterator not" |
| 1076 | 1148 | " referring to this unordered_map"); |
| ... | ... | @@ -1089,7 +1161,7 @@ public: |
| 1089 | 1161 | template <class... _Args> |
| 1090 | 1162 | _LIBCPP_INLINE_VISIBILITY |
| 1091 | 1163 | iterator emplace_hint(const_iterator __p, _Args&&... __args) { |
| 1092 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1164 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1093 | 1165 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| 1094 | 1166 | "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not" |
| 1095 | 1167 | " referring to this unordered_map"); |
| ... | ... | @@ -1106,7 +1178,7 @@ public: |
| 1106 | 1178 | _LIBCPP_INLINE_VISIBILITY |
| 1107 | 1179 | pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) |
| 1108 | 1180 | { |
| 1109 | return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct, | |
| 1181 | return __table_.__emplace_unique_key_args(__k, piecewise_construct, | |
| 1110 | 1182 | _VSTD::forward_as_tuple(__k), |
| 1111 | 1183 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); |
| 1112 | 1184 | } |
| ... | ... | @@ -1115,7 +1187,7 @@ public: |
| 1115 | 1187 | _LIBCPP_INLINE_VISIBILITY |
| 1116 | 1188 | pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) |
| 1117 | 1189 | { |
| 1118 | return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct, | |
| 1190 | return __table_.__emplace_unique_key_args(__k, piecewise_construct, | |
| 1119 | 1191 | _VSTD::forward_as_tuple(_VSTD::move(__k)), |
| 1120 | 1192 | _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); |
| 1121 | 1193 | } |
| ... | ... | @@ -1124,7 +1196,7 @@ public: |
| 1124 | 1196 | _LIBCPP_INLINE_VISIBILITY |
| 1125 | 1197 | iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) |
| 1126 | 1198 | { |
| 1127 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1199 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1128 | 1200 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, |
| 1129 | 1201 | "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" |
| 1130 | 1202 | " referring to this unordered_map"); |
| ... | ... | @@ -1138,7 +1210,7 @@ public: |
| 1138 | 1210 | _LIBCPP_INLINE_VISIBILITY |
| 1139 | 1211 | iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) |
| 1140 | 1212 | { |
| 1141 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1213 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1142 | 1214 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this, |
| 1143 | 1215 | "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not" |
| 1144 | 1216 | " referring to this unordered_map"); |
| ... | ... | @@ -1280,11 +1352,34 @@ public: |
| 1280 | 1352 | iterator find(const key_type& __k) {return __table_.find(__k);} |
| 1281 | 1353 | _LIBCPP_INLINE_VISIBILITY |
| 1282 | 1354 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
| 1355 | ||
| 1356 | #if _LIBCPP_STD_VER > 17 | |
| 1357 | template <typename _K2> | |
| 1358 | _LIBCPP_INLINE_VISIBILITY | |
| 1359 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> | |
| 1360 | find(const _K2& __k) {return __table_.find(__k);} | |
| 1361 | template <typename _K2> | |
| 1362 | _LIBCPP_INLINE_VISIBILITY | |
| 1363 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> | |
| 1364 | find(const _K2& __k) const {return __table_.find(__k);} | |
| 1365 | #endif // _LIBCPP_STD_VER > 17 | |
| 1366 | ||
| 1283 | 1367 | _LIBCPP_INLINE_VISIBILITY |
| 1284 | 1368 | size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} |
| 1369 | #if _LIBCPP_STD_VER > 17 | |
| 1370 | template <typename _K2> | |
| 1371 | _LIBCPP_INLINE_VISIBILITY | |
| 1372 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> | |
| 1373 | count(const _K2& __k) const {return __table_.__count_unique(__k);} | |
| 1374 | #endif // _LIBCPP_STD_VER > 17 | |
| 1285 | 1375 | #if _LIBCPP_STD_VER > 17 |
| 1286 | 1376 | _LIBCPP_INLINE_VISIBILITY |
| 1287 | 1377 | bool contains(const key_type& __k) const {return find(__k) != end();} |
| 1378 | ||
| 1379 | template <typename _K2> | |
| 1380 | _LIBCPP_INLINE_VISIBILITY | |
| 1381 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> | |
| 1382 | contains(const _K2& __k) const {return find(__k) != end();} | |
| 1288 | 1383 | #endif // _LIBCPP_STD_VER > 17 |
| 1289 | 1384 | _LIBCPP_INLINE_VISIBILITY |
| 1290 | 1385 | pair<iterator, iterator> equal_range(const key_type& __k) |
| ... | ... | @@ -1292,6 +1387,16 @@ public: |
| 1292 | 1387 | _LIBCPP_INLINE_VISIBILITY |
| 1293 | 1388 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 1294 | 1389 | {return __table_.__equal_range_unique(__k);} |
| 1390 | #if _LIBCPP_STD_VER > 17 | |
| 1391 | template <typename _K2> | |
| 1392 | _LIBCPP_INLINE_VISIBILITY | |
| 1393 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> | |
| 1394 | equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} | |
| 1395 | template <typename _K2> | |
| 1396 | _LIBCPP_INLINE_VISIBILITY | |
| 1397 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> | |
| 1398 | equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} | |
| 1399 | #endif // _LIBCPP_STD_VER > 17 | |
| 1295 | 1400 | |
| 1296 | 1401 | mapped_type& operator[](const key_type& __k); |
| 1297 | 1402 | #ifndef _LIBCPP_CXX03_LANG |
| ... | ... | @@ -1336,7 +1441,7 @@ public: |
| 1336 | 1441 | _LIBCPP_INLINE_VISIBILITY |
| 1337 | 1442 | void reserve(size_type __n) {__table_.reserve(__n);} |
| 1338 | 1443 | |
| 1339 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1444 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1340 | 1445 | |
| 1341 | 1446 | bool __dereferenceable(const const_iterator* __i) const |
| 1342 | 1447 | {return __table_.__dereferenceable(&__i->__i_);} |
| ... | ... | @@ -1347,7 +1452,7 @@ public: |
| 1347 | 1452 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const |
| 1348 | 1453 | {return __table_.__addable(&__i->__i_, __n);} |
| 1349 | 1454 | |
| 1350 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1455 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1351 | 1456 | |
| 1352 | 1457 | private: |
| 1353 | 1458 | |
| ... | ... | @@ -1428,7 +1533,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1428 | 1533 | size_type __n, const hasher& __hf, const key_equal& __eql) |
| 1429 | 1534 | : __table_(__hf, __eql) |
| 1430 | 1535 | { |
| 1431 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1536 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1432 | 1537 | __get_db()->__insert_c(this); |
| 1433 | 1538 | #endif |
| 1434 | 1539 | __table_.rehash(__n); |
| ... | ... | @@ -1440,7 +1545,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1440 | 1545 | const allocator_type& __a) |
| 1441 | 1546 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 1442 | 1547 | { |
| 1443 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1548 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1444 | 1549 | __get_db()->__insert_c(this); |
| 1445 | 1550 | #endif |
| 1446 | 1551 | __table_.rehash(__n); |
| ... | ... | @@ -1452,7 +1557,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1452 | 1557 | const allocator_type& __a) |
| 1453 | 1558 | : __table_(typename __table::allocator_type(__a)) |
| 1454 | 1559 | { |
| 1455 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1560 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1456 | 1561 | __get_db()->__insert_c(this); |
| 1457 | 1562 | #endif |
| 1458 | 1563 | } |
| ... | ... | @@ -1462,7 +1567,7 @@ template <class _InputIterator> |
| 1462 | 1567 | unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1463 | 1568 | _InputIterator __first, _InputIterator __last) |
| 1464 | 1569 | { |
| 1465 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1570 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1466 | 1571 | __get_db()->__insert_c(this); |
| 1467 | 1572 | #endif |
| 1468 | 1573 | insert(__first, __last); |
| ... | ... | @@ -1475,7 +1580,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1475 | 1580 | const hasher& __hf, const key_equal& __eql) |
| 1476 | 1581 | : __table_(__hf, __eql) |
| 1477 | 1582 | { |
| 1478 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1583 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1479 | 1584 | __get_db()->__insert_c(this); |
| 1480 | 1585 | #endif |
| 1481 | 1586 | __table_.rehash(__n); |
| ... | ... | @@ -1489,7 +1594,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1489 | 1594 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 1490 | 1595 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 1491 | 1596 | { |
| 1492 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1597 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1493 | 1598 | __get_db()->__insert_c(this); |
| 1494 | 1599 | #endif |
| 1495 | 1600 | __table_.rehash(__n); |
| ... | ... | @@ -1501,7 +1606,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1501 | 1606 | const unordered_map& __u) |
| 1502 | 1607 | : __table_(__u.__table_) |
| 1503 | 1608 | { |
| 1504 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1609 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1505 | 1610 | __get_db()->__insert_c(this); |
| 1506 | 1611 | #endif |
| 1507 | 1612 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -1513,7 +1618,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1513 | 1618 | const unordered_map& __u, const allocator_type& __a) |
| 1514 | 1619 | : __table_(__u.__table_, typename __table::allocator_type(__a)) |
| 1515 | 1620 | { |
| 1516 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1621 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1517 | 1622 | __get_db()->__insert_c(this); |
| 1518 | 1623 | #endif |
| 1519 | 1624 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -1529,7 +1634,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1529 | 1634 | _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) |
| 1530 | 1635 | : __table_(_VSTD::move(__u.__table_)) |
| 1531 | 1636 | { |
| 1532 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1637 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1533 | 1638 | __get_db()->__insert_c(this); |
| 1534 | 1639 | __get_db()->swap(this, &__u); |
| 1535 | 1640 | #endif |
| ... | ... | @@ -1540,7 +1645,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1540 | 1645 | unordered_map&& __u, const allocator_type& __a) |
| 1541 | 1646 | : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) |
| 1542 | 1647 | { |
| 1543 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1648 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1544 | 1649 | __get_db()->__insert_c(this); |
| 1545 | 1650 | #endif |
| 1546 | 1651 | if (__a != __u.get_allocator()) |
| ... | ... | @@ -1551,7 +1656,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1551 | 1656 | __u.__table_.remove((__i++).__i_)->__value_.__move()); |
| 1552 | 1657 | } |
| 1553 | 1658 | } |
| 1554 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1659 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1555 | 1660 | else |
| 1556 | 1661 | __get_db()->swap(this, &__u); |
| 1557 | 1662 | #endif |
| ... | ... | @@ -1561,7 +1666,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 1561 | 1666 | unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1562 | 1667 | initializer_list<value_type> __il) |
| 1563 | 1668 | { |
| 1564 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1669 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1565 | 1670 | __get_db()->__insert_c(this); |
| 1566 | 1671 | #endif |
| 1567 | 1672 | insert(__il.begin(), __il.end()); |
| ... | ... | @@ -1573,7 +1678,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1573 | 1678 | const key_equal& __eql) |
| 1574 | 1679 | : __table_(__hf, __eql) |
| 1575 | 1680 | { |
| 1576 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1681 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1577 | 1682 | __get_db()->__insert_c(this); |
| 1578 | 1683 | #endif |
| 1579 | 1684 | __table_.rehash(__n); |
| ... | ... | @@ -1586,7 +1691,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( |
| 1586 | 1691 | const key_equal& __eql, const allocator_type& __a) |
| 1587 | 1692 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 1588 | 1693 | { |
| 1589 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1694 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1590 | 1695 | __get_db()->__insert_c(this); |
| 1591 | 1696 | #endif |
| 1592 | 1697 | __table_.rehash(__n); |
| ... | ... | @@ -1633,8 +1738,8 @@ _Tp& |
| 1633 | 1738 | unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) |
| 1634 | 1739 | { |
| 1635 | 1740 | return __table_.__emplace_unique_key_args(__k, |
| 1636 | std::piecewise_construct, std::forward_as_tuple(__k), | |
| 1637 | std::forward_as_tuple()).first->__get_value().second; | |
| 1741 | piecewise_construct, _VSTD::forward_as_tuple(__k), | |
| 1742 | _VSTD::forward_as_tuple()).first->__get_value().second; | |
| 1638 | 1743 | } |
| 1639 | 1744 | |
| 1640 | 1745 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| ... | ... | @@ -1642,8 +1747,8 @@ _Tp& |
| 1642 | 1747 | unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) |
| 1643 | 1748 | { |
| 1644 | 1749 | return __table_.__emplace_unique_key_args(__k, |
| 1645 | std::piecewise_construct, std::forward_as_tuple(std::move(__k)), | |
| 1646 | std::forward_as_tuple()).first->__get_value().second; | |
| 1750 | piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)), | |
| 1751 | _VSTD::forward_as_tuple()).first->__get_value().second; | |
| 1647 | 1752 | } |
| 1648 | 1753 | #else // _LIBCPP_CXX03_LANG |
| 1649 | 1754 | |
| ... | ... | @@ -1657,7 +1762,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const |
| 1657 | 1762 | __h.get_deleter().__first_constructed = true; |
| 1658 | 1763 | __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second)); |
| 1659 | 1764 | __h.get_deleter().__second_constructed = true; |
| 1660 | return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 | |
| 1765 | return __h; | |
| 1661 | 1766 | } |
| 1662 | 1767 | |
| 1663 | 1768 | template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| ... | ... | @@ -1762,11 +1867,11 @@ public: |
| 1762 | 1867 | "Invalid allocator::value_type"); |
| 1763 | 1868 | |
| 1764 | 1869 | private: |
| 1765 | typedef __hash_value_type<key_type, mapped_type> __value_type; | |
| 1766 | typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; | |
| 1767 | typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; | |
| 1870 | typedef __hash_value_type<key_type, mapped_type> __value_type; | |
| 1871 | typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; | |
| 1872 | typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; | |
| 1768 | 1873 | typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, |
| 1769 | __value_type>::type __allocator_type; | |
| 1874 | __value_type>::type __allocator_type; | |
| 1770 | 1875 | |
| 1771 | 1876 | typedef __hash_table<__value_type, __hasher, |
| 1772 | 1877 | __key_equal, __allocator_type> __table; |
| ... | ... | @@ -1807,7 +1912,7 @@ public: |
| 1807 | 1912 | unordered_multimap() |
| 1808 | 1913 | _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) |
| 1809 | 1914 | { |
| 1810 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1915 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1811 | 1916 | __get_db()->__insert_c(this); |
| 1812 | 1917 | #endif |
| 1813 | 1918 | } |
| ... | ... | @@ -2059,11 +2164,32 @@ public: |
| 2059 | 2164 | iterator find(const key_type& __k) {return __table_.find(__k);} |
| 2060 | 2165 | _LIBCPP_INLINE_VISIBILITY |
| 2061 | 2166 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
| 2167 | #if _LIBCPP_STD_VER > 17 | |
| 2168 | template <typename _K2> | |
| 2169 | _LIBCPP_INLINE_VISIBILITY | |
| 2170 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> | |
| 2171 | find(const _K2& __k) {return __table_.find(__k);} | |
| 2172 | template <typename _K2> | |
| 2173 | _LIBCPP_INLINE_VISIBILITY | |
| 2174 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> | |
| 2175 | find(const _K2& __k) const {return __table_.find(__k);} | |
| 2176 | #endif // _LIBCPP_STD_VER > 17 | |
| 2062 | 2177 | _LIBCPP_INLINE_VISIBILITY |
| 2063 | 2178 | size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} |
| 2179 | #if _LIBCPP_STD_VER > 17 | |
| 2180 | template <typename _K2> | |
| 2181 | _LIBCPP_INLINE_VISIBILITY | |
| 2182 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> | |
| 2183 | count(const _K2& __k) const {return __table_.__count_multi(__k);} | |
| 2184 | #endif // _LIBCPP_STD_VER > 17 | |
| 2064 | 2185 | #if _LIBCPP_STD_VER > 17 |
| 2065 | 2186 | _LIBCPP_INLINE_VISIBILITY |
| 2066 | 2187 | bool contains(const key_type& __k) const {return find(__k) != end();} |
| 2188 | ||
| 2189 | template <typename _K2> | |
| 2190 | _LIBCPP_INLINE_VISIBILITY | |
| 2191 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> | |
| 2192 | contains(const _K2& __k) const {return find(__k) != end();} | |
| 2067 | 2193 | #endif // _LIBCPP_STD_VER > 17 |
| 2068 | 2194 | _LIBCPP_INLINE_VISIBILITY |
| 2069 | 2195 | pair<iterator, iterator> equal_range(const key_type& __k) |
| ... | ... | @@ -2071,6 +2197,16 @@ public: |
| 2071 | 2197 | _LIBCPP_INLINE_VISIBILITY |
| 2072 | 2198 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 2073 | 2199 | {return __table_.__equal_range_multi(__k);} |
| 2200 | #if _LIBCPP_STD_VER > 17 | |
| 2201 | template <typename _K2> | |
| 2202 | _LIBCPP_INLINE_VISIBILITY | |
| 2203 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> | |
| 2204 | equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} | |
| 2205 | template <typename _K2> | |
| 2206 | _LIBCPP_INLINE_VISIBILITY | |
| 2207 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> | |
| 2208 | equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} | |
| 2209 | #endif // _LIBCPP_STD_VER > 17 | |
| 2074 | 2210 | |
| 2075 | 2211 | _LIBCPP_INLINE_VISIBILITY |
| 2076 | 2212 | size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} |
| ... | ... | @@ -2108,7 +2244,7 @@ public: |
| 2108 | 2244 | _LIBCPP_INLINE_VISIBILITY |
| 2109 | 2245 | void reserve(size_type __n) {__table_.reserve(__n);} |
| 2110 | 2246 | |
| 2111 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2247 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2112 | 2248 | |
| 2113 | 2249 | bool __dereferenceable(const const_iterator* __i) const |
| 2114 | 2250 | {return __table_.__dereferenceable(&__i->__i_);} |
| ... | ... | @@ -2119,7 +2255,7 @@ public: |
| 2119 | 2255 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const |
| 2120 | 2256 | {return __table_.__addable(&__i->__i_, __n);} |
| 2121 | 2257 | |
| 2122 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2258 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 2123 | 2259 | |
| 2124 | 2260 | |
| 2125 | 2261 | }; |
| ... | ... | @@ -2196,7 +2332,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2196 | 2332 | size_type __n, const hasher& __hf, const key_equal& __eql) |
| 2197 | 2333 | : __table_(__hf, __eql) |
| 2198 | 2334 | { |
| 2199 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2335 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2200 | 2336 | __get_db()->__insert_c(this); |
| 2201 | 2337 | #endif |
| 2202 | 2338 | __table_.rehash(__n); |
| ... | ... | @@ -2208,7 +2344,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2208 | 2344 | const allocator_type& __a) |
| 2209 | 2345 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 2210 | 2346 | { |
| 2211 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2347 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2212 | 2348 | __get_db()->__insert_c(this); |
| 2213 | 2349 | #endif |
| 2214 | 2350 | __table_.rehash(__n); |
| ... | ... | @@ -2219,7 +2355,7 @@ template <class _InputIterator> |
| 2219 | 2355 | unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2220 | 2356 | _InputIterator __first, _InputIterator __last) |
| 2221 | 2357 | { |
| 2222 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2358 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2223 | 2359 | __get_db()->__insert_c(this); |
| 2224 | 2360 | #endif |
| 2225 | 2361 | insert(__first, __last); |
| ... | ... | @@ -2232,7 +2368,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2232 | 2368 | const hasher& __hf, const key_equal& __eql) |
| 2233 | 2369 | : __table_(__hf, __eql) |
| 2234 | 2370 | { |
| 2235 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2371 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2236 | 2372 | __get_db()->__insert_c(this); |
| 2237 | 2373 | #endif |
| 2238 | 2374 | __table_.rehash(__n); |
| ... | ... | @@ -2246,7 +2382,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2246 | 2382 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 2247 | 2383 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 2248 | 2384 | { |
| 2249 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2385 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2250 | 2386 | __get_db()->__insert_c(this); |
| 2251 | 2387 | #endif |
| 2252 | 2388 | __table_.rehash(__n); |
| ... | ... | @@ -2259,7 +2395,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2259 | 2395 | const allocator_type& __a) |
| 2260 | 2396 | : __table_(typename __table::allocator_type(__a)) |
| 2261 | 2397 | { |
| 2262 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2398 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2263 | 2399 | __get_db()->__insert_c(this); |
| 2264 | 2400 | #endif |
| 2265 | 2401 | } |
| ... | ... | @@ -2269,7 +2405,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2269 | 2405 | const unordered_multimap& __u) |
| 2270 | 2406 | : __table_(__u.__table_) |
| 2271 | 2407 | { |
| 2272 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2408 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2273 | 2409 | __get_db()->__insert_c(this); |
| 2274 | 2410 | #endif |
| 2275 | 2411 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -2281,7 +2417,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2281 | 2417 | const unordered_multimap& __u, const allocator_type& __a) |
| 2282 | 2418 | : __table_(__u.__table_, typename __table::allocator_type(__a)) |
| 2283 | 2419 | { |
| 2284 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2420 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2285 | 2421 | __get_db()->__insert_c(this); |
| 2286 | 2422 | #endif |
| 2287 | 2423 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -2297,7 +2433,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2297 | 2433 | _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) |
| 2298 | 2434 | : __table_(_VSTD::move(__u.__table_)) |
| 2299 | 2435 | { |
| 2300 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2436 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2301 | 2437 | __get_db()->__insert_c(this); |
| 2302 | 2438 | __get_db()->swap(this, &__u); |
| 2303 | 2439 | #endif |
| ... | ... | @@ -2308,7 +2444,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2308 | 2444 | unordered_multimap&& __u, const allocator_type& __a) |
| 2309 | 2445 | : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a)) |
| 2310 | 2446 | { |
| 2311 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2447 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2312 | 2448 | __get_db()->__insert_c(this); |
| 2313 | 2449 | #endif |
| 2314 | 2450 | if (__a != __u.get_allocator()) |
| ... | ... | @@ -2320,7 +2456,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2320 | 2456 | __u.__table_.remove((__i++).__i_)->__value_.__move()); |
| 2321 | 2457 | } |
| 2322 | 2458 | } |
| 2323 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2459 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2324 | 2460 | else |
| 2325 | 2461 | __get_db()->swap(this, &__u); |
| 2326 | 2462 | #endif |
| ... | ... | @@ -2330,7 +2466,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> |
| 2330 | 2466 | unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2331 | 2467 | initializer_list<value_type> __il) |
| 2332 | 2468 | { |
| 2333 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2469 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2334 | 2470 | __get_db()->__insert_c(this); |
| 2335 | 2471 | #endif |
| 2336 | 2472 | insert(__il.begin(), __il.end()); |
| ... | ... | @@ -2342,7 +2478,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2342 | 2478 | const key_equal& __eql) |
| 2343 | 2479 | : __table_(__hf, __eql) |
| 2344 | 2480 | { |
| 2345 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2481 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2346 | 2482 | __get_db()->__insert_c(this); |
| 2347 | 2483 | #endif |
| 2348 | 2484 | __table_.rehash(__n); |
| ... | ... | @@ -2355,7 +2491,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( |
| 2355 | 2491 | const key_equal& __eql, const allocator_type& __a) |
| 2356 | 2492 | : __table_(__hf, __eql, typename __table::allocator_type(__a)) |
| 2357 | 2493 | { |
| 2358 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2494 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2359 | 2495 | __get_db()->__insert_c(this); |
| 2360 | 2496 | #endif |
| 2361 | 2497 | __table_.rehash(__n); |
lib/libcxx/include/unordered_set+123-37| ... | ... | @@ -145,10 +145,22 @@ public: |
| 145 | 145 | |
| 146 | 146 | iterator find(const key_type& k); |
| 147 | 147 | const_iterator find(const key_type& k) const; |
| 148 | template<typename K> | |
| 149 | iterator find(const K& x); // C++20 | |
| 150 | template<typename K> | |
| 151 | const_iterator find(const K& x) const; // C++20 | |
| 148 | 152 | size_type count(const key_type& k) const; |
| 153 | template<typename K> | |
| 154 | size_type count(const K& k) const; // C++20 | |
| 149 | 155 | bool contains(const key_type& k) const; // C++20 |
| 156 | template<typename K> | |
| 157 | bool contains(const K& k) const; // C++20 | |
| 150 | 158 | pair<iterator, iterator> equal_range(const key_type& k); |
| 151 | 159 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 160 | template<typename K> | |
| 161 | pair<iterator, iterator> equal_range(const K& k); // C++20 | |
| 162 | template<typename K> | |
| 163 | pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 | |
| 152 | 164 | |
| 153 | 165 | size_type bucket_count() const noexcept; |
| 154 | 166 | size_type max_bucket_count() const noexcept; |
| ... | ... | @@ -310,10 +322,22 @@ public: |
| 310 | 322 | |
| 311 | 323 | iterator find(const key_type& k); |
| 312 | 324 | const_iterator find(const key_type& k) const; |
| 325 | template<typename K> | |
| 326 | iterator find(const K& x); // C++20 | |
| 327 | template<typename K> | |
| 328 | const_iterator find(const K& x) const; // C++20 | |
| 313 | 329 | size_type count(const key_type& k) const; |
| 330 | template<typename K> | |
| 331 | size_type count(const K& k) const; // C++20 | |
| 314 | 332 | bool contains(const key_type& k) const; // C++20 |
| 333 | template<typename K> | |
| 334 | bool contains(const K& k) const; // C++20 | |
| 315 | 335 | pair<iterator, iterator> equal_range(const key_type& k); |
| 316 | 336 | pair<const_iterator, const_iterator> equal_range(const key_type& k) const; |
| 337 | template<typename K> | |
| 338 | pair<iterator, iterator> equal_range(const K& k); // C++20 | |
| 339 | template<typename K> | |
| 340 | pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20 | |
| 317 | 341 | |
| 318 | 342 | size_type bucket_count() const noexcept; |
| 319 | 343 | size_type max_bucket_count() const noexcept; |
| ... | ... | @@ -425,7 +449,7 @@ public: |
| 425 | 449 | unordered_set() |
| 426 | 450 | _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) |
| 427 | 451 | { |
| 428 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 452 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 429 | 453 | __get_db()->__insert_c(this); |
| 430 | 454 | #endif |
| 431 | 455 | } |
| ... | ... | @@ -539,7 +563,7 @@ public: |
| 539 | 563 | {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} |
| 540 | 564 | template <class... _Args> |
| 541 | 565 | _LIBCPP_INLINE_VISIBILITY |
| 542 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 566 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 543 | 567 | iterator emplace_hint(const_iterator __p, _Args&&... __args) |
| 544 | 568 | { |
| 545 | 569 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| ... | ... | @@ -556,7 +580,7 @@ public: |
| 556 | 580 | pair<iterator, bool> insert(value_type&& __x) |
| 557 | 581 | {return __table_.__insert_unique(_VSTD::move(__x));} |
| 558 | 582 | _LIBCPP_INLINE_VISIBILITY |
| 559 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 583 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 560 | 584 | iterator insert(const_iterator __p, value_type&& __x) |
| 561 | 585 | { |
| 562 | 586 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| ... | ... | @@ -577,7 +601,7 @@ public: |
| 577 | 601 | {return __table_.__insert_unique(__x);} |
| 578 | 602 | |
| 579 | 603 | _LIBCPP_INLINE_VISIBILITY |
| 580 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 604 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 581 | 605 | iterator insert(const_iterator __p, const value_type& __x) |
| 582 | 606 | { |
| 583 | 607 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, |
| ... | ... | @@ -679,11 +703,32 @@ public: |
| 679 | 703 | iterator find(const key_type& __k) {return __table_.find(__k);} |
| 680 | 704 | _LIBCPP_INLINE_VISIBILITY |
| 681 | 705 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
| 706 | #if _LIBCPP_STD_VER > 17 | |
| 707 | template <typename _K2> | |
| 708 | _LIBCPP_INLINE_VISIBILITY | |
| 709 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> | |
| 710 | find(const _K2& __k) {return __table_.find(__k);} | |
| 711 | template <typename _K2> | |
| 712 | _LIBCPP_INLINE_VISIBILITY | |
| 713 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> | |
| 714 | find(const _K2& __k) const {return __table_.find(__k);} | |
| 715 | #endif // _LIBCPP_STD_VER > 17 | |
| 682 | 716 | _LIBCPP_INLINE_VISIBILITY |
| 683 | 717 | size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} |
| 718 | #if _LIBCPP_STD_VER > 17 | |
| 719 | template <typename _K2> | |
| 720 | _LIBCPP_INLINE_VISIBILITY | |
| 721 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> | |
| 722 | count(const _K2& __k) const {return __table_.__count_unique(__k);} | |
| 723 | #endif // _LIBCPP_STD_VER > 17 | |
| 684 | 724 | #if _LIBCPP_STD_VER > 17 |
| 685 | 725 | _LIBCPP_INLINE_VISIBILITY |
| 686 | 726 | bool contains(const key_type& __k) const {return find(__k) != end();} |
| 727 | ||
| 728 | template <typename _K2> | |
| 729 | _LIBCPP_INLINE_VISIBILITY | |
| 730 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> | |
| 731 | contains(const _K2& __k) const {return find(__k) != end();} | |
| 687 | 732 | #endif // _LIBCPP_STD_VER > 17 |
| 688 | 733 | _LIBCPP_INLINE_VISIBILITY |
| 689 | 734 | pair<iterator, iterator> equal_range(const key_type& __k) |
| ... | ... | @@ -691,6 +736,16 @@ public: |
| 691 | 736 | _LIBCPP_INLINE_VISIBILITY |
| 692 | 737 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 693 | 738 | {return __table_.__equal_range_unique(__k);} |
| 739 | #if _LIBCPP_STD_VER > 17 | |
| 740 | template <typename _K2> | |
| 741 | _LIBCPP_INLINE_VISIBILITY | |
| 742 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> | |
| 743 | equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} | |
| 744 | template <typename _K2> | |
| 745 | _LIBCPP_INLINE_VISIBILITY | |
| 746 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> | |
| 747 | equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} | |
| 748 | #endif // _LIBCPP_STD_VER > 17 | |
| 694 | 749 | |
| 695 | 750 | _LIBCPP_INLINE_VISIBILITY |
| 696 | 751 | size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} |
| ... | ... | @@ -726,7 +781,7 @@ public: |
| 726 | 781 | _LIBCPP_INLINE_VISIBILITY |
| 727 | 782 | void reserve(size_type __n) {__table_.reserve(__n);} |
| 728 | 783 | |
| 729 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 784 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 730 | 785 | |
| 731 | 786 | bool __dereferenceable(const const_iterator* __i) const |
| 732 | 787 | {return __table_.__dereferenceable(__i);} |
| ... | ... | @@ -737,7 +792,7 @@ public: |
| 737 | 792 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const |
| 738 | 793 | {return __table_.__addable(__i, __n);} |
| 739 | 794 | |
| 740 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 795 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 741 | 796 | |
| 742 | 797 | }; |
| 743 | 798 | |
| ... | ... | @@ -802,7 +857,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, |
| 802 | 857 | const hasher& __hf, const key_equal& __eql) |
| 803 | 858 | : __table_(__hf, __eql) |
| 804 | 859 | { |
| 805 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 860 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 806 | 861 | __get_db()->__insert_c(this); |
| 807 | 862 | #endif |
| 808 | 863 | __table_.rehash(__n); |
| ... | ... | @@ -813,7 +868,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, |
| 813 | 868 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 814 | 869 | : __table_(__hf, __eql, __a) |
| 815 | 870 | { |
| 816 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 871 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 817 | 872 | __get_db()->__insert_c(this); |
| 818 | 873 | #endif |
| 819 | 874 | __table_.rehash(__n); |
| ... | ... | @@ -824,7 +879,7 @@ template <class _InputIterator> |
| 824 | 879 | unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 825 | 880 | _InputIterator __first, _InputIterator __last) |
| 826 | 881 | { |
| 827 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 882 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 828 | 883 | __get_db()->__insert_c(this); |
| 829 | 884 | #endif |
| 830 | 885 | insert(__first, __last); |
| ... | ... | @@ -837,7 +892,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 837 | 892 | const hasher& __hf, const key_equal& __eql) |
| 838 | 893 | : __table_(__hf, __eql) |
| 839 | 894 | { |
| 840 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 895 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 841 | 896 | __get_db()->__insert_c(this); |
| 842 | 897 | #endif |
| 843 | 898 | __table_.rehash(__n); |
| ... | ... | @@ -851,7 +906,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 851 | 906 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 852 | 907 | : __table_(__hf, __eql, __a) |
| 853 | 908 | { |
| 854 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 909 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 855 | 910 | __get_db()->__insert_c(this); |
| 856 | 911 | #endif |
| 857 | 912 | __table_.rehash(__n); |
| ... | ... | @@ -864,7 +919,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 864 | 919 | const allocator_type& __a) |
| 865 | 920 | : __table_(__a) |
| 866 | 921 | { |
| 867 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 922 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 868 | 923 | __get_db()->__insert_c(this); |
| 869 | 924 | #endif |
| 870 | 925 | } |
| ... | ... | @@ -874,7 +929,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 874 | 929 | const unordered_set& __u) |
| 875 | 930 | : __table_(__u.__table_) |
| 876 | 931 | { |
| 877 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 932 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 878 | 933 | __get_db()->__insert_c(this); |
| 879 | 934 | #endif |
| 880 | 935 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -886,7 +941,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 886 | 941 | const unordered_set& __u, const allocator_type& __a) |
| 887 | 942 | : __table_(__u.__table_, __a) |
| 888 | 943 | { |
| 889 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 944 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 890 | 945 | __get_db()->__insert_c(this); |
| 891 | 946 | #endif |
| 892 | 947 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -902,7 +957,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 902 | 957 | _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) |
| 903 | 958 | : __table_(_VSTD::move(__u.__table_)) |
| 904 | 959 | { |
| 905 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 960 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 906 | 961 | __get_db()->__insert_c(this); |
| 907 | 962 | __get_db()->swap(this, &__u); |
| 908 | 963 | #endif |
| ... | ... | @@ -913,7 +968,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 913 | 968 | unordered_set&& __u, const allocator_type& __a) |
| 914 | 969 | : __table_(_VSTD::move(__u.__table_), __a) |
| 915 | 970 | { |
| 916 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 971 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 917 | 972 | __get_db()->__insert_c(this); |
| 918 | 973 | #endif |
| 919 | 974 | if (__a != __u.get_allocator()) |
| ... | ... | @@ -922,7 +977,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 922 | 977 | while (__u.size() != 0) |
| 923 | 978 | __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_)); |
| 924 | 979 | } |
| 925 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 980 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 926 | 981 | else |
| 927 | 982 | __get_db()->swap(this, &__u); |
| 928 | 983 | #endif |
| ... | ... | @@ -932,7 +987,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 932 | 987 | unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 933 | 988 | initializer_list<value_type> __il) |
| 934 | 989 | { |
| 935 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 990 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 936 | 991 | __get_db()->__insert_c(this); |
| 937 | 992 | #endif |
| 938 | 993 | insert(__il.begin(), __il.end()); |
| ... | ... | @@ -944,7 +999,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 944 | 999 | const key_equal& __eql) |
| 945 | 1000 | : __table_(__hf, __eql) |
| 946 | 1001 | { |
| 947 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1002 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 948 | 1003 | __get_db()->__insert_c(this); |
| 949 | 1004 | #endif |
| 950 | 1005 | __table_.rehash(__n); |
| ... | ... | @@ -957,7 +1012,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( |
| 957 | 1012 | const key_equal& __eql, const allocator_type& __a) |
| 958 | 1013 | : __table_(__hf, __eql, __a) |
| 959 | 1014 | { |
| 960 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1015 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 961 | 1016 | __get_db()->__insert_c(this); |
| 962 | 1017 | #endif |
| 963 | 1018 | __table_.rehash(__n); |
| ... | ... | @@ -1091,7 +1146,7 @@ public: |
| 1091 | 1146 | unordered_multiset() |
| 1092 | 1147 | _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) |
| 1093 | 1148 | { |
| 1094 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1149 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1095 | 1150 | __get_db()->__insert_c(this); |
| 1096 | 1151 | #endif |
| 1097 | 1152 | } |
| ... | ... | @@ -1314,11 +1369,32 @@ public: |
| 1314 | 1369 | iterator find(const key_type& __k) {return __table_.find(__k);} |
| 1315 | 1370 | _LIBCPP_INLINE_VISIBILITY |
| 1316 | 1371 | const_iterator find(const key_type& __k) const {return __table_.find(__k);} |
| 1372 | #if _LIBCPP_STD_VER > 17 | |
| 1373 | template <typename _K2> | |
| 1374 | _LIBCPP_INLINE_VISIBILITY | |
| 1375 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> | |
| 1376 | find(const _K2& __k) {return __table_.find(__k);} | |
| 1377 | template <typename _K2> | |
| 1378 | _LIBCPP_INLINE_VISIBILITY | |
| 1379 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> | |
| 1380 | find(const _K2& __k) const {return __table_.find(__k);} | |
| 1381 | #endif // _LIBCPP_STD_VER > 17 | |
| 1317 | 1382 | _LIBCPP_INLINE_VISIBILITY |
| 1318 | 1383 | size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} |
| 1384 | #if _LIBCPP_STD_VER > 17 | |
| 1385 | template <typename _K2> | |
| 1386 | _LIBCPP_INLINE_VISIBILITY | |
| 1387 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> | |
| 1388 | count(const _K2& __k) const {return __table_.__count_multi(__k);} | |
| 1389 | #endif // _LIBCPP_STD_VER > 17 | |
| 1319 | 1390 | #if _LIBCPP_STD_VER > 17 |
| 1320 | 1391 | _LIBCPP_INLINE_VISIBILITY |
| 1321 | 1392 | bool contains(const key_type& __k) const {return find(__k) != end();} |
| 1393 | ||
| 1394 | template <typename _K2> | |
| 1395 | _LIBCPP_INLINE_VISIBILITY | |
| 1396 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> | |
| 1397 | contains(const _K2& __k) const {return find(__k) != end();} | |
| 1322 | 1398 | #endif // _LIBCPP_STD_VER > 17 |
| 1323 | 1399 | _LIBCPP_INLINE_VISIBILITY |
| 1324 | 1400 | pair<iterator, iterator> equal_range(const key_type& __k) |
| ... | ... | @@ -1326,6 +1402,16 @@ public: |
| 1326 | 1402 | _LIBCPP_INLINE_VISIBILITY |
| 1327 | 1403 | pair<const_iterator, const_iterator> equal_range(const key_type& __k) const |
| 1328 | 1404 | {return __table_.__equal_range_multi(__k);} |
| 1405 | #if _LIBCPP_STD_VER > 17 | |
| 1406 | template <typename _K2> | |
| 1407 | _LIBCPP_INLINE_VISIBILITY | |
| 1408 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> | |
| 1409 | equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} | |
| 1410 | template <typename _K2> | |
| 1411 | _LIBCPP_INLINE_VISIBILITY | |
| 1412 | _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> | |
| 1413 | equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} | |
| 1414 | #endif // _LIBCPP_STD_VER > 17 | |
| 1329 | 1415 | |
| 1330 | 1416 | _LIBCPP_INLINE_VISIBILITY |
| 1331 | 1417 | size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} |
| ... | ... | @@ -1361,7 +1447,7 @@ public: |
| 1361 | 1447 | _LIBCPP_INLINE_VISIBILITY |
| 1362 | 1448 | void reserve(size_type __n) {__table_.reserve(__n);} |
| 1363 | 1449 | |
| 1364 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1450 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1365 | 1451 | |
| 1366 | 1452 | bool __dereferenceable(const const_iterator* __i) const |
| 1367 | 1453 | {return __table_.__dereferenceable(__i);} |
| ... | ... | @@ -1372,7 +1458,7 @@ public: |
| 1372 | 1458 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const |
| 1373 | 1459 | {return __table_.__addable(__i, __n);} |
| 1374 | 1460 | |
| 1375 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1461 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 1376 | 1462 | |
| 1377 | 1463 | }; |
| 1378 | 1464 | |
| ... | ... | @@ -1435,7 +1521,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1435 | 1521 | size_type __n, const hasher& __hf, const key_equal& __eql) |
| 1436 | 1522 | : __table_(__hf, __eql) |
| 1437 | 1523 | { |
| 1438 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1524 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1439 | 1525 | __get_db()->__insert_c(this); |
| 1440 | 1526 | #endif |
| 1441 | 1527 | __table_.rehash(__n); |
| ... | ... | @@ -1447,7 +1533,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1447 | 1533 | const allocator_type& __a) |
| 1448 | 1534 | : __table_(__hf, __eql, __a) |
| 1449 | 1535 | { |
| 1450 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1536 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1451 | 1537 | __get_db()->__insert_c(this); |
| 1452 | 1538 | #endif |
| 1453 | 1539 | __table_.rehash(__n); |
| ... | ... | @@ -1458,7 +1544,7 @@ template <class _InputIterator> |
| 1458 | 1544 | unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1459 | 1545 | _InputIterator __first, _InputIterator __last) |
| 1460 | 1546 | { |
| 1461 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1547 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1462 | 1548 | __get_db()->__insert_c(this); |
| 1463 | 1549 | #endif |
| 1464 | 1550 | insert(__first, __last); |
| ... | ... | @@ -1471,7 +1557,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1471 | 1557 | const hasher& __hf, const key_equal& __eql) |
| 1472 | 1558 | : __table_(__hf, __eql) |
| 1473 | 1559 | { |
| 1474 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1560 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1475 | 1561 | __get_db()->__insert_c(this); |
| 1476 | 1562 | #endif |
| 1477 | 1563 | __table_.rehash(__n); |
| ... | ... | @@ -1485,7 +1571,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1485 | 1571 | const hasher& __hf, const key_equal& __eql, const allocator_type& __a) |
| 1486 | 1572 | : __table_(__hf, __eql, __a) |
| 1487 | 1573 | { |
| 1488 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1574 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1489 | 1575 | __get_db()->__insert_c(this); |
| 1490 | 1576 | #endif |
| 1491 | 1577 | __table_.rehash(__n); |
| ... | ... | @@ -1498,7 +1584,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1498 | 1584 | const allocator_type& __a) |
| 1499 | 1585 | : __table_(__a) |
| 1500 | 1586 | { |
| 1501 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1587 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1502 | 1588 | __get_db()->__insert_c(this); |
| 1503 | 1589 | #endif |
| 1504 | 1590 | } |
| ... | ... | @@ -1508,7 +1594,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1508 | 1594 | const unordered_multiset& __u) |
| 1509 | 1595 | : __table_(__u.__table_) |
| 1510 | 1596 | { |
| 1511 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1597 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1512 | 1598 | __get_db()->__insert_c(this); |
| 1513 | 1599 | #endif |
| 1514 | 1600 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -1520,7 +1606,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1520 | 1606 | const unordered_multiset& __u, const allocator_type& __a) |
| 1521 | 1607 | : __table_(__u.__table_, __a) |
| 1522 | 1608 | { |
| 1523 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1609 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1524 | 1610 | __get_db()->__insert_c(this); |
| 1525 | 1611 | #endif |
| 1526 | 1612 | __table_.rehash(__u.bucket_count()); |
| ... | ... | @@ -1536,7 +1622,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1536 | 1622 | _NOEXCEPT_(is_nothrow_move_constructible<__table>::value) |
| 1537 | 1623 | : __table_(_VSTD::move(__u.__table_)) |
| 1538 | 1624 | { |
| 1539 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1625 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1540 | 1626 | __get_db()->__insert_c(this); |
| 1541 | 1627 | __get_db()->swap(this, &__u); |
| 1542 | 1628 | #endif |
| ... | ... | @@ -1547,7 +1633,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1547 | 1633 | unordered_multiset&& __u, const allocator_type& __a) |
| 1548 | 1634 | : __table_(_VSTD::move(__u.__table_), __a) |
| 1549 | 1635 | { |
| 1550 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1636 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1551 | 1637 | __get_db()->__insert_c(this); |
| 1552 | 1638 | #endif |
| 1553 | 1639 | if (__a != __u.get_allocator()) |
| ... | ... | @@ -1556,7 +1642,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1556 | 1642 | while (__u.size() != 0) |
| 1557 | 1643 | __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_)); |
| 1558 | 1644 | } |
| 1559 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1645 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1560 | 1646 | else |
| 1561 | 1647 | __get_db()->swap(this, &__u); |
| 1562 | 1648 | #endif |
| ... | ... | @@ -1566,7 +1652,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc> |
| 1566 | 1652 | unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1567 | 1653 | initializer_list<value_type> __il) |
| 1568 | 1654 | { |
| 1569 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1655 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1570 | 1656 | __get_db()->__insert_c(this); |
| 1571 | 1657 | #endif |
| 1572 | 1658 | insert(__il.begin(), __il.end()); |
| ... | ... | @@ -1578,7 +1664,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1578 | 1664 | const key_equal& __eql) |
| 1579 | 1665 | : __table_(__hf, __eql) |
| 1580 | 1666 | { |
| 1581 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1667 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1582 | 1668 | __get_db()->__insert_c(this); |
| 1583 | 1669 | #endif |
| 1584 | 1670 | __table_.rehash(__n); |
| ... | ... | @@ -1591,7 +1677,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( |
| 1591 | 1677 | const key_equal& __eql, const allocator_type& __a) |
| 1592 | 1678 | : __table_(__hf, __eql, __a) |
| 1593 | 1679 | { |
| 1594 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1680 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1595 | 1681 | __get_db()->__insert_c(this); |
| 1596 | 1682 | #endif |
| 1597 | 1683 | __table_.rehash(__n); |
lib/libcxx/include/utility+24-14| ... | ... | @@ -499,7 +499,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 499 | 499 | second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} |
| 500 | 500 | |
| 501 | 501 | template <class... _Args1, class... _Args2> |
| 502 | _LIBCPP_INLINE_VISIBILITY | |
| 502 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 503 | 503 | pair(piecewise_construct_t __pc, |
| 504 | 504 | tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) |
| 505 | 505 | _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && |
| ... | ... | @@ -508,7 +508,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 508 | 508 | typename __make_tuple_indices<sizeof...(_Args1)>::type(), |
| 509 | 509 | typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} |
| 510 | 510 | |
| 511 | _LIBCPP_INLINE_VISIBILITY | |
| 511 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 512 | 512 | pair& operator=(typename conditional< |
| 513 | 513 | is_copy_assignable<first_type>::value && |
| 514 | 514 | is_copy_assignable<second_type>::value, |
| ... | ... | @@ -521,7 +521,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 521 | 521 | return *this; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | _LIBCPP_INLINE_VISIBILITY | |
| 524 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 525 | 525 | pair& operator=(typename conditional< |
| 526 | 526 | is_move_assignable<first_type>::value && |
| 527 | 527 | is_move_assignable<second_type>::value, |
| ... | ... | @@ -537,7 +537,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 537 | 537 | template <class _Tuple, _EnableB< |
| 538 | 538 | _CheckTLC<_Tuple>::template __enable_assign<_Tuple>() |
| 539 | 539 | > = false> |
| 540 | _LIBCPP_INLINE_VISIBILITY | |
| 540 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 541 | 541 | pair& operator=(_Tuple&& __p) { |
| 542 | 542 | first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p)); |
| 543 | 543 | second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p)); |
| ... | ... | @@ -545,7 +545,7 @@ struct _LIBCPP_TEMPLATE_VIS pair |
| 545 | 545 | } |
| 546 | 546 | #endif |
| 547 | 547 | |
| 548 | _LIBCPP_INLINE_VISIBILITY | |
| 548 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 549 | 549 | void |
| 550 | 550 | swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value && |
| 551 | 551 | __is_nothrow_swappable<second_type>::value) |
| ... | ... | @@ -558,10 +558,10 @@ private: |
| 558 | 558 | |
| 559 | 559 | #ifndef _LIBCPP_CXX03_LANG |
| 560 | 560 | template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> |
| 561 | _LIBCPP_INLINE_VISIBILITY | |
| 562 | pair(piecewise_construct_t, | |
| 563 | tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, | |
| 564 | __tuple_indices<_I1...>, __tuple_indices<_I2...>); | |
| 561 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 562 | pair(piecewise_construct_t, | |
| 563 | tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, | |
| 564 | __tuple_indices<_I1...>, __tuple_indices<_I2...>); | |
| 565 | 565 | #endif |
| 566 | 566 | }; |
| 567 | 567 | |
| ... | ... | @@ -619,7 +619,7 @@ operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | template <class _T1, class _T2> |
| 622 | inline _LIBCPP_INLINE_VISIBILITY | |
| 622 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 | |
| 623 | 623 | typename enable_if |
| 624 | 624 | < |
| 625 | 625 | __is_swappable<_T1>::value && |
| ... | ... | @@ -970,7 +970,7 @@ _Size |
| 970 | 970 | __loadword(const void* __p) |
| 971 | 971 | { |
| 972 | 972 | _Size __r; |
| 973 | std::memcpy(&__r, __p, sizeof(__r)); | |
| 973 | _VSTD::memcpy(&__r, __p, sizeof(__r)); | |
| 974 | 974 | return __r; |
| 975 | 975 | } |
| 976 | 976 | |
| ... | ... | @@ -1189,7 +1189,7 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) |
| 1189 | 1189 | __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); |
| 1190 | 1190 | __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, |
| 1191 | 1191 | __y + __loadword<_Size>(__s + 16)); |
| 1192 | std::swap(__z, __x); | |
| 1192 | _VSTD::swap(__z, __x); | |
| 1193 | 1193 | __s += 64; |
| 1194 | 1194 | __len -= 64; |
| 1195 | 1195 | } while (__len != 0); |
| ... | ... | @@ -1364,6 +1364,16 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> |
| 1364 | 1364 | size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} |
| 1365 | 1365 | }; |
| 1366 | 1366 | |
| 1367 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 1368 | template <> | |
| 1369 | struct _LIBCPP_TEMPLATE_VIS hash<char8_t> | |
| 1370 | : public unary_function<char8_t, size_t> | |
| 1371 | { | |
| 1372 | _LIBCPP_INLINE_VISIBILITY | |
| 1373 | size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} | |
| 1374 | }; | |
| 1375 | #endif // !_LIBCPP_NO_HAS_CHAR8_T | |
| 1376 | ||
| 1367 | 1377 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS |
| 1368 | 1378 | |
| 1369 | 1379 | template <> |
| ... | ... | @@ -1506,7 +1516,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double> |
| 1506 | 1516 | // -0.0 and 0.0 should return same hash |
| 1507 | 1517 | if (__v == 0.0L) |
| 1508 | 1518 | return 0; |
| 1509 | #if defined(__i386__) | |
| 1519 | #if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__)) | |
| 1510 | 1520 | // Zero out padding bits |
| 1511 | 1521 | union |
| 1512 | 1522 | { |
| ... | ... | @@ -1593,7 +1603,7 @@ using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool, |
| 1593 | 1603 | __invokable_r<size_t, _Hash, _Key const&>::value |
| 1594 | 1604 | >; |
| 1595 | 1605 | |
| 1596 | template <class _Key, class _Hash = std::hash<_Key> > | |
| 1606 | template <class _Key, class _Hash = hash<_Key> > | |
| 1597 | 1607 | using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool, |
| 1598 | 1608 | __check_hash_requirements<_Key, _Hash>::value && |
| 1599 | 1609 | is_default_constructible<_Hash>::value |
lib/libcxx/include/valarray+73-95| ... | ... | @@ -136,6 +136,7 @@ public: |
| 136 | 136 | void operator>>=(const valarray<value_type>& v) const; |
| 137 | 137 | |
| 138 | 138 | void operator=(const value_type& x) const; |
| 139 | void operator=(const valarray<T>& val_arr) const; | |
| 139 | 140 | |
| 140 | 141 | slice_array() = delete; |
| 141 | 142 | }; |
| ... | ... | @@ -802,7 +803,7 @@ private: |
| 802 | 803 | public: |
| 803 | 804 | // construct/destroy: |
| 804 | 805 | _LIBCPP_INLINE_VISIBILITY |
| 805 | valarray() : __begin_(0), __end_(0) {} | |
| 806 | valarray() : __begin_(nullptr), __end_(nullptr) {} | |
| 806 | 807 | inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 |
| 807 | 808 | explicit valarray(size_t __n); |
| 808 | 809 | _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -1264,6 +1265,9 @@ public: |
| 1264 | 1265 | _LIBCPP_INLINE_VISIBILITY |
| 1265 | 1266 | void operator=(const value_type& __x) const; |
| 1266 | 1267 | |
| 1268 | _LIBCPP_INLINE_VISIBILITY | |
| 1269 | void operator=(const valarray<value_type>& __va) const; | |
| 1270 | ||
| 1267 | 1271 | private: |
| 1268 | 1272 | _LIBCPP_INLINE_VISIBILITY |
| 1269 | 1273 | slice_array(const slice& __sl, const valarray<value_type>& __v) |
| ... | ... | @@ -1303,6 +1307,15 @@ slice_array<_Tp>::operator=(const _Expr& __v) const |
| 1303 | 1307 | *__t = __v[__i]; |
| 1304 | 1308 | } |
| 1305 | 1309 | |
| 1310 | template <class _Tp> | |
| 1311 | inline void | |
| 1312 | slice_array<_Tp>::operator=(const valarray<value_type>& __va) const | |
| 1313 | { | |
| 1314 | value_type* __t = __vp_; | |
| 1315 | for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_) | |
| 1316 | *__t = __va[__i]; | |
| 1317 | } | |
| 1318 | ||
| 1306 | 1319 | template <class _Tp> |
| 1307 | 1320 | template <class _Expr> |
| 1308 | 1321 | inline |
| ... | ... | @@ -2738,11 +2751,9 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const |
| 2738 | 2751 | if (__n) |
| 2739 | 2752 | { |
| 2740 | 2753 | __r.__begin_ = |
| 2741 | __r.__end_ = | |
| 2742 | static_cast<result_type*>( | |
| 2743 | _VSTD::__libcpp_allocate(__n * sizeof(result_type), _LIBCPP_ALIGNOF(result_type))); | |
| 2754 | __r.__end_ = allocator<result_type>().allocate(__n); | |
| 2744 | 2755 | for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) |
| 2745 | ::new (__r.__end_) result_type(__expr_[__i]); | |
| 2756 | ::new ((void*)__r.__end_) result_type(__expr_[__i]); | |
| 2746 | 2757 | } |
| 2747 | 2758 | return __r; |
| 2748 | 2759 | } |
| ... | ... | @@ -2752,19 +2763,18 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const |
| 2752 | 2763 | template <class _Tp> |
| 2753 | 2764 | inline |
| 2754 | 2765 | valarray<_Tp>::valarray(size_t __n) |
| 2755 | : __begin_(0), | |
| 2756 | __end_(0) | |
| 2766 | : __begin_(nullptr), | |
| 2767 | __end_(nullptr) | |
| 2757 | 2768 | { |
| 2758 | 2769 | if (__n) |
| 2759 | 2770 | { |
| 2760 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2761 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2771 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2762 | 2772 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2763 | 2773 | try |
| 2764 | 2774 | { |
| 2765 | 2775 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2766 | 2776 | for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) |
| 2767 | ::new (__end_) value_type(); | |
| 2777 | ::new ((void*)__end_) value_type(); | |
| 2768 | 2778 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2769 | 2779 | } |
| 2770 | 2780 | catch (...) |
| ... | ... | @@ -2779,27 +2789,26 @@ valarray<_Tp>::valarray(size_t __n) |
| 2779 | 2789 | template <class _Tp> |
| 2780 | 2790 | inline |
| 2781 | 2791 | valarray<_Tp>::valarray(const value_type& __x, size_t __n) |
| 2782 | : __begin_(0), | |
| 2783 | __end_(0) | |
| 2792 | : __begin_(nullptr), | |
| 2793 | __end_(nullptr) | |
| 2784 | 2794 | { |
| 2785 | 2795 | resize(__n, __x); |
| 2786 | 2796 | } |
| 2787 | 2797 | |
| 2788 | 2798 | template <class _Tp> |
| 2789 | 2799 | valarray<_Tp>::valarray(const value_type* __p, size_t __n) |
| 2790 | : __begin_(0), | |
| 2791 | __end_(0) | |
| 2800 | : __begin_(nullptr), | |
| 2801 | __end_(nullptr) | |
| 2792 | 2802 | { |
| 2793 | 2803 | if (__n) |
| 2794 | 2804 | { |
| 2795 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2796 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2805 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2797 | 2806 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2798 | 2807 | try |
| 2799 | 2808 | { |
| 2800 | 2809 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2801 | 2810 | for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left) |
| 2802 | ::new (__end_) value_type(*__p); | |
| 2811 | ::new ((void*)__end_) value_type(*__p); | |
| 2803 | 2812 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2804 | 2813 | } |
| 2805 | 2814 | catch (...) |
| ... | ... | @@ -2813,19 +2822,18 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) |
| 2813 | 2822 | |
| 2814 | 2823 | template <class _Tp> |
| 2815 | 2824 | valarray<_Tp>::valarray(const valarray& __v) |
| 2816 | : __begin_(0), | |
| 2817 | __end_(0) | |
| 2825 | : __begin_(nullptr), | |
| 2826 | __end_(nullptr) | |
| 2818 | 2827 | { |
| 2819 | 2828 | if (__v.size()) |
| 2820 | 2829 | { |
| 2821 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2822 | _VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2830 | __begin_ = __end_ = allocator<value_type>().allocate(__v.size()); | |
| 2823 | 2831 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2824 | 2832 | try |
| 2825 | 2833 | { |
| 2826 | 2834 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2827 | 2835 | for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p) |
| 2828 | ::new (__end_) value_type(*__p); | |
| 2836 | ::new ((void*)__end_) value_type(*__p); | |
| 2829 | 2837 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2830 | 2838 | } |
| 2831 | 2839 | catch (...) |
| ... | ... | @@ -2850,21 +2858,20 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT |
| 2850 | 2858 | |
| 2851 | 2859 | template <class _Tp> |
| 2852 | 2860 | valarray<_Tp>::valarray(initializer_list<value_type> __il) |
| 2853 | : __begin_(0), | |
| 2854 | __end_(0) | |
| 2861 | : __begin_(nullptr), | |
| 2862 | __end_(nullptr) | |
| 2855 | 2863 | { |
| 2856 | 2864 | const size_t __n = __il.size(); |
| 2857 | 2865 | if (__n) |
| 2858 | 2866 | { |
| 2859 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2860 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2867 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2861 | 2868 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2862 | 2869 | try |
| 2863 | 2870 | { |
| 2864 | 2871 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2865 | 2872 | size_t __n_left = __n; |
| 2866 | 2873 | for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left) |
| 2867 | ::new (__end_) value_type(*__p); | |
| 2874 | ::new ((void*)__end_) value_type(*__p); | |
| 2868 | 2875 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2869 | 2876 | } |
| 2870 | 2877 | catch (...) |
| ... | ... | @@ -2880,21 +2887,20 @@ _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))) |
| 2880 | 2887 | |
| 2881 | 2888 | template <class _Tp> |
| 2882 | 2889 | valarray<_Tp>::valarray(const slice_array<value_type>& __sa) |
| 2883 | : __begin_(0), | |
| 2884 | __end_(0) | |
| 2890 | : __begin_(nullptr), | |
| 2891 | __end_(nullptr) | |
| 2885 | 2892 | { |
| 2886 | 2893 | const size_t __n = __sa.__size_; |
| 2887 | 2894 | if (__n) |
| 2888 | 2895 | { |
| 2889 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2890 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2896 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2891 | 2897 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2892 | 2898 | try |
| 2893 | 2899 | { |
| 2894 | 2900 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 2895 | 2901 | size_t __n_left = __n; |
| 2896 | 2902 | for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left) |
| 2897 | ::new (__end_) value_type(*__p); | |
| 2903 | ::new ((void*)__end_) value_type(*__p); | |
| 2898 | 2904 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2899 | 2905 | } |
| 2900 | 2906 | catch (...) |
| ... | ... | @@ -2908,14 +2914,13 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa) |
| 2908 | 2914 | |
| 2909 | 2915 | template <class _Tp> |
| 2910 | 2916 | valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) |
| 2911 | : __begin_(0), | |
| 2912 | __end_(0) | |
| 2917 | : __begin_(nullptr), | |
| 2918 | __end_(nullptr) | |
| 2913 | 2919 | { |
| 2914 | 2920 | const size_t __n = __ga.__1d_.size(); |
| 2915 | 2921 | if (__n) |
| 2916 | 2922 | { |
| 2917 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2918 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2923 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2919 | 2924 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2920 | 2925 | try |
| 2921 | 2926 | { |
| ... | ... | @@ -2924,7 +2929,7 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) |
| 2924 | 2929 | const value_type* __s = __ga.__vp_; |
| 2925 | 2930 | for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; |
| 2926 | 2931 | __i != __e; ++__i, ++__end_) |
| 2927 | ::new (__end_) value_type(__s[*__i]); | |
| 2932 | ::new ((void*)__end_) value_type(__s[*__i]); | |
| 2928 | 2933 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2929 | 2934 | } |
| 2930 | 2935 | catch (...) |
| ... | ... | @@ -2938,14 +2943,13 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) |
| 2938 | 2943 | |
| 2939 | 2944 | template <class _Tp> |
| 2940 | 2945 | valarray<_Tp>::valarray(const mask_array<value_type>& __ma) |
| 2941 | : __begin_(0), | |
| 2942 | __end_(0) | |
| 2946 | : __begin_(nullptr), | |
| 2947 | __end_(nullptr) | |
| 2943 | 2948 | { |
| 2944 | 2949 | const size_t __n = __ma.__1d_.size(); |
| 2945 | 2950 | if (__n) |
| 2946 | 2951 | { |
| 2947 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2948 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2952 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2949 | 2953 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2950 | 2954 | try |
| 2951 | 2955 | { |
| ... | ... | @@ -2954,7 +2958,7 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma) |
| 2954 | 2958 | const value_type* __s = __ma.__vp_; |
| 2955 | 2959 | for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; |
| 2956 | 2960 | __i != __e; ++__i, ++__end_) |
| 2957 | ::new (__end_) value_type(__s[*__i]); | |
| 2961 | ::new ((void*)__end_) value_type(__s[*__i]); | |
| 2958 | 2962 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2959 | 2963 | } |
| 2960 | 2964 | catch (...) |
| ... | ... | @@ -2968,14 +2972,13 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma) |
| 2968 | 2972 | |
| 2969 | 2973 | template <class _Tp> |
| 2970 | 2974 | valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) |
| 2971 | : __begin_(0), | |
| 2972 | __end_(0) | |
| 2975 | : __begin_(nullptr), | |
| 2976 | __end_(nullptr) | |
| 2973 | 2977 | { |
| 2974 | 2978 | const size_t __n = __ia.__1d_.size(); |
| 2975 | 2979 | if (__n) |
| 2976 | 2980 | { |
| 2977 | __begin_ = __end_ = static_cast<value_type*>( | |
| 2978 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 2981 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 2979 | 2982 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2980 | 2983 | try |
| 2981 | 2984 | { |
| ... | ... | @@ -2984,7 +2987,7 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) |
| 2984 | 2987 | const value_type* __s = __ia.__vp_; |
| 2985 | 2988 | for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; |
| 2986 | 2989 | __i != __e; ++__i, ++__end_) |
| 2987 | ::new (__end_) value_type(__s[*__i]); | |
| 2990 | ::new ((void*)__end_) value_type(__s[*__i]); | |
| 2988 | 2991 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 2989 | 2992 | } |
| 2990 | 2993 | catch (...) |
| ... | ... | @@ -3011,8 +3014,7 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l) |
| 3011 | 3014 | if (size() != __n) |
| 3012 | 3015 | { |
| 3013 | 3016 | __clear(size()); |
| 3014 | __begin_ = static_cast<value_type*>( | |
| 3015 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3017 | __begin_ = allocator<value_type>().allocate(__n); | |
| 3016 | 3018 | __end_ = __begin_ + __n; |
| 3017 | 3019 | _VSTD::uninitialized_copy(__f, __l, __begin_); |
| 3018 | 3020 | } else { |
| ... | ... | @@ -3265,12 +3267,9 @@ valarray<_Tp>::operator+() const |
| 3265 | 3267 | size_t __n = size(); |
| 3266 | 3268 | if (__n) |
| 3267 | 3269 | { |
| 3268 | __r.__begin_ = | |
| 3269 | __r.__end_ = | |
| 3270 | static_cast<value_type*>( | |
| 3271 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3270 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3272 | 3271 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3273 | ::new (__r.__end_) value_type(+*__p); | |
| 3272 | ::new ((void*)__r.__end_) value_type(+*__p); | |
| 3274 | 3273 | } |
| 3275 | 3274 | return __r; |
| 3276 | 3275 | } |
| ... | ... | @@ -3283,12 +3282,9 @@ valarray<_Tp>::operator-() const |
| 3283 | 3282 | size_t __n = size(); |
| 3284 | 3283 | if (__n) |
| 3285 | 3284 | { |
| 3286 | __r.__begin_ = | |
| 3287 | __r.__end_ = | |
| 3288 | static_cast<value_type*>( | |
| 3289 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3285 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3290 | 3286 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3291 | ::new (__r.__end_) value_type(-*__p); | |
| 3287 | ::new ((void*)__r.__end_) value_type(-*__p); | |
| 3292 | 3288 | } |
| 3293 | 3289 | return __r; |
| 3294 | 3290 | } |
| ... | ... | @@ -3301,12 +3297,9 @@ valarray<_Tp>::operator~() const |
| 3301 | 3297 | size_t __n = size(); |
| 3302 | 3298 | if (__n) |
| 3303 | 3299 | { |
| 3304 | __r.__begin_ = | |
| 3305 | __r.__end_ = | |
| 3306 | static_cast<value_type*>( | |
| 3307 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3300 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3308 | 3301 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3309 | ::new (__r.__end_) value_type(~*__p); | |
| 3302 | ::new ((void*)__r.__end_) value_type(~*__p); | |
| 3310 | 3303 | } |
| 3311 | 3304 | return __r; |
| 3312 | 3305 | } |
| ... | ... | @@ -3319,11 +3312,9 @@ valarray<_Tp>::operator!() const |
| 3319 | 3312 | size_t __n = size(); |
| 3320 | 3313 | if (__n) |
| 3321 | 3314 | { |
| 3322 | __r.__begin_ = | |
| 3323 | __r.__end_ = | |
| 3324 | static_cast<bool*>(_VSTD::__libcpp_allocate(__n * sizeof(bool), _LIBCPP_ALIGNOF(bool))); | |
| 3315 | __r.__begin_ = __r.__end_ = allocator<bool>().allocate(__n); | |
| 3325 | 3316 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3326 | ::new (__r.__end_) bool(!*__p); | |
| 3317 | ::new ((void*)__r.__end_) bool(!*__p); | |
| 3327 | 3318 | } |
| 3328 | 3319 | return __r; |
| 3329 | 3320 | } |
| ... | ... | @@ -3639,10 +3630,7 @@ valarray<_Tp>::shift(int __i) const |
| 3639 | 3630 | size_t __n = size(); |
| 3640 | 3631 | if (__n) |
| 3641 | 3632 | { |
| 3642 | __r.__begin_ = | |
| 3643 | __r.__end_ = | |
| 3644 | static_cast<value_type*>( | |
| 3645 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3633 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3646 | 3634 | const value_type* __sb; |
| 3647 | 3635 | value_type* __tb; |
| 3648 | 3636 | value_type* __te; |
| ... | ... | @@ -3661,11 +3649,11 @@ valarray<_Tp>::shift(int __i) const |
| 3661 | 3649 | __te = __r.__begin_ + __n; |
| 3662 | 3650 | } |
| 3663 | 3651 | for (; __r.__end_ != __tb; ++__r.__end_) |
| 3664 | ::new (__r.__end_) value_type(); | |
| 3652 | ::new ((void*)__r.__end_) value_type(); | |
| 3665 | 3653 | for (; __r.__end_ != __te; ++__r.__end_, ++__sb) |
| 3666 | ::new (__r.__end_) value_type(*__sb); | |
| 3654 | ::new ((void*)__r.__end_) value_type(*__sb); | |
| 3667 | 3655 | for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_) |
| 3668 | ::new (__r.__end_) value_type(); | |
| 3656 | ::new ((void*)__r.__end_) value_type(); | |
| 3669 | 3657 | } |
| 3670 | 3658 | return __r; |
| 3671 | 3659 | } |
| ... | ... | @@ -3678,16 +3666,13 @@ valarray<_Tp>::cshift(int __i) const |
| 3678 | 3666 | size_t __n = size(); |
| 3679 | 3667 | if (__n) |
| 3680 | 3668 | { |
| 3681 | __r.__begin_ = | |
| 3682 | __r.__end_ = | |
| 3683 | static_cast<value_type*>( | |
| 3684 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3669 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3685 | 3670 | __i %= static_cast<int>(__n); |
| 3686 | 3671 | const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; |
| 3687 | 3672 | for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) |
| 3688 | ::new (__r.__end_) value_type(*__s); | |
| 3673 | ::new ((void*)__r.__end_) value_type(*__s); | |
| 3689 | 3674 | for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s) |
| 3690 | ::new (__r.__end_) value_type(*__s); | |
| 3675 | ::new ((void*)__r.__end_) value_type(*__s); | |
| 3691 | 3676 | } |
| 3692 | 3677 | return __r; |
| 3693 | 3678 | } |
| ... | ... | @@ -3700,12 +3685,9 @@ valarray<_Tp>::apply(value_type __f(value_type)) const |
| 3700 | 3685 | size_t __n = size(); |
| 3701 | 3686 | if (__n) |
| 3702 | 3687 | { |
| 3703 | __r.__begin_ = | |
| 3704 | __r.__end_ = | |
| 3705 | static_cast<value_type*>( | |
| 3706 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3688 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3707 | 3689 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3708 | ::new (__r.__end_) value_type(__f(*__p)); | |
| 3690 | ::new ((void*)__r.__end_) value_type(__f(*__p)); | |
| 3709 | 3691 | } |
| 3710 | 3692 | return __r; |
| 3711 | 3693 | } |
| ... | ... | @@ -3718,12 +3700,9 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const |
| 3718 | 3700 | size_t __n = size(); |
| 3719 | 3701 | if (__n) |
| 3720 | 3702 | { |
| 3721 | __r.__begin_ = | |
| 3722 | __r.__end_ = | |
| 3723 | static_cast<value_type*>( | |
| 3724 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3703 | __r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n); | |
| 3725 | 3704 | for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) |
| 3726 | ::new (__r.__end_) value_type(__f(*__p)); | |
| 3705 | ::new ((void*)__r.__end_) value_type(__f(*__p)); | |
| 3727 | 3706 | } |
| 3728 | 3707 | return __r; |
| 3729 | 3708 | } |
| ... | ... | @@ -3736,7 +3715,7 @@ void valarray<_Tp>::__clear(size_t __capacity) |
| 3736 | 3715 | { |
| 3737 | 3716 | while (__end_ != __begin_) |
| 3738 | 3717 | (--__end_)->~value_type(); |
| 3739 | _VSTD::__libcpp_deallocate(__begin_, __capacity * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)); | |
| 3718 | allocator<value_type>().deallocate(__begin_, __capacity); | |
| 3740 | 3719 | __begin_ = __end_ = nullptr; |
| 3741 | 3720 | } |
| 3742 | 3721 | } |
| ... | ... | @@ -3748,14 +3727,13 @@ valarray<_Tp>::resize(size_t __n, value_type __x) |
| 3748 | 3727 | __clear(size()); |
| 3749 | 3728 | if (__n) |
| 3750 | 3729 | { |
| 3751 | __begin_ = __end_ = static_cast<value_type*>( | |
| 3752 | _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type))); | |
| 3730 | __begin_ = __end_ = allocator<value_type>().allocate(__n); | |
| 3753 | 3731 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3754 | 3732 | try |
| 3755 | 3733 | { |
| 3756 | 3734 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 3757 | 3735 | for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) |
| 3758 | ::new (__end_) value_type(__x); | |
| 3736 | ::new ((void*)__end_) value_type(__x); | |
| 3759 | 3737 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 3760 | 3738 | } |
| 3761 | 3739 | catch (...) |
lib/libcxx/include/variant+29-25| ... | ... | @@ -197,6 +197,7 @@ namespace std { |
| 197 | 197 | */ |
| 198 | 198 | |
| 199 | 199 | #include <__config> |
| 200 | #include <__availability> | |
| 200 | 201 | #include <__tuple> |
| 201 | 202 | #include <array> |
| 202 | 203 | #include <exception> |
| ... | ... | @@ -227,7 +228,10 @@ public: |
| 227 | 228 | |
| 228 | 229 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 229 | 230 | |
| 230 | #if _LIBCPP_STD_VER > 14 | |
| 231 | // TODO: GCC 5 lies about its support for C++17 (it says it supports it but it | |
| 232 | // really doesn't). That breaks variant, which uses some C++17 features. | |
| 233 | // Remove this once we drop support for GCC 5. | |
| 234 | #if _LIBCPP_STD_VER > 14 && !(defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW < 6000) | |
| 231 | 235 | |
| 232 | 236 | _LIBCPP_NORETURN |
| 233 | 237 | inline _LIBCPP_INLINE_VISIBILITY |
| ... | ... | @@ -290,9 +294,9 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { |
| 290 | 294 | _LIBCPP_INLINE_VAR constexpr size_t variant_npos = static_cast<size_t>(-1); |
| 291 | 295 | |
| 292 | 296 | constexpr int __choose_index_type(unsigned int __num_elem) { |
| 293 | if (__num_elem < std::numeric_limits<unsigned char>::max()) | |
| 297 | if (__num_elem < numeric_limits<unsigned char>::max()) | |
| 294 | 298 | return 0; |
| 295 | if (__num_elem < std::numeric_limits<unsigned short>::max()) | |
| 299 | if (__num_elem < numeric_limits<unsigned short>::max()) | |
| 296 | 300 | return 1; |
| 297 | 301 | return 2; |
| 298 | 302 | } |
| ... | ... | @@ -482,12 +486,12 @@ private: |
| 482 | 486 | return __result{{_VSTD::forward<_Fs>(__fs)...}}; |
| 483 | 487 | } |
| 484 | 488 | |
| 485 | template <std::size_t... _Is> | |
| 489 | template <size_t... _Is> | |
| 486 | 490 | struct __dispatcher { |
| 487 | 491 | template <class _Fp, class... _Vs> |
| 488 | 492 | inline _LIBCPP_INLINE_VISIBILITY |
| 489 | 493 | static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) { |
| 490 | return __invoke_constexpr( | |
| 494 | return _VSTD::__invoke_constexpr( | |
| 491 | 495 | static_cast<_Fp>(__f), |
| 492 | 496 | __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...); |
| 493 | 497 | } |
| ... | ... | @@ -595,7 +599,7 @@ private: |
| 595 | 599 | __std_visit_exhaustive_visitor_check< |
| 596 | 600 | _Visitor, |
| 597 | 601 | decltype((_VSTD::forward<_Alts>(__alts).__value))...>(); |
| 598 | return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor), | |
| 602 | return _VSTD::__invoke_constexpr(_VSTD::forward<_Visitor>(__visitor), | |
| 599 | 603 | _VSTD::forward<_Alts>(__alts).__value...); |
| 600 | 604 | } |
| 601 | 605 | _Visitor&& __visitor; |
| ... | ... | @@ -720,12 +724,12 @@ protected: |
| 720 | 724 | }; |
| 721 | 725 | |
| 722 | 726 | template <class _Traits, _Trait = _Traits::__destructible_trait> |
| 723 | class _LIBCPP_TEMPLATE_VIS __destructor; | |
| 727 | class _LIBCPP_TEMPLATE_VIS __dtor; | |
| 724 | 728 | |
| 725 | 729 | #define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \ |
| 726 | 730 | template <class... _Types> \ |
| 727 | class _LIBCPP_TEMPLATE_VIS __destructor<__traits<_Types...>, \ | |
| 728 | destructible_trait> \ | |
| 731 | class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, \ | |
| 732 | destructible_trait> \ | |
| 729 | 733 | : public __base<destructible_trait, _Types...> { \ |
| 730 | 734 | using __base_type = __base<destructible_trait, _Types...>; \ |
| 731 | 735 | using __index_t = typename __base_type::__index_t; \ |
| ... | ... | @@ -734,11 +738,11 @@ class _LIBCPP_TEMPLATE_VIS __destructor; |
| 734 | 738 | using __base_type::__base_type; \ |
| 735 | 739 | using __base_type::operator=; \ |
| 736 | 740 | \ |
| 737 | __destructor(const __destructor&) = default; \ | |
| 738 | __destructor(__destructor&&) = default; \ | |
| 741 | __dtor(const __dtor&) = default; \ | |
| 742 | __dtor(__dtor&&) = default; \ | |
| 739 | 743 | destructor \ |
| 740 | __destructor& operator=(const __destructor&) = default; \ | |
| 741 | __destructor& operator=(__destructor&&) = default; \ | |
| 744 | __dtor& operator=(const __dtor&) = default; \ | |
| 745 | __dtor& operator=(__dtor&&) = default; \ | |
| 742 | 746 | \ |
| 743 | 747 | protected: \ |
| 744 | 748 | inline _LIBCPP_INLINE_VISIBILITY \ |
| ... | ... | @@ -747,12 +751,12 @@ class _LIBCPP_TEMPLATE_VIS __destructor; |
| 747 | 751 | |
| 748 | 752 | _LIBCPP_VARIANT_DESTRUCTOR( |
| 749 | 753 | _Trait::_TriviallyAvailable, |
| 750 | ~__destructor() = default;, | |
| 754 | ~__dtor() = default;, | |
| 751 | 755 | void __destroy() noexcept { this->__index = __variant_npos<__index_t>; }); |
| 752 | 756 | |
| 753 | 757 | _LIBCPP_VARIANT_DESTRUCTOR( |
| 754 | 758 | _Trait::_Available, |
| 755 | ~__destructor() { __destroy(); }, | |
| 759 | ~__dtor() { __destroy(); }, | |
| 756 | 760 | void __destroy() noexcept { |
| 757 | 761 | if (!this->valueless_by_exception()) { |
| 758 | 762 | __visitation::__base::__visit_alt( |
| ... | ... | @@ -767,14 +771,14 @@ _LIBCPP_VARIANT_DESTRUCTOR( |
| 767 | 771 | |
| 768 | 772 | _LIBCPP_VARIANT_DESTRUCTOR( |
| 769 | 773 | _Trait::_Unavailable, |
| 770 | ~__destructor() = delete;, | |
| 774 | ~__dtor() = delete;, | |
| 771 | 775 | void __destroy() noexcept = delete;); |
| 772 | 776 | |
| 773 | 777 | #undef _LIBCPP_VARIANT_DESTRUCTOR |
| 774 | 778 | |
| 775 | 779 | template <class _Traits> |
| 776 | class _LIBCPP_TEMPLATE_VIS __constructor : public __destructor<_Traits> { | |
| 777 | using __base_type = __destructor<_Traits>; | |
| 780 | class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> { | |
| 781 | using __base_type = __dtor<_Traits>; | |
| 778 | 782 | |
| 779 | 783 | public: |
| 780 | 784 | using __base_type::__base_type; |
| ... | ... | @@ -791,7 +795,7 @@ protected: |
| 791 | 795 | |
| 792 | 796 | template <class _Rhs> |
| 793 | 797 | inline _LIBCPP_INLINE_VISIBILITY |
| 794 | static void __generic_construct(__constructor& __lhs, _Rhs&& __rhs) { | |
| 798 | static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) { | |
| 795 | 799 | __lhs.__destroy(); |
| 796 | 800 | if (!__rhs.valueless_by_exception()) { |
| 797 | 801 | __visitation::__base::__visit_alt_at( |
| ... | ... | @@ -813,10 +817,10 @@ class _LIBCPP_TEMPLATE_VIS __move_constructor; |
| 813 | 817 | #define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, \ |
| 814 | 818 | move_constructor) \ |
| 815 | 819 | template <class... _Types> \ |
| 816 | class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \ | |
| 817 | move_constructible_trait> \ | |
| 818 | : public __constructor<__traits<_Types...>> { \ | |
| 819 | using __base_type = __constructor<__traits<_Types...>>; \ | |
| 820 | class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \ | |
| 821 | move_constructible_trait> \ | |
| 822 | : public __ctor<__traits<_Types...>> { \ | |
| 823 | using __base_type = __ctor<__traits<_Types...>>; \ | |
| 820 | 824 | \ |
| 821 | 825 | public: \ |
| 822 | 826 | using __base_type::__base_type; \ |
| ... | ... | @@ -1104,7 +1108,7 @@ struct __narrowing_check { |
| 1104 | 1108 | template <class _Dest> |
| 1105 | 1109 | static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>; |
| 1106 | 1110 | template <class _Dest, class _Source> |
| 1107 | using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({std::declval<_Source>()})); | |
| 1111 | using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({_VSTD::declval<_Source>()})); | |
| 1108 | 1112 | }; |
| 1109 | 1113 | |
| 1110 | 1114 | template <class _Dest, class _Source> |
| ... | ... | @@ -1510,7 +1514,7 @@ template <class _Operator> |
| 1510 | 1514 | struct __convert_to_bool { |
| 1511 | 1515 | template <class _T1, class _T2> |
| 1512 | 1516 | _LIBCPP_INLINE_VISIBILITY constexpr bool operator()(_T1 && __t1, _T2&& __t2) const { |
| 1513 | static_assert(std::is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value, | |
| 1517 | static_assert(is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value, | |
| 1514 | 1518 | "the relational operator does not return a type which is implicitly convertible to bool"); |
| 1515 | 1519 | return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); |
| 1516 | 1520 | } |
lib/libcxx/include/vector+48-51| ... | ... | @@ -454,7 +454,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 454 | 454 | __vector_base<_Tp, _Allocator>::__vector_base(allocator_type&& __a) _NOEXCEPT |
| 455 | 455 | : __begin_(nullptr), |
| 456 | 456 | __end_(nullptr), |
| 457 | __end_cap_(nullptr, std::move(__a)) {} | |
| 457 | __end_cap_(nullptr, _VSTD::move(__a)) {} | |
| 458 | 458 | #endif |
| 459 | 459 | |
| 460 | 460 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -496,7 +496,7 @@ public: |
| 496 | 496 | _LIBCPP_INLINE_VISIBILITY |
| 497 | 497 | vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| 498 | 498 | { |
| 499 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 499 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 500 | 500 | __get_db()->__insert_c(this); |
| 501 | 501 | #endif |
| 502 | 502 | } |
| ... | ... | @@ -508,7 +508,7 @@ public: |
| 508 | 508 | #endif |
| 509 | 509 | : __base(__a) |
| 510 | 510 | { |
| 511 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 511 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 512 | 512 | __get_db()->__insert_c(this); |
| 513 | 513 | #endif |
| 514 | 514 | } |
| ... | ... | @@ -551,7 +551,7 @@ public: |
| 551 | 551 | ~vector() |
| 552 | 552 | { |
| 553 | 553 | __annotate_delete(); |
| 554 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 554 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 555 | 555 | __get_db()->__erase_c(this); |
| 556 | 556 | #endif |
| 557 | 557 | } |
| ... | ... | @@ -789,14 +789,14 @@ public: |
| 789 | 789 | |
| 790 | 790 | bool __invariants() const; |
| 791 | 791 | |
| 792 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 792 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 793 | 793 | |
| 794 | 794 | bool __dereferenceable(const const_iterator* __i) const; |
| 795 | 795 | bool __decrementable(const const_iterator* __i) const; |
| 796 | 796 | bool __addable(const const_iterator* __i, ptrdiff_t __n) const; |
| 797 | 797 | bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; |
| 798 | 798 | |
| 799 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 799 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 800 | 800 | |
| 801 | 801 | private: |
| 802 | 802 | _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); |
| ... | ... | @@ -931,7 +931,7 @@ private: |
| 931 | 931 | |
| 932 | 932 | #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES |
| 933 | 933 | template<class _InputIterator, |
| 934 | class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 934 | class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>, | |
| 935 | 935 | class = typename enable_if<__is_allocator<_Alloc>::value, void>::type |
| 936 | 936 | > |
| 937 | 937 | vector(_InputIterator, _InputIterator) |
| ... | ... | @@ -951,8 +951,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 951 | 951 | { |
| 952 | 952 | |
| 953 | 953 | __annotate_delete(); |
| 954 | __alloc_traits::__construct_backward_with_exception_guarantees( | |
| 955 | this->__alloc(), this->__begin_, this->__end_, __v.__begin_); | |
| 954 | _VSTD::__construct_backward_with_exception_guarantees(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); | |
| 956 | 955 | _VSTD::swap(this->__begin_, __v.__begin_); |
| 957 | 956 | _VSTD::swap(this->__end_, __v.__end_); |
| 958 | 957 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); |
| ... | ... | @@ -967,10 +966,8 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a |
| 967 | 966 | { |
| 968 | 967 | __annotate_delete(); |
| 969 | 968 | pointer __r = __v.__begin_; |
| 970 | __alloc_traits::__construct_backward_with_exception_guarantees( | |
| 971 | this->__alloc(), this->__begin_, __p, __v.__begin_); | |
| 972 | __alloc_traits::__construct_forward_with_exception_guarantees( | |
| 973 | this->__alloc(), __p, this->__end_, __v.__end_); | |
| 969 | _VSTD::__construct_backward_with_exception_guarantees(this->__alloc(), this->__begin_, __p, __v.__begin_); | |
| 970 | _VSTD::__construct_forward_with_exception_guarantees(this->__alloc(), __p, this->__end_, __v.__end_); | |
| 974 | 971 | _VSTD::swap(this->__begin_, __v.__begin_); |
| 975 | 972 | _VSTD::swap(this->__end_, __v.__end_); |
| 976 | 973 | _VSTD::swap(this->__end_cap(), __v.__end_cap()); |
| ... | ... | @@ -1077,7 +1074,7 @@ typename enable_if |
| 1077 | 1074 | vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n) |
| 1078 | 1075 | { |
| 1079 | 1076 | _ConstructTransaction __tx(*this, __n); |
| 1080 | __alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_); | |
| 1077 | _VSTD::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_); | |
| 1081 | 1078 | } |
| 1082 | 1079 | |
| 1083 | 1080 | // Default constructs __n objects starting at __end_ |
| ... | ... | @@ -1121,7 +1118,7 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) |
| 1121 | 1118 | template <class _Tp, class _Allocator> |
| 1122 | 1119 | vector<_Tp, _Allocator>::vector(size_type __n) |
| 1123 | 1120 | { |
| 1124 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1121 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1125 | 1122 | __get_db()->__insert_c(this); |
| 1126 | 1123 | #endif |
| 1127 | 1124 | if (__n > 0) |
| ... | ... | @@ -1136,7 +1133,7 @@ template <class _Tp, class _Allocator> |
| 1136 | 1133 | vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 1137 | 1134 | : __base(__a) |
| 1138 | 1135 | { |
| 1139 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1136 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1140 | 1137 | __get_db()->__insert_c(this); |
| 1141 | 1138 | #endif |
| 1142 | 1139 | if (__n > 0) |
| ... | ... | @@ -1150,7 +1147,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) |
| 1150 | 1147 | template <class _Tp, class _Allocator> |
| 1151 | 1148 | vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) |
| 1152 | 1149 | { |
| 1153 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1150 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1154 | 1151 | __get_db()->__insert_c(this); |
| 1155 | 1152 | #endif |
| 1156 | 1153 | if (__n > 0) |
| ... | ... | @@ -1164,7 +1161,7 @@ template <class _Tp, class _Allocator> |
| 1164 | 1161 | vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) |
| 1165 | 1162 | : __base(__a) |
| 1166 | 1163 | { |
| 1167 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1164 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1168 | 1165 | __get_db()->__insert_c(this); |
| 1169 | 1166 | #endif |
| 1170 | 1167 | if (__n > 0) |
| ... | ... | @@ -1184,7 +1181,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, |
| 1184 | 1181 | typename iterator_traits<_InputIterator>::reference>::value, |
| 1185 | 1182 | _InputIterator>::type __last) |
| 1186 | 1183 | { |
| 1187 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1184 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1188 | 1185 | __get_db()->__insert_c(this); |
| 1189 | 1186 | #endif |
| 1190 | 1187 | for (; __first != __last; ++__first) |
| ... | ... | @@ -1201,7 +1198,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c |
| 1201 | 1198 | typename iterator_traits<_InputIterator>::reference>::value>::type*) |
| 1202 | 1199 | : __base(__a) |
| 1203 | 1200 | { |
| 1204 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1201 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1205 | 1202 | __get_db()->__insert_c(this); |
| 1206 | 1203 | #endif |
| 1207 | 1204 | for (; __first != __last; ++__first) |
| ... | ... | @@ -1217,7 +1214,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, |
| 1217 | 1214 | typename iterator_traits<_ForwardIterator>::reference>::value, |
| 1218 | 1215 | _ForwardIterator>::type __last) |
| 1219 | 1216 | { |
| 1220 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1217 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1221 | 1218 | __get_db()->__insert_c(this); |
| 1222 | 1219 | #endif |
| 1223 | 1220 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); |
| ... | ... | @@ -1237,7 +1234,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las |
| 1237 | 1234 | typename iterator_traits<_ForwardIterator>::reference>::value>::type*) |
| 1238 | 1235 | : __base(__a) |
| 1239 | 1236 | { |
| 1240 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1237 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1241 | 1238 | __get_db()->__insert_c(this); |
| 1242 | 1239 | #endif |
| 1243 | 1240 | size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); |
| ... | ... | @@ -1252,7 +1249,7 @@ template <class _Tp, class _Allocator> |
| 1252 | 1249 | vector<_Tp, _Allocator>::vector(const vector& __x) |
| 1253 | 1250 | : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc())) |
| 1254 | 1251 | { |
| 1255 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1252 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1256 | 1253 | __get_db()->__insert_c(this); |
| 1257 | 1254 | #endif |
| 1258 | 1255 | size_type __n = __x.size(); |
| ... | ... | @@ -1267,7 +1264,7 @@ template <class _Tp, class _Allocator> |
| 1267 | 1264 | vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a) |
| 1268 | 1265 | : __base(__a) |
| 1269 | 1266 | { |
| 1270 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1267 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1271 | 1268 | __get_db()->__insert_c(this); |
| 1272 | 1269 | #endif |
| 1273 | 1270 | size_type __n = __x.size(); |
| ... | ... | @@ -1290,7 +1287,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x) |
| 1290 | 1287 | #endif |
| 1291 | 1288 | : __base(_VSTD::move(__x.__alloc())) |
| 1292 | 1289 | { |
| 1293 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1290 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1294 | 1291 | __get_db()->__insert_c(this); |
| 1295 | 1292 | __get_db()->swap(this, &__x); |
| 1296 | 1293 | #endif |
| ... | ... | @@ -1305,7 +1302,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1305 | 1302 | vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) |
| 1306 | 1303 | : __base(__a) |
| 1307 | 1304 | { |
| 1308 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1305 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1309 | 1306 | __get_db()->__insert_c(this); |
| 1310 | 1307 | #endif |
| 1311 | 1308 | if (__a == __x.__alloc()) |
| ... | ... | @@ -1314,7 +1311,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) |
| 1314 | 1311 | this->__end_ = __x.__end_; |
| 1315 | 1312 | this->__end_cap() = __x.__end_cap(); |
| 1316 | 1313 | __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr; |
| 1317 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1314 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1318 | 1315 | __get_db()->swap(this, &__x); |
| 1319 | 1316 | #endif |
| 1320 | 1317 | } |
| ... | ... | @@ -1329,7 +1326,7 @@ template <class _Tp, class _Allocator> |
| 1329 | 1326 | inline _LIBCPP_INLINE_VISIBILITY |
| 1330 | 1327 | vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) |
| 1331 | 1328 | { |
| 1332 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1329 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1333 | 1330 | __get_db()->__insert_c(this); |
| 1334 | 1331 | #endif |
| 1335 | 1332 | if (__il.size() > 0) |
| ... | ... | @@ -1344,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1344 | 1341 | vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) |
| 1345 | 1342 | : __base(__a) |
| 1346 | 1343 | { |
| 1347 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1344 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1348 | 1345 | __get_db()->__insert_c(this); |
| 1349 | 1346 | #endif |
| 1350 | 1347 | if (__il.size() > 0) |
| ... | ... | @@ -1390,7 +1387,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) |
| 1390 | 1387 | this->__end_ = __c.__end_; |
| 1391 | 1388 | this->__end_cap() = __c.__end_cap(); |
| 1392 | 1389 | __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; |
| 1393 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1390 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1394 | 1391 | __get_db()->swap(this, &__c); |
| 1395 | 1392 | #endif |
| 1396 | 1393 | } |
| ... | ... | @@ -1493,7 +1490,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1493 | 1490 | typename vector<_Tp, _Allocator>::iterator |
| 1494 | 1491 | vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT |
| 1495 | 1492 | { |
| 1496 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1493 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1497 | 1494 | return iterator(this, __p); |
| 1498 | 1495 | #else |
| 1499 | 1496 | return iterator(__p); |
| ... | ... | @@ -1505,7 +1502,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1505 | 1502 | typename vector<_Tp, _Allocator>::const_iterator |
| 1506 | 1503 | vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT |
| 1507 | 1504 | { |
| 1508 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1505 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1509 | 1506 | return const_iterator(this, __p); |
| 1510 | 1507 | #else |
| 1511 | 1508 | return const_iterator(__p); |
| ... | ... | @@ -1709,7 +1706,7 @@ inline _LIBCPP_INLINE_VISIBILITY |
| 1709 | 1706 | typename vector<_Tp, _Allocator>::iterator |
| 1710 | 1707 | vector<_Tp, _Allocator>::erase(const_iterator __position) |
| 1711 | 1708 | { |
| 1712 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1709 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1713 | 1710 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1714 | 1711 | "vector::erase(iterator) called with an iterator not" |
| 1715 | 1712 | " referring to this vector"); |
| ... | ... | @@ -1728,7 +1725,7 @@ template <class _Tp, class _Allocator> |
| 1728 | 1725 | typename vector<_Tp, _Allocator>::iterator |
| 1729 | 1726 | vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) |
| 1730 | 1727 | { |
| 1731 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1728 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1732 | 1729 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, |
| 1733 | 1730 | "vector::erase(iterator, iterator) called with an iterator not" |
| 1734 | 1731 | " referring to this vector"); |
| ... | ... | @@ -1769,7 +1766,7 @@ template <class _Tp, class _Allocator> |
| 1769 | 1766 | typename vector<_Tp, _Allocator>::iterator |
| 1770 | 1767 | vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) |
| 1771 | 1768 | { |
| 1772 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1769 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1773 | 1770 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1774 | 1771 | "vector::insert(iterator, x) called with an iterator not" |
| 1775 | 1772 | " referring to this vector"); |
| ... | ... | @@ -1806,7 +1803,7 @@ template <class _Tp, class _Allocator> |
| 1806 | 1803 | typename vector<_Tp, _Allocator>::iterator |
| 1807 | 1804 | vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) |
| 1808 | 1805 | { |
| 1809 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1806 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1810 | 1807 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1811 | 1808 | "vector::insert(iterator, x) called with an iterator not" |
| 1812 | 1809 | " referring to this vector"); |
| ... | ... | @@ -1839,7 +1836,7 @@ template <class... _Args> |
| 1839 | 1836 | typename vector<_Tp, _Allocator>::iterator |
| 1840 | 1837 | vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) |
| 1841 | 1838 | { |
| 1842 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1839 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1843 | 1840 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1844 | 1841 | "vector::emplace(iterator, x) called with an iterator not" |
| 1845 | 1842 | " referring to this vector"); |
| ... | ... | @@ -1874,7 +1871,7 @@ template <class _Tp, class _Allocator> |
| 1874 | 1871 | typename vector<_Tp, _Allocator>::iterator |
| 1875 | 1872 | vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) |
| 1876 | 1873 | { |
| 1877 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1874 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1878 | 1875 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1879 | 1876 | "vector::insert(iterator, n, x) called with an iterator not" |
| 1880 | 1877 | " referring to this vector"); |
| ... | ... | @@ -1925,7 +1922,7 @@ typename enable_if |
| 1925 | 1922 | >::type |
| 1926 | 1923 | vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) |
| 1927 | 1924 | { |
| 1928 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1925 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1929 | 1926 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1930 | 1927 | "vector::insert(iterator, range) called with an iterator not" |
| 1931 | 1928 | " referring to this vector"); |
| ... | ... | @@ -1978,7 +1975,7 @@ typename enable_if |
| 1978 | 1975 | >::type |
| 1979 | 1976 | vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) |
| 1980 | 1977 | { |
| 1981 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 1978 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 1982 | 1979 | _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, |
| 1983 | 1980 | "vector::insert(iterator, range) called with an iterator not" |
| 1984 | 1981 | " referring to this vector"); |
| ... | ... | @@ -2057,11 +2054,11 @@ vector<_Tp, _Allocator>::swap(vector& __x) |
| 2057 | 2054 | _VSTD::swap(this->__begin_, __x.__begin_); |
| 2058 | 2055 | _VSTD::swap(this->__end_, __x.__end_); |
| 2059 | 2056 | _VSTD::swap(this->__end_cap(), __x.__end_cap()); |
| 2060 | __swap_allocator(this->__alloc(), __x.__alloc(), | |
| 2057 | _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 2061 | 2058 | integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>()); |
| 2062 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2059 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2063 | 2060 | __get_db()->swap(this, &__x); |
| 2064 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2061 | #endif | |
| 2065 | 2062 | } |
| 2066 | 2063 | |
| 2067 | 2064 | template <class _Tp, class _Allocator> |
| ... | ... | @@ -2085,7 +2082,7 @@ vector<_Tp, _Allocator>::__invariants() const |
| 2085 | 2082 | return true; |
| 2086 | 2083 | } |
| 2087 | 2084 | |
| 2088 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2085 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2089 | 2086 | |
| 2090 | 2087 | template <class _Tp, class _Allocator> |
| 2091 | 2088 | bool |
| ... | ... | @@ -2117,16 +2114,16 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __ |
| 2117 | 2114 | return this->__begin_ <= __p && __p < this->__end_; |
| 2118 | 2115 | } |
| 2119 | 2116 | |
| 2120 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2117 | #endif // _LIBCPP_DEBUG_LEVEL == 2 | |
| 2121 | 2118 | |
| 2122 | 2119 | template <class _Tp, class _Allocator> |
| 2123 | 2120 | inline _LIBCPP_INLINE_VISIBILITY |
| 2124 | 2121 | void |
| 2125 | 2122 | vector<_Tp, _Allocator>::__invalidate_all_iterators() |
| 2126 | 2123 | { |
| 2127 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2124 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2128 | 2125 | __get_db()->__invalidate_all(this); |
| 2129 | #endif // _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2126 | #endif | |
| 2130 | 2127 | } |
| 2131 | 2128 | |
| 2132 | 2129 | |
| ... | ... | @@ -2134,7 +2131,7 @@ template <class _Tp, class _Allocator> |
| 2134 | 2131 | inline _LIBCPP_INLINE_VISIBILITY |
| 2135 | 2132 | void |
| 2136 | 2133 | vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { |
| 2137 | #if _LIBCPP_DEBUG_LEVEL >= 2 | |
| 2134 | #if _LIBCPP_DEBUG_LEVEL == 2 | |
| 2138 | 2135 | __c_node* __c = __get_db()->__find_c_and_lock(this); |
| 2139 | 2136 | for (__i_node** __p = __c->end_; __p != __c->beg_; ) { |
| 2140 | 2137 | --__p; |
| ... | ... | @@ -2142,7 +2139,7 @@ vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { |
| 2142 | 2139 | if (__i->base() > __new_last) { |
| 2143 | 2140 | (*__p)->__c_ = nullptr; |
| 2144 | 2141 | if (--__c->end_ != __p) |
| 2145 | memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 2142 | _VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); | |
| 2146 | 2143 | } |
| 2147 | 2144 | } |
| 2148 | 2145 | __get_db()->unlock(); |
| ... | ... | @@ -2883,7 +2880,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>::vector(vector&& __v) |
| 2883 | 2880 | #endif |
| 2884 | 2881 | : __begin_(__v.__begin_), |
| 2885 | 2882 | __size_(__v.__size_), |
| 2886 | __cap_alloc_(std::move(__v.__cap_alloc_)) { | |
| 2883 | __cap_alloc_(_VSTD::move(__v.__cap_alloc_)) { | |
| 2887 | 2884 | __v.__begin_ = nullptr; |
| 2888 | 2885 | __v.__size_ = 0; |
| 2889 | 2886 | __v.__cap() = 0; |
| ... | ... | @@ -3235,7 +3232,7 @@ vector<bool, _Allocator>::swap(vector& __x) |
| 3235 | 3232 | _VSTD::swap(this->__begin_, __x.__begin_); |
| 3236 | 3233 | _VSTD::swap(this->__size_, __x.__size_); |
| 3237 | 3234 | _VSTD::swap(this->__cap(), __x.__cap()); |
| 3238 | __swap_allocator(this->__alloc(), __x.__alloc(), | |
| 3235 | _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(), | |
| 3239 | 3236 | integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>()); |
| 3240 | 3237 | } |
| 3241 | 3238 |
lib/libcxx/include/version+34-2| ... | ... | @@ -24,8 +24,14 @@ __cpp_lib_apply 201603L <tuple> |
| 24 | 24 | __cpp_lib_array_constexpr 201811L <iterator> <array> |
| 25 | 25 | 201603L // C++17 |
| 26 | 26 | __cpp_lib_as_const 201510L <utility> |
| 27 | __cpp_lib_atomic_flag_test 201907L <atomic> | |
| 28 | __cpp_lib_atomic_float 201711L <atomic> | |
| 27 | 29 | __cpp_lib_atomic_is_always_lock_free 201603L <atomic> |
| 30 | __cpp_lib_atomic_lock_free_type_aliases 201907L <atomic> | |
| 28 | 31 | __cpp_lib_atomic_ref 201806L <atomic> |
| 32 | __cpp_lib_atomic_shared_ptr 201711L <atomic> | |
| 33 | __cpp_lib_atomic_value_initialization 201911L <atomic> <memory> | |
| 34 | __cpp_lib_atomic_wait 201907L <atomic> | |
| 29 | 35 | __cpp_lib_bind_front 201811L <functional> |
| 30 | 36 | __cpp_lib_bit_cast 201806L <bit> |
| 31 | 37 | __cpp_lib_bool_constant 201505L <type_traits> |
| ... | ... | @@ -39,9 +45,12 @@ __cpp_lib_chrono_udls 201304L <chrono> |
| 39 | 45 | __cpp_lib_clamp 201603L <algorithm> |
| 40 | 46 | __cpp_lib_complex_udls 201309L <complex> |
| 41 | 47 | __cpp_lib_concepts 201806L <concepts> |
| 48 | __cpp_lib_constexpr_dynamic_alloc 201907L <memory> | |
| 42 | 49 | __cpp_lib_constexpr_misc 201811L <array> <functional> <iterator> |
| 43 | 50 | <string_view> <tuple> <utility> |
| 51 | __cpp_lib_constexpr_numeric 201911L <numeric> | |
| 44 | 52 | __cpp_lib_constexpr_swap_algorithms 201806L <algorithm> |
| 53 | __cpp_lib_constexpr_utility 201811L <utility> | |
| 45 | 54 | __cpp_lib_destroying_delete 201806L <new> |
| 46 | 55 | __cpp_lib_enable_shared_from_this 201603L <memory> |
| 47 | 56 | __cpp_lib_endian 201907L <bit> |
| ... | ... | @@ -58,6 +67,7 @@ __cpp_lib_hardware_interference_size 201703L <new> |
| 58 | 67 | __cpp_lib_has_unique_object_representations 201606L <type_traits> |
| 59 | 68 | __cpp_lib_hypot 201603L <cmath> |
| 60 | 69 | __cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector> |
| 70 | __cpp_lib_int_pow2 202002L <bit> | |
| 61 | 71 | __cpp_lib_integer_sequence 201304L <utility> |
| 62 | 72 | __cpp_lib_integral_constant_callable 201304L <type_traits> |
| 63 | 73 | __cpp_lib_interpolate 201902L <numeric> |
| ... | ... | @@ -200,7 +210,7 @@ __cpp_lib_void_t 201411L <type_traits> |
| 200 | 210 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
| 201 | 211 | # define __cpp_lib_shared_mutex 201505L |
| 202 | 212 | # endif |
| 203 | // # define __cpp_lib_shared_ptr_arrays 201611L | |
| 213 | # define __cpp_lib_shared_ptr_arrays 201611L | |
| 204 | 214 | # define __cpp_lib_shared_ptr_weak_type 201606L |
| 205 | 215 | # define __cpp_lib_string_view 201606L |
| 206 | 216 | // # define __cpp_lib_to_chars 201611L |
| ... | ... | @@ -217,22 +227,44 @@ __cpp_lib_void_t 201411L <type_traits> |
| 217 | 227 | # undef __cpp_lib_array_constexpr |
| 218 | 228 | # define __cpp_lib_array_constexpr 201811L |
| 219 | 229 | # if !defined(_LIBCPP_HAS_NO_THREADS) |
| 230 | # define __cpp_lib_atomic_flag_test 201907L | |
| 231 | # endif | |
| 232 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 233 | // # define __cpp_lib_atomic_float 201711L | |
| 234 | # endif | |
| 235 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 236 | # define __cpp_lib_atomic_lock_free_type_aliases 201907L | |
| 237 | # endif | |
| 238 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 220 | 239 | // # define __cpp_lib_atomic_ref 201806L |
| 221 | 240 | # endif |
| 241 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 242 | // # define __cpp_lib_atomic_shared_ptr 201711L | |
| 243 | # endif | |
| 244 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 245 | // # define __cpp_lib_atomic_value_initialization 201911L | |
| 246 | # endif | |
| 247 | # if !defined(_LIBCPP_HAS_NO_THREADS) | |
| 248 | # define __cpp_lib_atomic_wait 201907L | |
| 249 | # endif | |
| 222 | 250 | // # define __cpp_lib_bind_front 201811L |
| 223 | 251 | // # define __cpp_lib_bit_cast 201806L |
| 224 | 252 | # if !defined(_LIBCPP_NO_HAS_CHAR8_T) |
| 225 | 253 | # define __cpp_lib_char8_t 201811L |
| 226 | 254 | # endif |
| 227 | 255 | // # define __cpp_lib_concepts 201806L |
| 256 | # define __cpp_lib_constexpr_dynamic_alloc 201907L | |
| 228 | 257 | // # define __cpp_lib_constexpr_misc 201811L |
| 258 | # define __cpp_lib_constexpr_numeric 201911L | |
| 229 | 259 | // # define __cpp_lib_constexpr_swap_algorithms 201806L |
| 260 | # define __cpp_lib_constexpr_utility 201811L | |
| 230 | 261 | # if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L |
| 231 | 262 | # define __cpp_lib_destroying_delete 201806L |
| 232 | 263 | # endif |
| 233 | 264 | # define __cpp_lib_endian 201907L |
| 234 | 265 | # define __cpp_lib_erase_if 202002L |
| 235 | // # define __cpp_lib_generic_unordered_lookup 201811L | |
| 266 | # define __cpp_lib_generic_unordered_lookup 201811L | |
| 267 | # define __cpp_lib_int_pow2 202002L | |
| 236 | 268 | # define __cpp_lib_interpolate 201902L |
| 237 | 269 | # if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) |
| 238 | 270 | # define __cpp_lib_is_constant_evaluated 201811L |
lib/libcxx/include/wctype.h+3-1| ... | ... | @@ -50,7 +50,9 @@ wctrans_t wctrans(const char* property); |
| 50 | 50 | #pragma GCC system_header |
| 51 | 51 | #endif |
| 52 | 52 | |
| 53 | #include_next <wctype.h> | |
| 53 | #if __has_include_next(<wctype.h>) | |
| 54 | # include_next <wctype.h> | |
| 55 | #endif | |
| 54 | 56 | |
| 55 | 57 | #ifdef __cplusplus |
| 56 | 58 |
lib/libcxx/src/atomic.cpp-2| ... | ... | @@ -13,8 +13,6 @@ |
| 13 | 13 | #include <atomic> |
| 14 | 14 | #include <functional> |
| 15 | 15 | |
| 16 | #include <iostream> | |
| 17 | ||
| 18 | 16 | #ifdef __linux__ |
| 19 | 17 | |
| 20 | 18 | #include <unistd.h> |
lib/libcxx/src/barrier.cpp+3-9| ... | ... | @@ -26,21 +26,15 @@ public: |
| 26 | 26 | } __tickets[64]; |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | ptrdiff_t& __expected; | |
| 30 | unique_ptr<char[]> __state_allocation; | |
| 31 | __state_t* __state; | |
| 29 | ptrdiff_t& __expected; | |
| 30 | unique_ptr<__state_t[]> __state; | |
| 32 | 31 | |
| 33 | 32 | _LIBCPP_HIDDEN |
| 34 | 33 | __barrier_algorithm_base(ptrdiff_t& __expected) |
| 35 | 34 | : __expected(__expected) |
| 36 | 35 | { |
| 37 | 36 | size_t const __count = (__expected + 1) >> 1; |
| 38 | size_t const __size = sizeof(__state_t) * __count; | |
| 39 | size_t __allocation_size = __size + alignof(__state_t); | |
| 40 | __state_allocation = unique_ptr<char[]>(new char[__allocation_size]); | |
| 41 | void* __allocation = __state_allocation.get(); | |
| 42 | void* const __state_ = align(alignof(__state_t), __size, __allocation, __allocation_size); | |
| 43 | __state = new (__state_) __barrier_algorithm_base::__state_t[__count]; | |
| 37 | __state = unique_ptr<__state_t[]>(new __state_t[__count]); | |
| 44 | 38 | } |
| 45 | 39 | _LIBCPP_HIDDEN |
| 46 | 40 | bool __arrive(__barrier_phase_t __old_phase) |
lib/libcxx/src/chrono.cpp+53-44| ... | ... | @@ -13,11 +13,15 @@ |
| 13 | 13 | #include "include/apple_availability.h" |
| 14 | 14 | |
| 15 | 15 | #if __has_include(<unistd.h>) |
| 16 | #include <unistd.h> | |
| 16 | # include <unistd.h> | |
| 17 | #endif | |
| 18 | ||
| 19 | #if __has_include(<sys/time.h>) | |
| 20 | # include <sys/time.h> // for gettimeofday and timeval | |
| 17 | 21 | #endif |
| 18 | 22 | |
| 19 | 23 | #if !defined(__APPLE__) && _POSIX_TIMERS > 0 |
| 20 | #define _LIBCPP_USE_CLOCK_GETTIME | |
| 24 | # define _LIBCPP_USE_CLOCK_GETTIME | |
| 21 | 25 | #endif |
| 22 | 26 | |
| 23 | 27 | #if defined(_LIBCPP_WIN32API) |
| ... | ... | @@ -27,10 +31,6 @@ |
| 27 | 31 | # if _WIN32_WINNT >= _WIN32_WINNT_WIN8 |
| 28 | 32 | # include <winapifamily.h> |
| 29 | 33 | # endif |
| 30 | #else | |
| 31 | # if !defined(CLOCK_REALTIME) | |
| 32 | # include <sys/time.h> // for gettimeofday and timeval | |
| 33 | # endif // !defined(CLOCK_REALTIME) | |
| 34 | 34 | #endif // defined(_LIBCPP_WIN32API) |
| 35 | 35 | |
| 36 | 36 | #if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB) |
| ... | ... | @@ -42,14 +42,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD |
| 42 | 42 | namespace chrono |
| 43 | 43 | { |
| 44 | 44 | |
| 45 | // | |
| 45 | 46 | // system_clock |
| 47 | // | |
| 46 | 48 | |
| 47 | const bool system_clock::is_steady; | |
| 48 | ||
| 49 | system_clock::time_point | |
| 50 | system_clock::now() _NOEXCEPT | |
| 51 | { | |
| 52 | 49 | #if defined(_LIBCPP_WIN32API) |
| 50 | ||
| 51 | static system_clock::time_point __libcpp_system_clock_now() { | |
| 53 | 52 | // FILETIME is in 100ns units |
| 54 | 53 | using filetime_duration = |
| 55 | 54 | _VSTD::chrono::duration<__int64, |
| ... | ... | @@ -60,31 +59,42 @@ system_clock::now() _NOEXCEPT |
| 60 | 59 | static _LIBCPP_CONSTEXPR const seconds nt_to_unix_epoch{11644473600}; |
| 61 | 60 | |
| 62 | 61 | FILETIME ft; |
| 63 | #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 | |
| 64 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | |
| 62 | #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | |
| 65 | 63 | GetSystemTimePreciseAsFileTime(&ft); |
| 66 | #else | |
| 67 | GetSystemTimeAsFileTime(&ft); | |
| 68 | #endif | |
| 69 | 64 | #else |
| 70 | 65 | GetSystemTimeAsFileTime(&ft); |
| 71 | 66 | #endif |
| 72 | 67 | |
| 73 | 68 | filetime_duration d{(static_cast<__int64>(ft.dwHighDateTime) << 32) | |
| 74 | 69 | static_cast<__int64>(ft.dwLowDateTime)}; |
| 75 | return time_point(duration_cast<duration>(d - nt_to_unix_epoch)); | |
| 76 | #else | |
| 77 | #if defined(CLOCK_REALTIME) | |
| 70 | return system_clock::time_point(duration_cast<system_clock::duration>(d - nt_to_unix_epoch)); | |
| 71 | } | |
| 72 | ||
| 73 | #elif defined(CLOCK_REALTIME) && defined(_LIBCPP_USE_CLOCK_GETTIME) | |
| 74 | ||
| 75 | static system_clock::time_point __libcpp_system_clock_now() { | |
| 78 | 76 | struct timespec tp; |
| 79 | 77 | if (0 != clock_gettime(CLOCK_REALTIME, &tp)) |
| 80 | 78 | __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed"); |
| 81 | return time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000)); | |
| 79 | return system_clock::time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000)); | |
| 80 | } | |
| 81 | ||
| 82 | 82 | #else |
| 83 | ||
| 84 | static system_clock::time_point __libcpp_system_clock_now() { | |
| 83 | 85 | timeval tv; |
| 84 | 86 | gettimeofday(&tv, 0); |
| 85 | return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); | |
| 86 | #endif // CLOCK_REALTIME | |
| 87 | return system_clock::time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); | |
| 88 | } | |
| 89 | ||
| 87 | 90 | #endif |
| 91 | ||
| 92 | const bool system_clock::is_steady; | |
| 93 | ||
| 94 | system_clock::time_point | |
| 95 | system_clock::now() _NOEXCEPT | |
| 96 | { | |
| 97 | return __libcpp_system_clock_now(); | |
| 88 | 98 | } |
| 89 | 99 | |
| 90 | 100 | time_t |
| ... | ... | @@ -99,33 +109,28 @@ system_clock::from_time_t(time_t t) _NOEXCEPT |
| 99 | 109 | return system_clock::time_point(seconds(t)); |
| 100 | 110 | } |
| 101 | 111 | |
| 102 | #ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK | |
| 112 | // | |
| 103 | 113 | // steady_clock |
| 104 | 114 | // |
| 105 | 115 | // Warning: If this is not truly steady, then it is non-conforming. It is |
| 106 | 116 | // better for it to not exist and have the rest of libc++ use system_clock |
| 107 | 117 | // instead. |
| 118 | // | |
| 108 | 119 | |
| 109 | const bool steady_clock::is_steady; | |
| 120 | #ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK | |
| 110 | 121 | |
| 111 | 122 | #if defined(__APPLE__) |
| 112 | 123 | |
| 113 | #if !defined(CLOCK_MONOTONIC_RAW) | |
| 114 | # error "Building libc++ on Apple platforms requires CLOCK_MONOTONIC_RAW" | |
| 115 | #endif | |
| 116 | ||
| 117 | 124 | // On Apple platforms, only CLOCK_UPTIME_RAW, CLOCK_MONOTONIC_RAW or |
| 118 | 125 | // mach_absolute_time are able to time functions in the nanosecond range. |
| 119 | 126 | // Furthermore, only CLOCK_MONOTONIC_RAW is truly monotonic, because it |
| 120 | 127 | // also counts cycles when the system is asleep. Thus, it is the only |
| 121 | 128 | // acceptable implementation of steady_clock. |
| 122 | steady_clock::time_point | |
| 123 | steady_clock::now() _NOEXCEPT | |
| 124 | { | |
| 129 | static steady_clock::time_point __libcpp_steady_clock_now() { | |
| 125 | 130 | struct timespec tp; |
| 126 | 131 | if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp)) |
| 127 | 132 | __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed"); |
| 128 | return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); | |
| 133 | return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); | |
| 129 | 134 | } |
| 130 | 135 | |
| 131 | 136 | #elif defined(_LIBCPP_WIN32API) |
| ... | ... | @@ -138,36 +143,40 @@ steady_clock::now() _NOEXCEPT |
| 138 | 143 | static LARGE_INTEGER |
| 139 | 144 | __QueryPerformanceFrequency() |
| 140 | 145 | { |
| 141 | 	LARGE_INTEGER val; | |
| 142 | 	(void) QueryPerformanceFrequency(&val); | |
| 143 | 	return val; | |
| 146 | LARGE_INTEGER val; | |
| 147 | (void) QueryPerformanceFrequency(&val); | |
| 148 | return val; | |
| 144 | 149 | } |
| 145 | 150 | |
| 146 | steady_clock::time_point | |
| 147 | steady_clock::now() _NOEXCEPT | |
| 148 | { | |
| 151 | static steady_clock::time_point __libcpp_steady_clock_now() { | |
| 149 | 152 | static const LARGE_INTEGER freq = __QueryPerformanceFrequency(); |
| 150 | 153 | |
| 151 | 154 | LARGE_INTEGER counter; |
| 152 | 155 | (void) QueryPerformanceCounter(&counter); |
| 153 | return time_point(duration(counter.QuadPart * nano::den / freq.QuadPart)); | |
| 156 | return steady_clock::time_point(steady_clock::duration(counter.QuadPart * nano::den / freq.QuadPart)); | |
| 154 | 157 | } |
| 155 | 158 | |
| 156 | 159 | #elif defined(CLOCK_MONOTONIC) |
| 157 | 160 | |
| 158 | steady_clock::time_point | |
| 159 | steady_clock::now() _NOEXCEPT | |
| 160 | { | |
| 161 | static steady_clock::time_point __libcpp_steady_clock_now() { | |
| 161 | 162 | struct timespec tp; |
| 162 | 163 | if (0 != clock_gettime(CLOCK_MONOTONIC, &tp)) |
| 163 | 164 | __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed"); |
| 164 | return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); | |
| 165 | return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); | |
| 165 | 166 | } |
| 166 | 167 | |
| 167 | 168 | #else |
| 168 | # error "Monotonic clock not implemented" | |
| 169 | # error "Monotonic clock not implemented on this platform" | |
| 169 | 170 | #endif |
| 170 | 171 | |
| 172 | const bool steady_clock::is_steady; | |
| 173 | ||
| 174 | steady_clock::time_point | |
| 175 | steady_clock::now() _NOEXCEPT | |
| 176 | { | |
| 177 | return __libcpp_steady_clock_now(); | |
| 178 | } | |
| 179 | ||
| 171 | 180 | #endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK |
| 172 | 181 | |
| 173 | 182 | } |
lib/libcxx/src/experimental/memory_resource.cpp-10| ... | ... | @@ -76,16 +76,6 @@ union ResourceInitHelper { |
| 76 | 76 | ~ResourceInitHelper() {} |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | // Detect if the init_priority attribute is supported. | |
| 80 | #if (defined(_LIBCPP_COMPILER_GCC) && defined(__APPLE__)) \ | |
| 81 | || defined(_LIBCPP_COMPILER_MSVC) | |
| 82 | // GCC on Apple doesn't support the init priority attribute, | |
| 83 | // and MSVC doesn't support any GCC attributes. | |
| 84 | # define _LIBCPP_INIT_PRIORITY_MAX | |
| 85 | #else | |
| 86 | # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) | |
| 87 | #endif | |
| 88 | ||
| 89 | 79 | // When compiled in C++14 this initialization should be a constant expression. |
| 90 | 80 | // Only in C++11 is "init_priority" needed to ensure initialization order. |
| 91 | 81 | #if _LIBCPP_STD_VER > 11 |
lib/libcxx/src/filesystem/filesystem_common.h+53-39| ... | ... | @@ -13,8 +13,9 @@ |
| 13 | 13 | #include "filesystem" |
| 14 | 14 | #include "array" |
| 15 | 15 | #include "chrono" |
| 16 | #include "cstdlib" | |
| 17 | 16 | #include "climits" |
| 17 | #include "cstdlib" | |
| 18 | #include "ctime" | |
| 18 | 19 | |
| 19 | 20 | #include <unistd.h> |
| 20 | 21 | #include <sys/stat.h> |
| ... | ... | @@ -47,7 +48,7 @@ static string format_string_imp(const char* msg, ...) { |
| 47 | 48 | struct GuardVAList { |
| 48 | 49 | va_list& target; |
| 49 | 50 | bool active = true; |
| 50 | GuardVAList(va_list& target) : target(target), active(true) {} | |
| 51 | GuardVAList(va_list& tgt) : target(tgt), active(true) {} | |
| 51 | 52 | void clear() { |
| 52 | 53 | if (active) |
| 53 | 54 | va_end(target); |
| ... | ... | @@ -134,50 +135,50 @@ path error_value<path>() { |
| 134 | 135 | |
| 135 | 136 | template <class T> |
| 136 | 137 | struct ErrorHandler { |
| 137 | const char* func_name; | |
| 138 | error_code* ec = nullptr; | |
| 139 | const path* p1 = nullptr; | |
| 140 | const path* p2 = nullptr; | |
| 138 | const char* func_name_; | |
| 139 | error_code* ec_ = nullptr; | |
| 140 | const path* p1_ = nullptr; | |
| 141 | const path* p2_ = nullptr; | |
| 141 | 142 | |
| 142 | 143 | ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr, |
| 143 | 144 | const path* p2 = nullptr) |
| 144 | : func_name(fname), ec(ec), p1(p1), p2(p2) { | |
| 145 | if (ec) | |
| 146 | ec->clear(); | |
| 145 | : func_name_(fname), ec_(ec), p1_(p1), p2_(p2) { | |
| 146 | if (ec_) | |
| 147 | ec_->clear(); | |
| 147 | 148 | } |
| 148 | 149 | |
| 149 | T report(const error_code& m_ec) const { | |
| 150 | if (ec) { | |
| 151 | *ec = m_ec; | |
| 150 | T report(const error_code& ec) const { | |
| 151 | if (ec_) { | |
| 152 | *ec_ = ec; | |
| 152 | 153 | return error_value<T>(); |
| 153 | 154 | } |
| 154 | string what = string("in ") + func_name; | |
| 155 | switch (bool(p1) + bool(p2)) { | |
| 155 | string what = string("in ") + func_name_; | |
| 156 | switch (bool(p1_) + bool(p2_)) { | |
| 156 | 157 | case 0: |
| 157 | __throw_filesystem_error(what, m_ec); | |
| 158 | __throw_filesystem_error(what, ec); | |
| 158 | 159 | case 1: |
| 159 | __throw_filesystem_error(what, *p1, m_ec); | |
| 160 | __throw_filesystem_error(what, *p1_, ec); | |
| 160 | 161 | case 2: |
| 161 | __throw_filesystem_error(what, *p1, *p2, m_ec); | |
| 162 | __throw_filesystem_error(what, *p1_, *p2_, ec); | |
| 162 | 163 | } |
| 163 | 164 | _LIBCPP_UNREACHABLE(); |
| 164 | 165 | } |
| 165 | 166 | |
| 166 | 167 | template <class... Args> |
| 167 | T report(const error_code& m_ec, const char* msg, Args const&... args) const { | |
| 168 | if (ec) { | |
| 169 | *ec = m_ec; | |
| 168 | T report(const error_code& ec, const char* msg, Args const&... args) const { | |
| 169 | if (ec_) { | |
| 170 | *ec_ = ec; | |
| 170 | 171 | return error_value<T>(); |
| 171 | 172 | } |
| 172 | 173 | string what = |
| 173 | string("in ") + func_name + ": " + format_string(msg, args...); | |
| 174 | switch (bool(p1) + bool(p2)) { | |
| 174 | string("in ") + func_name_ + ": " + format_string(msg, args...); | |
| 175 | switch (bool(p1_) + bool(p2_)) { | |
| 175 | 176 | case 0: |
| 176 | __throw_filesystem_error(what, m_ec); | |
| 177 | __throw_filesystem_error(what, ec); | |
| 177 | 178 | case 1: |
| 178 | __throw_filesystem_error(what, *p1, m_ec); | |
| 179 | __throw_filesystem_error(what, *p1_, ec); | |
| 179 | 180 | case 2: |
| 180 | __throw_filesystem_error(what, *p1, *p2, m_ec); | |
| 181 | __throw_filesystem_error(what, *p1_, *p2_, ec); | |
| 181 | 182 | } |
| 182 | 183 | _LIBCPP_UNREACHABLE(); |
| 183 | 184 | } |
| ... | ... | @@ -197,8 +198,9 @@ private: |
| 197 | 198 | using chrono::duration; |
| 198 | 199 | using chrono::duration_cast; |
| 199 | 200 | |
| 200 | using TimeSpec = struct ::timespec; | |
| 201 | using StatT = struct ::stat; | |
| 201 | using TimeSpec = struct timespec; | |
| 202 | using TimeVal = struct timeval; | |
| 203 | using StatT = struct stat; | |
| 202 | 204 | |
| 203 | 205 | template <class FileTimeT, class TimeT, |
| 204 | 206 | bool IsFloat = is_floating_point<typename FileTimeT::rep>::value> |
| ... | ... | @@ -380,26 +382,38 @@ public: |
| 380 | 382 | using fs_time = time_util<file_time_type, time_t, TimeSpec>; |
| 381 | 383 | |
| 382 | 384 | #if defined(__APPLE__) |
| 383 | TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; } | |
| 384 | TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; } | |
| 385 | inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; } | |
| 386 | inline TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; } | |
| 387 | #elif defined(__MVS__) | |
| 388 | inline TimeSpec extract_mtime(StatT const& st) { | |
| 389 | TimeSpec TS = {st.st_mtime, 0}; | |
| 390 | return TS; | |
| 391 | } | |
| 392 | inline TimeSpec extract_atime(StatT const& st) { | |
| 393 | TimeSpec TS = {st.st_atime, 0}; | |
| 394 | return TS; | |
| 395 | } | |
| 385 | 396 | #else |
| 386 | TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; } | |
| 387 | TimeSpec extract_atime(StatT const& st) { return st.st_atim; } | |
| 397 | inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; } | |
| 398 | inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; } | |
| 388 | 399 | #endif |
| 389 | 400 | |
| 390 | // allow the utimes implementation to compile even it we're not going | |
| 391 | // to use it. | |
| 392 | ||
| 393 | bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS, | |
| 394 | error_code& ec) { | |
| 401 | inline TimeVal make_timeval(TimeSpec const& ts) { | |
| 395 | 402 | using namespace chrono; |
| 396 | 403 | auto Convert = [](long nsec) { |
| 397 | using int_type = decltype(std::declval< ::timeval>().tv_usec); | |
| 404 | using int_type = decltype(std::declval<TimeVal>().tv_usec); | |
| 398 | 405 | auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count(); |
| 399 | 406 | return static_cast<int_type>(dur); |
| 400 | 407 | }; |
| 401 | struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)}, | |
| 402 | {TS[1].tv_sec, Convert(TS[1].tv_nsec)}}; | |
| 408 | TimeVal TV = {}; | |
| 409 | TV.tv_sec = ts.tv_sec; | |
| 410 | TV.tv_usec = Convert(ts.tv_nsec); | |
| 411 | return TV; | |
| 412 | } | |
| 413 | ||
| 414 | inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS, | |
| 415 | error_code& ec) { | |
| 416 | TimeVal ConvertedTS[2] = {make_timeval(TS[0]), make_timeval(TS[1])}; | |
| 403 | 417 | if (::utimes(p.c_str(), ConvertedTS) == -1) { |
| 404 | 418 | ec = capture_errno(); |
| 405 | 419 | return true; |
lib/libcxx/src/filesystem/operations.cpp+99-102| ... | ... | @@ -9,8 +9,6 @@ |
| 9 | 9 | #include "filesystem" |
| 10 | 10 | #include "array" |
| 11 | 11 | #include "iterator" |
| 12 | #include "fstream" | |
| 13 | #include "random" /* for unique_path */ | |
| 14 | 12 | #include "string_view" |
| 15 | 13 | #include "type_traits" |
| 16 | 14 | #include "vector" |
| ... | ... | @@ -25,29 +23,23 @@ |
| 25 | 23 | #include <time.h> |
| 26 | 24 | #include <fcntl.h> /* values for fchmodat */ |
| 27 | 25 | |
| 28 | #if defined(__linux__) | |
| 29 | #include <linux/version.h> | |
| 30 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) | |
| 31 | #include <sys/sendfile.h> | |
| 32 | #define _LIBCPP_USE_SENDFILE | |
| 33 | #endif | |
| 26 | #if __has_include(<sys/sendfile.h>) | |
| 27 | # include <sys/sendfile.h> | |
| 28 | # define _LIBCPP_FILESYSTEM_USE_SENDFILE | |
| 34 | 29 | #elif defined(__APPLE__) || __has_include(<copyfile.h>) |
| 35 | #include <copyfile.h> | |
| 36 | #define _LIBCPP_USE_COPYFILE | |
| 30 | # include <copyfile.h> | |
| 31 | # define _LIBCPP_FILESYSTEM_USE_COPYFILE | |
| 32 | #else | |
| 33 | # include "fstream" | |
| 34 | # define _LIBCPP_FILESYSTEM_USE_FSTREAM | |
| 37 | 35 | #endif |
| 38 | 36 | |
| 39 | 37 | #if !defined(CLOCK_REALTIME) |
| 40 | #include <sys/time.h> // for gettimeofday and timeval | |
| 41 | #endif // !defined(CLOCK_REALTIME) | |
| 42 | ||
| 43 | #if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB) | |
| 44 | #pragma comment(lib, "rt") | |
| 38 | # include <sys/time.h> // for gettimeofday and timeval | |
| 45 | 39 | #endif |
| 46 | 40 | |
| 47 | #if defined(_LIBCPP_COMPILER_GCC) | |
| 48 | #if _GNUC_VER < 500 | |
| 49 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" | |
| 50 | #endif | |
| 41 | #if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB) | |
| 42 | # pragma comment(lib, "rt") | |
| 51 | 43 | #endif |
| 52 | 44 | |
| 53 | 45 | _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM |
| ... | ... | @@ -542,7 +534,7 @@ path __canonical(path const& orig_p, error_code* ec) { |
| 542 | 534 | ErrorHandler<path> err("canonical", ec, &orig_p, &cwd); |
| 543 | 535 | |
| 544 | 536 | path p = __do_absolute(orig_p, &cwd, ec); |
| 545 | #if _POSIX_VERSION >= 200112 | |
| 537 | #if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112 | |
| 546 | 538 | std::unique_ptr<char, decltype(&::free)> |
| 547 | 539 | hold(::realpath(p.c_str(), nullptr), &::free); |
| 548 | 540 | if (hold.get() == nullptr) |
| ... | ... | @@ -646,96 +638,83 @@ void __copy(const path& from, const path& to, copy_options options, |
| 646 | 638 | namespace detail { |
| 647 | 639 | namespace { |
| 648 | 640 | |
| 649 | #ifdef _LIBCPP_USE_SENDFILE | |
| 650 | bool copy_file_impl_sendfile(FileDescriptor& read_fd, FileDescriptor& write_fd, | |
| 651 | error_code& ec) { | |
| 652 | ||
| 653 | size_t count = read_fd.get_stat().st_size; | |
| 654 | do { | |
| 655 | ssize_t res; | |
| 656 | if ((res = ::sendfile(write_fd.fd, read_fd.fd, nullptr, count)) == -1) { | |
| 657 | ec = capture_errno(); | |
| 658 | return false; | |
| 659 | } | |
| 660 | count -= res; | |
| 661 | } while (count > 0); | |
| 662 | ||
| 663 | ec.clear(); | |
| 641 | #if defined(_LIBCPP_FILESYSTEM_USE_SENDFILE) | |
| 642 | bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) { | |
| 643 | size_t count = read_fd.get_stat().st_size; | |
| 644 | do { | |
| 645 | ssize_t res; | |
| 646 | if ((res = ::sendfile(write_fd.fd, read_fd.fd, nullptr, count)) == -1) { | |
| 647 | ec = capture_errno(); | |
| 648 | return false; | |
| 649 | } | |
| 650 | count -= res; | |
| 651 | } while (count > 0); | |
| 664 | 652 | |
| 665 | return true; | |
| 666 | } | |
| 667 | #elif defined(_LIBCPP_USE_COPYFILE) | |
| 668 | bool copy_file_impl_copyfile(FileDescriptor& read_fd, FileDescriptor& write_fd, | |
| 669 | error_code& ec) { | |
| 670 | struct CopyFileState { | |
| 671 | copyfile_state_t state; | |
| 672 | CopyFileState() { state = copyfile_state_alloc(); } | |
| 673 | ~CopyFileState() { copyfile_state_free(state); } | |
| 674 | ||
| 675 | private: | |
| 676 | CopyFileState(CopyFileState const&) = delete; | |
| 677 | CopyFileState& operator=(CopyFileState const&) = delete; | |
| 678 | }; | |
| 653 | ec.clear(); | |
| 679 | 654 | |
| 680 | CopyFileState cfs; | |
| 681 | if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_DATA) < 0) { | |
| 682 | ec = capture_errno(); | |
| 683 | return false; | |
| 655 | return true; | |
| 684 | 656 | } |
| 657 | #elif defined(_LIBCPP_FILESYSTEM_USE_COPYFILE) | |
| 658 | bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) { | |
| 659 | struct CopyFileState { | |
| 660 | copyfile_state_t state; | |
| 661 | CopyFileState() { state = copyfile_state_alloc(); } | |
| 662 | ~CopyFileState() { copyfile_state_free(state); } | |
| 685 | 663 | |
| 686 | ec.clear(); | |
| 687 | return true; | |
| 688 | } | |
| 689 | #endif | |
| 664 | private: | |
| 665 | CopyFileState(CopyFileState const&) = delete; | |
| 666 | CopyFileState& operator=(CopyFileState const&) = delete; | |
| 667 | }; | |
| 690 | 668 | |
| 691 | // Note: This function isn't guarded by ifdef's even though it may be unused | |
| 692 | // in order to assure it still compiles. | |
| 693 | __attribute__((unused)) bool copy_file_impl_default(FileDescriptor& read_fd, | |
| 694 | FileDescriptor& write_fd, | |
| 695 | error_code& ec) { | |
| 696 | ifstream in; | |
| 697 | in.__open(read_fd.fd, ios::binary); | |
| 698 | if (!in.is_open()) { | |
| 699 | // This assumes that __open didn't reset the error code. | |
| 700 | ec = capture_errno(); | |
| 701 | return false; | |
| 702 | } | |
| 703 | ofstream out; | |
| 704 | out.__open(write_fd.fd, ios::binary); | |
| 705 | if (!out.is_open()) { | |
| 706 | ec = capture_errno(); | |
| 707 | return false; | |
| 708 | } | |
| 669 | CopyFileState cfs; | |
| 670 | if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_DATA) < 0) { | |
| 671 | ec = capture_errno(); | |
| 672 | return false; | |
| 673 | } | |
| 709 | 674 | |
| 710 | if (in.good() && out.good()) { | |
| 711 | using InIt = istreambuf_iterator<char>; | |
| 712 | using OutIt = ostreambuf_iterator<char>; | |
| 713 | InIt bin(in); | |
| 714 | InIt ein; | |
| 715 | OutIt bout(out); | |
| 716 | copy(bin, ein, bout); | |
| 717 | } | |
| 718 | if (out.fail() || in.fail()) { | |
| 719 | ec = make_error_code(errc::io_error); | |
| 720 | return false; | |
| 675 | ec.clear(); | |
| 676 | return true; | |
| 721 | 677 | } |
| 678 | #elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM) | |
| 679 | bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) { | |
| 680 | ifstream in; | |
| 681 | in.__open(read_fd.fd, ios::binary); | |
| 682 | if (!in.is_open()) { | |
| 683 | // This assumes that __open didn't reset the error code. | |
| 684 | ec = capture_errno(); | |
| 685 | return false; | |
| 686 | } | |
| 687 | read_fd.fd = -1; | |
| 688 | ofstream out; | |
| 689 | out.__open(write_fd.fd, ios::binary); | |
| 690 | if (!out.is_open()) { | |
| 691 | ec = capture_errno(); | |
| 692 | return false; | |
| 693 | } | |
| 694 | write_fd.fd = -1; | |
| 695 | ||
| 696 | if (in.good() && out.good()) { | |
| 697 | using InIt = istreambuf_iterator<char>; | |
| 698 | using OutIt = ostreambuf_iterator<char>; | |
| 699 | InIt bin(in); | |
| 700 | InIt ein; | |
| 701 | OutIt bout(out); | |
| 702 | copy(bin, ein, bout); | |
| 703 | } | |
| 704 | if (out.fail() || in.fail()) { | |
| 705 | ec = make_error_code(errc::io_error); | |
| 706 | return false; | |
| 707 | } | |
| 722 | 708 | |
| 723 | ec.clear(); | |
| 724 | return true; | |
| 725 | } | |
| 726 | ||
| 727 | bool copy_file_impl(FileDescriptor& from, FileDescriptor& to, error_code& ec) { | |
| 728 | #if defined(_LIBCPP_USE_SENDFILE) | |
| 729 | return copy_file_impl_sendfile(from, to, ec); | |
| 730 | #elif defined(_LIBCPP_USE_COPYFILE) | |
| 731 | return copy_file_impl_copyfile(from, to, ec); | |
| 709 | ec.clear(); | |
| 710 | return true; | |
| 711 | } | |
| 732 | 712 | #else |
| 733 | return copy_file_impl_default(from, to, ec); | |
| 734 | #endif | |
| 735 | } | |
| 713 | # error "Unknown implementation for copy_file_impl" | |
| 714 | #endif // copy_file_impl implementation | |
| 736 | 715 | |
| 737 | } // namespace | |
| 738 | } // namespace detail | |
| 716 | } // end anonymous namespace | |
| 717 | } // end namespace detail | |
| 739 | 718 | |
| 740 | 719 | bool __copy_file(const path& from, const path& to, copy_options options, |
| 741 | 720 | error_code* ec) { |
| ... | ... | @@ -870,8 +849,17 @@ bool __create_directory(const path& p, error_code* ec) { |
| 870 | 849 | |
| 871 | 850 | if (::mkdir(p.c_str(), static_cast<int>(perms::all)) == 0) |
| 872 | 851 | return true; |
| 873 | if (errno != EEXIST) | |
| 852 | ||
| 853 | if (errno == EEXIST) { | |
| 854 | error_code mec = capture_errno(); | |
| 855 | error_code ignored_ec; | |
| 856 | const file_status st = status(p, ignored_ec); | |
| 857 | if (!is_directory(st)) { | |
| 858 | err.report(mec); | |
| 859 | } | |
| 860 | } else { | |
| 874 | 861 | err.report(capture_errno()); |
| 862 | } | |
| 875 | 863 | return false; |
| 876 | 864 | } |
| 877 | 865 | |
| ... | ... | @@ -889,8 +877,17 @@ bool __create_directory(path const& p, path const& attributes, error_code* ec) { |
| 889 | 877 | |
| 890 | 878 | if (::mkdir(p.c_str(), attr_stat.st_mode) == 0) |
| 891 | 879 | return true; |
| 892 | if (errno != EEXIST) | |
| 880 | ||
| 881 | if (errno == EEXIST) { | |
| 882 | error_code mec = capture_errno(); | |
| 883 | error_code ignored_ec; | |
| 884 | const file_status st = status(p, ignored_ec); | |
| 885 | if (!is_directory(st)) { | |
| 886 | err.report(mec); | |
| 887 | } | |
| 888 | } else { | |
| 893 | 889 | err.report(capture_errno()); |
| 890 | } | |
| 894 | 891 | return false; |
| 895 | 892 | } |
| 896 | 893 |
lib/libcxx/src/include/config_elast.h+4| ... | ... | @@ -17,10 +17,14 @@ |
| 17 | 17 | #include <errno.h> |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | // Note: _LIBCPP_ELAST needs to be defined only on platforms | |
| 21 | // where strerror/strerror_r can't handle out-of-range errno values. | |
| 20 | 22 | #if defined(ELAST) |
| 21 | 23 | #define _LIBCPP_ELAST ELAST |
| 22 | 24 | #elif defined(_NEWLIB_VERSION) |
| 23 | 25 | #define _LIBCPP_ELAST __ELASTERROR |
| 26 | #elif defined(__NuttX__) | |
| 27 | // No _LIBCPP_ELAST needed on NuttX | |
| 24 | 28 | #elif defined(__Fuchsia__) |
| 25 | 29 | // No _LIBCPP_ELAST needed on Fuchsia |
| 26 | 30 | #elif defined(__wasi__) |
lib/libcxx/src/include/refstring.h+19-6| ... | ... | @@ -13,12 +13,25 @@ |
| 13 | 13 | #include <stdexcept> |
| 14 | 14 | #include <cstddef> |
| 15 | 15 | #include <cstring> |
| 16 | #ifdef __APPLE__ | |
| 17 | #include <dlfcn.h> | |
| 18 | #include <mach-o/dyld.h> | |
| 19 | #endif | |
| 20 | 16 | #include "atomic_support.h" |
| 21 | 17 | |
| 18 | // MacOS and iOS used to ship with libstdc++, and still support old applications | |
| 19 | // linking against libstdc++. The libc++ and libstdc++ exceptions are supposed | |
| 20 | // to be ABI compatible, such that they can be thrown from one library and caught | |
| 21 | // in the other. | |
| 22 | // | |
| 23 | // For that reason, we must look for libstdc++ in the same process and if found, | |
| 24 | // check the string stored in the exception object to see if it is the GCC empty | |
| 25 | // string singleton before manipulating the reference count. This is done so that | |
| 26 | // if an exception is created with a zero-length string in libstdc++, libc++abi | |
| 27 | // won't try to delete the memory. | |
| 28 | #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \ | |
| 29 | defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) | |
| 30 | # define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE | |
| 31 | # include <dlfcn.h> | |
| 32 | # include <mach-o/dyld.h> | |
| 33 | #endif | |
| 34 | ||
| 22 | 35 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 23 | 36 | |
| 24 | 37 | namespace __refstring_imp { namespace { |
| ... | ... | @@ -40,7 +53,7 @@ inline char * data_from_rep(_Rep_base *rep) noexcept { |
| 40 | 53 | return data + sizeof(*rep); |
| 41 | 54 | } |
| 42 | 55 | |
| 43 | #if defined(__APPLE__) | |
| 56 | #if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE) | |
| 44 | 57 | inline |
| 45 | 58 | const char* compute_gcc_empty_string_storage() _NOEXCEPT |
| 46 | 59 | { |
| ... | ... | @@ -115,7 +128,7 @@ __libcpp_refstring::~__libcpp_refstring() { |
| 115 | 128 | |
| 116 | 129 | inline |
| 117 | 130 | bool __libcpp_refstring::__uses_refcount() const { |
| 118 | #ifdef __APPLE__ | |
| 131 | #if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE) | |
| 119 | 132 | return __imp_ != get_gcc_empty_string_storage(); |
| 120 | 133 | #else |
| 121 | 134 | return true; |
lib/libcxx/src/ios.cpp-16| ... | ... | @@ -15,30 +15,14 @@ |
| 15 | 15 | #include "__locale" |
| 16 | 16 | #include "algorithm" |
| 17 | 17 | #include "include/config_elast.h" |
| 18 | #include "istream" | |
| 19 | 18 | #include "limits" |
| 20 | 19 | #include "memory" |
| 21 | 20 | #include "new" |
| 22 | #include "streambuf" | |
| 23 | 21 | #include "string" |
| 24 | 22 | #include "__undef_macros" |
| 25 | 23 | |
| 26 | 24 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | 25 | |
| 28 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>; | |
| 29 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>; | |
| 30 | ||
| 31 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>; | |
| 32 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>; | |
| 33 | ||
| 34 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>; | |
| 35 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>; | |
| 36 | ||
| 37 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>; | |
| 38 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>; | |
| 39 | ||
| 40 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>; | |
| 41 | ||
| 42 | 26 | class _LIBCPP_HIDDEN __iostream_category |
| 43 | 27 | : public __do_message |
| 44 | 28 | { |
lib/libcxx/src/ios.instantiations.cpp created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | //===----------------------------------------------------------------------===// | |
| 2 | // | |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |
| 4 | // See https://llvm.org/LICENSE.txt for license information. | |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| 6 | // | |
| 7 | //===----------------------------------------------------------------------===// | |
| 8 | ||
| 9 | #include "__config" | |
| 10 | #include "fstream" | |
| 11 | #include "ios" | |
| 12 | #include "istream" | |
| 13 | #include "ostream" | |
| 14 | #include "sstream" | |
| 15 | #include "streambuf" | |
| 16 | ||
| 17 | ||
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD | |
| 19 | ||
| 20 | // Original explicit instantiations provided in the library | |
| 21 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>; | |
| 22 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>; | |
| 23 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>; | |
| 24 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>; | |
| 25 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>; | |
| 26 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>; | |
| 27 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>; | |
| 28 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>; | |
| 29 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>; | |
| 30 | ||
| 31 | // Additional instantiations added later. Whether programs rely on these being | |
| 32 | // available is protected by _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1. | |
| 33 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>; | |
| 34 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>; | |
| 35 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>; | |
| 36 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>; | |
| 37 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>; | |
| 38 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>; | |
| 39 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>; | |
| 40 | ||
| 41 | // Add more here if needed... | |
| 42 | ||
| 43 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/iostream.cpp+1-1| ... | ... | @@ -77,7 +77,7 @@ __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_t |
| 77 | 77 | #endif |
| 78 | 78 | ; |
| 79 | 79 | |
| 80 | _LIBCPP_HIDDEN ios_base::Init __start_std_streams; | |
| 80 | _LIBCPP_HIDDEN ios_base::Init __start_std_streams _LIBCPP_INIT_PRIORITY_MAX; | |
| 81 | 81 | |
| 82 | 82 | // On Windows the TLS storage for locales needs to be initialized before we create |
| 83 | 83 | // the standard streams, otherwise it may not be alive during program termination |
lib/libcxx/src/locale.cpp+199-9| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | #include "__sso_allocator" |
| 31 | 31 | #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) |
| 32 | 32 | #include "support/win32/locale_win32.h" |
| 33 | #elif !defined(__BIONIC__) | |
| 33 | #elif !defined(__BIONIC__) && !defined(__NuttX__) | |
| 34 | 34 | #include <langinfo.h> |
| 35 | 35 | #endif |
| 36 | 36 | #include <stdlib.h> |
| ... | ... | @@ -158,7 +158,7 @@ const locale::category locale::all; |
| 158 | 158 | class _LIBCPP_HIDDEN locale::__imp |
| 159 | 159 | : public facet |
| 160 | 160 | { |
| 161 | enum {N = 28}; | |
| 161 | enum {N = 30}; | |
| 162 | 162 | #if defined(_LIBCPP_COMPILER_MSVC) |
| 163 | 163 | // FIXME: MSVC doesn't support aligned parameters by value. |
| 164 | 164 | // I can't get the __sso_allocator to work here |
| ... | ... | @@ -202,8 +202,14 @@ locale::__imp::__imp(size_t refs) |
| 202 | 202 | install(&make<_VSTD::ctype<wchar_t> >(1u)); |
| 203 | 203 | install(&make<codecvt<char, char, mbstate_t> >(1u)); |
| 204 | 204 | install(&make<codecvt<wchar_t, char, mbstate_t> >(1u)); |
| 205 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 205 | 206 | install(&make<codecvt<char16_t, char, mbstate_t> >(1u)); |
| 206 | 207 | install(&make<codecvt<char32_t, char, mbstate_t> >(1u)); |
| 208 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 209 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 210 | install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u)); | |
| 211 | install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u)); | |
| 212 | #endif | |
| 207 | 213 | install(&make<numpunct<char> >(1u)); |
| 208 | 214 | install(&make<numpunct<wchar_t> >(1u)); |
| 209 | 215 | install(&make<num_get<char> >(1u)); |
| ... | ... | @@ -245,8 +251,14 @@ locale::__imp::__imp(const string& name, size_t refs) |
| 245 | 251 | install(new ctype_byname<wchar_t>(name_)); |
| 246 | 252 | install(new codecvt_byname<char, char, mbstate_t>(name_)); |
| 247 | 253 | install(new codecvt_byname<wchar_t, char, mbstate_t>(name_)); |
| 254 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 248 | 255 | install(new codecvt_byname<char16_t, char, mbstate_t>(name_)); |
| 249 | 256 | install(new codecvt_byname<char32_t, char, mbstate_t>(name_)); |
| 257 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 258 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 259 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_)); | |
| 260 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_)); | |
| 261 | #endif | |
| 250 | 262 | install(new numpunct_byname<char>(name_)); |
| 251 | 263 | install(new numpunct_byname<wchar_t>(name_)); |
| 252 | 264 | install(new moneypunct_byname<char, false>(name_)); |
| ... | ... | @@ -315,8 +327,14 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c) |
| 315 | 327 | install(new ctype_byname<wchar_t>(name)); |
| 316 | 328 | install(new codecvt_byname<char, char, mbstate_t>(name)); |
| 317 | 329 | install(new codecvt_byname<wchar_t, char, mbstate_t>(name)); |
| 330 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 318 | 331 | install(new codecvt_byname<char16_t, char, mbstate_t>(name)); |
| 319 | 332 | install(new codecvt_byname<char32_t, char, mbstate_t>(name)); |
| 333 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 334 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 335 | install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name)); | |
| 336 | install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name)); | |
| 337 | #endif | |
| 320 | 338 | } |
| 321 | 339 | if (c & locale::monetary) |
| 322 | 340 | { |
| ... | ... | @@ -385,8 +403,14 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) |
| 385 | 403 | install_from<_VSTD::ctype<char> >(one); |
| 386 | 404 | install_from<_VSTD::ctype<wchar_t> >(one); |
| 387 | 405 | install_from<_VSTD::codecvt<char, char, mbstate_t> >(one); |
| 406 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH | |
| 388 | 407 | install_from<_VSTD::codecvt<char16_t, char, mbstate_t> >(one); |
| 389 | 408 | install_from<_VSTD::codecvt<char32_t, char, mbstate_t> >(one); |
| 409 | _LIBCPP_SUPPRESS_DEPRECATED_POP | |
| 410 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 411 | install_from<_VSTD::codecvt<char16_t, char8_t, mbstate_t> >(one); | |
| 412 | install_from<_VSTD::codecvt<char32_t, char8_t, mbstate_t> >(one); | |
| 413 | #endif | |
| 390 | 414 | install_from<_VSTD::codecvt<wchar_t, char, mbstate_t> >(one); |
| 391 | 415 | } |
| 392 | 416 | if (c & locale::monetary) |
| ... | ... | @@ -1149,7 +1173,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT |
| 1149 | 1173 | { |
| 1150 | 1174 | return _LIBCPP_GET_C_LOCALE->__ctype_toupper; |
| 1151 | 1175 | } |
| 1152 | #elif __NetBSD__ | |
| 1176 | #elif defined(__NetBSD__) | |
| 1153 | 1177 | const short* |
| 1154 | 1178 | ctype<char>::__classic_lower_table() _NOEXCEPT |
| 1155 | 1179 | { |
| ... | ... | @@ -3171,6 +3195,87 @@ codecvt<char16_t, char, mbstate_t>::do_max_length() const _NOEXCEPT |
| 3171 | 3195 | return 4; |
| 3172 | 3196 | } |
| 3173 | 3197 | |
| 3198 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 3199 | ||
| 3200 | // template <> class codecvt<char16_t, char8_t, mbstate_t> | |
| 3201 | ||
| 3202 | locale::id codecvt<char16_t, char8_t, mbstate_t>::id; | |
| 3203 | ||
| 3204 | codecvt<char16_t, char8_t, mbstate_t>::~codecvt() | |
| 3205 | { | |
| 3206 | } | |
| 3207 | ||
| 3208 | codecvt<char16_t, char8_t, mbstate_t>::result | |
| 3209 | codecvt<char16_t, char8_t, mbstate_t>::do_out(state_type&, | |
| 3210 | const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt, | |
| 3211 | extern_type* to, extern_type* to_end, extern_type*& to_nxt) const | |
| 3212 | { | |
| 3213 | const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm); | |
| 3214 | const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end); | |
| 3215 | const uint16_t* _frm_nxt = _frm; | |
| 3216 | uint8_t* _to = reinterpret_cast<uint8_t*>(to); | |
| 3217 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); | |
| 3218 | uint8_t* _to_nxt = _to; | |
| 3219 | result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt); | |
| 3220 | frm_nxt = frm + (_frm_nxt - _frm); | |
| 3221 | to_nxt = to + (_to_nxt - _to); | |
| 3222 | return r; | |
| 3223 | } | |
| 3224 | ||
| 3225 | codecvt<char16_t, char8_t, mbstate_t>::result | |
| 3226 | codecvt<char16_t, char8_t, mbstate_t>::do_in(state_type&, | |
| 3227 | const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt, | |
| 3228 | intern_type* to, intern_type* to_end, intern_type*& to_nxt) const | |
| 3229 | { | |
| 3230 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); | |
| 3231 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); | |
| 3232 | const uint8_t* _frm_nxt = _frm; | |
| 3233 | uint16_t* _to = reinterpret_cast<uint16_t*>(to); | |
| 3234 | uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end); | |
| 3235 | uint16_t* _to_nxt = _to; | |
| 3236 | result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt); | |
| 3237 | frm_nxt = frm + (_frm_nxt - _frm); | |
| 3238 | to_nxt = to + (_to_nxt - _to); | |
| 3239 | return r; | |
| 3240 | } | |
| 3241 | ||
| 3242 | codecvt<char16_t, char8_t, mbstate_t>::result | |
| 3243 | codecvt<char16_t, char8_t, mbstate_t>::do_unshift(state_type&, | |
| 3244 | extern_type* to, extern_type*, extern_type*& to_nxt) const | |
| 3245 | { | |
| 3246 | to_nxt = to; | |
| 3247 | return noconv; | |
| 3248 | } | |
| 3249 | ||
| 3250 | int | |
| 3251 | codecvt<char16_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT | |
| 3252 | { | |
| 3253 | return 0; | |
| 3254 | } | |
| 3255 | ||
| 3256 | bool | |
| 3257 | codecvt<char16_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT | |
| 3258 | { | |
| 3259 | return false; | |
| 3260 | } | |
| 3261 | ||
| 3262 | int | |
| 3263 | codecvt<char16_t, char8_t, mbstate_t>::do_length(state_type&, | |
| 3264 | const extern_type* frm, const extern_type* frm_end, size_t mx) const | |
| 3265 | { | |
| 3266 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); | |
| 3267 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); | |
| 3268 | return utf8_to_utf16_length(_frm, _frm_end, mx); | |
| 3269 | } | |
| 3270 | ||
| 3271 | int | |
| 3272 | codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT | |
| 3273 | { | |
| 3274 | return 4; | |
| 3275 | } | |
| 3276 | ||
| 3277 | #endif | |
| 3278 | ||
| 3174 | 3279 | // template <> class codecvt<char32_t, char, mbstate_t> |
| 3175 | 3280 | |
| 3176 | 3281 | locale::id codecvt<char32_t, char, mbstate_t>::id; |
| ... | ... | @@ -3248,6 +3353,87 @@ codecvt<char32_t, char, mbstate_t>::do_max_length() const _NOEXCEPT |
| 3248 | 3353 | return 4; |
| 3249 | 3354 | } |
| 3250 | 3355 | |
| 3356 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 3357 | ||
| 3358 | // template <> class codecvt<char32_t, char8_t, mbstate_t> | |
| 3359 | ||
| 3360 | locale::id codecvt<char32_t, char8_t, mbstate_t>::id; | |
| 3361 | ||
| 3362 | codecvt<char32_t, char8_t, mbstate_t>::~codecvt() | |
| 3363 | { | |
| 3364 | } | |
| 3365 | ||
| 3366 | codecvt<char32_t, char8_t, mbstate_t>::result | |
| 3367 | codecvt<char32_t, char8_t, mbstate_t>::do_out(state_type&, | |
| 3368 | const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt, | |
| 3369 | extern_type* to, extern_type* to_end, extern_type*& to_nxt) const | |
| 3370 | { | |
| 3371 | const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm); | |
| 3372 | const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end); | |
| 3373 | const uint32_t* _frm_nxt = _frm; | |
| 3374 | uint8_t* _to = reinterpret_cast<uint8_t*>(to); | |
| 3375 | uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end); | |
| 3376 | uint8_t* _to_nxt = _to; | |
| 3377 | result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt); | |
| 3378 | frm_nxt = frm + (_frm_nxt - _frm); | |
| 3379 | to_nxt = to + (_to_nxt - _to); | |
| 3380 | return r; | |
| 3381 | } | |
| 3382 | ||
| 3383 | codecvt<char32_t, char8_t, mbstate_t>::result | |
| 3384 | codecvt<char32_t, char8_t, mbstate_t>::do_in(state_type&, | |
| 3385 | const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt, | |
| 3386 | intern_type* to, intern_type* to_end, intern_type*& to_nxt) const | |
| 3387 | { | |
| 3388 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); | |
| 3389 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); | |
| 3390 | const uint8_t* _frm_nxt = _frm; | |
| 3391 | uint32_t* _to = reinterpret_cast<uint32_t*>(to); | |
| 3392 | uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end); | |
| 3393 | uint32_t* _to_nxt = _to; | |
| 3394 | result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt); | |
| 3395 | frm_nxt = frm + (_frm_nxt - _frm); | |
| 3396 | to_nxt = to + (_to_nxt - _to); | |
| 3397 | return r; | |
| 3398 | } | |
| 3399 | ||
| 3400 | codecvt<char32_t, char8_t, mbstate_t>::result | |
| 3401 | codecvt<char32_t, char8_t, mbstate_t>::do_unshift(state_type&, | |
| 3402 | extern_type* to, extern_type*, extern_type*& to_nxt) const | |
| 3403 | { | |
| 3404 | to_nxt = to; | |
| 3405 | return noconv; | |
| 3406 | } | |
| 3407 | ||
| 3408 | int | |
| 3409 | codecvt<char32_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT | |
| 3410 | { | |
| 3411 | return 0; | |
| 3412 | } | |
| 3413 | ||
| 3414 | bool | |
| 3415 | codecvt<char32_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT | |
| 3416 | { | |
| 3417 | return false; | |
| 3418 | } | |
| 3419 | ||
| 3420 | int | |
| 3421 | codecvt<char32_t, char8_t, mbstate_t>::do_length(state_type&, | |
| 3422 | const extern_type* frm, const extern_type* frm_end, size_t mx) const | |
| 3423 | { | |
| 3424 | const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm); | |
| 3425 | const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end); | |
| 3426 | return utf8_to_ucs4_length(_frm, _frm_end, mx); | |
| 3427 | } | |
| 3428 | ||
| 3429 | int | |
| 3430 | codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT | |
| 3431 | { | |
| 3432 | return 4; | |
| 3433 | } | |
| 3434 | ||
| 3435 | #endif | |
| 3436 | ||
| 3251 | 3437 | // __codecvt_utf8<wchar_t> |
| 3252 | 3438 | |
| 3253 | 3439 | __codecvt_utf8<wchar_t>::result |
| ... | ... | @@ -5128,7 +5314,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) |
| 5128 | 5314 | mb = mbstate_t(); |
| 5129 | 5315 | const char* bb = buf; |
| 5130 | 5316 | size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
| 5131 | if (j == size_t(-1)) | |
| 5317 | if (j == size_t(-1) || j == 0) | |
| 5132 | 5318 | __throw_runtime_error("locale not supported"); |
| 5133 | 5319 | wbe = wbuf + j; |
| 5134 | 5320 | __weeks_[i].assign(wbuf, wbe); |
| ... | ... | @@ -5136,7 +5322,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) |
| 5136 | 5322 | mb = mbstate_t(); |
| 5137 | 5323 | bb = buf; |
| 5138 | 5324 | j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
| 5139 | if (j == size_t(-1)) | |
| 5325 | if (j == size_t(-1) || j == 0) | |
| 5140 | 5326 | __throw_runtime_error("locale not supported"); |
| 5141 | 5327 | wbe = wbuf + j; |
| 5142 | 5328 | __weeks_[i+7].assign(wbuf, wbe); |
| ... | ... | @@ -5149,7 +5335,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) |
| 5149 | 5335 | mb = mbstate_t(); |
| 5150 | 5336 | const char* bb = buf; |
| 5151 | 5337 | size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
| 5152 | if (j == size_t(-1)) | |
| 5338 | if (j == size_t(-1) || j == 0) | |
| 5153 | 5339 | __throw_runtime_error("locale not supported"); |
| 5154 | 5340 | wbe = wbuf + j; |
| 5155 | 5341 | __months_[i].assign(wbuf, wbe); |
| ... | ... | @@ -5157,7 +5343,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) |
| 5157 | 5343 | mb = mbstate_t(); |
| 5158 | 5344 | bb = buf; |
| 5159 | 5345 | j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_); |
| 5160 | if (j == size_t(-1)) | |
| 5346 | if (j == size_t(-1) || j == 0) | |
| 5161 | 5347 | __throw_runtime_error("locale not supported"); |
| 5162 | 5348 | wbe = wbuf + j; |
| 5163 | 5349 | __months_[i+12].assign(wbuf, wbe); |
| ... | ... | @@ -6148,7 +6334,11 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t> |
| 6148 | 6334 | |
| 6149 | 6335 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>; |
| 6150 | 6336 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>; |
| 6151 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>; | |
| 6152 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>; | |
| 6337 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char16_t, char, mbstate_t>; | |
| 6338 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char32_t, char, mbstate_t>; | |
| 6339 | #ifndef _LIBCPP_NO_HAS_CHAR8_T | |
| 6340 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; | |
| 6341 | template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; | |
| 6342 | #endif | |
| 6153 | 6343 | |
| 6154 | 6344 | _LIBCPP_END_NAMESPACE_STD |
lib/libcxx/src/memory.cpp-4| ... | ... | @@ -124,16 +124,12 @@ __shared_weak_count::lock() _NOEXCEPT |
| 124 | 124 | return nullptr; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | #if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) | |
| 128 | ||
| 129 | 127 | const void* |
| 130 | 128 | __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT |
| 131 | 129 | { |
| 132 | 130 | return nullptr; |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | #endif // _LIBCPP_NO_RTTI | |
| 136 | ||
| 137 | 133 | #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| 138 | 134 | |
| 139 | 135 | _LIBCPP_SAFE_STATIC static const std::size_t __sp_mut_count = 16; |
lib/libcxx/src/new.cpp+18-19| ... | ... | @@ -64,7 +64,7 @@ operator new(std::size_t size) _THROW_BAD_ALLOC |
| 64 | 64 | if (size == 0) |
| 65 | 65 | size = 1; |
| 66 | 66 | void* p; |
| 67 | while ((p = ::malloc(size)) == 0) | |
| 67 | while ((p = ::malloc(size)) == nullptr) | |
| 68 | 68 | { |
| 69 | 69 | // If malloc fails and there is a new_handler, |
| 70 | 70 | // call it to try free up memory. |
| ... | ... | @@ -85,7 +85,7 @@ _LIBCPP_WEAK |
| 85 | 85 | void* |
| 86 | 86 | operator new(size_t size, const std::nothrow_t&) _NOEXCEPT |
| 87 | 87 | { |
| 88 | void* p = 0; | |
| 88 | void* p = nullptr; | |
| 89 | 89 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 90 | 90 | try |
| 91 | 91 | { |
| ... | ... | @@ -111,7 +111,7 @@ _LIBCPP_WEAK |
| 111 | 111 | void* |
| 112 | 112 | operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT |
| 113 | 113 | { |
| 114 | void* p = 0; | |
| 114 | void* p = nullptr; | |
| 115 | 115 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 116 | 116 | try |
| 117 | 117 | { |
| ... | ... | @@ -130,7 +130,8 @@ _LIBCPP_WEAK |
| 130 | 130 | void |
| 131 | 131 | operator delete(void* ptr) _NOEXCEPT |
| 132 | 132 | { |
| 133 | ::free(ptr); | |
| 133 | if (ptr) | |
| 134 | ::free(ptr); | |
| 134 | 135 | } |
| 135 | 136 | |
| 136 | 137 | _LIBCPP_WEAK |
| ... | ... | @@ -178,15 +179,16 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC |
| 178 | 179 | size = 1; |
| 179 | 180 | if (static_cast<size_t>(alignment) < sizeof(void*)) |
| 180 | 181 | alignment = std::align_val_t(sizeof(void*)); |
| 182 | ||
| 183 | // Try allocating memory. If allocation fails and there is a new_handler, | |
| 184 | // call it to try free up memory, and try again until it succeeds, or until | |
| 185 | // the new_handler decides to terminate. | |
| 186 | // | |
| 187 | // If allocation fails and there is no new_handler, we throw bad_alloc | |
| 188 | // (or return nullptr if exceptions are disabled). | |
| 181 | 189 | void* p; |
| 182 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 183 | while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr) | |
| 184 | #else | |
| 185 | while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0) | |
| 186 | #endif | |
| 190 | while ((p = std::__libcpp_aligned_alloc(static_cast<std::size_t>(alignment), size)) == nullptr) | |
| 187 | 191 | { |
| 188 | // If posix_memalign fails and there is a new_handler, | |
| 189 | // call it to try free up memory. | |
| 190 | 192 | std::new_handler nh = std::get_new_handler(); |
| 191 | 193 | if (nh) |
| 192 | 194 | nh(); |
| ... | ... | @@ -194,7 +196,6 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC |
| 194 | 196 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 195 | 197 | throw std::bad_alloc(); |
| 196 | 198 | #else |
| 197 | p = nullptr; // posix_memalign doesn't initialize 'p' on failure | |
| 198 | 199 | break; |
| 199 | 200 | #endif |
| 200 | 201 | } |
| ... | ... | @@ -206,7 +207,7 @@ _LIBCPP_WEAK |
| 206 | 207 | void* |
| 207 | 208 | operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT |
| 208 | 209 | { |
| 209 | void* p = 0; | |
| 210 | void* p = nullptr; | |
| 210 | 211 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 211 | 212 | try |
| 212 | 213 | { |
| ... | ... | @@ -232,7 +233,7 @@ _LIBCPP_WEAK |
| 232 | 233 | void* |
| 233 | 234 | operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT |
| 234 | 235 | { |
| 235 | void* p = 0; | |
| 236 | void* p = nullptr; | |
| 236 | 237 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 237 | 238 | try |
| 238 | 239 | { |
| ... | ... | @@ -251,11 +252,9 @@ _LIBCPP_WEAK |
| 251 | 252 | void |
| 252 | 253 | operator delete(void* ptr, std::align_val_t) _NOEXCEPT |
| 253 | 254 | { |
| 254 | #if defined(_LIBCPP_MSVCRT_LIKE) | |
| 255 | ::_aligned_free(ptr); | |
| 256 | #else | |
| 257 | ::free(ptr); | |
| 258 | #endif | |
| 255 | if (ptr) { | |
| 256 | std::__libcpp_aligned_free(ptr); | |
| 257 | } | |
| 259 | 258 | } |
| 260 | 259 | |
| 261 | 260 | _LIBCPP_WEAK |
lib/libcxx/src/optional.cpp+1| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | //===----------------------------------------------------------------------===// |
| 8 | 8 | |
| 9 | 9 | #include "optional" |
| 10 | #include "__availability" | |
| 10 | 11 | |
| 11 | 12 | namespace std |
| 12 | 13 | { |
lib/libcxx/src/support/runtime/exception_fallback.ipp-4| ... | ... | @@ -49,7 +49,6 @@ get_terminate() _NOEXCEPT |
| 49 | 49 | return __libcpp_atomic_load(&__terminate_handler); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | #ifndef __EMSCRIPTEN__ // We provide this in JS | |
| 53 | 52 | _LIBCPP_NORETURN |
| 54 | 53 | void |
| 55 | 54 | terminate() _NOEXCEPT |
| ... | ... | @@ -72,9 +71,7 @@ terminate() _NOEXCEPT |
| 72 | 71 | } |
| 73 | 72 | #endif // _LIBCPP_NO_EXCEPTIONS |
| 74 | 73 | } |
| 75 | #endif // !__EMSCRIPTEN__ | |
| 76 | 74 | |
| 77 | #if !defined(__EMSCRIPTEN__) | |
| 78 | 75 | bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; } |
| 79 | 76 | |
| 80 | 77 | int uncaught_exceptions() _NOEXCEPT |
| ... | ... | @@ -83,7 +80,6 @@ int uncaught_exceptions() _NOEXCEPT |
| 83 | 80 | fprintf(stderr, "uncaught_exceptions not yet implemented\n"); |
| 84 | 81 | ::abort(); |
| 85 | 82 | } |
| 86 | #endif // !__EMSCRIPTEN__ | |
| 87 | 83 | |
| 88 | 84 | |
| 89 | 85 | exception::~exception() _NOEXCEPT |
lib/libcxx/src/thread.cpp+2-16| ... | ... | @@ -14,17 +14,9 @@ |
| 14 | 14 | #include "vector" |
| 15 | 15 | #include "future" |
| 16 | 16 | #include "limits" |
| 17 | #include <sys/types.h> | |
| 18 | ||
| 19 | #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) | |
| 20 | # include <sys/param.h> | |
| 21 | # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) | |
| 22 | # include <sys/sysctl.h> | |
| 23 | # endif | |
| 24 | #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) | |
| 25 | 17 | |
| 26 | 18 | #if __has_include(<unistd.h>) |
| 27 | #include <unistd.h> | |
| 19 | # include <unistd.h> // for sysconf | |
| 28 | 20 | #endif |
| 29 | 21 | |
| 30 | 22 | #if defined(__NetBSD__) |
| ... | ... | @@ -80,13 +72,7 @@ thread::detach() |
| 80 | 72 | unsigned |
| 81 | 73 | thread::hardware_concurrency() _NOEXCEPT |
| 82 | 74 | { |
| 83 | #if defined(CTL_HW) && defined(HW_NCPU) | |
| 84 | unsigned n; | |
| 85 | int mib[2] = {CTL_HW, HW_NCPU}; | |
| 86 | std::size_t s = sizeof(n); | |
| 87 | sysctl(mib, 2, &n, &s, 0, 0); | |
| 88 | return n; | |
| 89 | #elif defined(_SC_NPROCESSORS_ONLN) | |
| 75 | #if defined(_SC_NPROCESSORS_ONLN) | |
| 90 | 76 | long result = sysconf(_SC_NPROCESSORS_ONLN); |
| 91 | 77 | // sysconf returns -1 if the name is invalid, the option does not exist or |
| 92 | 78 | // does not have a definite limit. |
src/libcxx.zig+1| ... | ... | @@ -49,6 +49,7 @@ const libcxx_files = [_][]const u8{ |
| 49 | 49 | "src/future.cpp", |
| 50 | 50 | "src/hash.cpp", |
| 51 | 51 | "src/ios.cpp", |
| 52 | "src/ios.instantiations.cpp", | |
| 52 | 53 | "src/iostream.cpp", |
| 53 | 54 | "src/locale.cpp", |
| 54 | 55 | "src/memory.cpp", |