authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 11:52:51+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 12:18:55+01:00
logf9a11fbfafa7e056c08350f740af8a96a722a235
treeb58a3c881bd097f8e52d7a18d8b2c57e9c39791b
parent1e66ac5755ebe8614b8b3a278eabcfca5f78c3c2

Update libcxx

llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6

106 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 @@
3232# define _GNUC_VER_NEW 0
3333#endif
3434
35#define _LIBCPP_VERSION 11000
35#define _LIBCPP_VERSION 12000
3636
3737#ifndef _LIBCPP_ABI_VERSION
3838# define _LIBCPP_ABI_VERSION 1
3939#endif
4040
41#ifndef __STDC_HOSTED__
41#if __STDC_HOSTED__ == 0
4242# define _LIBCPP_FREESTANDING
4343#endif
4444
......@@ -63,7 +63,7 @@
6363#elif defined(__wasm__)
6464# define _LIBCPP_OBJECT_FORMAT_WASM 1
6565#else
66# error Unknown object file format
66 // ... add new file formats here ...
6767#endif
6868
6969#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
......@@ -105,6 +105,10 @@
105105// Re-worked external template instantiations for std::string with a focus on
106106// performance and fast-path inlining.
107107# 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
108112#elif _LIBCPP_ABI_VERSION == 1
109113# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
110114// Enable compiling copies of now inline methods into the dylib to support
......@@ -121,9 +125,11 @@
121125# endif
122126#endif
123127
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
127133#endif
128134
129135#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
......@@ -344,13 +350,11 @@
344350# if defined(__FreeBSD__)
345351# define _LIBCPP_HAS_ALIGNED_ALLOC
346352# define _LIBCPP_HAS_QUICK_EXIT
347# define _LIBCPP_HAS_C11_FEATURES
348353# if __FreeBSD_version >= 1300064 || \
349354 (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000)
350355# define _LIBCPP_HAS_TIMESPEC_GET
351356# endif
352357# elif defined(__BIONIC__)
353# define _LIBCPP_HAS_C11_FEATURES
354358# if __ANDROID_API__ >= 21
355359# define _LIBCPP_HAS_QUICK_EXIT
356360# endif
......@@ -364,7 +368,6 @@
364368# define _LIBCPP_HAS_ALIGNED_ALLOC
365369# define _LIBCPP_HAS_QUICK_EXIT
366370# define _LIBCPP_HAS_TIMESPEC_GET
367# define _LIBCPP_HAS_C11_FEATURES
368371# elif defined(__linux__)
369372# if !defined(_LIBCPP_HAS_MUSL_LIBC)
370373# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
......@@ -372,16 +375,24 @@
372375# endif
373376# if _LIBCPP_GLIBC_PREREQ(2, 17)
374377# define _LIBCPP_HAS_ALIGNED_ALLOC
375# define _LIBCPP_HAS_C11_FEATURES
376378# define _LIBCPP_HAS_TIMESPEC_GET
377379# endif
378380# else // defined(_LIBCPP_HAS_MUSL_LIBC)
379381# define _LIBCPP_HAS_ALIGNED_ALLOC
380382# define _LIBCPP_HAS_QUICK_EXIT
381383# define _LIBCPP_HAS_TIMESPEC_GET
382# define _LIBCPP_HAS_C11_FEATURES
383384# 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__
385396#endif
386397
387398#ifndef _LIBCPP_CXX03_LANG
......@@ -389,9 +400,7 @@
389400#elif defined(_LIBCPP_COMPILER_CLANG)
390401# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
391402#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"
395404#endif
396405
397406#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
......@@ -433,10 +442,6 @@ typedef __char32_t char32_t;
433442# define _LIBCPP_NORETURN __attribute__ ((noreturn))
434443#endif
435444
436#if !(__has_feature(cxx_lambdas))
437#define _LIBCPP_HAS_NO_LAMBDAS
438#endif
439
440445#if !(__has_feature(cxx_nullptr))
441446# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
442447# define nullptr __nullptr
......@@ -445,18 +450,6 @@ typedef __char32_t char32_t;
445450# endif
446451#endif
447452
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
460453// Objective-C++ features (opt-in)
461454#if __has_feature(objc_arc)
462455#define _LIBCPP_HAS_OBJC_ARC
......@@ -754,16 +747,6 @@ typedef __char32_t char32_t;
754747# endif
755748#endif
756749
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
767750#ifndef _LIBCPP_HIDE_FROM_ABI
768751# if _LIBCPP_HIDE_FROM_ABI_PER_TU
769752# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
......@@ -838,6 +821,12 @@ typedef unsigned int char32_t;
838821# define _LIBCPP_CONSTEXPR constexpr
839822#endif
840823
824#ifndef __cpp_consteval
825# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR
826#else
827# define _LIBCPP_CONSTEVAL consteval
828#endif
829
841830#ifdef _LIBCPP_CXX03_LANG
842831# define _LIBCPP_DEFAULT {}
843832#else
......@@ -863,10 +852,6 @@ typedef unsigned int char32_t;
863852# define _LIBCPP_EXPLICIT
864853#endif
865854
866#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
867#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
868#endif
869
870855#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
871856# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
872857# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
......@@ -880,36 +865,33 @@ typedef unsigned int char32_t;
880865# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
881866#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
882867
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
894880#endif
895881
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
898885#endif
899886
900887#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
901888#define _LIBCPP_EXTERN_TEMPLATE(...)
902#define _LIBCPP_EXTERN_TEMPLATE2(...)
903889#endif
904890
905891#ifndef _LIBCPP_EXTERN_TEMPLATE
906892#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
907893#endif
908894
909#ifndef _LIBCPP_EXTERN_TEMPLATE2
910#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
911#endif
912
913895#ifndef _LIBCPP_EXTERN_TEMPLATE_DEFINE
914896#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
915897#endif
......@@ -938,6 +920,8 @@ typedef unsigned int char32_t;
938920 // We're deferring to Microsoft's STL to provide aligned new et al. We don't
939921 // have it unless the language feature test macro is defined.
940922# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
923#elif defined(__MVS__)
924# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
941925#endif
942926
943927#if defined(__APPLE__)
......@@ -999,6 +983,18 @@ typedef unsigned int char32_t;
999983# define _LIBCPP_DEPRECATED_IN_CXX17
1000984#endif
1001985
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
1002998// Macros to enter and leave a state where deprecation warnings are suppressed.
1003999#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
10041000 (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
......@@ -1037,14 +1033,6 @@ typedef unsigned int char32_t;
10371033# define _LIBCPP_CONSTEXPR_AFTER_CXX17
10381034#endif
10391035
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
10481036// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
10491037// NODISCARD macros to the correct attribute.
10501038#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
......@@ -1079,12 +1067,6 @@ typedef unsigned int char32_t;
10791067# define _LIBCPP_INLINE_VAR
10801068#endif
10811069
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
10881070#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
10891071#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
10901072#define _LIBCPP_CONSTEXPR_IF_NODEBUG
......@@ -1125,11 +1107,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11251107# if defined(__FreeBSD__) || \
11261108 defined(__wasi__) || \
11271109 defined(__NetBSD__) || \
1110 defined(__NuttX__) || \
11281111 defined(__linux__) || \
11291112 defined(__GNU__) || \
11301113 defined(__APPLE__) || \
11311114 defined(__CloudABI__) || \
11321115 defined(__sun__) || \
1116 defined(__MVS__) || \
11331117 (defined(__MINGW32__) && __has_include(<pthread.h>))
11341118# define _LIBCPP_HAS_THREAD_API_PTHREAD
11351119# elif defined(__Fuchsia__)
......@@ -1167,10 +1151,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11671151 _LIBCPP_HAS_NO_THREADS is defined.
11681152#endif
11691153
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
11741154#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
11751155#define __STDCPP_THREADS__ 1
11761156#endif
......@@ -1227,8 +1207,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12271207# endif
12281208#endif
12291209
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__)
12321213#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
12331214#endif
12341215
......@@ -1337,6 +1318,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
13371318#endif
13381319#endif // !defined(_LIBCPP_NODEBUG_TYPE)
13391320
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
13401327#if defined(_LIBCPP_ABI_MICROSOFT) && \
13411328 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
13421329# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
......@@ -1367,120 +1354,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
13671354#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
13681355#endif
13691356
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
14841357#if defined(_LIBCPP_COMPILER_IBM)
14851358#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
14861359#endif
......@@ -1547,6 +1420,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
15471420#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
15481421#endif
15491422
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
15501429#endif // __cplusplus
15511430
15521431#endif // _LIBCPP_CONFIG
lib/libcxx/include/__config_site.in+3-2
......@@ -26,12 +26,13 @@
2626#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
2727#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
2828#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
29#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
2930#cmakedefine _LIBCPP_NO_VCRUNTIME
30#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
3131#cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@
32#endif
3332#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
3433#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
34#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
35#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
3536
3637@_LIBCPP_ABI_DEFINES@
3738
lib/libcxx/include/__debug+17-22
......@@ -27,26 +27,21 @@
2727# include <cstddef>
2828#endif
2929
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
4634# 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
4741#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)
5045#endif
5146
5247_LIBCPP_BEGIN_NAMESPACE_STD
......@@ -59,7 +54,7 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
5954 __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
6055 : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
6156
62 _LIBCPP_FUNC_VIS std::string what() const;
57 _LIBCPP_FUNC_VIS string what() const;
6358
6459 const char* __file_;
6560 int __line_;
......@@ -83,7 +78,7 @@ void __libcpp_abort_debug_function(__libcpp_debug_info const&);
8378_LIBCPP_FUNC_VIS
8479bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
8580
86#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
81#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
8782
8883struct _LIBCPP_TYPE_VIS __c_node;
8984
......@@ -226,7 +221,7 @@ public:
226221
227222 template <class _Cont>
228223 _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);
230225 }
231226
232227 template <class _Cont>
......@@ -271,7 +266,7 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
271266_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
272267
273268
274#endif // _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
269#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
275270
276271_LIBCPP_END_NAMESPACE_STD
277272
lib/libcxx/include/__functional_03+24-24
......@@ -126,7 +126,7 @@ __func<_Fp, _Alloc, _Rp()>::__clone() const
126126 _Ap __a(__f_.second());
127127 typedef __allocator_destructor<_Ap> _Dp;
128128 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));
130130 return __hold.release();
131131}
132132
......@@ -134,7 +134,7 @@ template<class _Fp, class _Alloc, class _Rp>
134134void
135135__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
136136{
137 ::new (__p) __func(__f_.first(), __f_.second());
137 ::new ((void*)__p) __func(__f_.first(), __f_.second());
138138}
139139
140140template<class _Fp, class _Alloc, class _Rp>
......@@ -212,7 +212,7 @@ __func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
212212 _Ap __a(__f_.second());
213213 typedef __allocator_destructor<_Ap> _Dp;
214214 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));
216216 return __hold.release();
217217}
218218
......@@ -220,7 +220,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
220220void
221221__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
222222{
223 ::new (__p) __func(__f_.first(), __f_.second());
223 ::new ((void*)__p) __func(__f_.first(), __f_.second());
224224}
225225
226226template<class _Fp, class _Alloc, class _Rp, class _A0>
......@@ -298,7 +298,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
298298 _Ap __a(__f_.second());
299299 typedef __allocator_destructor<_Ap> _Dp;
300300 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));
302302 return __hold.release();
303303}
304304
......@@ -306,7 +306,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
306306void
307307__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
308308{
309 ::new (__p) __func(__f_.first(), __f_.second());
309 ::new ((void*)__p) __func(__f_.first(), __f_.second());
310310}
311311
312312template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
......@@ -384,7 +384,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
384384 _Ap __a(__f_.second());
385385 typedef __allocator_destructor<_Ap> _Dp;
386386 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));
388388 return __hold.release();
389389}
390390
......@@ -392,7 +392,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
392392void
393393__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
394394{
395 ::new (__p) __func(__f_.first(), __f_.second());
395 ::new ((void*)__p) __func(__f_.first(), __f_.second());
396396}
397397
398398template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
......@@ -554,7 +554,7 @@ function<_Rp()>::function(_Fp __f,
554554 if (sizeof(_FF) <= sizeof(__buf_))
555555 {
556556 __f_ = (__base*)&__buf_;
557 ::new (__f_) _FF(__f);
557 ::new ((void*)__f_) _FF(__f);
558558 }
559559 else
560560 {
......@@ -562,7 +562,7 @@ function<_Rp()>::function(_Fp __f,
562562 _Ap __a;
563563 typedef __allocator_destructor<_Ap> _Dp;
564564 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));
566566 __f_ = __hold.release();
567567 }
568568 }
......@@ -581,7 +581,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
581581 if (sizeof(_FF) <= sizeof(__buf_))
582582 {
583583 __f_ = (__base*)&__buf_;
584 ::new (__f_) _FF(__f, __a0);
584 ::new ((void*)__f_) _FF(__f, __a0);
585585 }
586586 else
587587 {
......@@ -589,7 +589,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
589589 _Ap __a(__a0);
590590 typedef __allocator_destructor<_Ap> _Dp;
591591 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));
593593 __f_ = __hold.release();
594594 }
595595 }
......@@ -834,7 +834,7 @@ function<_Rp(_A0)>::function(_Fp __f,
834834 if (sizeof(_FF) <= sizeof(__buf_))
835835 {
836836 __f_ = (__base*)&__buf_;
837 ::new (__f_) _FF(__f);
837 ::new ((void*)__f_) _FF(__f);
838838 }
839839 else
840840 {
......@@ -842,7 +842,7 @@ function<_Rp(_A0)>::function(_Fp __f,
842842 _Ap __a;
843843 typedef __allocator_destructor<_Ap> _Dp;
844844 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));
846846 __f_ = __hold.release();
847847 }
848848 }
......@@ -861,7 +861,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
861861 if (sizeof(_FF) <= sizeof(__buf_))
862862 {
863863 __f_ = (__base*)&__buf_;
864 ::new (__f_) _FF(__f, __a0);
864 ::new ((void*)__f_) _FF(__f, __a0);
865865 }
866866 else
867867 {
......@@ -869,7 +869,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
869869 _Ap __a(__a0);
870870 typedef __allocator_destructor<_Ap> _Dp;
871871 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));
873873 __f_ = __hold.release();
874874 }
875875 }
......@@ -1114,7 +1114,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
11141114 if (sizeof(_FF) <= sizeof(__buf_))
11151115 {
11161116 __f_ = (__base*)&__buf_;
1117 ::new (__f_) _FF(__f);
1117 ::new ((void*)__f_) _FF(__f);
11181118 }
11191119 else
11201120 {
......@@ -1122,7 +1122,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
11221122 _Ap __a;
11231123 typedef __allocator_destructor<_Ap> _Dp;
11241124 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));
11261126 __f_ = __hold.release();
11271127 }
11281128 }
......@@ -1141,7 +1141,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
11411141 if (sizeof(_FF) <= sizeof(__buf_))
11421142 {
11431143 __f_ = (__base*)&__buf_;
1144 ::new (__f_) _FF(__f, __a0);
1144 ::new ((void*)__f_) _FF(__f, __a0);
11451145 }
11461146 else
11471147 {
......@@ -1149,7 +1149,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
11491149 _Ap __a(__a0);
11501150 typedef __allocator_destructor<_Ap> _Dp;
11511151 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));
11531153 __f_ = __hold.release();
11541154 }
11551155 }
......@@ -1394,7 +1394,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
13941394 if (sizeof(_FF) <= sizeof(__buf_))
13951395 {
13961396 __f_ = (__base*)&__buf_;
1397 ::new (__f_) _FF(__f);
1397 ::new ((void*)__f_) _FF(__f);
13981398 }
13991399 else
14001400 {
......@@ -1402,7 +1402,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
14021402 _Ap __a;
14031403 typedef __allocator_destructor<_Ap> _Dp;
14041404 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));
14061406 __f_ = __hold.release();
14071407 }
14081408 }
......@@ -1421,7 +1421,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
14211421 if (sizeof(_FF) <= sizeof(__buf_))
14221422 {
14231423 __f_ = (__base*)&__buf_;
1424 ::new (__f_) _FF(__f, __a0);
1424 ::new ((void*)__f_) _FF(__f, __a0);
14251425 }
14261426 else
14271427 {
......@@ -1429,7 +1429,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
14291429 _Ap __a(__a0);
14301430 typedef __allocator_destructor<_Ap> _Dp;
14311431 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));
14331433 __f_ = __hold.release();
14341434 }
14351435 }
lib/libcxx/include/__functional_base+27-27
......@@ -298,7 +298,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
298298template <class _Tp, class ..._Args>
299299struct __invoke_return
300300{
301 typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
301 typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
302302};
303303
304304#else // defined(_LIBCPP_CXX03_LANG)
......@@ -314,27 +314,27 @@ struct __invoke_void_return_wrapper
314314#ifndef _LIBCPP_CXX03_LANG
315315 template <class ..._Args>
316316 static _Ret __call(_Args&&... __args) {
317 return __invoke(_VSTD::forward<_Args>(__args)...);
317 return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
318318 }
319319#else
320320 template <class _Fn>
321321 static _Ret __call(_Fn __f) {
322 return __invoke(__f);
322 return _VSTD::__invoke(__f);
323323 }
324324
325325 template <class _Fn, class _A0>
326326 static _Ret __call(_Fn __f, _A0& __a0) {
327 return __invoke(__f, __a0);
327 return _VSTD::__invoke(__f, __a0);
328328 }
329329
330330 template <class _Fn, class _A0, class _A1>
331331 static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
332 return __invoke(__f, __a0, __a1);
332 return _VSTD::__invoke(__f, __a0, __a1);
333333 }
334334
335335 template <class _Fn, class _A0, class _A1, class _A2>
336336 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);
338338 }
339339#endif
340340};
......@@ -345,27 +345,27 @@ struct __invoke_void_return_wrapper<void>
345345#ifndef _LIBCPP_CXX03_LANG
346346 template <class ..._Args>
347347 static void __call(_Args&&... __args) {
348 __invoke(_VSTD::forward<_Args>(__args)...);
348 _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
349349 }
350350#else
351351 template <class _Fn>
352352 static void __call(_Fn __f) {
353 __invoke(__f);
353 _VSTD::__invoke(__f);
354354 }
355355
356356 template <class _Fn, class _A0>
357357 static void __call(_Fn __f, _A0& __a0) {
358 __invoke(__f, __a0);
358 _VSTD::__invoke(__f, __a0);
359359 }
360360
361361 template <class _Fn, class _A0, class _A1>
362362 static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
363 __invoke(__f, __a0, __a1);
363 _VSTD::__invoke(__f, __a0, __a1);
364364 }
365365
366366 template <class _Fn, class _A0, class _A1, class _A2>
367367 static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
368 __invoke(__f, __a0, __a1, __a2);
368 _VSTD::__invoke(__f, __a0, __a1, __a2);
369369 }
370370#endif
371371};
......@@ -398,112 +398,112 @@ public:
398398 _LIBCPP_INLINE_VISIBILITY
399399 typename __invoke_of<type&, _ArgTypes...>::type
400400 operator() (_ArgTypes&&... __args) const {
401 return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
401 return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
402402 }
403403#else
404404
405405 _LIBCPP_INLINE_VISIBILITY
406406 typename __invoke_return<type>::type
407407 operator() () const {
408 return __invoke(get());
408 return _VSTD::__invoke(get());
409409 }
410410
411411 template <class _A0>
412412 _LIBCPP_INLINE_VISIBILITY
413413 typename __invoke_return0<type, _A0>::type
414414 operator() (_A0& __a0) const {
415 return __invoke(get(), __a0);
415 return _VSTD::__invoke(get(), __a0);
416416 }
417417
418418 template <class _A0>
419419 _LIBCPP_INLINE_VISIBILITY
420420 typename __invoke_return0<type, _A0 const>::type
421421 operator() (_A0 const& __a0) const {
422 return __invoke(get(), __a0);
422 return _VSTD::__invoke(get(), __a0);
423423 }
424424
425425 template <class _A0, class _A1>
426426 _LIBCPP_INLINE_VISIBILITY
427427 typename __invoke_return1<type, _A0, _A1>::type
428428 operator() (_A0& __a0, _A1& __a1) const {
429 return __invoke(get(), __a0, __a1);
429 return _VSTD::__invoke(get(), __a0, __a1);
430430 }
431431
432432 template <class _A0, class _A1>
433433 _LIBCPP_INLINE_VISIBILITY
434434 typename __invoke_return1<type, _A0 const, _A1>::type
435435 operator() (_A0 const& __a0, _A1& __a1) const {
436 return __invoke(get(), __a0, __a1);
436 return _VSTD::__invoke(get(), __a0, __a1);
437437 }
438438
439439 template <class _A0, class _A1>
440440 _LIBCPP_INLINE_VISIBILITY
441441 typename __invoke_return1<type, _A0, _A1 const>::type
442442 operator() (_A0& __a0, _A1 const& __a1) const {
443 return __invoke(get(), __a0, __a1);
443 return _VSTD::__invoke(get(), __a0, __a1);
444444 }
445445
446446 template <class _A0, class _A1>
447447 _LIBCPP_INLINE_VISIBILITY
448448 typename __invoke_return1<type, _A0 const, _A1 const>::type
449449 operator() (_A0 const& __a0, _A1 const& __a1) const {
450 return __invoke(get(), __a0, __a1);
450 return _VSTD::__invoke(get(), __a0, __a1);
451451 }
452452
453453 template <class _A0, class _A1, class _A2>
454454 _LIBCPP_INLINE_VISIBILITY
455455 typename __invoke_return2<type, _A0, _A1, _A2>::type
456456 operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
457 return __invoke(get(), __a0, __a1, __a2);
457 return _VSTD::__invoke(get(), __a0, __a1, __a2);
458458 }
459459
460460 template <class _A0, class _A1, class _A2>
461461 _LIBCPP_INLINE_VISIBILITY
462462 typename __invoke_return2<type, _A0 const, _A1, _A2>::type
463463 operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
464 return __invoke(get(), __a0, __a1, __a2);
464 return _VSTD::__invoke(get(), __a0, __a1, __a2);
465465 }
466466
467467 template <class _A0, class _A1, class _A2>
468468 _LIBCPP_INLINE_VISIBILITY
469469 typename __invoke_return2<type, _A0, _A1 const, _A2>::type
470470 operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
471 return __invoke(get(), __a0, __a1, __a2);
471 return _VSTD::__invoke(get(), __a0, __a1, __a2);
472472 }
473473
474474 template <class _A0, class _A1, class _A2>
475475 _LIBCPP_INLINE_VISIBILITY
476476 typename __invoke_return2<type, _A0, _A1, _A2 const>::type
477477 operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
478 return __invoke(get(), __a0, __a1, __a2);
478 return _VSTD::__invoke(get(), __a0, __a1, __a2);
479479 }
480480
481481 template <class _A0, class _A1, class _A2>
482482 _LIBCPP_INLINE_VISIBILITY
483483 typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
484484 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);
486486 }
487487
488488 template <class _A0, class _A1, class _A2>
489489 _LIBCPP_INLINE_VISIBILITY
490490 typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
491491 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);
493493 }
494494
495495 template <class _A0, class _A1, class _A2>
496496 _LIBCPP_INLINE_VISIBILITY
497497 typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
498498 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);
500500 }
501501
502502 template <class _A0, class _A1, class _A2>
503503 _LIBCPP_INLINE_VISIBILITY
504504 typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
505505 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);
507507 }
508508#endif // _LIBCPP_CXX03_LANG
509509};
lib/libcxx/include/__functional_base_03+12-12
......@@ -40,7 +40,7 @@ struct __enable_invoke_imp<_Ret, _T1, false, true> {
4040template <class _Ret, class _T1>
4141struct __enable_invoke_imp<_Ret, _T1, false, false> {
4242 typedef typename add_lvalue_reference<
43 typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type
43 typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
4444 >::type _Bullet4;
4545 typedef _Bullet4 type;
4646};
......@@ -142,7 +142,7 @@ __invoke(_Fn __f, _T1& __t1) {
142142
143143template <class _Fp>
144144inline _LIBCPP_INLINE_VISIBILITY
145decltype(_VSTD::declval<_Fp&>()())
145decltype(declval<_Fp&>()())
146146__invoke(_Fp& __f)
147147{
148148 return __f();
......@@ -150,7 +150,7 @@ __invoke(_Fp& __f)
150150
151151template <class _Fp, class _A0>
152152inline _LIBCPP_INLINE_VISIBILITY
153decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
153decltype(declval<_Fp&>()(declval<_A0&>()))
154154__invoke(_Fp& __f, _A0& __a0)
155155{
156156 return __f(__a0);
......@@ -158,7 +158,7 @@ __invoke(_Fp& __f, _A0& __a0)
158158
159159template <class _Fp, class _A0, class _A1>
160160inline _LIBCPP_INLINE_VISIBILITY
161decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
161decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
162162__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
163163{
164164 return __f(__a0, __a1);
......@@ -166,7 +166,7 @@ __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
166166
167167template <class _Fp, class _A0, class _A1, class _A2>
168168inline _LIBCPP_INLINE_VISIBILITY
169decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
169decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
170170__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
171171{
172172 return __f(__a0, __a1, __a2);
......@@ -181,13 +181,13 @@ struct __invoke_return
181181template <class _Fp>
182182struct __invoke_return<_Fp, false>
183183{
184 typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
184 typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type;
185185};
186186
187187template <class _Tp, class _A0>
188188struct __invoke_return0
189189{
190 typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
190 typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type;
191191};
192192
193193template <class _Rp, class _Tp, class _A0>
......@@ -199,8 +199,8 @@ struct __invoke_return0<_Rp _Tp::*, _A0>
199199template <class _Tp, class _A0, class _A1>
200200struct __invoke_return1
201201{
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;
204204};
205205
206206template <class _Rp, class _Class, class _A0, class _A1>
......@@ -211,9 +211,9 @@ struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
211211template <class _Tp, class _A0, class _A1, class _A2>
212212struct __invoke_return2
213213{
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;
217217};
218218
219219template <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
3434template <class _Key, class _Tp>
3535struct __hash_value_type;
3636
37#ifndef _LIBCPP_CXX03_LANG
3837template <class _Tp>
3938struct __is_hash_value_type_imp : false_type {};
4039
4140template <class _Key, class _Value>
42struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value>> : true_type {};
41struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value> > : true_type {};
4342
4443template <class ..._Args>
4544struct __is_hash_value_type : false_type {};
4645
4746template <class _One>
4847struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {};
49#endif
5048
5149_LIBCPP_FUNC_VIS
5250size_t __next_prime(size_t __n);
......@@ -122,7 +120,7 @@ inline _LIBCPP_INLINE_VISIBILITY
122120size_t
123121__next_hash_pow2(size_t __n)
124122{
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)));
126124}
127125
128126
......@@ -155,12 +153,10 @@ struct __hash_key_value_types {
155153 static __container_value_type* __get_ptr(__node_value_type& __n) {
156154 return _VSTD::addressof(__n);
157155 }
158#ifndef _LIBCPP_CXX03_LANG
159156 _LIBCPP_INLINE_VISIBILITY
160157 static __container_value_type&& __move(__node_value_type& __v) {
161158 return _VSTD::move(__v);
162159 }
163#endif
164160};
165161
166162template <class _Key, class _Tp>
......@@ -197,13 +193,10 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
197193 static __container_value_type* __get_ptr(__node_value_type& __n) {
198194 return _VSTD::addressof(__n.__get_value());
199195 }
200#ifndef _LIBCPP_CXX03_LANG
201196 _LIBCPP_INLINE_VISIBILITY
202197 static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
203198 return __v.__move();
204199 }
205#endif
206
207200};
208201
209202template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>,
......@@ -295,10 +288,12 @@ public:
295288 typedef typename _NodeTypes::__node_value_type_pointer pointer;
296289
297290 _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
299294 }
300295
301#if _LIBCPP_DEBUG_LEVEL >= 2
296#if _LIBCPP_DEBUG_LEVEL == 2
302297 _LIBCPP_INLINE_VISIBILITY
303298 __hash_iterator(const __hash_iterator& __i)
304299 : __node_(__i.__node_)
......@@ -322,7 +317,7 @@ public:
322317 }
323318 return *this;
324319 }
325#endif // _LIBCPP_DEBUG_LEVEL >= 2
320#endif // _LIBCPP_DEBUG_LEVEL == 2
326321
327322 _LIBCPP_INLINE_VISIBILITY
328323 reference operator*() const {
......@@ -364,7 +359,7 @@ public:
364359 {return !(__x == __y);}
365360
366361private:
367#if _LIBCPP_DEBUG_LEVEL >= 2
362#if _LIBCPP_DEBUG_LEVEL == 2
368363 _LIBCPP_INLINE_VISIBILITY
369364 __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
370365 : __node_(__node)
......@@ -405,17 +400,21 @@ public:
405400
406401
407402 _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
409406 }
410407
411408 _LIBCPP_INLINE_VISIBILITY
412409 __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
413410 : __node_(__x.__node_)
414411 {
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
416415 }
417416
418#if _LIBCPP_DEBUG_LEVEL >= 2
417#if _LIBCPP_DEBUG_LEVEL == 2
419418 _LIBCPP_INLINE_VISIBILITY
420419 __hash_const_iterator(const __hash_const_iterator& __i)
421420 : __node_(__i.__node_)
......@@ -439,7 +438,7 @@ public:
439438 }
440439 return *this;
441440 }
442#endif // _LIBCPP_DEBUG_LEVEL >= 2
441#endif // _LIBCPP_DEBUG_LEVEL == 2
443442
444443 _LIBCPP_INLINE_VISIBILITY
445444 reference operator*() const {
......@@ -480,7 +479,7 @@ public:
480479 {return !(__x == __y);}
481480
482481private:
483#if _LIBCPP_DEBUG_LEVEL >= 2
482#if _LIBCPP_DEBUG_LEVEL == 2
484483 _LIBCPP_INLINE_VISIBILITY
485484 __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
486485 : __node_(__node)
......@@ -518,10 +517,12 @@ public:
518517 typedef typename _NodeTypes::__node_value_type_pointer pointer;
519518
520519 _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
522523 }
523524
524#if _LIBCPP_DEBUG_LEVEL >= 2
525#if _LIBCPP_DEBUG_LEVEL == 2
525526 _LIBCPP_INLINE_VISIBILITY
526527 __hash_local_iterator(const __hash_local_iterator& __i)
527528 : __node_(__i.__node_),
......@@ -549,7 +550,7 @@ public:
549550 }
550551 return *this;
551552 }
552#endif // _LIBCPP_DEBUG_LEVEL >= 2
553#endif // _LIBCPP_DEBUG_LEVEL == 2
553554
554555 _LIBCPP_INLINE_VISIBILITY
555556 reference operator*() const {
......@@ -593,7 +594,7 @@ public:
593594 {return !(__x == __y);}
594595
595596private:
596#if _LIBCPP_DEBUG_LEVEL >= 2
597#if _LIBCPP_DEBUG_LEVEL == 2
597598 _LIBCPP_INLINE_VISIBILITY
598599 __hash_local_iterator(__next_pointer __node, size_t __bucket,
599600 size_t __bucket_count, const void* __c) _NOEXCEPT
......@@ -650,7 +651,9 @@ public:
650651
651652
652653 _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
654657 }
655658
656659 _LIBCPP_INLINE_VISIBILITY
......@@ -659,10 +662,12 @@ public:
659662 __bucket_(__x.__bucket_),
660663 __bucket_count_(__x.__bucket_count_)
661664 {
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
663668 }
664669
665#if _LIBCPP_DEBUG_LEVEL >= 2
670#if _LIBCPP_DEBUG_LEVEL == 2
666671 _LIBCPP_INLINE_VISIBILITY
667672 __hash_const_local_iterator(const __hash_const_local_iterator& __i)
668673 : __node_(__i.__node_),
......@@ -690,7 +695,7 @@ public:
690695 }
691696 return *this;
692697 }
693#endif // _LIBCPP_DEBUG_LEVEL >= 2
698#endif // _LIBCPP_DEBUG_LEVEL == 2
694699
695700 _LIBCPP_INLINE_VISIBILITY
696701 reference operator*() const {
......@@ -734,7 +739,7 @@ public:
734739 {return !(__x == __y);}
735740
736741private:
737#if _LIBCPP_DEBUG_LEVEL >= 2
742#if _LIBCPP_DEBUG_LEVEL == 2
738743 _LIBCPP_INLINE_VISIBILITY
739744 __hash_const_local_iterator(__next_pointer __node, size_t __bucket,
740745 size_t __bucket_count, const void* __c) _NOEXCEPT
......@@ -783,7 +788,6 @@ public:
783788 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
784789 : __data_(__size, __a) {}
785790
786#ifndef _LIBCPP_CXX03_LANG
787791 _LIBCPP_INLINE_VISIBILITY
788792 __bucket_list_deallocator(__bucket_list_deallocator&& __x)
789793 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
......@@ -791,7 +795,6 @@ public:
791795 {
792796 __x.size() = 0;
793797 }
794#endif
795798
796799 _LIBCPP_INLINE_VISIBILITY
797800 size_type& size() _NOEXCEPT {return __data_.first();}
......@@ -1007,7 +1010,6 @@ public:
10071010 explicit __hash_table(const allocator_type& __a);
10081011 __hash_table(const __hash_table& __u);
10091012 __hash_table(const __hash_table& __u, const allocator_type& __a);
1010#ifndef _LIBCPP_CXX03_LANG
10111013 __hash_table(__hash_table&& __u)
10121014 _NOEXCEPT_(
10131015 is_nothrow_move_constructible<__bucket_list>::value &&
......@@ -1016,11 +1018,9 @@ public:
10161018 is_nothrow_move_constructible<hasher>::value &&
10171019 is_nothrow_move_constructible<key_equal>::value);
10181020 __hash_table(__hash_table&& __u, const allocator_type& __a);
1019#endif // _LIBCPP_CXX03_LANG
10201021 ~__hash_table();
10211022
10221023 __hash_table& operator=(const __hash_table& __u);
1023#ifndef _LIBCPP_CXX03_LANG
10241024 _LIBCPP_INLINE_VISIBILITY
10251025 __hash_table& operator=(__hash_table&& __u)
10261026 _NOEXCEPT_(
......@@ -1028,7 +1028,6 @@ public:
10281028 is_nothrow_move_assignable<__node_allocator>::value &&
10291029 is_nothrow_move_assignable<hasher>::value &&
10301030 is_nothrow_move_assignable<key_equal>::value);
1031#endif
10321031 template <class _InputIterator>
10331032 void __assign_unique(_InputIterator __first, _InputIterator __last);
10341033 template <class _InputIterator>
......@@ -1037,7 +1036,7 @@ public:
10371036 _LIBCPP_INLINE_VISIBILITY
10381037 size_type max_size() const _NOEXCEPT
10391038 {
1040 return std::min<size_type>(
1039 return _VSTD::min<size_type>(
10411040 __node_traits::max_size(__node_alloc()),
10421041 numeric_limits<difference_type >::max()
10431042 );
......@@ -1066,7 +1065,6 @@ public:
10661065 iterator __node_insert_multi(const_iterator __p,
10671066 __node_pointer __nd);
10681067
1069#ifndef _LIBCPP_CXX03_LANG
10701068 template <class _Key, class ..._Args>
10711069 _LIBCPP_INLINE_VISIBILITY
10721070 pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
......@@ -1151,15 +1149,6 @@ public:
11511149 return __emplace_hint_multi(__p, _VSTD::forward<_Pp>(__x));
11521150 }
11531151
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
11631152 _LIBCPP_INLINE_VISIBILITY
11641153 pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
11651154 return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
......@@ -1295,7 +1284,7 @@ public:
12951284 {
12961285 _LIBCPP_ASSERT(__n < bucket_count(),
12971286 "unordered container::begin(n) called with n >= bucket_count()");
1298#if _LIBCPP_DEBUG_LEVEL >= 2
1287#if _LIBCPP_DEBUG_LEVEL == 2
12991288 return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
13001289#else
13011290 return local_iterator(__bucket_list_[__n], __n, bucket_count());
......@@ -1308,7 +1297,7 @@ public:
13081297 {
13091298 _LIBCPP_ASSERT(__n < bucket_count(),
13101299 "unordered container::end(n) called with n >= bucket_count()");
1311#if _LIBCPP_DEBUG_LEVEL >= 2
1300#if _LIBCPP_DEBUG_LEVEL == 2
13121301 return local_iterator(nullptr, __n, bucket_count(), this);
13131302#else
13141303 return local_iterator(nullptr, __n, bucket_count());
......@@ -1321,7 +1310,7 @@ public:
13211310 {
13221311 _LIBCPP_ASSERT(__n < bucket_count(),
13231312 "unordered container::cbegin(n) called with n >= bucket_count()");
1324#if _LIBCPP_DEBUG_LEVEL >= 2
1313#if _LIBCPP_DEBUG_LEVEL == 2
13251314 return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
13261315#else
13271316 return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
......@@ -1334,35 +1323,30 @@ public:
13341323 {
13351324 _LIBCPP_ASSERT(__n < bucket_count(),
13361325 "unordered container::cend(n) called with n >= bucket_count()");
1337#if _LIBCPP_DEBUG_LEVEL >= 2
1326#if _LIBCPP_DEBUG_LEVEL == 2
13381327 return const_local_iterator(nullptr, __n, bucket_count(), this);
13391328#else
13401329 return const_local_iterator(nullptr, __n, bucket_count());
13411330#endif
13421331 }
13431332
1344#if _LIBCPP_DEBUG_LEVEL >= 2
1333#if _LIBCPP_DEBUG_LEVEL == 2
13451334
13461335 bool __dereferenceable(const const_iterator* __i) const;
13471336 bool __decrementable(const const_iterator* __i) const;
13481337 bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
13491338 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
13501339
1351#endif // _LIBCPP_DEBUG_LEVEL >= 2
1340#endif // _LIBCPP_DEBUG_LEVEL == 2
13521341
13531342private:
13541343 void __rehash(size_type __n);
13551344
1356#ifndef _LIBCPP_CXX03_LANG
13571345 template <class ..._Args>
13581346 __node_holder __construct_node(_Args&& ...__args);
13591347
13601348 template <class _First, class ..._Rest>
13611349 __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
13661350
13671351
13681352 _LIBCPP_INLINE_VISIBILITY
......@@ -1373,7 +1357,6 @@ private:
13731357 _LIBCPP_INLINE_VISIBILITY
13741358 void __copy_assign_alloc(const __hash_table&, false_type) {}
13751359
1376#ifndef _LIBCPP_CXX03_LANG
13771360 void __move_assign(__hash_table& __u, false_type);
13781361 void __move_assign(__hash_table& __u, true_type)
13791362 _NOEXCEPT_(
......@@ -1400,7 +1383,6 @@ private:
14001383 }
14011384 _LIBCPP_INLINE_VISIBILITY
14021385 void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
1403#endif // _LIBCPP_CXX03_LANG
14041386
14051387 void __deallocate_node(__next_pointer __np) _NOEXCEPT;
14061388 __next_pointer __detach() _NOEXCEPT;
......@@ -1477,8 +1459,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
14771459{
14781460}
14791461
1480#ifndef _LIBCPP_CXX03_LANG
1481
14821462template <class _Tp, class _Hash, class _Equal, class _Alloc>
14831463__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
14841464 _NOEXCEPT_(
......@@ -1526,8 +1506,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
15261506 }
15271507}
15281508
1529#endif // _LIBCPP_CXX03_LANG
1530
15311509template <class _Tp, class _Hash, class _Equal, class _Alloc>
15321510__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
15331511{
......@@ -1539,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
15391517#endif
15401518
15411519 __deallocate_node(__p1_.first().__next_);
1542#if _LIBCPP_DEBUG_LEVEL >= 2
1520#if _LIBCPP_DEBUG_LEVEL == 2
15431521 __get_db()->__erase_c(this);
15441522#endif
15451523}
......@@ -1583,7 +1561,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
15831561 while (__np != nullptr)
15841562 {
15851563 __next_pointer __next = __np->__next_;
1586#if _LIBCPP_DEBUG_LEVEL >= 2
1564#if _LIBCPP_DEBUG_LEVEL == 2
15871565 __c_node* __c = __get_db()->__find_c_and_lock(this);
15881566 for (__i_node** __p = __c->end_; __p != __c->beg_; )
15891567 {
......@@ -1593,7 +1571,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
15931571 {
15941572 (*__p)->__c_ = nullptr;
15951573 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*));
15971575 }
15981576 }
15991577 __get_db()->unlock();
......@@ -1618,8 +1596,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
16181596 return __cache;
16191597}
16201598
1621#ifndef _LIBCPP_CXX03_LANG
1622
16231599template <class _Tp, class _Hash, class _Equal, class _Alloc>
16241600void
16251601__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
......@@ -1646,7 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
16461622 __u.__p1_.first().__next_ = nullptr;
16471623 __u.size() = 0;
16481624 }
1649#if _LIBCPP_DEBUG_LEVEL >= 2
1625#if _LIBCPP_DEBUG_LEVEL == 2
16501626 __get_db()->swap(this, &__u);
16511627#endif
16521628}
......@@ -1714,8 +1690,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
17141690 return *this;
17151691}
17161692
1717#endif // _LIBCPP_CXX03_LANG
1718
17191693template <class _Tp, class _Hash, class _Equal, class _Alloc>
17201694template <class _InputIterator>
17211695void
......@@ -1800,7 +1774,7 @@ inline
18001774typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
18011775__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
18021776{
1803#if _LIBCPP_DEBUG_LEVEL >= 2
1777#if _LIBCPP_DEBUG_LEVEL == 2
18041778 return iterator(__p1_.first().__next_, this);
18051779#else
18061780 return iterator(__p1_.first().__next_);
......@@ -1812,7 +1786,7 @@ inline
18121786typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
18131787__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
18141788{
1815#if _LIBCPP_DEBUG_LEVEL >= 2
1789#if _LIBCPP_DEBUG_LEVEL == 2
18161790 return iterator(nullptr, this);
18171791#else
18181792 return iterator(nullptr);
......@@ -1824,7 +1798,7 @@ inline
18241798typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
18251799__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
18261800{
1827#if _LIBCPP_DEBUG_LEVEL >= 2
1801#if _LIBCPP_DEBUG_LEVEL == 2
18281802 return const_iterator(__p1_.first().__next_, this);
18291803#else
18301804 return const_iterator(__p1_.first().__next_);
......@@ -1836,7 +1810,7 @@ inline
18361810typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
18371811__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
18381812{
1839#if _LIBCPP_DEBUG_LEVEL >= 2
1813#if _LIBCPP_DEBUG_LEVEL == 2
18401814 return const_iterator(nullptr, this);
18411815#else
18421816 return const_iterator(nullptr);
......@@ -1945,7 +1919,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
19451919 __existing_node = __nd->__ptr();
19461920 __inserted = true;
19471921 }
1948#if _LIBCPP_DEBUG_LEVEL >= 2
1922#if _LIBCPP_DEBUG_LEVEL == 2
19491923 return pair<iterator, bool>(iterator(__existing_node, this), __inserted);
19501924#else
19511925 return pair<iterator, bool>(iterator(__existing_node), __inserted);
......@@ -1955,7 +1929,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
19551929// Prepare the container for an insertion of the value __cp_val with the hash
19561930// __cp_hash. This does a lookup into the container to see if __cp_value is
19571931// 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.
19591933//
19601934// Note that this function does forward exceptions if key_eq() throws, and never
19611935// mutates __value or actually inserts into the map.
......@@ -2043,7 +2017,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
20432017 __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_);
20442018 __node_insert_multi_perform(__cp, __pn);
20452019
2046#if _LIBCPP_DEBUG_LEVEL >= 2
2020#if _LIBCPP_DEBUG_LEVEL == 2
20472021 return iterator(__cp->__ptr(), this);
20482022#else
20492023 return iterator(__cp->__ptr());
......@@ -2055,7 +2029,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
20552029__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
20562030 const_iterator __p, __node_pointer __cp)
20572031{
2058#if _LIBCPP_DEBUG_LEVEL >= 2
2032#if _LIBCPP_DEBUG_LEVEL == 2
20592033 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
20602034 "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
20612035 " referring to this unordered container");
......@@ -2078,7 +2052,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
20782052 __cp->__next_ = __np;
20792053 __pp->__next_ = static_cast<__next_pointer>(__cp);
20802054 ++size();
2081#if _LIBCPP_DEBUG_LEVEL >= 2
2055#if _LIBCPP_DEBUG_LEVEL == 2
20822056 return iterator(static_cast<__next_pointer>(__cp), this);
20832057#else
20842058 return iterator(static_cast<__next_pointer>(__cp));
......@@ -2089,17 +2063,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
20892063
20902064
20912065
2092#ifndef _LIBCPP_CXX03_LANG
20932066template <class _Tp, class _Hash, class _Equal, class _Alloc>
20942067template <class _Key, class ..._Args>
20952068pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
20962069__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
2097#else
2098template <class _Tp, class _Hash, class _Equal, class _Alloc>
2099template <class _Key, class _Args>
2100pair<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
21032070{
21042071
21052072 size_t __hash = hash_function()(__k);
......@@ -2123,11 +2090,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
21232090 }
21242091 }
21252092 {
2126#ifndef _LIBCPP_CXX03_LANG
21272093 __node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...);
2128#else
2129 __node_holder __h = __construct_node_hash(__hash, __args);
2130#endif
21312094 if (size()+1 > __bc * max_load_factor() || __bc == 0)
21322095 {
21332096 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&
21592122 __inserted = true;
21602123 }
21612124__done:
2162#if _LIBCPP_DEBUG_LEVEL >= 2
2125#if _LIBCPP_DEBUG_LEVEL == 2
21632126 return pair<iterator, bool>(iterator(__nd, this), __inserted);
21642127#else
21652128 return pair<iterator, bool>(iterator(__nd), __inserted);
21662129#endif
21672130}
21682131
2169#ifndef _LIBCPP_CXX03_LANG
2170
21712132template <class _Tp, class _Hash, class _Equal, class _Alloc>
21722133template <class... _Args>
21732134pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
......@@ -2197,7 +2158,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
21972158__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
21982159 const_iterator __p, _Args&&... __args)
21992160{
2200#if _LIBCPP_DEBUG_LEVEL >= 2
2161#if _LIBCPP_DEBUG_LEVEL == 2
22012162 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
22022163 "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
22032164 " referring to this unordered container");
......@@ -2208,36 +2169,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
22082169 return __r;
22092170}
22102171
2211#else // _LIBCPP_CXX03_LANG
2212
2213template <class _Tp, class _Hash, class _Equal, class _Alloc>
2214typename __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
2223template <class _Tp, class _Hash, class _Equal, class _Alloc>
2224typename __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
22412172#if _LIBCPP_STD_VER > 14
22422173template <class _Tp, class _Hash, class _Equal, class _Alloc>
22432174template <class _NodeHandle, class _InsertReturnType>
......@@ -2399,9 +2330,9 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
23992330void
24002331__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
24012332{
2402#if _LIBCPP_DEBUG_LEVEL >= 2
2333#if _LIBCPP_DEBUG_LEVEL == 2
24032334 __get_db()->__invalidate_all(this);
2404#endif // _LIBCPP_DEBUG_LEVEL >= 2
2335#endif
24052336 __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
24062337 __bucket_list_.reset(__nbc > 0 ?
24072338 __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
......@@ -2470,7 +2401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
24702401 {
24712402 if ((__nd->__hash() == __hash)
24722403 && key_eq()(__nd->__upcast()->__value_, __k))
2473#if _LIBCPP_DEBUG_LEVEL >= 2
2404#if _LIBCPP_DEBUG_LEVEL == 2
24742405 return iterator(__nd, this);
24752406#else
24762407 return iterator(__nd);
......@@ -2501,7 +2432,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
25012432 {
25022433 if ((__nd->__hash() == __hash)
25032434 && key_eq()(__nd->__upcast()->__value_, __k))
2504#if _LIBCPP_DEBUG_LEVEL >= 2
2435#if _LIBCPP_DEBUG_LEVEL == 2
25052436 return const_iterator(__nd, this);
25062437#else
25072438 return const_iterator(__nd);
......@@ -2513,8 +2444,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
25132444 return end();
25142445}
25152446
2516#ifndef _LIBCPP_CXX03_LANG
2517
25182447template <class _Tp, class _Hash, class _Equal, class _Alloc>
25192448template <class ..._Args>
25202449typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
......@@ -2550,43 +2479,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(
25502479 return __h;
25512480}
25522481
2553#else // _LIBCPP_CXX03_LANG
2554
2555template <class _Tp, class _Hash, class _Equal, class _Alloc>
2556typename __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
2568template <class _Tp, class _Hash, class _Equal, class _Alloc>
2569typename __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
25842482template <class _Tp, class _Hash, class _Equal, class _Alloc>
25852483typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
25862484__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
25872485{
25882486 __next_pointer __np = __p.__node_;
2589#if _LIBCPP_DEBUG_LEVEL >= 2
2487#if _LIBCPP_DEBUG_LEVEL == 2
25902488 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
25912489 "unordered container erase(iterator) called with an iterator not"
25922490 " referring to this container");
......@@ -2606,7 +2504,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
26062504__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
26072505 const_iterator __last)
26082506{
2609#if _LIBCPP_DEBUG_LEVEL >= 2
2507#if _LIBCPP_DEBUG_LEVEL == 2
26102508 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
26112509 "unodered container::erase(iterator, iterator) called with an iterator not"
26122510 " referring to this unodered container");
......@@ -2620,7 +2518,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
26202518 erase(__p);
26212519 }
26222520 __next_pointer __np = __last.__node_;
2623#if _LIBCPP_DEBUG_LEVEL >= 2
2521#if _LIBCPP_DEBUG_LEVEL == 2
26242522 return iterator (__np, this);
26252523#else
26262524 return iterator (__np);
......@@ -2691,7 +2589,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
26912589 __pn->__next_ = __cn->__next_;
26922590 __cn->__next_ = nullptr;
26932591 --size();
2694#if _LIBCPP_DEBUG_LEVEL >= 2
2592#if _LIBCPP_DEBUG_LEVEL == 2
26952593 __c_node* __c = __get_db()->__find_c_and_lock(this);
26962594 for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
26972595 {
......@@ -2701,7 +2599,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
27012599 {
27022600 (*__dp)->__c_ = nullptr;
27032601 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*));
27052603 }
27062604 }
27072605 __get_db()->unlock();
......@@ -2830,9 +2728,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
28302728 __u.__bucket_list_.reset(__npp);
28312729 }
28322730 _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(),
28342732 __u.__bucket_list_.get_deleter().__alloc());
2835 __swap_allocator(__node_alloc(), __u.__node_alloc());
2733 _VSTD::__swap_allocator(__node_alloc(), __u.__node_alloc());
28362734 _VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
28372735 __p2_.swap(__u.__p2_);
28382736 __p3_.swap(__u.__p3_);
......@@ -2842,7 +2740,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
28422740 if (__u.size() > 0)
28432741 __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
28442742 __u.__p1_.first().__ptr();
2845#if _LIBCPP_DEBUG_LEVEL >= 2
2743#if _LIBCPP_DEBUG_LEVEL == 2
28462744 __get_db()->swap(this, &__u);
28472745#endif
28482746}
......@@ -2876,7 +2774,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
28762774 __x.swap(__y);
28772775}
28782776
2879#if _LIBCPP_DEBUG_LEVEL >= 2
2777#if _LIBCPP_DEBUG_LEVEL == 2
28802778
28812779template <class _Tp, class _Hash, class _Equal, class _Alloc>
28822780bool
......@@ -2906,7 +2804,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
29062804 return false;
29072805}
29082806
2909#endif // _LIBCPP_DEBUG_LEVEL >= 2
2807#endif // _LIBCPP_DEBUG_LEVEL == 2
29102808
29112809_LIBCPP_END_NAMESPACE_STD
29122810
lib/libcxx/include/__libcpp_version+1-1
......@@ -1 +1 @@
111000
112000
lib/libcxx/include/__locale+234-36
......@@ -11,6 +11,7 @@
1111#define _LIBCPP___LOCALE
1212
1313#include <__config>
14#include <__availability>
1415#include <string>
1516#include <memory>
1617#include <utility>
......@@ -21,7 +22,9 @@
2122#if defined(_LIBCPP_MSVCRT_LIKE)
2223# include <cstring>
2324# 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__)
2528# include <support/ibm/xlocale.h>
2629#elif defined(__ANDROID__)
2730# include <support/android/locale_bionic.h>
......@@ -76,7 +79,7 @@ struct __libcpp_locale_guard {
7679 // locale name, otherwise it will be a semicolon-separated string listing
7780 // each category. In the second case, we know at least one category won't
7881 // 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) {
8083 __locale_all = _strdup(__lc);
8184 if (__locale_all == nullptr)
8285 __throw_bad_alloc();
......@@ -105,7 +108,6 @@ struct __libcpp_locale_guard {
105108};
106109#endif
107110
108
109111class _LIBCPP_TYPE_VIS locale;
110112
111113template <class _Facet>
......@@ -335,8 +337,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
335337 return static_cast<long>(__h);
336338}
337339
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>)
340342
341343// template <class CharT> class collate_byname;
342344
......@@ -396,7 +398,26 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
396398class _LIBCPP_TYPE_VIS ctype_base
397399{
398400public:
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__)
400421 typedef unsigned short mask;
401422 static const mask space = _ISspace;
402423 static const mask print = _ISprint;
......@@ -485,24 +506,7 @@ public:
485506# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
486507# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
487508#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?
506510#endif
507511 static const mask alnum = alpha | digit;
508512 static const mask graph = alnum | punct;
......@@ -623,7 +627,7 @@ class _LIBCPP_TYPE_VIS ctype<char>
623627public:
624628 typedef char char_type;
625629
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);
627631
628632 _LIBCPP_INLINE_VISIBILITY
629633 bool is(mask __m, char_type __c) const
......@@ -1069,10 +1073,10 @@ protected:
10691073 virtual int do_max_length() const _NOEXCEPT;
10701074};
10711075
1072// template <> class codecvt<char16_t, char, mbstate_t>
1076// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
10731077
10741078template <>
1075class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
1079class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char16_t, char, mbstate_t>
10761080 : public locale::facet,
10771081 public codecvt_base
10781082{
......@@ -1155,10 +1159,100 @@ protected:
11551159 virtual int do_max_length() const _NOEXCEPT;
11561160};
11571161
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
11591165
11601166template <>
1161class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
1167class _LIBCPP_TYPE_VIS codecvt<char16_t, char8_t, mbstate_t>
1168 : public locale::facet,
1169 public codecvt_base
1170{
1171public:
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
1229protected:
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
1254template <>
1255class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char32_t, char, mbstate_t>
11621256 : public locale::facet,
11631257 public codecvt_base
11641258{
......@@ -1241,6 +1335,96 @@ protected:
12411335 virtual int do_max_length() const _NOEXCEPT;
12421336};
12431337
1338#ifndef _LIBCPP_NO_HAS_CHAR8_T
1339
1340// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
1341
1342template <>
1343class _LIBCPP_TYPE_VIS codecvt<char32_t, char8_t, mbstate_t>
1344 : public locale::facet,
1345 public codecvt_base
1346{
1347public:
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
1405protected:
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
12441428// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
12451429
12461430template <class _InternT, class _ExternT, class _StateT>
......@@ -1258,15 +1442,21 @@ protected:
12581442 ~codecvt_byname();
12591443};
12601444
1445_LIBCPP_SUPPRESS_DEPRECATED_PUSH
12611446template <class _InternT, class _ExternT, class _StateT>
12621447codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
12631448{
12641449}
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
12701460
12711461template <size_t _Np>
12721462struct __narrow_to_utf8
......@@ -1290,12 +1480,14 @@ struct __narrow_to_utf8<8>
12901480 }
12911481};
12921482
1483_LIBCPP_SUPPRESS_DEPRECATED_PUSH
12931484template <>
12941485struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
12951486 : public codecvt<char16_t, char, mbstate_t>
12961487{
12971488 _LIBCPP_INLINE_VISIBILITY
12981489 __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1490_LIBCPP_SUPPRESS_DEPRECATED_POP
12991491
13001492 _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
13011493
......@@ -1324,12 +1516,14 @@ struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
13241516 }
13251517};
13261518
1519_LIBCPP_SUPPRESS_DEPRECATED_PUSH
13271520template <>
13281521struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
13291522 : public codecvt<char32_t, char, mbstate_t>
13301523{
13311524 _LIBCPP_INLINE_VISIBILITY
13321525 __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1526_LIBCPP_SUPPRESS_DEPRECATED_POP
13331527
13341528 _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
13351529
......@@ -1380,12 +1574,14 @@ struct __widen_from_utf8<8>
13801574 }
13811575};
13821576
1577_LIBCPP_SUPPRESS_DEPRECATED_PUSH
13831578template <>
13841579struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
13851580 : public codecvt<char16_t, char, mbstate_t>
13861581{
13871582 _LIBCPP_INLINE_VISIBILITY
13881583 __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1584_LIBCPP_SUPPRESS_DEPRECATED_POP
13891585
13901586 _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
13911587
......@@ -1407,19 +1603,21 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
14071603 if (__r == codecvt_base::error || __nn == __nb)
14081604 __throw_runtime_error("locale not supported");
14091605 for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
1410 *__s = (wchar_t)*__p;
1606 *__s = *__p;
14111607 __nb = __nn;
14121608 }
14131609 return __s;
14141610 }
14151611};
14161612
1613_LIBCPP_SUPPRESS_DEPRECATED_PUSH
14171614template <>
14181615struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
14191616 : public codecvt<char32_t, char, mbstate_t>
14201617{
14211618 _LIBCPP_INLINE_VISIBILITY
14221619 __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1620_LIBCPP_SUPPRESS_DEPRECATED_POP
14231621
14241622 _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
14251623
......@@ -1441,7 +1639,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
14411639 if (__r == codecvt_base::error || __nn == __nb)
14421640 __throw_runtime_error("locale not supported");
14431641 for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
1444 *__s = (wchar_t)*__p;
1642 *__s = *__p;
14451643 __nb = __nn;
14461644 }
14471645 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
27template <class _Tp, class = void>
28struct __has_pointer_type : false_type {};
29
30template <class _Tp>
31struct __has_pointer_type<_Tp,
32 typename __void_t<typename _Tp::pointer>::type> : true_type {};
33
34namespace __pointer_type_imp
35{
36
37template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
38struct __pointer_type
39{
40 typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
41};
42
43template <class _Tp, class _Dp>
44struct __pointer_type<_Tp, _Dp, false>
45{
46 typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
47};
48
49} // __pointer_type_imp
50
51template <class _Tp, class _Dp>
52struct __pointer_type
53{
54 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
55};
56
57template <class _Tp, class = void>
58struct __has_const_pointer : false_type {};
59
60template <class _Tp>
61struct __has_const_pointer<_Tp,
62 typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
63
64template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
65struct __const_pointer
66{
67 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
68};
69
70template <class _Tp, class _Ptr, class _Alloc>
71struct __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
80template <class _Tp, class = void>
81struct __has_void_pointer : false_type {};
82
83template <class _Tp>
84struct __has_void_pointer<_Tp,
85 typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
86
87template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
88struct __void_pointer
89{
90 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
91};
92
93template <class _Ptr, class _Alloc>
94struct __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
103template <class _Tp, class = void>
104struct __has_const_void_pointer : false_type {};
105
106template <class _Tp>
107struct __has_const_void_pointer<_Tp,
108 typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
109
110template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
111struct __const_void_pointer
112{
113 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
114};
115
116template <class _Ptr, class _Alloc>
117struct __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
126template <class _Tp, class = void>
127struct __has_size_type : false_type {};
128
129template <class _Tp>
130struct __has_size_type<_Tp,
131 typename __void_t<typename _Tp::size_type>::type> : true_type {};
132
133template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
134struct __size_type
135{
136 typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
137};
138
139template <class _Alloc, class _DiffType>
140struct __size_type<_Alloc, _DiffType, true>
141{
142 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
143};
144
145template <class _Tp, class = void>
146struct __has_propagate_on_container_copy_assignment : false_type {};
147
148template <class _Tp>
149struct __has_propagate_on_container_copy_assignment<_Tp,
150 typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
151 : true_type {};
152
153template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
154struct __propagate_on_container_copy_assignment
155{
156 typedef _LIBCPP_NODEBUG_TYPE false_type type;
157};
158
159template <class _Alloc>
160struct __propagate_on_container_copy_assignment<_Alloc, true>
161{
162 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
163};
164
165template <class _Tp, class = void>
166struct __has_propagate_on_container_move_assignment : false_type {};
167
168template <class _Tp>
169struct __has_propagate_on_container_move_assignment<_Tp,
170 typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
171 : true_type {};
172
173template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
174struct __propagate_on_container_move_assignment
175{
176 typedef false_type type;
177};
178
179template <class _Alloc>
180struct __propagate_on_container_move_assignment<_Alloc, true>
181{
182 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
183};
184
185template <class _Tp, class = void>
186struct __has_propagate_on_container_swap : false_type {};
187
188template <class _Tp>
189struct __has_propagate_on_container_swap<_Tp,
190 typename __void_t<typename _Tp::propagate_on_container_swap>::type>
191 : true_type {};
192
193template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
194struct __propagate_on_container_swap
195{
196 typedef false_type type;
197};
198
199template <class _Alloc>
200struct __propagate_on_container_swap<_Alloc, true>
201{
202 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
203};
204
205template <class _Tp, class = void>
206struct __has_is_always_equal : false_type {};
207
208template <class _Tp>
209struct __has_is_always_equal<_Tp,
210 typename __void_t<typename _Tp::is_always_equal>::type>
211 : true_type {};
212
213template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
214struct __is_always_equal
215{
216 typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
217};
218
219template <class _Alloc>
220struct __is_always_equal<_Alloc, true>
221{
222 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
223};
224
225template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
226struct __has_rebind_other
227{
228private:
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
234public:
235 static const bool value = sizeof(__test<_Tp>(0)) == 1;
236};
237
238template <class _Tp, class _Up>
239struct __has_rebind_other<_Tp, _Up, false>
240{
241 static const bool value = false;
242};
243
244template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
245struct __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
252template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
253struct __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
260template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
261struct __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
269template <class _Alloc, class _SizeType, class _ConstVoidPtr>
270auto
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
275template <class _Alloc, class _SizeType, class _ConstVoidPtr>
276auto
277__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
278 -> false_type;
279
280template <class _Alloc, class _SizeType, class _ConstVoidPtr>
281struct __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
290template <class _Alloc, class _SizeType, class _ConstVoidPtr>
291struct __has_allocate_hint
292 : true_type
293{
294};
295
296#endif // _LIBCPP_CXX03_LANG
297
298_LIBCPP_SUPPRESS_DEPRECATED_PUSH
299template <class _Alloc, class ..._Args,
300 class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))>
301static true_type __test_has_construct(int);
302_LIBCPP_SUPPRESS_DEPRECATED_POP
303
304template <class _Alloc, class...>
305static false_type __test_has_construct(...);
306
307template <class _Alloc, class ..._Args>
308struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {};
309
310#if !defined(_LIBCPP_CXX03_LANG)
311
312_LIBCPP_SUPPRESS_DEPRECATED_PUSH
313template <class _Alloc, class _Pointer>
314auto
315__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
316 -> decltype(__a.destroy(__p), true_type());
317_LIBCPP_SUPPRESS_DEPRECATED_POP
318
319template <class _Alloc, class _Pointer>
320auto
321__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
322 -> false_type;
323
324template <class _Alloc, class _Pointer>
325struct __has_destroy
326 : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
327 declval<_Pointer>()))
328{
329};
330
331_LIBCPP_SUPPRESS_DEPRECATED_PUSH
332template <class _Alloc>
333auto
334__has_max_size_test(_Alloc&& __a)
335 -> decltype(__a.max_size(), true_type());
336_LIBCPP_SUPPRESS_DEPRECATED_POP
337
338template <class _Alloc>
339auto
340__has_max_size_test(const volatile _Alloc& __a)
341 -> false_type;
342
343template <class _Alloc>
344struct __has_max_size
345 : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
346{
347};
348
349template <class _Alloc>
350auto
351__has_select_on_container_copy_construction_test(_Alloc&& __a)
352 -> decltype(__a.select_on_container_copy_construction(), true_type());
353
354template <class _Alloc>
355auto
356__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
357 -> false_type;
358
359template <class _Alloc>
360struct __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
367template <class _Alloc, class _Pointer, class = void>
368struct __has_destroy : false_type {};
369
370template <class _Alloc, class _Pointer>
371struct __has_destroy<_Alloc, _Pointer, typename __void_t<
372 decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>()))
373>::type> : true_type {};
374
375template <class _Alloc>
376struct __has_max_size
377 : true_type
378{
379};
380
381template <class _Alloc>
382struct __has_select_on_container_copy_construction
383 : false_type
384{
385};
386
387#endif // _LIBCPP_CXX03_LANG
388
389template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
390struct __alloc_traits_difference_type
391{
392 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type;
393};
394
395template <class _Alloc, class _Ptr>
396struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
397{
398 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
399};
400
401template <class _Tp>
402struct __is_default_allocator : false_type {};
403
404template <class _Tp>
405struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
406
407
408
409template <class _Alloc,
410 bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
411 >
412struct __is_cpp17_move_insertable;
413template <class _Alloc>
414struct __is_cpp17_move_insertable<_Alloc, true> : true_type {};
415template <class _Alloc>
416struct __is_cpp17_move_insertable<_Alloc, false> : is_move_constructible<typename _Alloc::value_type> {};
417
418template <class _Alloc,
419 bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
420 >
421struct __is_cpp17_copy_insertable;
422template <class _Alloc>
423struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
424template <class _Alloc>
425struct __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
432template <class _Alloc>
433struct _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
500private:
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
575template <class _Traits, class _Tp>
576struct __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
29template <class _Tp>
30inline _LIBCPP_CONSTEXPR_AFTER_CXX14
31_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
32_Tp*
33addressof(_Tp& __x) _NOEXCEPT
34{
35 return __builtin_addressof(__x);
36}
37
38#else
39
40template <class _Tp>
41inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
42_Tp*
43addressof(_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.
56template <class _Tp>
57inline _LIBCPP_INLINE_VISIBILITY
58__strong _Tp*
59addressof(__strong _Tp& __x) _NOEXCEPT
60{
61 return &__x;
62}
63
64#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
65template <class _Tp>
66inline _LIBCPP_INLINE_VISIBILITY
67__weak _Tp*
68addressof(__weak _Tp& __x) _NOEXCEPT
69{
70 return &__x;
71}
72#endif
73
74template <class _Tp>
75inline _LIBCPP_INLINE_VISIBILITY
76__autoreleasing _Tp*
77addressof(__autoreleasing _Tp& __x) _NOEXCEPT
78{
79 return &__x;
80}
81
82template <class _Tp>
83inline _LIBCPP_INLINE_VISIBILITY
84__unsafe_unretained _Tp*
85addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
86{
87 return &__x;
88}
89#endif
90
91#if !defined(_LIBCPP_CXX03_LANG)
92template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
93#endif
94
95// construct_at
96
97#if _LIBCPP_STD_VER > 17
98
99template<class _Tp, class ..._Args, class = decltype(
100 ::new (_VSTD::declval<void*>()) _Tp(_VSTD::declval<_Args>()...)
101)>
102_LIBCPP_INLINE_VISIBILITY
103constexpr _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
114template <class _Tp>
115inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
116void 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
25template <class _Tp, class = void>
26struct __has_element_type : false_type {};
27
28template <class _Tp>
29struct __has_element_type<_Tp,
30 typename __void_t<typename _Tp::element_type>::type> : true_type {};
31
32template <class _Ptr, bool = __has_element_type<_Ptr>::value>
33struct __pointer_traits_element_type;
34
35template <class _Ptr>
36struct __pointer_traits_element_type<_Ptr, true>
37{
38 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
39};
40
41template <template <class, class...> class _Sp, class _Tp, class ..._Args>
42struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
43{
44 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
45};
46
47template <template <class, class...> class _Sp, class _Tp, class ..._Args>
48struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
49{
50 typedef _LIBCPP_NODEBUG_TYPE _Tp type;
51};
52
53template <class _Tp, class = void>
54struct __has_difference_type : false_type {};
55
56template <class _Tp>
57struct __has_difference_type<_Tp,
58 typename __void_t<typename _Tp::difference_type>::type> : true_type {};
59
60template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
61struct __pointer_traits_difference_type
62{
63 typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
64};
65
66template <class _Ptr>
67struct __pointer_traits_difference_type<_Ptr, true>
68{
69 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
70};
71
72template <class _Tp, class _Up>
73struct __has_rebind
74{
75private:
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
81public:
82 static const bool value = sizeof(__test<_Tp>(0)) == 1;
83};
84
85template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
86struct __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
95template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
96struct __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
105template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
106struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
107{
108 typedef _Sp<_Up, _Args...> type;
109};
110
111template <class _Ptr>
112struct _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
125private:
126 struct __nat {};
127public:
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
134template <class _Tp>
135struct _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
147private:
148 struct __nat {};
149public:
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
156template <class _From, class _To>
157struct __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.
46template<class _Alloc>
47struct __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
78private:
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:
146146 unique_lock& operator=(unique_lock const&); // = delete;
147147
148148public:
149#ifndef _LIBCPP_CXX03_LANG
150149 _LIBCPP_INLINE_VISIBILITY
151150 unique_lock(unique_lock&& __u) _NOEXCEPT
152151 : __m_(__u.__m_), __owns_(__u.__owns_)
......@@ -163,8 +162,6 @@ public:
163162 return *this;
164163 }
165164
166#endif // _LIBCPP_CXX03_LANG
167
168165 void lock();
169166 bool try_lock();
170167
......@@ -382,12 +379,12 @@ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
382379
383380 using __ratio = ratio_divide<_Period, nano>;
384381 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();
386383 if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
387384 return nanoseconds::max();
388385 }
389386
390 __ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
387 __ns_rep __result_min = numeric_limits<__ns_rep>::min();
391388 if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
392389 return nanoseconds::min();
393390 }
lib/libcxx/include/__split_buffer+4-20
......@@ -68,7 +68,6 @@ public:
6868 __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
6969 ~__split_buffer();
7070
71#ifndef _LIBCPP_CXX03_LANG
7271 __split_buffer(__split_buffer&& __c)
7372 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
7473 __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
......@@ -76,7 +75,6 @@ public:
7675 _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
7776 is_nothrow_move_assignable<allocator_type>::value) ||
7877 !__alloc_traits::propagate_on_container_move_assignment::value);
79#endif // _LIBCPP_CXX03_LANG
8078
8179 _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
8280 _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
......@@ -101,12 +99,10 @@ public:
10199 void shrink_to_fit() _NOEXCEPT;
102100 void push_front(const_reference __x);
103101 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
104#ifndef _LIBCPP_CXX03_LANG
105102 void push_front(value_type&& __x);
106103 void push_back(value_type&& __x);
107104 template <class... _Args>
108105 void emplace_back(_Args&&... __args);
109#endif // !defined(_LIBCPP_CXX03_LANG)
110106
111107 _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
112108 _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
......@@ -270,7 +266,7 @@ typename enable_if
270266>::type
271267__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
272268{
273 _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
269 _ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last));
274270 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
275271 __alloc_traits::construct(this->__alloc(),
276272 _VSTD::__to_address(__tx.__pos_), *__first);
......@@ -283,7 +279,7 @@ void
283279__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
284280{
285281 while (__begin_ != __new_begin)
286 __alloc_traits::destroy(__alloc(), __to_address(__begin_++));
282 __alloc_traits::destroy(__alloc(), _VSTD::__to_address(__begin_++));
287283}
288284
289285template <class _Tp, class _Allocator>
......@@ -300,7 +296,7 @@ void
300296__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
301297{
302298 while (__new_last != __end_)
303 __alloc_traits::destroy(__alloc(), __to_address(--__end_));
299 __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__end_));
304300}
305301
306302template <class _Tp, class _Allocator>
......@@ -350,8 +346,6 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
350346 __alloc_traits::deallocate(__alloc(), __first_, capacity());
351347}
352348
353#ifndef _LIBCPP_CXX03_LANG
354
355349template <class _Tp, class _Allocator>
356350__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
357351 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
......@@ -412,8 +406,6 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
412406 return *this;
413407}
414408
415#endif // _LIBCPP_CXX03_LANG
416
417409template <class _Tp, class _Allocator>
418410void
419411__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
......@@ -424,7 +416,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
424416 _VSTD::swap(__begin_, __x.__begin_);
425417 _VSTD::swap(__end_, __x.__end_);
426418 _VSTD::swap(__end_cap(), __x.__end_cap());
427 __swap_allocator(__alloc(), __x.__alloc());
419 _VSTD::__swap_allocator(__alloc(), __x.__alloc());
428420}
429421
430422template <class _Tp, class _Allocator>
......@@ -499,8 +491,6 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
499491 --__begin_;
500492}
501493
502#ifndef _LIBCPP_CXX03_LANG
503
504494template <class _Tp, class _Allocator>
505495void
506496__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
......@@ -531,8 +521,6 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
531521 --__begin_;
532522}
533523
534#endif // _LIBCPP_CXX03_LANG
535
536524template <class _Tp, class _Allocator>
537525inline _LIBCPP_INLINE_VISIBILITY
538526void
......@@ -563,8 +551,6 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
563551 ++__end_;
564552}
565553
566#ifndef _LIBCPP_CXX03_LANG
567
568554template <class _Tp, class _Allocator>
569555void
570556__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
......@@ -626,8 +612,6 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
626612 ++__end_;
627613}
628614
629#endif // _LIBCPP_CXX03_LANG
630
631615template <class _Tp, class _Allocator>
632616inline _LIBCPP_INLINE_VISIBILITY
633617void
lib/libcxx/include/__sso_allocator+5-4
......@@ -11,8 +11,9 @@
1111#define _LIBCPP___SSO_ALLOCATOR
1212
1313#include <__config>
14#include <type_traits>
14#include <memory>
1515#include <new>
16#include <type_traits>
1617
1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1819#pragma GCC system_header
......@@ -47,21 +48,21 @@ public:
4748private:
4849 __sso_allocator& operator=(const __sso_allocator&);
4950public:
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)
5152 {
5253 if (!__allocated_ && __n <= _Np)
5354 {
5455 __allocated_ = true;
5556 return (pointer)&buf_;
5657 }
57 return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
58 return allocator<_Tp>().allocate(__n);
5859 }
5960 _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n)
6061 {
6162 if (__p == (pointer)&buf_)
6263 __allocated_ = false;
6364 else
64 _VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
65 allocator<_Tp>().deallocate(__p, __n);
6566 }
6667 _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
6768
lib/libcxx/include/__string+49-47
......@@ -55,7 +55,9 @@ template <> struct char_traits<char8_t>; // c++20
5555
5656#include <__config>
5757#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
5961#include <memory> // for __murmur2_or_cityhash
6062
6163#include <__debug>
......@@ -92,7 +94,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
9294 _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \
9395 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \
9496 _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&)) \
9698 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \
9799 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \
98100 _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
108110 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
109111 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
110112 _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&)) \
112114 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
113115 _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
114116 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \
......@@ -158,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
158160 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
159161 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
160162 _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&)) \
162164 _Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
163165 _Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
164166 _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
268270 return __s;
269271 ++__s;
270272 }
271 return 0;
273 return nullptr;
272274}
273275
274276template <class _CharT>
......@@ -318,7 +320,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
318320// constexpr versions of move/copy/assign.
319321
320322template <class _CharT>
321static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
323static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
322324_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
323325{
324326 if (__n == 0) return __s1;
......@@ -331,7 +333,7 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
331333}
332334
333335template <class _CharT>
334static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
336static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
335337_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
336338{
337339 _VSTD::copy_n(__s2, __n, __s1);
......@@ -339,7 +341,7 @@ _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
339341}
340342
341343template <class _CharT>
342static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
344static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
343345_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
344346{
345347 _VSTD::fill_n(__s, __n, __a);
......@@ -370,27 +372,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
370372 length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
371373 static _LIBCPP_CONSTEXPR_AFTER_CXX14
372374 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
374376 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
375377 {
376378 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);
379381 }
380 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
382 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
381383 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
382384 {
383385 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
384386 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);
387389 }
388 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
390 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
389391 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
390392 {
391393 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);
394396 }
395397
396398 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
414416#if __has_feature(cxx_constexpr_string_builtins)
415417 return __builtin_memcmp(__s1, __s2, __n);
416418#elif _LIBCPP_STD_VER <= 14
417 return memcmp(__s1, __s2, __n);
419 return _VSTD::memcmp(__s1, __s2, __n);
418420#else
419421 for (; __n; --__n, ++__s1, ++__s2)
420422 {
......@@ -436,7 +438,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
436438#if __has_feature(cxx_constexpr_string_builtins)
437439 return __builtin_char_memchr(__s, to_int_type(__a), __n);
438440#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);
440442#else
441443 for (; __n; --__n)
442444 {
......@@ -473,27 +475,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
473475 size_t length(const char_type* __s) _NOEXCEPT;
474476 static _LIBCPP_CONSTEXPR_AFTER_CXX14
475477 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
477479 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
478480 {
479481 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);
482484 }
483 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
485 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
484486 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
485487 {
486488 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
487489 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);
490492 }
491 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
493 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
492494 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
493495 {
494496 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);
497499 }
498500 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
499501 {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
516518#if __has_feature(cxx_constexpr_string_builtins)
517519 return __builtin_wmemcmp(__s1, __s2, __n);
518520#elif _LIBCPP_STD_VER <= 14
519 return wmemcmp(__s1, __s2, __n);
521 return _VSTD::wmemcmp(__s1, __s2, __n);
520522#else
521523 for (; __n; --__n, ++__s1, ++__s2)
522524 {
......@@ -548,7 +550,7 @@ char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
548550#if __has_feature(cxx_constexpr_string_builtins)
549551 return __builtin_wcslen(__s);
550552#elif _LIBCPP_STD_VER <= 14
551 return wcslen(__s);
553 return _VSTD::wcslen(__s);
552554#else
553555 size_t __len = 0;
554556 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& __
566568#if __has_feature(cxx_constexpr_string_builtins)
567569 return __builtin_wmemchr(__s, __a, __n);
568570#elif _LIBCPP_STD_VER <= 14
569 return wmemchr(__s, __a, __n);
571 return _VSTD::wmemchr(__s, __a, __n);
570572#else
571573 for (; __n; --__n)
572574 {
......@@ -606,29 +608,29 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
606608 _LIBCPP_INLINE_VISIBILITY static constexpr
607609 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
608610
609 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
611 static _LIBCPP_CONSTEXPR_AFTER_CXX17
610612 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
611613 {
612614 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);
615617 }
616618
617 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
619 static _LIBCPP_CONSTEXPR_AFTER_CXX17
618620 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
619621 {
620622 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
621623 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);
624626 }
625627
626 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
628 static _LIBCPP_CONSTEXPR_AFTER_CXX17
627629 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
628630 {
629631 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);
632634 }
633635
634636 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& __
683685 return __s;
684686 ++__s;
685687 }
686 return 0;
688 return nullptr;
687689}
688690
689691#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& _
765767 return __s;
766768 ++__s;
767769 }
768 return 0;
770 return nullptr;
769771}
770772
771773inline _LIBCPP_CONSTEXPR_AFTER_CXX17
......@@ -885,7 +887,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
885887 return __s;
886888 ++__s;
887889 }
888 return 0;
890 return nullptr;
889891}
890892
891893inline _LIBCPP_CONSTEXPR_AFTER_CXX17
......@@ -943,7 +945,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
943945 if (__pos >= __sz)
944946 return __npos;
945947 const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
946 if (__r == 0)
948 if (__r == nullptr)
947949 return __npos;
948950 return static_cast<_SizeT>(__r - __p);
949951}
......@@ -972,7 +974,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
972974
973975 // Find __f2 the first byte matching in __first1.
974976 __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2);
975 if (__first1 == 0)
977 if (__first1 == nullptr)
976978 return __last1;
977979
978980 // 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,
10951097 {
10961098 const _CharT* __pe = __p + __sz;
10971099 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)
10991101 return static_cast<_SizeT>(__ps - __p);
11001102 }
11011103 return __npos;
......@@ -1129,7 +1131,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
11291131 else
11301132 __pos = __sz;
11311133 for (const _CharT* __ps = __p + __pos; __ps != __p;)
1132 if (_Traits::find(__s, __n, *--__ps) == 0)
1134 if (_Traits::find(__s, __n, *--__ps) == nullptr)
11331135 return static_cast<_SizeT>(__ps - __p);
11341136 return __npos;
11351137}
lib/libcxx/include/__threading_support+36-26
......@@ -11,10 +11,15 @@
1111#define _LIBCPP_THREADING_SUPPORT
1212
1313#include <__config>
14#include <__availability>
1415#include <chrono>
1516#include <iosfwd>
1617#include <errno.h>
1718
19#ifdef __MVS__
20# include <support/ibm/nanosleep.h>
21#endif
22
1823#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
1924#pragma GCC system_header
2025#endif
......@@ -26,7 +31,7 @@
2631#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
2732# include <pthread.h>
2833# include <sched.h>
29# ifdef __APPLE__
34# if defined(__APPLE__) || defined(__MVS__)
3035# define _LIBCPP_NO_NATIVE_SEMAPHORES
3136# endif
3237# ifndef _LIBCPP_NO_NATIVE_SEMAPHORES
......@@ -82,11 +87,14 @@ typedef pthread_once_t __libcpp_exec_once_flag;
8287#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
8388
8489// Thread id
85typedef 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
8695
8796// Thread
88#define _LIBCPP_NULL_THREAD 0U
89
97#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
9098typedef pthread_t __libcpp_thread_t;
9199
92100// Thread Local Storage
......@@ -278,24 +286,21 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
278286#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
279287
280288struct __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 }
283302};
284303
285inline _LIBCPP_INLINE_VISIBILITY
286bool __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
299304static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
300305
301306template<class _Fn, class _BFn>
......@@ -484,7 +489,7 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
484489// Returns non-zero if the thread ids are equal, otherwise 0
485490bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
486491{
487 return pthread_equal(t1, t2) != 0;
492 return t1 == t2;
488493}
489494
490495// 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)
495500
496501// Thread
497502bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
498 return *__t == 0;
503 return *__t == __libcpp_thread_t();
499504}
500505
501506int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
502507 void *__arg)
503508{
504 return pthread_create(__t, 0, __func, __arg);
509 return pthread_create(__t, nullptr, __func, __arg);
505510}
506511
507512__libcpp_thread_id __libcpp_thread_get_current_id()
508513{
509 return pthread_self();
514 const __libcpp_thread_t thread = pthread_self();
515 return __libcpp_thread_get_id(&thread);
510516}
511517
512518__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
513519{
520#if defined(__MVS__)
521 return __t->__;
522#else
514523 return *__t;
524#endif
515525}
516526
517527int __libcpp_thread_join(__libcpp_thread_t *__t)
518528{
519 return pthread_join(*__t, 0);
529 return pthread_join(*__t, nullptr);
520530}
521531
522532int __libcpp_thread_detach(__libcpp_thread_t *__t)
......@@ -651,7 +661,7 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
651661
652662// Thread
653663bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
654 return *__t == 0;
664 return __libcpp_thread_get_id(__t) == 0;
655665}
656666
657667int __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
533533// node traits
534534
535535
536#ifndef _LIBCPP_CXX03_LANG
537536template <class _Tp>
538537struct __is_tree_value_type_imp : false_type {};
539538
540539template <class _Key, class _Value>
541struct __is_tree_value_type_imp<__value_type<_Key, _Value>> : true_type {};
540struct __is_tree_value_type_imp<__value_type<_Key, _Value> > : true_type {};
542541
543542template <class ..._Args>
544543struct __is_tree_value_type : false_type {};
545544
546545template <class _One>
547546struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {};
548#endif
549547
550548template <class _Tp>
551549struct __tree_key_value_types {
......@@ -566,12 +564,10 @@ struct __tree_key_value_types {
566564 static __container_value_type* __get_ptr(__node_value_type& __n) {
567565 return _VSTD::addressof(__n);
568566 }
569#ifndef _LIBCPP_CXX03_LANG
570567 _LIBCPP_INLINE_VISIBILITY
571568 static __container_value_type&& __move(__node_value_type& __v) {
572569 return _VSTD::move(__v);
573570 }
574#endif
575571};
576572
577573template <class _Key, class _Tp>
......@@ -616,12 +612,10 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
616612 return _VSTD::addressof(__n.__get_value());
617613 }
618614
619#ifndef _LIBCPP_CXX03_LANG
620615 _LIBCPP_INLINE_VISIBILITY
621616 static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
622617 return __v.__move();
623618 }
624#endif
625619};
626620
627621template <class _VoidPtr>
......@@ -973,7 +967,7 @@ private:
973967
974968template<class _Tp, class _Compare>
975969#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,
977971 "the specified comparator type does not provide a viable const call operator")
978972#endif
979973int __diagnose_non_const_comparator();
......@@ -1103,7 +1097,6 @@ public:
11031097 void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
11041098 template <class _InputIterator>
11051099 void __assign_multi(_InputIterator __first, _InputIterator __last);
1106#ifndef _LIBCPP_CXX03_LANG
11071100 __tree(__tree&& __t)
11081101 _NOEXCEPT_(
11091102 is_nothrow_move_constructible<__node_allocator>::value &&
......@@ -1114,8 +1107,6 @@ public:
11141107 __node_traits::propagate_on_container_move_assignment::value &&
11151108 is_nothrow_move_assignable<value_compare>::value &&
11161109 is_nothrow_move_assignable<__node_allocator>::value);
1117#endif // _LIBCPP_CXX03_LANG
1118
11191110 ~__tree();
11201111
11211112 _LIBCPP_INLINE_VISIBILITY
......@@ -1129,7 +1120,7 @@ public:
11291120
11301121 _LIBCPP_INLINE_VISIBILITY
11311122 size_type max_size() const _NOEXCEPT
1132 {return std::min<size_type>(
1123 {return _VSTD::min<size_type>(
11331124 __node_traits::max_size(__node_alloc()),
11341125 numeric_limits<difference_type >::max());}
11351126
......@@ -1146,12 +1137,11 @@ public:
11461137 _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
11471138#endif
11481139
1149#ifndef _LIBCPP_CXX03_LANG
11501140 template <class _Key, class ..._Args>
11511141 pair<iterator, bool>
11521142 __emplace_unique_key_args(_Key const&, _Args&&... __args);
11531143 template <class _Key, class ..._Args>
1154 iterator
1144 pair<iterator, bool>
11551145 __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
11561146
11571147 template <class... _Args>
......@@ -1225,7 +1215,7 @@ public:
12251215 >::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
12261216 return __emplace_hint_unique_key_args(__p, __f,
12271217 _VSTD::forward<_First>(__f),
1228 _VSTD::forward<_Second>(__s));
1218 _VSTD::forward<_Second>(__s)).first;
12291219 }
12301220
12311221 template <class... _Args>
......@@ -1245,25 +1235,16 @@ public:
12451235 _LIBCPP_INLINE_VISIBILITY
12461236 iterator
12471237 __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;
12491239 }
12501240
12511241 template <class _Pp>
12521242 _LIBCPP_INLINE_VISIBILITY
12531243 iterator
12541244 __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;
12561246 }
12571247
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
12671248 _LIBCPP_INLINE_VISIBILITY
12681249 pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
12691250 return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
......@@ -1271,15 +1252,9 @@ public:
12711252
12721253 _LIBCPP_INLINE_VISIBILITY
12731254 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;
12751256 }
12761257
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
12831258 _LIBCPP_INLINE_VISIBILITY
12841259 pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
12851260 return __emplace_unique_key_args(_NodeTypes::__get_key(__v), _VSTD::move(__v));
......@@ -1287,7 +1262,7 @@ public:
12871262
12881263 _LIBCPP_INLINE_VISIBILITY
12891264 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;
12911266 }
12921267
12931268 template <class _Vp, class = typename enable_if<
......@@ -1332,8 +1307,6 @@ public:
13321307 return __emplace_hint_multi(__p, _VSTD::forward<_Vp>(__v));
13331308 }
13341309
1335#endif // !_LIBCPP_CXX03_LANG
1336
13371310 _LIBCPP_INLINE_VISIBILITY
13381311 pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
13391312
......@@ -1455,7 +1428,7 @@ private:
14551428 __node_base_pointer&
14561429 __find_leaf(const_iterator __hint,
14571430 __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
14591432 // breaks existing code which uses non-const callable comparators.
14601433 template <class _Key>
14611434 __node_base_pointer&
......@@ -1471,12 +1444,8 @@ private:
14711444 __node_base_pointer& __dummy,
14721445 const _Key& __v);
14731446
1474#ifndef _LIBCPP_CXX03_LANG
14751447 template <class ..._Args>
14761448 __node_holder __construct_node(_Args&& ...__args);
1477#else
1478 __node_holder __construct_node(const __container_value_type& __v);
1479#endif
14801449
14811450 void destroy(__node_pointer __nd) _NOEXCEPT;
14821451
......@@ -1706,8 +1675,6 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
17061675 __begin_node() = __end_node();
17071676}
17081677
1709#ifndef _LIBCPP_CXX03_LANG
1710
17111678template <class _Tp, class _Compare, class _Allocator>
17121679__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
17131680 _NOEXCEPT_(
......@@ -1814,8 +1781,6 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
18141781 return *this;
18151782}
18161783
1817#endif // _LIBCPP_CXX03_LANG
1818
18191784template <class _Tp, class _Compare, class _Allocator>
18201785__tree<_Tp, _Compare, _Allocator>::~__tree()
18211786{
......@@ -1854,7 +1819,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
18541819 using _VSTD::swap;
18551820 swap(__begin_node_, __t.__begin_node_);
18561821 swap(__pair1_.first(), __t.__pair1_.first());
1857 __swap_allocator(__node_alloc(), __t.__node_alloc());
1822 _VSTD::__swap_allocator(__node_alloc(), __t.__node_alloc());
18581823 __pair3_.swap(__t.__pair3_);
18591824 if (size() == 0)
18601825 __begin_node() = __end_node();
......@@ -2117,17 +2082,10 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
21172082 ++size();
21182083}
21192084
2120#ifndef _LIBCPP_CXX03_LANG
21212085template <class _Tp, class _Compare, class _Allocator>
21222086template <class _Key, class... _Args>
21232087pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
21242088__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
2125#else
2126template <class _Tp, class _Compare, class _Allocator>
2127template <class _Key, class _Args>
2128pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
2129__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args& __args)
2130#endif
21312089{
21322090 __parent_pointer __parent;
21332091 __node_base_pointer& __child = __find_equal(__parent, __k);
......@@ -2135,11 +2093,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
21352093 bool __inserted = false;
21362094 if (__child == nullptr)
21372095 {
2138#ifndef _LIBCPP_CXX03_LANG
21392096 __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
2140#else
2141 __node_holder __h = __construct_node(__args);
2142#endif
21432097 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
21442098 __r = __h.release();
21452099 __inserted = true;
......@@ -2147,41 +2101,27 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
21472101 return pair<iterator, bool>(iterator(__r), __inserted);
21482102}
21492103
2150
2151#ifndef _LIBCPP_CXX03_LANG
21522104template <class _Tp, class _Compare, class _Allocator>
21532105template <class _Key, class... _Args>
2154typename __tree<_Tp, _Compare, _Allocator>::iterator
2106pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
21552107__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
21562108 const_iterator __p, _Key const& __k, _Args&&... __args)
2157#else
2158template <class _Tp, class _Compare, class _Allocator>
2159template <class _Key, class _Args>
2160typename __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
21642109{
21652110 __parent_pointer __parent;
21662111 __node_base_pointer __dummy;
21672112 __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
21682113 __node_pointer __r = static_cast<__node_pointer>(__child);
2114 bool __inserted = false;
21692115 if (__child == nullptr)
21702116 {
2171#ifndef _LIBCPP_CXX03_LANG
21722117 __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
2173#else
2174 __node_holder __h = __construct_node(__args);
2175#endif
21762118 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
21772119 __r = __h.release();
2120 __inserted = true;
21782121 }
2179 return iterator(__r);
2122 return pair<iterator, bool>(iterator(__r), __inserted);
21802123}
21812124
2182
2183#ifndef _LIBCPP_CXX03_LANG
2184
21852125template <class _Tp, class _Compare, class _Allocator>
21862126template <class ..._Args>
21872127typename __tree<_Tp, _Compare, _Allocator>::__node_holder
......@@ -2259,46 +2199,6 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
22592199 return iterator(static_cast<__node_pointer>(__h.release()));
22602200}
22612201
2262
2263#else // _LIBCPP_CXX03_LANG
2264
2265template <class _Tp, class _Compare, class _Allocator>
2266typename __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
2279template <class _Tp, class _Compare, class _Allocator>
2280typename __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
2290template <class _Tp, class _Compare, class _Allocator>
2291typename __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
23022202template <class _Tp, class _Compare, class _Allocator>
23032203pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
23042204__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>
4747 find_if(InputIterator first, InputIterator last, Predicate pred);
4848
4949template<class InputIterator, class Predicate>
50 InputIterator // constexpr in C++20
50 constexpr InputIterator // constexpr in C++20
5151 find_if_not(InputIterator first, InputIterator last, Predicate pred);
5252
5353template <class ForwardIterator1, class ForwardIterator2>
54 ForwardIterator1 // constexpr in C++20
54 constexpr ForwardIterator1 // constexpr in C++20
5555 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
5656 ForwardIterator2 first2, ForwardIterator2 last2);
5757
5858template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
59 ForwardIterator1 // constexpr in C++20
59 constexpr ForwardIterator1 // constexpr in C++20
6060 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
6161 ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
6262
......@@ -185,11 +185,11 @@ template <class BidirectionalIterator1, class BidirectionalIterator2>
185185 BidirectionalIterator2 result);
186186
187187template <class ForwardIterator1, class ForwardIterator2>
188 ForwardIterator2
188 constexpr ForwardIterator2 // constexpr in C++20
189189 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
190190
191191template <class ForwardIterator1, class ForwardIterator2>
192 void
192 constexpr void // constexpr in C++20
193193 iter_swap(ForwardIterator1 a, ForwardIterator2 b);
194194
195195template <class InputIterator, class OutputIterator, class UnaryOperation>
......@@ -251,19 +251,19 @@ template <class InputIterator, class OutputIterator, class Predicate>
251251 remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
252252
253253template <class ForwardIterator>
254 ForwardIterator
254 constexpr ForwardIterator // constexpr in C++20
255255 unique(ForwardIterator first, ForwardIterator last);
256256
257257template <class ForwardIterator, class BinaryPredicate>
258 ForwardIterator
258 constexpr ForwardIterator // constexpr in C++20
259259 unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
260260
261261template <class InputIterator, class OutputIterator>
262 OutputIterator
262 constexpr OutputIterator // constexpr in C++20
263263 unique_copy(InputIterator first, InputIterator last, OutputIterator result);
264264
265265template <class InputIterator, class OutputIterator, class BinaryPredicate>
266 OutputIterator
266 constexpr OutputIterator // constexpr in C++20
267267 unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
268268
269269template <class BidirectionalIterator>
......@@ -275,11 +275,11 @@ template <class BidirectionalIterator, class OutputIterator>
275275 reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
276276
277277template <class ForwardIterator>
278 ForwardIterator
278 constexpr ForwardIterator // constexpr in C++20
279279 rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
280280
281281template <class ForwardIterator, class OutputIterator>
282 OutputIterator
282 constexpr OutputIterator // constexpr in C++20
283283 rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
284284
285285template <class RandomAccessIterator>
......@@ -329,7 +329,7 @@ template <class ForwardIterator>
329329 is_sorted(ForwardIterator first, ForwardIterator last);
330330
331331template <class ForwardIterator, class Compare>
332 bool
332 constexpr bool // constexpr in C++20
333333 is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
334334
335335template<class ForwardIterator>
......@@ -415,12 +415,12 @@ template <class ForwardIterator, class T, class Compare>
415415 binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
416416
417417template <class InputIterator1, class InputIterator2, class OutputIterator>
418 OutputIterator
418 constexpr OutputIterator // constexpr in C++20
419419 merge(InputIterator1 first1, InputIterator1 last1,
420420 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
421421
422422template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
423 OutputIterator
423 constexpr OutputIterator // constexpr in C++20
424424 merge(InputIterator1 first1, InputIterator1 last1,
425425 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
426426
......@@ -441,12 +441,12 @@ template <class InputIterator1, class InputIterator2, class Compare>
441441 includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
442442
443443template <class InputIterator1, class InputIterator2, class OutputIterator>
444 OutputIterator
444 constexpr OutputIterator // constexpr in C++20
445445 set_union(InputIterator1 first1, InputIterator1 last1,
446446 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
447447
448448template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
449 OutputIterator
449 constexpr OutputIterator // constexpr in C++20
450450 set_union(InputIterator1 first1, InputIterator1 last1,
451451 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
452452
......@@ -461,22 +461,22 @@ template <class InputIterator1, class InputIterator2, class OutputIterator, clas
461461 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
462462
463463template <class InputIterator1, class InputIterator2, class OutputIterator>
464 OutputIterator
464 constexpr OutputIterator // constexpr in C++20
465465 set_difference(InputIterator1 first1, InputIterator1 last1,
466466 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
467467
468468template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
469 OutputIterator
469 constexpr OutputIterator // constexpr in C++20
470470 set_difference(InputIterator1 first1, InputIterator1 last1,
471471 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
472472
473473template <class InputIterator1, class InputIterator2, class OutputIterator>
474 OutputIterator
474 constexpr OutputIterator // constexpr in C++20
475475 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
476476 InputIterator2 first2, InputIterator2 last2, OutputIterator result);
477477
478478template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
479 OutputIterator
479 constexpr OutputIterator // constexpr in C++20
480480 set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
481481 InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
482482
......@@ -529,82 +529,82 @@ template <class RandomAccessIterator, class Compare>
529529 is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
530530
531531template <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);
534534
535535template <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);
538538
539539template <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);
542542
543543template <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);
546546
547547template<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);
550550
551551template<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);
554554
555555template<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
557557
558558template<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
560560
561561template <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);
564564
565565template <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);
568568
569569template <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);
572572
573573template <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);
576576
577577template<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);
580580
581581template<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);
584584
585585template<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);
588588
589589template<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);
592592
593593template<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);
596596
597597template<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);
600600
601601template<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);
604604
605605template<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);
608608
609609template <class InputIterator1, class InputIterator2>
610610 constexpr bool // constexpr in C++20
......@@ -895,7 +895,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
895895_InputIterator
896896for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
897897{
898 typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
898 typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
899899 _IntegralSize __n = __orig_n;
900900 while (__n > 0)
901901 {
......@@ -1614,7 +1614,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last,
16141614 _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
16151615{
16161616 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,
16181618 typename iterator_traits<_ForwardIterator>::iterator_category());
16191619}
16201620
......@@ -1625,13 +1625,13 @@ _ForwardIterator
16251625search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
16261626{
16271627 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),
16291629 __value_, __equal_to<__v, _Tp>());
16301630}
16311631
16321632// copy
16331633template <class _Iter>
1634inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1634inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
16351635_Iter
16361636__unwrap_iter(_Iter __i)
16371637{
......@@ -1639,7 +1639,7 @@ __unwrap_iter(_Iter __i)
16391639}
16401640
16411641template <class _Tp>
1642inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1642inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
16431643typename enable_if
16441644<
16451645 is_trivially_copy_assignable<_Tp>::value,
......@@ -1653,7 +1653,7 @@ __unwrap_iter(move_iterator<_Tp*> __i)
16531653#if _LIBCPP_DEBUG_LEVEL < 2
16541654
16551655template <class _Tp>
1656inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1656inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
16571657typename enable_if
16581658<
16591659 is_trivially_copy_assignable<_Tp>::value,
......@@ -1665,7 +1665,7 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
16651665}
16661666
16671667template <class _Tp>
1668inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1668inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
16691669typename enable_if
16701670<
16711671 is_trivially_copy_assignable<_Tp>::value,
......@@ -1679,7 +1679,7 @@ __unwrap_iter(__wrap_iter<const _Tp*> __i)
16791679#else
16801680
16811681template <class _Tp>
1682inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1682inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
16831683typename enable_if
16841684<
16851685 is_trivially_copy_assignable<_Tp>::value,
......@@ -1707,7 +1707,7 @@ inline _LIBCPP_INLINE_VISIBILITY
17071707_OutputIterator
17081708__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
17091709{
1710 return __copy_constexpr(__first, __last, __result);
1710 return _VSTD::__copy_constexpr(__first, __last, __result);
17111711}
17121712
17131713template <class _Tp, class _Up>
......@@ -1727,16 +1727,16 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)
17271727}
17281728
17291729template <class _InputIterator, class _OutputIterator>
1730inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1730inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17311731_OutputIterator
17321732copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
17331733{
17341734 if (__libcpp_is_constant_evaluated()) {
17351735 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));
17371737 } else {
17381738 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));
17401740 }
17411741}
17421742
......@@ -1757,7 +1757,7 @@ inline _LIBCPP_INLINE_VISIBILITY
17571757_OutputIterator
17581758__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
17591759{
1760 return __copy_backward_constexpr(__first, __last, __result);
1760 return _VSTD::__copy_backward_constexpr(__first, __last, __result);
17611761}
17621762
17631763template <class _Tp, class _Up>
......@@ -1780,19 +1780,19 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
17801780}
17811781
17821782template <class _BidirectionalIterator1, class _BidirectionalIterator2>
1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17841784_BidirectionalIterator2
17851785copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
17861786 _BidirectionalIterator2 __result)
17871787{
17881788 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));
17921792 } 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));
17961796 }
17971797}
17981798
......@@ -1818,7 +1818,7 @@ copy_if(_InputIterator __first, _InputIterator __last,
18181818// copy_n
18191819
18201820template<class _InputIterator, class _Size, class _OutputIterator>
1821inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1821inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
18221822typename enable_if
18231823<
18241824 __is_cpp17_input_iterator<_InputIterator>::value &&
......@@ -1827,7 +1827,7 @@ typename enable_if
18271827>::type
18281828copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
18291829{
1830 typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
1830 typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
18311831 _IntegralSize __n = __orig_n;
18321832 if (__n > 0)
18331833 {
......@@ -1844,7 +1844,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
18441844}
18451845
18461846template<class _InputIterator, class _Size, class _OutputIterator>
1847inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1847inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
18481848typename enable_if
18491849<
18501850 __is_cpp17_random_access_iterator<_InputIterator>::value,
......@@ -1852,25 +1852,35 @@ typename enable_if
18521852>::type
18531853copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
18541854{
1855 typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
1855 typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
18561856 _IntegralSize __n = __orig_n;
18571857 return _VSTD::copy(__first, __first + __n, __result);
18581858}
18591859
18601860// move
18611861
1862// __move_constexpr exists so that __move doesn't call itself when delegating to the constexpr
1863// version of __move.
18621864template <class _InputIterator, class _OutputIterator>
1863inline _LIBCPP_INLINE_VISIBILITY
1865inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
18641866_OutputIterator
1865__move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1867__move_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
18661868{
18671869 for (; __first != __last; ++__first, (void) ++__result)
18681870 *__result = _VSTD::move(*__first);
18691871 return __result;
18701872}
18711873
1874template <class _InputIterator, class _OutputIterator>
1875inline _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
18721882template <class _Tp, class _Up>
1873inline _LIBCPP_INLINE_VISIBILITY
1883inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
18741884typename enable_if
18751885<
18761886 is_same<typename remove_const<_Tp>::type, _Up>::value &&
......@@ -1879,6 +1889,8 @@ typename enable_if
18791889>::type
18801890__move(_Tp* __first, _Tp* __last, _Up* __result)
18811891{
1892 if (__libcpp_is_constant_evaluated())
1893 return _VSTD::__move_constexpr(__first, __last, __result);
18821894 const size_t __n = static_cast<size_t>(__last - __first);
18831895 if (__n > 0)
18841896 _VSTD::memmove(__result, __first, __n * sizeof(_Up));
......@@ -1886,27 +1898,37 @@ __move(_Tp* __first, _Tp* __last, _Up* __result)
18861898}
18871899
18881900template <class _InputIterator, class _OutputIterator>
1889inline _LIBCPP_INLINE_VISIBILITY
1901inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
18901902_OutputIterator
18911903move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
18921904{
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));
18941906}
18951907
18961908// move_backward
18971909
1910// __move_backward_constexpr exists so that __move_backward doesn't call itself when delegating to
1911// the constexpr version of __move_backward.
18981912template <class _InputIterator, class _OutputIterator>
1899inline _LIBCPP_INLINE_VISIBILITY
1913inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
19001914_OutputIterator
1901__move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1915__move_backward_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
19021916{
19031917 while (__first != __last)
19041918 *--__result = _VSTD::move(*--__last);
19051919 return __result;
19061920}
19071921
1922template <class _InputIterator, class _OutputIterator>
1923inline _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
19081930template <class _Tp, class _Up>
1909inline _LIBCPP_INLINE_VISIBILITY
1931inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
19101932typename enable_if
19111933<
19121934 is_same<typename remove_const<_Tp>::type, _Up>::value &&
......@@ -1915,6 +1937,8 @@ typename enable_if
19151937>::type
19161938__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
19171939{
1940 if (__libcpp_is_constant_evaluated())
1941 return _VSTD::__move_backward_constexpr(__first, __last, __result);
19181942 const size_t __n = static_cast<size_t>(__last - __first);
19191943 if (__n > 0)
19201944 {
......@@ -1925,12 +1949,12 @@ __move_backward(_Tp* __first, _Tp* __last, _Up* __result)
19251949}
19261950
19271951template <class _BidirectionalIterator1, class _BidirectionalIterator2>
1928inline _LIBCPP_INLINE_VISIBILITY
1952inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
19291953_BidirectionalIterator2
19301954move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
19311955 _BidirectionalIterator2 __result)
19321956{
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));
19341958}
19351959
19361960// iter_swap
......@@ -2033,7 +2057,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
20332057_OutputIterator
20342058fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
20352059{
2036 return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
2060 return _VSTD::__fill_n(__first, _VSTD::__convert_to_integral(__n), __value_);
20372061}
20382062
20392063// fill
......@@ -2081,7 +2105,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
20812105_OutputIterator
20822106generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
20832107{
2084 typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
2108 typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
20852109 _IntegralSize __n = __orig_n;
20862110 for (; __n > 0; ++__first, (void) --__n)
20872111 *__first = __gen();
......@@ -2333,7 +2357,7 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out
23332357// rotate
23342358
23352359template <class _ForwardIterator>
2336_ForwardIterator
2360_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
23372361__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
23382362{
23392363 typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
......@@ -2344,7 +2368,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last)
23442368}
23452369
23462370template <class _BidirectionalIterator>
2347_BidirectionalIterator
2371_LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
23482372__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
23492373{
23502374 typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
......@@ -2356,7 +2380,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
23562380}
23572381
23582382template <class _ForwardIterator>
2359_ForwardIterator
2383_LIBCPP_CONSTEXPR_AFTER_CXX14 _ForwardIterator
23602384__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
23612385{
23622386 _ForwardIterator __i = __middle;
......@@ -2392,7 +2416,7 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt
23922416
23932417template<typename _Integral>
23942418inline _LIBCPP_INLINE_VISIBILITY
2395_Integral
2419_LIBCPP_CONSTEXPR_AFTER_CXX14 _Integral
23962420__algo_gcd(_Integral __x, _Integral __y)
23972421{
23982422 do
......@@ -2405,7 +2429,7 @@ __algo_gcd(_Integral __x, _Integral __y)
24052429}
24062430
24072431template<typename _RandomAccessIterator>
2408_RandomAccessIterator
2432_LIBCPP_CONSTEXPR_AFTER_CXX14 _RandomAccessIterator
24092433__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
24102434{
24112435 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
......@@ -2441,7 +2465,7 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
24412465
24422466template <class _ForwardIterator>
24432467inline _LIBCPP_INLINE_VISIBILITY
2444_ForwardIterator
2468_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
24452469__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
24462470 _VSTD::forward_iterator_tag)
24472471{
......@@ -2456,7 +2480,7 @@ __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator _
24562480
24572481template <class _BidirectionalIterator>
24582482inline _LIBCPP_INLINE_VISIBILITY
2459_BidirectionalIterator
2483_LIBCPP_CONSTEXPR_AFTER_CXX11 _BidirectionalIterator
24602484__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
24612485 _VSTD::bidirectional_iterator_tag)
24622486{
......@@ -2473,7 +2497,7 @@ __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _Bidir
24732497
24742498template <class _RandomAccessIterator>
24752499inline _LIBCPP_INLINE_VISIBILITY
2476_RandomAccessIterator
2500_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
24772501__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
24782502 _VSTD::random_access_iterator_tag)
24792503{
......@@ -2491,7 +2515,7 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
24912515
24922516template <class _ForwardIterator>
24932517inline _LIBCPP_INLINE_VISIBILITY
2494_ForwardIterator
2518_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
24952519rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
24962520{
24972521 if (__first == __middle)
......@@ -2505,7 +2529,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l
25052529// rotate_copy
25062530
25072531template <class _ForwardIterator, class _OutputIterator>
2508inline _LIBCPP_INLINE_VISIBILITY
2532inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
25092533_OutputIterator
25102534rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result)
25112535{
......@@ -2684,12 +2708,12 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
26842708
26852709template <class _ForwardIterator, class _Compare>
26862710_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
2687std::pair<_ForwardIterator, _ForwardIterator>
2711pair<_ForwardIterator, _ForwardIterator>
26882712minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
26892713{
26902714 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
26912715 "std::minmax_element requires a ForwardIterator");
2692 std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
2716 pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
26932717 if (__first != __last)
26942718 {
26952719 if (++__first != __last)
......@@ -2735,7 +2759,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
27352759template <class _ForwardIterator>
27362760_LIBCPP_NODISCARD_EXT inline
27372761_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2738std::pair<_ForwardIterator, _ForwardIterator>
2762pair<_ForwardIterator, _ForwardIterator>
27392763minmax_element(_ForwardIterator __first, _ForwardIterator __last)
27402764{
27412765 return _VSTD::minmax_element(__first, __last,
......@@ -2774,7 +2798,7 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
27742798 typedef typename initializer_list<_Tp>::const_iterator _Iter;
27752799 _Iter __first = __t.begin();
27762800 _Iter __last = __t.end();
2777 std::pair<_Tp, _Tp> __result(*__first, *__first);
2801 pair<_Tp, _Tp> __result(*__first, *__first);
27782802
27792803 ++__first;
27802804 if (__t.size() % 2 == 0)
......@@ -3050,7 +3074,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
30503074 if (_Rp == 0)
30513075 return static_cast<result_type>(_Eng(__g, _Dt)());
30523076 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)
30543078 ++__w;
30553079 _Eng __e(__g, __w);
30563080 _UIntType __u;
......@@ -3380,8 +3404,8 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
33803404 // Move the falses into the temporary buffer, and the trues to the front of the line
33813405 // Update __first to always point to the end of the trues
33823406 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>();
33853409 ++__t;
33863410 _ForwardIterator __i = __first;
33873411 while (++__i != __last)
......@@ -3393,8 +3417,8 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
33933417 }
33943418 else
33953419 {
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>();
33983422 ++__t;
33993423 }
34003424 }
......@@ -3415,7 +3439,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
34153439 // F?????????????????
34163440 // f m l
34173441 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);
34193443 // TTTFFFFF??????????
34203444 // f ff m l
34213445 // 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
34303454 }
34313455 // TTTFFFFFTTTF??????
34323456 // 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);
34343458__second_half_done:
34353459 // TTTFFFFFTTTTTFFFFF
34363460 // f ff m sf l
......@@ -3472,7 +3496,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
34723496 __p = _VSTD::get_temporary_buffer<value_type>(__len);
34733497 __h.reset(__p.first);
34743498 }
3475 return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
3499 return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type>
34763500 (__first, __last, __pred, __len, __p, forward_iterator_tag());
34773501}
34783502
......@@ -3510,8 +3534,8 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
35103534 // Move the falses into the temporary buffer, and the trues to the front of the line
35113535 // Update __first to always point to the end of the trues
35123536 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>();
35153539 ++__t;
35163540 _BidirectionalIterator __i = __first;
35173541 while (++__i != __last)
......@@ -3523,8 +3547,8 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
35233547 }
35243548 else
35253549 {
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>();
35283552 ++__t;
35293553 }
35303554 }
......@@ -3558,7 +3582,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
35583582 // F???TFFF?????????T
35593583 // f m1 m l
35603584 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);
35623586__first_half_done:
35633587 // TTTFFFFF?????????T
35643588 // f ff m l
......@@ -3575,7 +3599,7 @@ __first_half_done:
35753599 }
35763600 // TTTFFFFFTTTF?????T
35773601 // 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);
35793603__second_half_done:
35803604 // TTTFFFFFTTTTTFFFFF
35813605 // f ff m sf l
......@@ -3620,7 +3644,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
36203644 __p = _VSTD::get_temporary_buffer<value_type>(__len);
36213645 __h.reset(__p.first);
36223646 }
3623 return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
3647 return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type>
36243648 (__first, __last, __pred, __len, __p, bidirectional_iterator_tag());
36253649}
36263650
......@@ -3629,7 +3653,7 @@ inline _LIBCPP_INLINE_VISIBILITY
36293653_ForwardIterator
36303654stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
36313655{
3632 return __stable_partition<typename add_lvalue_reference<_Predicate>::type>
3656 return _VSTD::__stable_partition<typename add_lvalue_reference<_Predicate>::type>
36333657 (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
36343658}
36353659
......@@ -3727,7 +3751,7 @@ unsigned
37273751__sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
37283752 _ForwardIterator __x4, _Compare __c)
37293753{
3730 unsigned __r = __sort3<_Compare>(__x1, __x2, __x3, __c);
3754 unsigned __r = _VSTD::__sort3<_Compare>(__x1, __x2, __x3, __c);
37313755 if (__c(*__x4, *__x3))
37323756 {
37333757 swap(*__x3, *__x4);
......@@ -3754,7 +3778,7 @@ unsigned
37543778__sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
37553779 _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c)
37563780{
3757 unsigned __r = __sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
3781 unsigned __r = _VSTD::__sort4<_Compare>(__x1, __x2, __x3, __x4, __c);
37583782 if (__c(*__x5, *__x4))
37593783 {
37603784 swap(*__x4, *__x5);
......@@ -3779,14 +3803,14 @@ __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3,
37793803}
37803804
37813805// Assumes size > 0
3782template <class _Compare, class _BirdirectionalIterator>
3806template <class _Compare, class _BidirectionalIterator>
37833807void
3784__selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
3808__selection_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
37853809{
3786 _BirdirectionalIterator __lm1 = __last;
3810 _BidirectionalIterator __lm1 = __last;
37873811 for (--__lm1; __first != __lm1; ++__first)
37883812 {
3789 _BirdirectionalIterator __i = _VSTD::min_element<_BirdirectionalIterator,
3813 _BidirectionalIterator __i = _VSTD::min_element<_BidirectionalIterator,
37903814 typename add_lvalue_reference<_Compare>::type>
37913815 (__first, __last, __comp);
37923816 if (__i != __first)
......@@ -3794,19 +3818,19 @@ __selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last
37943818 }
37953819}
37963820
3797template <class _Compare, class _BirdirectionalIterator>
3821template <class _Compare, class _BidirectionalIterator>
37983822void
3799__insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
3823__insertion_sort(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
38003824{
3801 typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type;
3825 typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
38023826 if (__first != __last)
38033827 {
3804 _BirdirectionalIterator __i = __first;
3828 _BidirectionalIterator __i = __first;
38053829 for (++__i; __i != __last; ++__i)
38063830 {
3807 _BirdirectionalIterator __j = __i;
3831 _BidirectionalIterator __j = __i;
38083832 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)
38103834 *__j = _VSTD::move(*__k);
38113835 *__j = _VSTD::move(__t);
38123836 }
......@@ -3819,7 +3843,7 @@ __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last,
38193843{
38203844 typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
38213845 _RandomAccessIterator __j = __first+2;
3822 __sort3<_Compare>(__first, __first+1, __j, __comp);
3846 _VSTD::__sort3<_Compare>(__first, __first+1, __j, __comp);
38233847 for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i)
38243848 {
38253849 if (__comp(*__i, *__j))
......@@ -3863,7 +3887,7 @@ __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator
38633887 }
38643888 typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
38653889 _RandomAccessIterator __j = __first+2;
3866 __sort3<_Compare>(__first, __first+1, __j, __comp);
3890 _VSTD::__sort3<_Compare>(__first, __first+1, __j, __comp);
38673891 const unsigned __limit = 8;
38683892 unsigned __count = 0;
38693893 for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i)
......@@ -3887,35 +3911,35 @@ __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator
38873911 return true;
38883912}
38893913
3890template <class _Compare, class _BirdirectionalIterator>
3914template <class _Compare, class _BidirectionalIterator>
38913915void
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)
38943918{
3895 typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type;
3919 typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
38963920 if (__first1 != __last1)
38973921 {
38983922 __destruct_n __d(0);
38993923 unique_ptr<value_type, __destruct_n&> __h(__first2, __d);
39003924 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>();
39033927 for (++__last2; ++__first1 != __last1; ++__last2)
39043928 {
39053929 value_type* __j2 = __last2;
39063930 value_type* __i2 = __j2;
39073931 if (__comp(*__first1, *--__i2))
39083932 {
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>();
39113935 for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2)
39123936 *__j2 = _VSTD::move(*__i2);
39133937 *__j2 = _VSTD::move(*__first1);
39143938 }
39153939 else
39163940 {
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>();
39193943 }
39203944 }
39213945 __h.release();
......@@ -4032,7 +4056,7 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c
40324056 ++__i;
40334057 }
40344058 // [__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
40364060 // _VSTD::__sort<_Compare>(__i, __last, __comp);
40374061 __first = __i;
40384062 goto __restart;
......@@ -4138,7 +4162,7 @@ inline _LIBCPP_INLINE_VISIBILITY
41384162void
41394163sort(_Tp** __first, _Tp** __last)
41404164{
4141 _VSTD::sort((size_t*)__first, (size_t*)__last, __less<size_t>());
4165 _VSTD::sort((uintptr_t*)__first, (uintptr_t*)__last, __less<uintptr_t>());
41424166}
41434167
41444168template <class _Tp>
......@@ -4223,7 +4247,7 @@ _ForwardIterator
42234247lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
42244248{
42254249 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);
42274251}
42284252
42294253template <class _ForwardIterator, class _Tp>
......@@ -4267,7 +4291,7 @@ _ForwardIterator
42674291upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
42684292{
42694293 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);
42714295}
42724296
42734297template <class _ForwardIterator, class _Tp>
......@@ -4308,8 +4332,8 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
43084332 _ForwardIterator __mp1 = __m;
43094333 return pair<_ForwardIterator, _ForwardIterator>
43104334 (
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)
43134337 );
43144338 }
43154339 }
......@@ -4323,7 +4347,7 @@ pair<_ForwardIterator, _ForwardIterator>
43234347equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
43244348{
43254349 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);
43274351}
43284352
43294353template <class _ForwardIterator, class _Tp>
......@@ -4343,7 +4367,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
43434367bool
43444368__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
43454369{
4346 __first = __lower_bound<_Compare>(__first, __last, __value_, __comp);
4370 __first = _VSTD::__lower_bound<_Compare>(__first, __last, __value_, __comp);
43474371 return __first != __last && !__comp(__value_, *__first);
43484372}
43494373
......@@ -4354,7 +4378,7 @@ bool
43544378binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
43554379{
43564380 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);
43584382}
43594383
43604384template <class _ForwardIterator, class _Tp>
......@@ -4370,6 +4394,7 @@ binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
43704394// merge
43714395
43724396template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
4397_LIBCPP_CONSTEXPR_AFTER_CXX17
43734398_OutputIterator
43744399__merge(_InputIterator1 __first1, _InputIterator1 __last1,
43754400 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
......@@ -4393,7 +4418,7 @@ __merge(_InputIterator1 __first1, _InputIterator1 __last1,
43934418}
43944419
43954420template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
4396inline _LIBCPP_INLINE_VISIBILITY
4421inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
43974422_OutputIterator
43984423merge(_InputIterator1 __first1, _InputIterator1 __last1,
43994424 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
......@@ -4403,7 +4428,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,
44034428}
44044429
44054430template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
4406inline _LIBCPP_INLINE_VISIBILITY
4431inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
44074432_OutputIterator
44084433merge(_InputIterator1 __first1, _InputIterator1 __last1,
44094434 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
......@@ -4456,20 +4481,20 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
44564481 if (__len1 <= __len2)
44574482 {
44584483 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);
44624487 }
44634488 else
44644489 {
44654490 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));
44684493 typedef reverse_iterator<_BidirectionalIterator> _RBi;
44694494 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));
44734498 }
44744499}
44754500
......@@ -4487,7 +4512,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
44874512 if (__len2 == 0)
44884513 return;
44894514 if (__len1 <= __buff_size || __len2 <= __buff_size)
4490 return __buffered_inplace_merge<_Compare>
4515 return _VSTD::__buffered_inplace_merge<_Compare>
44914516 (__first, __middle, __last, __comp, __len1, __len2, __buff);
44924517 // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
44934518 for (; true; ++__first, (void) --__len1)
......@@ -4515,7 +4540,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
45154540 __len21 = __len2 / 2;
45164541 __m2 = __middle;
45174542 _VSTD::advance(__m2, __len21);
4518 __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp);
4543 __m1 = _VSTD::__upper_bound<_Compare>(__first, __middle, *__m2, __comp);
45194544 __len11 = _VSTD::distance(__first, __m1);
45204545 }
45214546 else
......@@ -4530,7 +4555,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
45304555 __len11 = __len1 / 2;
45314556 __m1 = __first;
45324557 _VSTD::advance(__m1, __len11);
4533 __m2 = __lower_bound<_Compare>(__middle, __last, *__m1, __comp);
4558 __m2 = _VSTD::__lower_bound<_Compare>(__middle, __last, *__m1, __comp);
45344559 __len21 = _VSTD::distance(__middle, __m2);
45354560 }
45364561 difference_type __len12 = __len1 - __len11; // distance(__m1, __middle)
......@@ -4539,11 +4564,11 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
45394564 // swap middle two partitions
45404565 __middle = _VSTD::rotate(__m1, __middle, __m2);
45414566 // __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
45434568 if (__len11 + __len21 < __len12 + __len22)
45444569 {
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);
45474572 __first = __middle;
45484573 __middle = __m2;
45494574 __len1 = __len12;
......@@ -4551,8 +4576,8 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
45514576 }
45524577 else
45534578 {
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);
45564581 __last = __middle;
45574582 __middle = __m1;
45584583 __len1 = __len11;
......@@ -4603,28 +4628,28 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
46034628 {
46044629 if (__first1 == __last1)
46054630 {
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));
46084633 __h.release();
46094634 return;
46104635 }
46114636 if (__first2 == __last2)
46124637 {
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));
46154640 __h.release();
46164641 return;
46174642 }
46184643 if (__comp(*__first2, *__first1))
46194644 {
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>();
46224647 ++__first2;
46234648 }
46244649 else
46254650 {
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>();
46284653 ++__first1;
46294654 }
46304655 }
......@@ -4677,38 +4702,38 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
46774702 case 0:
46784703 return;
46794704 case 1:
4680 ::new(__first2) value_type(_VSTD::move(*__first1));
4705 ::new ((void*)__first2) value_type(_VSTD::move(*__first1));
46814706 return;
46824707 case 2:
46834708 __destruct_n __d(0);
46844709 unique_ptr<value_type, __destruct_n&> __h2(__first2, __d);
46854710 if (__comp(*--__last1, *__first1))
46864711 {
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>();
46894714 ++__first2;
4690 ::new(__first2) value_type(_VSTD::move(*__first1));
4715 ::new ((void*)__first2) value_type(_VSTD::move(*__first1));
46914716 }
46924717 else
46934718 {
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>();
46964721 ++__first2;
4697 ::new(__first2) value_type(_VSTD::move(*__last1));
4722 ::new ((void*)__first2) value_type(_VSTD::move(*__last1));
46984723 }
46994724 __h2.release();
47004725 return;
47014726 }
47024727 if (__len <= 8)
47034728 {
4704 __insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp);
4729 _VSTD::__insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp);
47054730 return;
47064731 }
47074732 typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
47084733 _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);
47124737}
47134738
47144739template <class _Tp>
......@@ -4737,7 +4762,7 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
47374762 }
47384763 if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value))
47394764 {
4740 __insertion_sort<_Compare>(__first, __last, __comp);
4765 _VSTD::__insertion_sort<_Compare>(__first, __last, __comp);
47414766 return;
47424767 }
47434768 typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2;
......@@ -4746,21 +4771,21 @@ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
47464771 {
47474772 __destruct_n __d(0);
47484773 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);
47594784 return;
47604785 }
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);
47644789}
47654790
47664791template <class _RandomAccessIterator, class _Compare>
......@@ -4779,7 +4804,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
47794804 __h.reset(__buf.first);
47804805 }
47814806 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);
47834808}
47844809
47854810template <class _RandomAccessIterator>
......@@ -4883,7 +4908,7 @@ void
48834908push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
48844909{
48854910 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);
48874912}
48884913
48894914template <class _RandomAccessIterator>
......@@ -4960,7 +4985,7 @@ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare
49604985 if (__len > 1)
49614986 {
49624987 swap(*__first, *--__last);
4963 __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first);
4988 _VSTD::__sift_down<_Compare>(__first, __last, __comp, __len - 1, __first);
49644989 }
49654990}
49664991
......@@ -4970,7 +4995,7 @@ void
49704995pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
49714996{
49724997 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);
49744999}
49755000
49765001template <class _RandomAccessIterator>
......@@ -4994,7 +5019,7 @@ __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
49945019 // start from the first parent, there is no need to consider children
49955020 for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start)
49965021 {
4997 __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start);
5022 _VSTD::__sift_down<_Compare>(__first, __last, __comp, __n, __first + __start);
49985023 }
49995024 }
50005025}
......@@ -5005,7 +5030,7 @@ void
50055030make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
50065031{
50075032 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);
50095034}
50105035
50115036template <class _RandomAccessIterator>
......@@ -5024,7 +5049,7 @@ __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
50245049{
50255050 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
50265051 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);
50285053}
50295054
50305055template <class _RandomAccessIterator, class _Compare>
......@@ -5033,7 +5058,7 @@ void
50335058sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
50345059{
50355060 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);
50375062}
50385063
50395064template <class _RandomAccessIterator>
......@@ -5051,17 +5076,17 @@ void
50515076__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
50525077 _Compare __comp)
50535078{
5054 __make_heap<_Compare>(__first, __middle, __comp);
5079 _VSTD::__make_heap<_Compare>(__first, __middle, __comp);
50555080 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
50565081 for (_RandomAccessIterator __i = __middle; __i != __last; ++__i)
50575082 {
50585083 if (__comp(*__i, *__first))
50595084 {
50605085 swap(*__i, *__first);
5061 __sift_down<_Compare>(__first, __middle, __comp, __len, __first);
5086 _VSTD::__sift_down<_Compare>(__first, __middle, __comp, __len, __first);
50625087 }
50635088 }
5064 __sort_heap<_Compare>(__first, __middle, __comp);
5089 _VSTD::__sort_heap<_Compare>(__first, __middle, __comp);
50655090}
50665091
50675092template <class _RandomAccessIterator, class _Compare>
......@@ -5071,7 +5096,7 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
50715096 _Compare __comp)
50725097{
50735098 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);
50755100}
50765101
50775102template <class _RandomAccessIterator>
......@@ -5095,15 +5120,15 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
50955120 {
50965121 for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
50975122 *__r = *__first;
5098 __make_heap<_Compare>(__result_first, __r, __comp);
5123 _VSTD::__make_heap<_Compare>(__result_first, __r, __comp);
50995124 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
51005125 for (; __first != __last; ++__first)
51015126 if (__comp(*__first, *__result_first))
51025127 {
51035128 *__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);
51055130 }
5106 __sort_heap<_Compare>(__result_first, __r, __comp);
5131 _VSTD::__sort_heap<_Compare>(__result_first, __r, __comp);
51075132 }
51085133 return __r;
51095134}
......@@ -5115,7 +5140,7 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last,
51155140 _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
51165141{
51175142 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);
51195144}
51205145
51215146template <class _InputIterator, class _RandomAccessIterator>
......@@ -5161,7 +5186,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
51615186 }
51625187 if (__len <= __limit)
51635188 {
5164 __selection_sort<_Compare>(__first, __last, __comp);
5189 _VSTD::__selection_sort<_Compare>(__first, __last, __comp);
51655190 return;
51665191 }
51675192 // __len > __limit >= 3
......@@ -5185,7 +5210,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
51855210 if (__i == --__j)
51865211 {
51875212 // *__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)
51895214 ++__i; // __first + 1
51905215 __j = __last;
51915216 if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1)
......@@ -5223,8 +5248,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
52235248 // The first part is sorted,
52245249 if (__nth < __i)
52255250 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);
52285253 __first = __i;
52295254 goto __restart;
52305255 }
......@@ -5306,12 +5331,12 @@ not_sorted:
53065331 // __nth_element on range containing __nth
53075332 if (__nth < __i)
53085333 {
5309 // __nth_element<_Compare>(__first, __nth, __i, __comp);
5334 // _VSTD::__nth_element<_Compare>(__first, __nth, __i, __comp);
53105335 __last = __i;
53115336 }
53125337 else
53135338 {
5314 // __nth_element<_Compare>(__i+1, __nth, __last, __comp);
5339 // _VSTD::__nth_element<_Compare>(__i+1, __nth, __last, __comp);
53155340 __first = ++__i;
53165341 }
53175342 }
......@@ -5323,7 +5348,7 @@ void
53235348nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
53245349{
53255350 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);
53275352}
53285353
53295354template <class _RandomAccessIterator>
......@@ -5359,7 +5384,7 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
53595384 _Compare __comp)
53605385{
53615386 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);
53635388}
53645389
53655390template <class _InputIterator1, class _InputIterator2>
......@@ -5376,7 +5401,7 @@ includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
53765401// set_union
53775402
53785403template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
5379_OutputIterator
5404_LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator
53805405__set_union(_InputIterator1 __first1, _InputIterator1 __last1,
53815406 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
53825407{
......@@ -5401,17 +5426,17 @@ __set_union(_InputIterator1 __first1, _InputIterator1 __last1,
54015426}
54025427
54035428template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
5404inline _LIBCPP_INLINE_VISIBILITY
5429inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
54055430_OutputIterator
54065431set_union(_InputIterator1 __first1, _InputIterator1 __last1,
54075432 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
54085433{
54095434 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);
54115436}
54125437
54135438template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
5414inline _LIBCPP_INLINE_VISIBILITY
5439inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
54155440_OutputIterator
54165441set_union(_InputIterator1 __first1, _InputIterator1 __last1,
54175442 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
......@@ -5453,7 +5478,7 @@ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
54535478 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
54545479{
54555480 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);
54575482}
54585483
54595484template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -5470,7 +5495,7 @@ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
54705495// set_difference
54715496
54725497template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
5473_OutputIterator
5498_LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator
54745499__set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
54755500 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
54765501{
......@@ -5495,17 +5520,17 @@ __set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
54955520}
54965521
54975522template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
5498inline _LIBCPP_INLINE_VISIBILITY
5523inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
54995524_OutputIterator
55005525set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55015526 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
55025527{
55035528 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);
55055530}
55065531
55075532template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
5508inline _LIBCPP_INLINE_VISIBILITY
5533inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
55095534_OutputIterator
55105535set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55115536 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
......@@ -5518,7 +5543,7 @@ set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55185543// set_symmetric_difference
55195544
55205545template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
5521_OutputIterator
5546_LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator
55225547__set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55235548 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
55245549{
......@@ -5548,17 +5573,17 @@ __set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55485573}
55495574
55505575template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
5551inline _LIBCPP_INLINE_VISIBILITY
5576inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
55525577_OutputIterator
55535578set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55545579 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
55555580{
55565581 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);
55585583}
55595584
55605585template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
5561inline _LIBCPP_INLINE_VISIBILITY
5586inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
55625587_OutputIterator
55635588set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
55645589 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
......@@ -5593,7 +5618,7 @@ lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
55935618 _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
55945619{
55955620 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);
55975622}
55985623
55995624template <class _InputIterator1, class _InputIterator2>
......@@ -5643,7 +5668,7 @@ bool
56435668next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
56445669{
56455670 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);
56475672}
56485673
56495674template <class _BidirectionalIterator>
......@@ -5690,7 +5715,7 @@ bool
56905715prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
56915716{
56925717 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);
56945719}
56955720
56965721template <class _BidirectionalIterator>
lib/libcxx/include/any+22-8
......@@ -81,8 +81,8 @@ namespace std {
8181*/
8282
8383#include <experimental/__config>
84#include <__availability>
8485#include <memory>
85#include <new>
8686#include <typeinfo>
8787#include <type_traits>
8888#include <cstdlib>
......@@ -157,7 +157,7 @@ namespace __any_imp
157157 template <class _Tp>
158158 inline _LIBCPP_INLINE_VISIBILITY
159159 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;
161161 }
162162
163163 template <class _Tp>
......@@ -368,7 +368,11 @@ namespace __any_imp
368368 template <class ..._Args>
369369 _LIBCPP_INLINE_VISIBILITY
370370 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)...);
372376 __dest.__h = &_SmallHandler::__handle;
373377 return *__ret;
374378 }
......@@ -376,8 +380,11 @@ namespace __any_imp
376380 private:
377381 _LIBCPP_INLINE_VISIBILITY
378382 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);
381388 __this.__h = nullptr;
382389 }
383390
......@@ -445,10 +452,12 @@ namespace __any_imp
445452 _LIBCPP_INLINE_VISIBILITY
446453 static _Tp& __create(any & __dest, _Args&&... __args) {
447454 typedef allocator<_Tp> _Alloc;
455 typedef allocator_traits<_Alloc> _ATraits;
448456 typedef __allocator_destructor<_Alloc> _Dp;
449457 _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)...);
452461 __dest.__s.__ptr = __hold.release();
453462 __dest.__h = &_LargeHandler::__handle;
454463 return *__ret;
......@@ -458,7 +467,12 @@ namespace __any_imp
458467
459468 _LIBCPP_INLINE_VISIBILITY
460469 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);
462476 __this.__h = nullptr;
463477 }
464478
lib/libcxx/include/array+5-9
......@@ -142,8 +142,8 @@ struct _LIBCPP_TEMPLATE_VIS array
142142 typedef const value_type* const_pointer;
143143 typedef size_t size_type;
144144 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;
147147
148148 _Tp __elems_[_Size];
149149
......@@ -155,7 +155,7 @@ struct _LIBCPP_TEMPLATE_VIS array
155155
156156 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
157157 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());
159159 }
160160
161161 // iterators:
......@@ -245,8 +245,8 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
245245 typedef const value_type* const_pointer;
246246 typedef size_t size_type;
247247 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;
250250
251251 typedef typename conditional<is_const<_Tp>::value, const char,
252252 char>::type _CharType;
......@@ -459,8 +459,6 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
459459 return __a.__elems_[_Ip];
460460}
461461
462#ifndef _LIBCPP_CXX03_LANG
463
464462template <size_t _Ip, class _Tp, size_t _Size>
465463inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
466464_Tp&&
......@@ -479,8 +477,6 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
479477 return _VSTD::move(__a.__elems_[_Ip]);
480478}
481479
482#endif // !_LIBCPP_CXX03_LANG
483
484480#if _LIBCPP_STD_VER > 17
485481
486482template <typename _Tp, size_t _Size, size_t... _Index>
lib/libcxx/include/atomic+93-77
......@@ -16,9 +16,12 @@
1616namespace std
1717{
1818
19// feature test macro
19// feature test macro [version.syn]
2020
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
2225
2326 // order and consistency
2427
......@@ -45,6 +48,7 @@ template <class T> T kill_dependency(T y) noexcept;
4548
4649#define ATOMIC_BOOL_LOCK_FREE unspecified
4750#define ATOMIC_CHAR_LOCK_FREE unspecified
51#define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20
4852#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
4953#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
5054#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
......@@ -108,6 +112,7 @@ template <>
108112struct atomic<integral>
109113{
110114 using value_type = integral;
115 using difference_type = value_type;
111116
112117 static constexpr bool is_always_lock_free;
113118 bool is_lock_free() const volatile noexcept;
......@@ -190,6 +195,7 @@ template <class T>
190195struct atomic<T*>
191196{
192197 using value_type = T*;
198 using difference_type = ptrdiff_t;
193199
194200 static constexpr bool is_always_lock_free;
195201 bool is_lock_free() const volatile noexcept;
......@@ -460,6 +466,7 @@ typedef atomic<long> atomic_long;
460466typedef atomic<unsigned long> atomic_ulong;
461467typedef atomic<long long> atomic_llong;
462468typedef atomic<unsigned long long> atomic_ullong;
469typedef atomic<char8_t> atomic_char8_t; // C++20
463470typedef atomic<char16_t> atomic_char16_t;
464471typedef atomic<char32_t> atomic_char32_t;
465472typedef atomic<wchar_t> atomic_wchar_t;
......@@ -477,7 +484,7 @@ typedef atomic<int_fast8_t> atomic_int_fast8_t;
477484typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
478485typedef atomic<int_fast16_t> atomic_int_fast16_t;
479486typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
480typedef atomic<int_fast32_t> atomic_int_fast32_t;
487typedef atomic<int_fast32_t> atomic_int_fast32_t;
481488typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
482489typedef atomic<int_fast64_t> atomic_int_fast64_t;
483490typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
......@@ -568,6 +575,7 @@ template <class T>
568575*/
569576
570577#include <__config>
578#include <__availability>
571579#include <__threading_support>
572580#include <cstddef>
573581#include <cstdint>
......@@ -654,7 +662,7 @@ typedef enum memory_order {
654662
655663template <typename _Tp> _LIBCPP_INLINE_VISIBILITY
656664bool __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;
658666}
659667
660668static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
......@@ -1119,6 +1127,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
11191127#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
11201128# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
11211129# 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
11221133# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
11231134# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
11241135# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
......@@ -1130,6 +1141,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
11301141#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
11311142# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
11321143# 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
11331147# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
11341148# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
11351149# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
......@@ -1245,10 +1259,10 @@ template <typename _Tp>
12451259_LIBCPP_INLINE_VISIBILITY
12461260bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
12471261 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1248 __a->__lock();
12491262 _Tp __temp;
1263 __a->__lock();
12501264 __cxx_atomic_assign_volatile(__temp, __a->__a_value);
1251 bool __ret = __temp == *__expected;
1265 bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
12521266 if(__ret)
12531267 __cxx_atomic_assign_volatile(__a->__a_value, __value);
12541268 else
......@@ -1261,11 +1275,11 @@ _LIBCPP_INLINE_VISIBILITY
12611275bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
12621276 _Tp* __expected, _Tp __value, memory_order, memory_order) {
12631277 __a->__lock();
1264 bool __ret = __a->__a_value == *__expected;
1278 bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
12651279 if(__ret)
1266 __a->__a_value = __value;
1280 _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
12671281 else
1268 *__expected = __a->__a_value;
1282 _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
12691283 __a->__unlock();
12701284 return __ret;
12711285}
......@@ -1274,10 +1288,10 @@ template <typename _Tp>
12741288_LIBCPP_INLINE_VISIBILITY
12751289bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
12761290 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1277 __a->__lock();
12781291 _Tp __temp;
1292 __a->__lock();
12791293 __cxx_atomic_assign_volatile(__temp, __a->__a_value);
1280 bool __ret = __temp == *__expected;
1294 bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
12811295 if(__ret)
12821296 __cxx_atomic_assign_volatile(__a->__a_value, __value);
12831297 else
......@@ -1290,11 +1304,11 @@ _LIBCPP_INLINE_VISIBILITY
12901304bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
12911305 _Tp* __expected, _Tp __value, memory_order, memory_order) {
12921306 __a->__lock();
1293 bool __ret = __a->__a_value == *__expected;
1307 bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
12941308 if(__ret)
1295 __a->__a_value = __value;
1309 _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
12961310 else
1297 *__expected = __a->__a_value;
1311 _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
12981312 __a->__unlock();
12991313 return __ret;
13001314}
......@@ -1444,6 +1458,9 @@ template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC
14441458template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
14451459template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
14461460template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1461#ifndef _LIBCPP_NO_HAS_CHAR8_T
1462template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; };
1463#endif
14471464template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
14481465template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
14491466template<> 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 {
14861503 using __cxx_contention_t = int64_t;
14871504#endif //__linux__
14881505
1489#if _LIBCPP_STD_VER >= 11
1490
14911506using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
14921507
14931508#ifndef _LIBCPP_HAS_NO_PLATFORM_WAIT
......@@ -1519,7 +1534,7 @@ struct __libcpp_atomic_wait_backoff_impl {
15191534 else if(__elapsed > chrono::microseconds(4))
15201535 __libcpp_thread_yield();
15211536 else
1522 ; // poll
1537 {} // poll
15231538 return false;
15241539 }
15251540};
......@@ -1565,8 +1580,6 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, mem
15651580 return __cxx_atomic_wait(__a, __test_fn);
15661581}
15671582
1568#endif //_LIBCPP_STD_VER >= 11
1569
15701583// general atomic<T>
15711584
15721585template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
......@@ -1775,6 +1788,7 @@ struct atomic
17751788{
17761789 typedef __atomic_base<_Tp> __base;
17771790 typedef _Tp value_type;
1791 typedef value_type difference_type;
17781792 _LIBCPP_INLINE_VISIBILITY
17791793 atomic() _NOEXCEPT _LIBCPP_DEFAULT
17801794 _LIBCPP_INLINE_VISIBILITY
......@@ -1796,6 +1810,7 @@ struct atomic<_Tp*>
17961810{
17971811 typedef __atomic_base<_Tp*> __base;
17981812 typedef _Tp* value_type;
1813 typedef ptrdiff_t difference_type;
17991814 _LIBCPP_INLINE_VISIBILITY
18001815 atomic() _NOEXCEPT _LIBCPP_DEFAULT
18011816 _LIBCPP_INLINE_VISIBILITY
......@@ -1872,7 +1887,7 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
18721887template <class _Tp>
18731888_LIBCPP_INLINE_VISIBILITY
18741889void
1875atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1890atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
18761891{
18771892 __cxx_atomic_init(&__o->__a_, __d);
18781893}
......@@ -1880,7 +1895,7 @@ atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
18801895template <class _Tp>
18811896_LIBCPP_INLINE_VISIBILITY
18821897void
1883atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1898atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
18841899{
18851900 __cxx_atomic_init(&__o->__a_, __d);
18861901}
......@@ -1890,7 +1905,7 @@ atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
18901905template <class _Tp>
18911906_LIBCPP_INLINE_VISIBILITY
18921907void
1893atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1908atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
18941909{
18951910 __o->store(__d);
18961911}
......@@ -1898,7 +1913,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
18981913template <class _Tp>
18991914_LIBCPP_INLINE_VISIBILITY
19001915void
1901atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1916atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
19021917{
19031918 __o->store(__d);
19041919}
......@@ -1908,7 +1923,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
19081923template <class _Tp>
19091924_LIBCPP_INLINE_VISIBILITY
19101925void
1911atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1926atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
19121927 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
19131928{
19141929 __o->store(__d, __m);
......@@ -1917,7 +1932,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE
19171932template <class _Tp>
19181933_LIBCPP_INLINE_VISIBILITY
19191934void
1920atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1935atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
19211936 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
19221937{
19231938 __o->store(__d, __m);
......@@ -1966,7 +1981,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
19661981template <class _Tp>
19671982_LIBCPP_INLINE_VISIBILITY
19681983_Tp
1969atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1984atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
19701985{
19711986 return __o->exchange(__d);
19721987}
......@@ -1974,7 +1989,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
19741989template <class _Tp>
19751990_LIBCPP_INLINE_VISIBILITY
19761991_Tp
1977atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1992atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
19781993{
19791994 return __o->exchange(__d);
19801995}
......@@ -1984,7 +1999,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
19841999template <class _Tp>
19852000_LIBCPP_INLINE_VISIBILITY
19862001_Tp
1987atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
2002atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
19882003{
19892004 return __o->exchange(__d, __m);
19902005}
......@@ -1992,7 +2007,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _
19922007template <class _Tp>
19932008_LIBCPP_INLINE_VISIBILITY
19942009_Tp
1995atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
2010atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
19962011{
19972012 return __o->exchange(__d, __m);
19982013}
......@@ -2002,7 +2017,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
20022017template <class _Tp>
20032018_LIBCPP_INLINE_VISIBILITY
20042019bool
2005atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
2020atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
20062021{
20072022 return __o->compare_exchange_weak(*__e, __d);
20082023}
......@@ -2010,7 +2025,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX
20102025template <class _Tp>
20112026_LIBCPP_INLINE_VISIBILITY
20122027bool
2013atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
2028atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
20142029{
20152030 return __o->compare_exchange_weak(*__e, __d);
20162031}
......@@ -2020,7 +2035,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
20202035template <class _Tp>
20212036_LIBCPP_INLINE_VISIBILITY
20222037bool
2023atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
2038atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
20242039{
20252040 return __o->compare_exchange_strong(*__e, __d);
20262041}
......@@ -2028,7 +2043,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO
20282043template <class _Tp>
20292044_LIBCPP_INLINE_VISIBILITY
20302045bool
2031atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
2046atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
20322047{
20332048 return __o->compare_exchange_strong(*__e, __d);
20342049}
......@@ -2038,8 +2053,8 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
20382053template <class _Tp>
20392054_LIBCPP_INLINE_VISIBILITY
20402055bool
2041atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
2042 _Tp __d,
2056atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
2057 typename atomic<_Tp>::value_type __d,
20432058 memory_order __s, memory_order __f) _NOEXCEPT
20442059 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
20452060{
......@@ -2049,7 +2064,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
20492064template <class _Tp>
20502065_LIBCPP_INLINE_VISIBILITY
20512066bool
2052atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
2067atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
20532068 memory_order __s, memory_order __f) _NOEXCEPT
20542069 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
20552070{
......@@ -2062,7 +2077,7 @@ template <class _Tp>
20622077_LIBCPP_INLINE_VISIBILITY
20632078bool
20642079atomic_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,
20662081 memory_order __s, memory_order __f) _NOEXCEPT
20672082 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
20682083{
......@@ -2072,8 +2087,8 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
20722087template <class _Tp>
20732088_LIBCPP_INLINE_VISIBILITY
20742089bool
2075atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
2076 _Tp __d,
2090atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
2091 typename atomic<_Tp>::value_type __d,
20772092 memory_order __s, memory_order __f) _NOEXCEPT
20782093 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
20792094{
......@@ -2156,10 +2171,10 @@ template <class _Tp>
21562171_LIBCPP_INLINE_VISIBILITY
21572172typename enable_if
21582173<
2159 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2174 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
21602175 _Tp
21612176>::type
2162atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2177atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
21632178{
21642179 return __o->fetch_add(__op);
21652180}
......@@ -2168,10 +2183,10 @@ template <class _Tp>
21682183_LIBCPP_INLINE_VISIBILITY
21692184typename enable_if
21702185<
2171 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2186 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
21722187 _Tp
21732188>::type
2174atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2189atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
21752190{
21762191 return __o->fetch_add(__op);
21772192}
......@@ -2179,7 +2194,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
21792194template <class _Tp>
21802195_LIBCPP_INLINE_VISIBILITY
21812196_Tp*
2182atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
2197atomic_fetch_add(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
21832198{
21842199 return __o->fetch_add(__op);
21852200}
......@@ -2187,7 +2202,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
21872202template <class _Tp>
21882203_LIBCPP_INLINE_VISIBILITY
21892204_Tp*
2190atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
2205atomic_fetch_add(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
21912206{
21922207 return __o->fetch_add(__op);
21932208}
......@@ -2198,10 +2213,10 @@ template <class _Tp>
21982213_LIBCPP_INLINE_VISIBILITY
21992214typename enable_if
22002215<
2201 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2216 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22022217 _Tp
22032218>::type
2204atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2219atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
22052220{
22062221 return __o->fetch_add(__op, __m);
22072222}
......@@ -2210,10 +2225,10 @@ template <class _Tp>
22102225_LIBCPP_INLINE_VISIBILITY
22112226typename enable_if
22122227<
2213 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2228 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22142229 _Tp
22152230>::type
2216atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2231atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
22172232{
22182233 return __o->fetch_add(__op, __m);
22192234}
......@@ -2221,8 +2236,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
22212236template <class _Tp>
22222237_LIBCPP_INLINE_VISIBILITY
22232238_Tp*
2224atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
2225 memory_order __m) _NOEXCEPT
2239atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
22262240{
22272241 return __o->fetch_add(__op, __m);
22282242}
......@@ -2230,7 +2244,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
22302244template <class _Tp>
22312245_LIBCPP_INLINE_VISIBILITY
22322246_Tp*
2233atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
2247atomic_fetch_add_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
22342248{
22352249 return __o->fetch_add(__op, __m);
22362250}
......@@ -2241,10 +2255,10 @@ template <class _Tp>
22412255_LIBCPP_INLINE_VISIBILITY
22422256typename enable_if
22432257<
2244 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2258 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22452259 _Tp
22462260>::type
2247atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2261atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
22482262{
22492263 return __o->fetch_sub(__op);
22502264}
......@@ -2253,10 +2267,10 @@ template <class _Tp>
22532267_LIBCPP_INLINE_VISIBILITY
22542268typename enable_if
22552269<
2256 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2270 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22572271 _Tp
22582272>::type
2259atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2273atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
22602274{
22612275 return __o->fetch_sub(__op);
22622276}
......@@ -2264,7 +2278,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
22642278template <class _Tp>
22652279_LIBCPP_INLINE_VISIBILITY
22662280_Tp*
2267atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
2281atomic_fetch_sub(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
22682282{
22692283 return __o->fetch_sub(__op);
22702284}
......@@ -2272,7 +2286,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
22722286template <class _Tp>
22732287_LIBCPP_INLINE_VISIBILITY
22742288_Tp*
2275atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
2289atomic_fetch_sub(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
22762290{
22772291 return __o->fetch_sub(__op);
22782292}
......@@ -2283,10 +2297,10 @@ template <class _Tp>
22832297_LIBCPP_INLINE_VISIBILITY
22842298typename enable_if
22852299<
2286 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2300 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22872301 _Tp
22882302>::type
2289atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2303atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
22902304{
22912305 return __o->fetch_sub(__op, __m);
22922306}
......@@ -2295,10 +2309,10 @@ template <class _Tp>
22952309_LIBCPP_INLINE_VISIBILITY
22962310typename enable_if
22972311<
2298 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
2312 is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
22992313 _Tp
23002314>::type
2301atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2315atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
23022316{
23032317 return __o->fetch_sub(__op, __m);
23042318}
......@@ -2306,8 +2320,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
23062320template <class _Tp>
23072321_LIBCPP_INLINE_VISIBILITY
23082322_Tp*
2309atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
2310 memory_order __m) _NOEXCEPT
2323atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
23112324{
23122325 return __o->fetch_sub(__op, __m);
23132326}
......@@ -2315,7 +2328,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
23152328template <class _Tp>
23162329_LIBCPP_INLINE_VISIBILITY
23172330_Tp*
2318atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
2331atomic_fetch_sub_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
23192332{
23202333 return __o->fetch_sub(__op, __m);
23212334}
......@@ -2329,7 +2342,7 @@ typename enable_if
23292342 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23302343 _Tp
23312344>::type
2332atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2345atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
23332346{
23342347 return __o->fetch_and(__op);
23352348}
......@@ -2341,7 +2354,7 @@ typename enable_if
23412354 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23422355 _Tp
23432356>::type
2344atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2357atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
23452358{
23462359 return __o->fetch_and(__op);
23472360}
......@@ -2355,7 +2368,7 @@ typename enable_if
23552368 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23562369 _Tp
23572370>::type
2358atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2371atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
23592372{
23602373 return __o->fetch_and(__op, __m);
23612374}
......@@ -2367,7 +2380,7 @@ typename enable_if
23672380 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23682381 _Tp
23692382>::type
2370atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2383atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
23712384{
23722385 return __o->fetch_and(__op, __m);
23732386}
......@@ -2381,7 +2394,7 @@ typename enable_if
23812394 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23822395 _Tp
23832396>::type
2384atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2397atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
23852398{
23862399 return __o->fetch_or(__op);
23872400}
......@@ -2393,7 +2406,7 @@ typename enable_if
23932406 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
23942407 _Tp
23952408>::type
2396atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2409atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
23972410{
23982411 return __o->fetch_or(__op);
23992412}
......@@ -2407,7 +2420,7 @@ typename enable_if
24072420 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24082421 _Tp
24092422>::type
2410atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2423atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
24112424{
24122425 return __o->fetch_or(__op, __m);
24132426}
......@@ -2419,7 +2432,7 @@ typename enable_if
24192432 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24202433 _Tp
24212434>::type
2422atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2435atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
24232436{
24242437 return __o->fetch_or(__op, __m);
24252438}
......@@ -2433,7 +2446,7 @@ typename enable_if
24332446 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24342447 _Tp
24352448>::type
2436atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2449atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
24372450{
24382451 return __o->fetch_xor(__op);
24392452}
......@@ -2445,7 +2458,7 @@ typename enable_if
24452458 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24462459 _Tp
24472460>::type
2448atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
2461atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
24492462{
24502463 return __o->fetch_xor(__op);
24512464}
......@@ -2459,7 +2472,7 @@ typename enable_if
24592472 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24602473 _Tp
24612474>::type
2462atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2475atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
24632476{
24642477 return __o->fetch_xor(__op, __m);
24652478}
......@@ -2471,7 +2484,7 @@ typename enable_if
24712484 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
24722485 _Tp
24732486>::type
2474atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
2487atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
24752488{
24762489 return __o->fetch_xor(__op, __m);
24772490}
......@@ -2715,6 +2728,9 @@ typedef atomic<long> atomic_long;
27152728typedef atomic<unsigned long> atomic_ulong;
27162729typedef atomic<long long> atomic_llong;
27172730typedef atomic<unsigned long long> atomic_ullong;
2731#ifndef _LIBCPP_NO_HAS_CHAR8_T
2732typedef atomic<char8_t> atomic_char8_t;
2733#endif
27182734typedef atomic<char16_t> atomic_char16_t;
27192735typedef atomic<char32_t> atomic_char32_t;
27202736typedef atomic<wchar_t> atomic_wchar_t;
lib/libcxx/include/barrier+10-2
......@@ -22,6 +22,8 @@ namespace std
2222 public:
2323 using arrival_token = see below;
2424
25 static constexpr ptrdiff_t max() noexcept;
26
2527 constexpr explicit barrier(ptrdiff_t phase_count,
2628 CompletionFunction f = CompletionFunction());
2729 ~barrier();
......@@ -44,6 +46,7 @@ namespace std
4446*/
4547
4648#include <__config>
49#include <__availability>
4750#include <atomic>
4851#ifndef _LIBCPP_HAS_NO_TREE_BARRIER
4952# include <memory>
......@@ -57,6 +60,9 @@ namespace std
5760# error <barrier> is not supported on this single threaded system
5861#endif
5962
63_LIBCPP_PUSH_MACROS
64#include <__undef_macros>
65
6066#if _LIBCPP_STD_VER >= 14
6167
6268_LIBCPP_BEGIN_NAMESPACE_STD
......@@ -287,7 +293,7 @@ public:
287293
288294 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
289295 barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
290 : __b(__count, std::move(__completion)) {
296 : __b(__count, _VSTD::move(__completion)) {
291297 }
292298
293299 barrier(barrier const&) = delete;
......@@ -301,7 +307,7 @@ public:
301307 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
302308 void wait(arrival_token&& __phase) const
303309 {
304 __b.wait(std::move(__phase));
310 __b.wait(_VSTD::move(__phase));
305311 }
306312 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
307313 void arrive_and_wait()
......@@ -319,4 +325,6 @@ _LIBCPP_END_NAMESPACE_STD
319325
320326#endif // _LIBCPP_STD_VER >= 14
321327
328_LIBCPP_POP_MACROS
329
322330#endif //_LIBCPP_BARRIER
lib/libcxx/include/bit+14-15
......@@ -17,13 +17,13 @@ namespace std {
1717
1818 // [bit.pow.two], integral powers of 2
1919 template <class T>
20 constexpr bool ispow2(T x) noexcept; // C++20
20 constexpr bool has_single_bit(T x) noexcept; // C++20
2121 template <class T>
22 constexpr T ceil2(T x); // C++20
22 constexpr T bit_ceil(T x); // C++20
2323 template <class T>
24 constexpr T floor2(T x) noexcept; // C++20
24 constexpr T bit_floor(T x) noexcept; // C++20
2525 template <class T>
26 constexpr T log2p1(T x) noexcept; // C++20
26 constexpr T bit_width(T x) noexcept; // C++20
2727
2828 // [bit.rotate], rotating
2929 template<class T>
......@@ -343,14 +343,14 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
343343unsigned __bit_log2(_Tp __t) _NOEXCEPT
344344{
345345 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);
347347}
348348
349349template <class _Tp>
350350_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
351bool __ispow2(_Tp __t) _NOEXCEPT
351bool __has_single_bit(_Tp __t) _NOEXCEPT
352352{
353 static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
353 static_assert(__bitop_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned");
354354 return __t != 0 && (((__t & (__t - 1)) == 0));
355355}
356356
......@@ -399,7 +399,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr
399399enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
400400countr_zero(_Tp __t) noexcept
401401{
402 return __countr_zero(__t);
402 return __countr_zero(__t);
403403}
404404
405405
......@@ -424,15 +424,15 @@ popcount(_Tp __t) noexcept
424424template <class _Tp>
425425_LIBCPP_INLINE_VISIBILITY constexpr
426426enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
427ispow2(_Tp __t) noexcept
427has_single_bit(_Tp __t) noexcept
428428{
429 return __ispow2(__t);
429 return __has_single_bit(__t);
430430}
431431
432432template <class _Tp>
433433_LIBCPP_INLINE_VISIBILITY constexpr
434434enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
435floor2(_Tp __t) noexcept
435bit_floor(_Tp __t) noexcept
436436{
437437 return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
438438}
......@@ -440,11 +440,11 @@ floor2(_Tp __t) noexcept
440440template <class _Tp>
441441_LIBCPP_INLINE_VISIBILITY constexpr
442442enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
443ceil2(_Tp __t) noexcept
443bit_ceil(_Tp __t) noexcept
444444{
445445 if (__t < 2) return 1;
446446 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");
448448
449449 if constexpr (sizeof(_Tp) >= sizeof(unsigned))
450450 return _Tp{1} << __n;
......@@ -459,12 +459,11 @@ ceil2(_Tp __t) noexcept
459459template <class _Tp>
460460_LIBCPP_INLINE_VISIBILITY constexpr
461461enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
462log2p1(_Tp __t) noexcept
462bit_width(_Tp __t) noexcept
463463{
464464 return __t == 0 ? 0 : __bit_log2(__t) + 1;
465465}
466466
467
468467enum class endian
469468{
470469 little = 0xDEAD,
lib/libcxx/include/bitset+5-5
......@@ -380,7 +380,7 @@ unsigned long long
380380__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
381381{
382382 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)
384384 __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
385385 return __r;
386386}
......@@ -625,13 +625,13 @@ protected:
625625 explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
626626
627627 _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
628 {return reference(0, 1);}
628 {return reference(nullptr, 1);}
629629 _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);}
631631 _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
632 {return iterator(0, 0);}
632 {return iterator(nullptr, 0);}
633633 _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
634 {return const_iterator(0, 0);}
634 {return const_iterator(nullptr, 0);}
635635
636636 _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
637637 _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
lib/libcxx/include/charconv+14-13
......@@ -74,12 +74,13 @@ namespace std {
7474*/
7575
7676#include <__config>
77#include <__availability>
7778#include <__errc>
78#include <type_traits>
79#include <cmath> // for log2f
80#include <cstdint>
81#include <cstring>
7982#include <limits>
80#include <stdint.h>
81#include <string.h>
82#include <math.h>
83#include <type_traits>
8384
8485#include <__debug>
8586
......@@ -206,7 +207,7 @@ __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r)
206207{
207208 auto __c = __a * __b;
208209 __r = __c;
209 return __c > (numeric_limits<unsigned char>::max)();
210 return __c > numeric_limits<unsigned char>::max();
210211}
211212
212213template <typename _Tp>
......@@ -215,7 +216,7 @@ __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r)
215216{
216217 auto __c = __a * __b;
217218 __r = __c;
218 return __c > (numeric_limits<unsigned short>::max)();
219 return __c > numeric_limits<unsigned short>::max();
219220}
220221
221222template <typename _Tp>
......@@ -226,7 +227,7 @@ __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r)
226227#if !defined(_LIBCPP_COMPILER_MSVC)
227228 return __builtin_mul_overflow(__a, __b, &__r);
228229#else
229 bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a;
230 bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a;
230231 __r = __a * __b;
231232 return __did;
232233#endif
......@@ -332,7 +333,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
332333 auto __len = __p - __buf;
333334 if (__len <= __diff)
334335 {
335 memcpy(__first, __buf, __len);
336 _VSTD::memcpy(__first, __buf, __len);
336337 return {__first + __len, {}};
337338 }
338339 else
......@@ -381,7 +382,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
381382 return {__last, errc::value_too_large};
382383 else
383384 {
384 memmove(__first, __p, __len);
385 _VSTD::memmove(__first, __p, __len);
385386 return {__first + __len, {}};
386387 }
387388}
......@@ -428,13 +429,13 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
428429 if (__x <= __complement(__to_unsigned(__tl::min())))
429430 {
430431 __x = __complement(__x);
431 memcpy(&__value, &__x, sizeof(__x));
432 _VSTD::memcpy(&__value, &__x, sizeof(__x));
432433 return __r;
433434 }
434435 }
435436 else
436437 {
437 if (__x <= (__tl::max)())
438 if (__x <= __tl::max())
438439 {
439440 __value = __x;
440441 return __r;
......@@ -525,7 +526,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
525526 auto __p = __tx::__read(__first, __last, __a, __b);
526527 if (__p == __last || !__in_pattern(*__p))
527528 {
528 __output_type __m = (numeric_limits<_Tp>::max)();
529 __output_type __m = numeric_limits<_Tp>::max();
529530 if (__m >= __a && __m - __a >= __b)
530531 {
531532 __value = __a + __b;
......@@ -580,7 +581,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
580581
581582 if (__p == __last || !__in_pattern(*__p, __base))
582583 {
583 if ((__tl::max)() - __a >= __b)
584 if (__tl::max() - __a >= __b)
584585 {
585586 __value = __a + __b;
586587 return {__p, {}};
lib/libcxx/include/chrono+4-3
......@@ -824,6 +824,7 @@ constexpr chrono::year operator ""y(unsigned lo
824824*/
825825
826826#include <__config>
827#include <__availability>
827828#include <ctime>
828829#include <type_traits>
829830#include <ratio>
......@@ -1076,7 +1077,7 @@ public:
10761077 is_convertible<_Rep2, rep>::value &&
10771078 (treat_as_floating_point<rep>::value ||
10781079 !treat_as_floating_point<_Rep2>::value)
1079 >::type* = 0)
1080 >::type* = nullptr)
10801081 : __rep_(__r) {}
10811082
10821083 // conversions
......@@ -1089,7 +1090,7 @@ public:
10891090 treat_as_floating_point<rep>::value ||
10901091 (__no_overflow<_Period2, period>::type::den == 1 &&
10911092 !treat_as_floating_point<_Rep2>::value))
1092 >::type* = 0)
1093 >::type* = nullptr)
10931094 : __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
10941095
10951096 // observer
......@@ -1375,7 +1376,7 @@ public:
13751376 typename enable_if
13761377 <
13771378 is_convertible<_Duration2, duration>::value
1378 >::type* = 0)
1379 >::type* = nullptr)
13791380 : __d_(t.time_since_epoch()) {}
13801381
13811382 // observer
lib/libcxx/include/cmath+2-2
......@@ -660,8 +660,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
660660template <class _IntT, class _RealT>
661661_LIBCPP_INLINE_VISIBILITY
662662_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>();
665665 if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
666666 return _Lim::max();
667667 } else if (__r <= _Lim::lowest()) {
lib/libcxx/include/codecvt+24
......@@ -109,6 +109,7 @@ protected:
109109 virtual int do_max_length() const _NOEXCEPT;
110110};
111111
112_LIBCPP_SUPPRESS_DEPRECATED_PUSH
112113template <>
113114class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
114115 : public codecvt<char16_t, char, mbstate_t>
......@@ -125,6 +126,8 @@ public:
125126 codecvt_mode _Mode)
126127 : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
127128 _Mode_(_Mode) {}
129_LIBCPP_SUPPRESS_DEPRECATED_POP
130
128131protected:
129132 virtual result
130133 do_out(state_type& __st,
......@@ -144,6 +147,7 @@ protected:
144147 virtual int do_max_length() const _NOEXCEPT;
145148};
146149
150_LIBCPP_SUPPRESS_DEPRECATED_PUSH
147151template <>
148152class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
149153 : public codecvt<char32_t, char, mbstate_t>
......@@ -160,6 +164,8 @@ public:
160164 codecvt_mode _Mode)
161165 : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
162166 _Mode_(_Mode) {}
167_LIBCPP_SUPPRESS_DEPRECATED_POP
168
163169protected:
164170 virtual result
165171 do_out(state_type& __st,
......@@ -267,6 +273,7 @@ protected:
267273 virtual int do_max_length() const _NOEXCEPT;
268274};
269275
276_LIBCPP_SUPPRESS_DEPRECATED_PUSH
270277template <>
271278class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
272279 : public codecvt<char16_t, char, mbstate_t>
......@@ -283,6 +290,8 @@ public:
283290 codecvt_mode _Mode)
284291 : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
285292 _Mode_(_Mode) {}
293_LIBCPP_SUPPRESS_DEPRECATED_POP
294
286295protected:
287296 virtual result
288297 do_out(state_type& __st,
......@@ -302,6 +311,7 @@ protected:
302311 virtual int do_max_length() const _NOEXCEPT;
303312};
304313
314_LIBCPP_SUPPRESS_DEPRECATED_PUSH
305315template <>
306316class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
307317 : public codecvt<char16_t, char, mbstate_t>
......@@ -318,6 +328,8 @@ public:
318328 codecvt_mode _Mode)
319329 : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
320330 _Mode_(_Mode) {}
331_LIBCPP_SUPPRESS_DEPRECATED_POP
332
321333protected:
322334 virtual result
323335 do_out(state_type& __st,
......@@ -337,6 +349,7 @@ protected:
337349 virtual int do_max_length() const _NOEXCEPT;
338350};
339351
352_LIBCPP_SUPPRESS_DEPRECATED_PUSH
340353template <>
341354class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
342355 : public codecvt<char32_t, char, mbstate_t>
......@@ -353,6 +366,8 @@ public:
353366 codecvt_mode _Mode)
354367 : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
355368 _Mode_(_Mode) {}
369_LIBCPP_SUPPRESS_DEPRECATED_POP
370
356371protected:
357372 virtual result
358373 do_out(state_type& __st,
......@@ -372,6 +387,7 @@ protected:
372387 virtual int do_max_length() const _NOEXCEPT;
373388};
374389
390_LIBCPP_SUPPRESS_DEPRECATED_PUSH
375391template <>
376392class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
377393 : public codecvt<char32_t, char, mbstate_t>
......@@ -388,6 +404,8 @@ public:
388404 codecvt_mode _Mode)
389405 : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
390406 _Mode_(_Mode) {}
407_LIBCPP_SUPPRESS_DEPRECATED_POP
408
391409protected:
392410 virtual result
393411 do_out(state_type& __st,
......@@ -460,6 +478,7 @@ protected:
460478 virtual int do_max_length() const _NOEXCEPT;
461479};
462480
481_LIBCPP_SUPPRESS_DEPRECATED_PUSH
463482template <>
464483class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
465484 : public codecvt<char32_t, char, mbstate_t>
......@@ -476,6 +495,8 @@ public:
476495 codecvt_mode _Mode)
477496 : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
478497 _Mode_(_Mode) {}
498_LIBCPP_SUPPRESS_DEPRECATED_POP
499
479500protected:
480501 virtual result
481502 do_out(state_type& __st,
......@@ -495,6 +516,7 @@ protected:
495516 virtual int do_max_length() const _NOEXCEPT;
496517};
497518
519_LIBCPP_SUPPRESS_DEPRECATED_PUSH
498520template <>
499521class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
500522 : public codecvt<char16_t, char, mbstate_t>
......@@ -511,6 +533,8 @@ public:
511533 codecvt_mode _Mode)
512534 : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
513535 _Mode_(_Mode) {}
536_LIBCPP_SUPPRESS_DEPRECATED_POP
537
514538protected:
515539 virtual result
516540 do_out(state_type& __st,
lib/libcxx/include/compare+9-4
......@@ -154,8 +154,13 @@ enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char {
154154 __unordered = -127
155155};
156156
157struct _CmpUnspecifiedType;
158using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)();
157struct _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};
159164
160165class weak_equality {
161166 _LIBCPP_INLINE_VISIBILITY
......@@ -696,8 +701,8 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept {
696701
697702template <size_t _Size>
698703constexpr _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 = {};
701706 for (auto __type : __types)
702707 ++__seen[__type];
703708 if (__seen[_None])
lib/libcxx/include/complex+7-10
......@@ -227,14 +227,6 @@ template<class T> complex<T> sqrt (const complex<T>&);
227227template<class T> complex<T> tan (const complex<T>&);
228228template<class T> complex<T> tanh (const complex<T>&);
229229
230template<class T, class charT, class traits>
231 basic_istream<charT, traits>&
232 operator>>(basic_istream<charT, traits>& is, complex<T>& x);
233
234template<class T, class charT, class traits>
235 basic_ostream<charT, traits>&
236 operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
237
238230} // std
239231
240232*/
......@@ -244,9 +236,12 @@ template<class T, class charT, class traits>
244236#include <stdexcept>
245237#include <cmath>
246238#include <iosfwd>
247#include <sstream>
248239#include <version>
249240
241#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
242# include <sstream> // for std::basic_ostringstream
243#endif
244
250245#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
251246#pragma GCC system_header
252247#endif
......@@ -955,7 +950,7 @@ inline _LIBCPP_INLINE_VISIBILITY
955950complex<_Tp>
956951proj(const complex<_Tp>& __c)
957952{
958 std::complex<_Tp> __r = __c;
953 complex<_Tp> __r = __c;
959954 if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
960955 __r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
961956 return __r;
......@@ -1438,6 +1433,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
14381433 return __is;
14391434}
14401435
1436#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
14411437template<class _Tp, class _CharT, class _Traits>
14421438basic_ostream<_CharT, _Traits>&
14431439operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
......@@ -1449,6 +1445,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
14491445 __s << '(' << __x.real() << ',' << __x.imag() << ')';
14501446 return __os << __s.str();
14511447}
1448#endif // !_LIBCPP_HAS_NO_LOCALIZATION
14521449
14531450#if _LIBCPP_STD_VER > 11
14541451// 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
5252#pragma GCC system_header
5353#endif
5454
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
5569_LIBCPP_BEGIN_NAMESPACE_STD
5670
5771using ::clock_t;
......@@ -72,7 +86,7 @@ using ::gmtime;
7286using ::localtime;
7387#endif
7488using ::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)
7690using ::timespec_get;
7791#endif
7892
lib/libcxx/include/deque+8-8
......@@ -1237,7 +1237,7 @@ __deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
12371237 __map_.swap(__c.__map_);
12381238 _VSTD::swap(__start_, __c.__start_);
12391239 _VSTD::swap(size(), __c.size());
1240 __swap_allocator(__alloc(), __c.__alloc());
1240 _VSTD::__swap_allocator(__alloc(), __c.__alloc());
12411241}
12421242
12431243template <class _Tp, class _Allocator>
......@@ -1393,7 +1393,7 @@ public:
13931393 size_type size() const _NOEXCEPT {return __base::size();}
13941394 _LIBCPP_INLINE_VISIBILITY
13951395 size_type max_size() const _NOEXCEPT
1396 {return std::min<size_type>(
1396 {return _VSTD::min<size_type>(
13971397 __alloc_traits::max_size(__base::__alloc()),
13981398 numeric_limits<difference_type>::max());}
13991399 void resize(size_type __n);
......@@ -1586,7 +1586,7 @@ public:
15861586
15871587#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
15881588template<class _InputIterator,
1589 class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
1589 class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
15901590 class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
15911591 >
15921592deque(_InputIterator, _InputIterator)
......@@ -2376,7 +2376,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
23762376 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
23772377 _ConstructTransaction __tx(this, __br);
23782378 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);
23802380 }
23812381 }
23822382}
......@@ -2393,7 +2393,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
23932393 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
23942394 _ConstructTransaction __tx(this, __br);
23952395 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_));
23972397 }
23982398 }
23992399}
......@@ -2410,7 +2410,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
24102410 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
24112411 _ConstructTransaction __tx(this, __br);
24122412 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);
24142414 }
24152415 }
24162416
......@@ -2708,7 +2708,7 @@ void
27082708deque<_Tp, _Allocator>::pop_front()
27092709{
27102710 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() +
27122712 __base::__start_ / __base::__block_size) +
27132713 __base::__start_ % __base::__block_size));
27142714 --__base::size();
......@@ -2723,7 +2723,7 @@ deque<_Tp, _Allocator>::pop_back()
27232723 _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
27242724 allocator_type& __a = __base::__alloc();
27252725 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() +
27272727 __p / __base::__block_size) +
27282728 __p % __base::__block_size));
27292729 --__base::size();
lib/libcxx/include/exception+2
......@@ -77,6 +77,8 @@ template <class E> void rethrow_if_nested(const E& e);
7777*/
7878
7979#include <__config>
80#include <__availability>
81#include <__memory/base.h>
8082#include <cstddef>
8183#include <cstdlib>
8284#include <type_traits>
lib/libcxx/include/experimental/memory_resource+2-3
......@@ -116,7 +116,7 @@ public:
116116 { return do_is_equal(__other); }
117117
118118// 8.5.3, memory.resource.priv
119protected:
119private:
120120 virtual void* do_allocate(size_t, size_t) = 0;
121121 virtual void do_deallocate(void*, size_t, size_t) = 0;
122122 virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0;
......@@ -381,7 +381,7 @@ public:
381381 { return __alloc_; }
382382
383383// 8.7.3, memory.resource.adaptor.mem
384protected:
384private:
385385 virtual void * do_allocate(size_t __bytes, size_t)
386386 {
387387 if (__bytes > __max_size()) {
......@@ -407,7 +407,6 @@ protected:
407407 return __p ? __alloc_ == __p->__alloc_ : false;
408408 }
409409
410private:
411410 _LIBCPP_INLINE_VISIBILITY
412411 size_t __max_size() const _NOEXCEPT {
413412 return numeric_limits<size_t>::max() - _MaxAlign;
lib/libcxx/include/experimental/simd+5
......@@ -659,6 +659,9 @@ public:
659659#pragma GCC system_header
660660#endif
661661
662_LIBCPP_PUSH_MACROS
663#include <__undef_macros>
664
662665_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD
663666
664667#if _LIBCPP_STD_VER >= 17
......@@ -1566,4 +1569,6 @@ public:
15661569
15671570_LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
15681571
1572_LIBCPP_POP_MACROS
1573
15691574#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)
671671 __h.get_deleter().__first_constructed = true;
672672 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
673673 __h.get_deleter().__second_constructed = true;
674 return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
674 return __h;
675675}
676676
677677template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
lib/libcxx/include/filesystem+84-37
......@@ -230,21 +230,25 @@
230230*/
231231
232232#include <__config>
233#include <__availability>
233234#include <cstddef>
234235#include <cstdlib>
235236#include <chrono>
236237#include <iterator>
237238#include <iosfwd>
238#include <locale>
239239#include <memory>
240240#include <stack>
241241#include <string>
242242#include <system_error>
243243#include <utility>
244#include <iomanip> // for quoted
245244#include <string_view>
246245#include <version>
247246
247#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
248# include <locale>
249# include <iomanip> // for quoted
250#endif
251
248252#include <__debug>
249253
250254#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -543,6 +547,13 @@ struct __can_convert_char<wchar_t> {
543547 static const bool value = true;
544548 using __char_type = wchar_t;
545549};
550#ifndef _LIBCPP_NO_HAS_CHAR8_T
551template <>
552struct __can_convert_char<char8_t> {
553 static const bool value = true;
554 using __char_type = char8_t;
555};
556#endif
546557template <>
547558struct __can_convert_char<char16_t> {
548559 static const bool value = true;
......@@ -560,7 +571,7 @@ __is_separator(_ECharT __e) {
560571 return __e == _ECharT('/');
561572}
562573
563struct _NullSentinal {};
574struct _NullSentinel {};
564575
565576template <class _Tp>
566577using _Void = void;
......@@ -615,9 +626,9 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
615626 static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
616627 static _ECharT const* __range_end(const _ECharT* __b) {
617628 using _Iter = const _ECharT*;
618 const _ECharT __sentinal = _ECharT{};
629 const _ECharT __sentinel = _ECharT{};
619630 _Iter __e = __b;
620 for (; *__e != __sentinal; ++__e)
631 for (; *__e != __sentinel; ++__e)
621632 ;
622633 return __e;
623634 }
......@@ -639,7 +650,7 @@ struct __is_pathable_iter<
639650 using _Base = __can_convert_char<_ECharT>;
640651
641652 static _Iter __range_begin(_Iter __b) { return __b; }
642 static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; }
653 static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
643654
644655 static _ECharT __first_or_null(_Iter __b) { return *__b; }
645656};
......@@ -661,6 +672,10 @@ struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {
661672template <class _Tp>
662673struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {};
663674
675template <class _ECharT>
676struct _PathCVT;
677
678#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
664679template <class _ECharT>
665680struct _PathCVT {
666681 static_assert(__can_convert_char<_ECharT>::value,
......@@ -684,13 +699,13 @@ struct _PathCVT {
684699 }
685700
686701 template <class _Iter>
687 static void __append_range(string& __dest, _Iter __b, _NullSentinal) {
702 static void __append_range(string& __dest, _Iter __b, _NullSentinel) {
688703 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)
691706 return;
692707 basic_string<_ECharT> __tmp;
693 for (; *__b != __sentinal; ++__b)
708 for (; *__b != __sentinel; ++__b)
694709 __tmp.push_back(*__b);
695710 _Narrower()(back_inserter(__dest), __tmp.data(),
696711 __tmp.data() + __tmp.length());
......@@ -703,6 +718,7 @@ struct _PathCVT {
703718 _Traits::__range_end(__s));
704719 }
705720};
721#endif // !_LIBCPP_HAS_NO_LOCALIZATION
706722
707723template <>
708724struct _PathCVT<char> {
......@@ -721,9 +737,9 @@ struct _PathCVT<char> {
721737 }
722738
723739 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)
727743 __dest.push_back(*__b);
728744 }
729745
......@@ -779,12 +795,14 @@ public:
779795 _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
780796 }
781797
798#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
782799 // TODO Implement locale conversions.
783800 template <class _Source, class = _EnableIfPathable<_Source, void> >
784801 path(const _Source& __src, const locale& __loc, format = format::auto_format);
785802 template <class _InputIt>
786803 path(_InputIt __first, _InputIt _last, const locale& __loc,
787804 format = format::auto_format);
805#endif
788806
789807 _LIBCPP_INLINE_VISIBILITY
790808 ~path() = default;
......@@ -922,9 +940,8 @@ public:
922940 template <class _ECharT>
923941 typename enable_if<__can_convert_char<_ECharT>::value, path&>::type
924942 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));
928945 return *this;
929946 }
930947
......@@ -983,6 +1000,14 @@ public:
9831000
9841001 _LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; }
9851002
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)
9861011 template <class _ECharT, class _Traits = char_traits<_ECharT>,
9871012 class _Allocator = allocator<_ECharT> >
9881013 basic_string<_ECharT, _Traits, _Allocator>
......@@ -995,19 +1020,26 @@ public:
9951020 return __s;
9961021 }
9971022
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 {
10001024 return string<wchar_t>();
10011025 }
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 {
10041027 return string<char16_t>();
10051028 }
1006 _LIBCPP_INLINE_VISIBILITY std::u32string u32string() const {
1029 _LIBCPP_INLINE_VISIBILITY _VSTD::u32string u32string() const {
10071030 return string<char32_t>();
10081031 }
1032#endif
10091033
10101034 // 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)
10111043 template <class _ECharT, class _Traits = char_traits<_ECharT>,
10121044 class _Allocator = allocator<_ECharT> >
10131045 basic_string<_ECharT, _Traits, _Allocator>
......@@ -1015,11 +1047,10 @@ public:
10151047 return string<_ECharT, _Traits, _Allocator>(__a);
10161048 }
10171049
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
10231054
10241055private:
10251056 int __compare(__string_view) const;
......@@ -1123,13 +1154,14 @@ public:
11231154 iterator begin() const;
11241155 iterator end() const;
11251156
1157#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
11261158 template <class _CharT, class _Traits>
11271159 _LIBCPP_INLINE_VISIBILITY friend
11281160 typename enable_if<is_same<_CharT, char>::value &&
11291161 is_same<_Traits, char_traits<char> >::value,
11301162 basic_ostream<_CharT, _Traits>&>::type
11311163 operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
1132 __os << std::__quoted(__p.native());
1164 __os << _VSTD::__quoted(__p.native());
11331165 return __os;
11341166 }
11351167
......@@ -1139,7 +1171,7 @@ public:
11391171 !is_same<_Traits, char_traits<char> >::value,
11401172 basic_ostream<_CharT, _Traits>&>::type
11411173 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>());
11431175 return __os;
11441176 }
11451177
......@@ -1151,6 +1183,7 @@ public:
11511183 __p = __tmp;
11521184 return __is;
11531185 }
1186#endif // !_LIBCPP_HAS_NO_LOCALIZATION
11541187
11551188 friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept {
11561189 return __lhs.compare(__rhs) == 0;
......@@ -1194,23 +1227,37 @@ _LIBCPP_FUNC_VIS
11941227size_t hash_value(const path& __p) noexcept;
11951228
11961229template <class _Source>
1197_LIBCPP_INLINE_VISIBILITY
1230_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
11981231 typename enable_if<__is_pathable<_Source>::value, path>::type
11991232 u8path(const _Source& __s) {
12001233 static_assert(
1234#ifndef _LIBCPP_NO_HAS_CHAR8_T
1235 is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
1236#endif
12011237 is_same<typename __is_pathable<_Source>::__char_type, char>::value,
12021238 "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 );
12041244 return path(__s);
12051245}
12061246
12071247template <class _InputIt>
1208_LIBCPP_INLINE_VISIBILITY
1248_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
12091249 typename enable_if<__is_pathable<_InputIt>::value, path>::type
12101250 u8path(_InputIt __f, _InputIt __l) {
12111251 static_assert(
1252#ifndef _LIBCPP_NO_HAS_CHAR8_T
1253 is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
1254#endif
12121255 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 );
12141261 return path(__f, __l);
12151262}
12161263
......@@ -1230,7 +1277,7 @@ public:
12301277 typedef bidirectional_iterator_tag iterator_category;
12311278
12321279 typedef path value_type;
1233 typedef std::ptrdiff_t difference_type;
1280 typedef ptrdiff_t difference_type;
12341281 typedef const path* pointer;
12351282 typedef const path& reference;
12361283
......@@ -1374,7 +1421,7 @@ template <class... _Args>
13741421_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
13751422#ifndef _LIBCPP_NO_EXCEPTIONS
13761423void __throw_filesystem_error(_Args&&... __args) {
1377 throw filesystem_error(std::forward<_Args>(__args)...);
1424 throw filesystem_error(_VSTD::forward<_Args>(__args)...);
13781425}
13791426#else
13801427void __throw_filesystem_error(_Args&&...) {
......@@ -2204,7 +2251,7 @@ private:
22042251
22052252 _LIBCPP_INLINE_VISIBILITY
22062253 void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
2207 __p_ = std::move(__p);
2254 __p_ = _VSTD::move(__p);
22082255 __data_ = __dt;
22092256 }
22102257
......@@ -2505,10 +2552,10 @@ end(const directory_iterator&) noexcept {
25052552class recursive_directory_iterator {
25062553public:
25072554 using value_type = directory_entry;
2508 using difference_type = std::ptrdiff_t;
2555 using difference_type = ptrdiff_t;
25092556 using pointer = directory_entry const*;
25102557 using reference = directory_entry const&;
2511 using iterator_category = std::input_iterator_tag;
2558 using iterator_category = input_iterator_tag;
25122559
25132560public:
25142561 // constructors and destructor
lib/libcxx/include/forward_list+3-3
......@@ -603,7 +603,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
603603 __is_nothrow_swappable<__node_allocator>::value)
604604#endif
605605{
606 __swap_allocator(__alloc(), __x.__alloc(),
606 _VSTD::__swap_allocator(__alloc(), __x.__alloc(),
607607 integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
608608 using _VSTD::swap;
609609 swap(__before_begin()->__next_, __x.__before_begin()->__next_);
......@@ -758,7 +758,7 @@ public:
758758 {return base::__before_begin()->__next_ == nullptr;}
759759 _LIBCPP_INLINE_VISIBILITY
760760 size_type max_size() const _NOEXCEPT {
761 return std::min<size_type>(
761 return _VSTD::min<size_type>(
762762 __node_traits::max_size(base::__alloc()),
763763 numeric_limits<difference_type>::max());
764764 }
......@@ -871,7 +871,7 @@ private:
871871
872872#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
873873template<class _InputIterator,
874 class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
874 class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
875875 class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
876876 >
877877forward_list(_InputIterator, _InputIterator)
lib/libcxx/include/fstream+72-64
......@@ -180,6 +180,7 @@ typedef basic_fstream<wchar_t> wfstream;
180180*/
181181
182182#include <__config>
183#include <__availability>
183184#include <ostream>
184185#include <istream>
185186#include <__locale>
......@@ -240,7 +241,7 @@ public:
240241 return open(__p.c_str(), __mode);
241242 }
242243#endif
243 _LIBCPP_INLINE_VISIBILITY
244 inline _LIBCPP_INLINE_VISIBILITY
244245 basic_filebuf* __open(int __fd, ios_base::openmode __mode);
245246#endif
246247 basic_filebuf* close();
......@@ -286,13 +287,13 @@ private:
286287
287288template <class _CharT, class _Traits>
288289basic_filebuf<_CharT, _Traits>::basic_filebuf()
289 : __extbuf_(0),
290 __extbufnext_(0),
291 __extbufend_(0),
290 : __extbuf_(nullptr),
291 __extbufnext_(nullptr),
292 __extbufend_(nullptr),
292293 __ebs_(0),
293 __intbuf_(0),
294 __intbuf_(nullptr),
294295 __ibs_(0),
295 __file_(0),
296 __file_(nullptr),
296297 __cv_(nullptr),
297298 __st_(),
298299 __st_last_(),
......@@ -307,7 +308,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
307308 __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
308309 __always_noconv_ = __cv_->always_noconv();
309310 }
310 setbuf(0, 4096);
311 setbuf(nullptr, 4096);
311312}
312313
313314#ifndef _LIBCPP_CXX03_LANG
......@@ -359,13 +360,13 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
359360 (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
360361 (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
361362 }
362 __rhs.__extbuf_ = 0;
363 __rhs.__extbufnext_ = 0;
364 __rhs.__extbufend_ = 0;
363 __rhs.__extbuf_ = nullptr;
364 __rhs.__extbufnext_ = nullptr;
365 __rhs.__extbufend_ = nullptr;
365366 __rhs.__ebs_ = 0;
366367 __rhs.__intbuf_ = 0;
367368 __rhs.__ibs_ = 0;
368 __rhs.__file_ = 0;
369 __rhs.__file_ = nullptr;
369370 __rhs.__st_ = state_type();
370371 __rhs.__st_last_ = state_type();
371372 __rhs.__om_ = 0;
......@@ -499,7 +500,7 @@ inline
499500bool
500501basic_filebuf<_CharT, _Traits>::is_open() const
501502{
502 return __file_ != 0;
503 return __file_ != nullptr;
503504}
504505
505506template <class _CharT, class _Traits>
......@@ -547,8 +548,8 @@ template <class _CharT, class _Traits>
547548basic_filebuf<_CharT, _Traits>*
548549basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
549550{
550 basic_filebuf<_CharT, _Traits>* __rt = 0;
551 if (__file_ == 0)
551 basic_filebuf<_CharT, _Traits>* __rt = nullptr;
552 if (__file_ == nullptr)
552553 {
553554 if (const char* __mdstr = __make_mdstring(__mode)) {
554555 __rt = this;
......@@ -558,22 +559,23 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
558559 if (__mode & ios_base::ate) {
559560 if (fseek(__file_, 0, SEEK_END)) {
560561 fclose(__file_);
561 __file_ = 0;
562 __rt = 0;
562 __file_ = nullptr;
563 __rt = nullptr;
563564 }
564565 }
565566 } else
566 __rt = 0;
567 __rt = nullptr;
567568 }
568569 }
569570 return __rt;
570571}
571572
572573template <class _CharT, class _Traits>
573_LIBCPP_INLINE_VISIBILITY basic_filebuf<_CharT, _Traits>*
574inline _LIBCPP_INLINE_VISIBILITY
575basic_filebuf<_CharT, _Traits>*
574576basic_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) {
577579 if (const char* __mdstr = __make_mdstring(__mode)) {
578580 __rt = this;
579581 __file_ = fdopen(__fd, __mdstr);
......@@ -582,12 +584,12 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
582584 if (__mode & ios_base::ate) {
583585 if (fseek(__file_, 0, SEEK_END)) {
584586 fclose(__file_);
585 __file_ = 0;
586 __rt = 0;
587 __file_ = nullptr;
588 __rt = nullptr;
587589 }
588590 }
589591 } else
590 __rt = 0;
592 __rt = nullptr;
591593 }
592594 }
593595 return __rt;
......@@ -600,8 +602,8 @@ template <class _CharT, class _Traits>
600602basic_filebuf<_CharT, _Traits>*
601603basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
602604{
603 basic_filebuf<_CharT, _Traits>* __rt = 0;
604 if (__file_ == 0)
605 basic_filebuf<_CharT, _Traits>* __rt = nullptr;
606 if (__file_ == nullptr)
605607 {
606608 __rt = this;
607609 const wchar_t* __mdstr;
......@@ -650,7 +652,7 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
650652 __mdstr = L"a+b";
651653 break;
652654 default:
653 __rt = 0;
655 __rt = nullptr;
654656 break;
655657 }
656658 if (__rt)
......@@ -664,13 +666,13 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
664666 if (fseek(__file_, 0, SEEK_END))
665667 {
666668 fclose(__file_);
667 __file_ = 0;
668 __rt = 0;
669 __file_ = nullptr;
670 __rt = nullptr;
669671 }
670672 }
671673 }
672674 else
673 __rt = 0;
675 __rt = nullptr;
674676 }
675677 }
676678 return __rt;
......@@ -690,16 +692,16 @@ template <class _CharT, class _Traits>
690692basic_filebuf<_CharT, _Traits>*
691693basic_filebuf<_CharT, _Traits>::close()
692694{
693 basic_filebuf<_CharT, _Traits>* __rt = 0;
695 basic_filebuf<_CharT, _Traits>* __rt = nullptr;
694696 if (__file_)
695697 {
696698 __rt = this;
697699 unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
698700 if (sync())
699 __rt = 0;
701 __rt = nullptr;
700702 if (fclose(__h.release()))
701 __rt = 0;
702 __file_ = 0;
703 __rt = nullptr;
704 __file_ = nullptr;
703705 setbuf(0, 0);
704706 }
705707 return __rt;
......@@ -709,17 +711,17 @@ template <class _CharT, class _Traits>
709711typename basic_filebuf<_CharT, _Traits>::int_type
710712basic_filebuf<_CharT, _Traits>::underflow()
711713{
712 if (__file_ == 0)
714 if (__file_ == nullptr)
713715 return traits_type::eof();
714716 bool __initial = __read_mode();
715717 char_type __1buf;
716 if (this->gptr() == 0)
718 if (this->gptr() == nullptr)
717719 this->setg(&__1buf, &__1buf+1, &__1buf+1);
718720 const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
719721 int_type __c = traits_type::eof();
720722 if (this->gptr() == this->egptr())
721723 {
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));
723725 if (__always_noconv_)
724726 {
725727 size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
......@@ -736,7 +738,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
736738 {
737739 _LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
738740 if (__extbufend_ != __extbufnext_)
739 memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
741 _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
740742 __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
741743 __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
742744 size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
......@@ -771,7 +773,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
771773 else
772774 __c = traits_type::to_int_type(*this->gptr());
773775 if (this->eback() == &__1buf)
774 this->setg(0, 0, 0);
776 this->setg(nullptr, nullptr, nullptr);
775777 return __c;
776778}
777779
......@@ -801,7 +803,7 @@ template <class _CharT, class _Traits>
801803typename basic_filebuf<_CharT, _Traits>::int_type
802804basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
803805{
804 if (__file_ == 0)
806 if (__file_ == nullptr)
805807 return traits_type::eof();
806808 __write_mode();
807809 char_type __1buf;
......@@ -809,7 +811,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
809811 char_type* __epb_save = this->epptr();
810812 if (!traits_type::eq_int_type(__c, traits_type::eof()))
811813 {
812 if (this->pptr() == 0)
814 if (this->pptr() == nullptr)
813815 this->setp(&__1buf, &__1buf+1);
814816 *this->pptr() = traits_type::to_char_type(__c);
815817 this->pbump(1);
......@@ -866,8 +868,8 @@ template <class _CharT, class _Traits>
866868basic_streambuf<_CharT, _Traits>*
867869basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
868870{
869 this->setg(0, 0, 0);
870 this->setp(0, 0);
871 this->setg(nullptr, nullptr, nullptr);
872 this->setp(nullptr, nullptr);
871873 if (__owns_eb_)
872874 delete [] __extbuf_;
873875 if (__owns_ib_)
......@@ -909,7 +911,7 @@ basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
909911 else
910912 {
911913 __ibs_ = 0;
912 __intbuf_ = 0;
914 __intbuf_ = nullptr;
913915 __owns_ib_ = false;
914916 }
915917 return this;
......@@ -924,7 +926,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
924926 __throw_bad_cast();
925927
926928 int __width = __cv_->encoding();
927 if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
929 if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
928930 return pos_type(off_type(-1));
929931 // __width > 0 || __off == 0
930932 int __whence;
......@@ -959,7 +961,7 @@ template <class _CharT, class _Traits>
959961typename basic_filebuf<_CharT, _Traits>::pos_type
960962basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
961963{
962 if (__file_ == 0 || sync())
964 if (__file_ == nullptr || sync())
963965 return pos_type(off_type(-1));
964966#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
965967 if (fseek(__file_, __sp, SEEK_SET))
......@@ -976,7 +978,7 @@ template <class _CharT, class _Traits>
976978int
977979basic_filebuf<_CharT, _Traits>::sync()
978980{
979 if (__file_ == 0)
981 if (__file_ == nullptr)
980982 return 0;
981983 if (!__cv_)
982984 __throw_bad_cast();
......@@ -1035,7 +1037,7 @@ basic_filebuf<_CharT, _Traits>::sync()
10351037 if (__update_st)
10361038 __st_ = __state;
10371039 __extbufnext_ = __extbufend_ = __extbuf_;
1038 this->setg(0, 0, 0);
1040 this->setg(nullptr, nullptr, nullptr);
10391041 __cm_ = 0;
10401042 }
10411043 return 0;
......@@ -1051,8 +1053,8 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
10511053 __always_noconv_ = __cv_->always_noconv();
10521054 if (__old_anc != __always_noconv_)
10531055 {
1054 this->setg(0, 0, 0);
1055 this->setp(0, 0);
1056 this->setg(nullptr, nullptr, nullptr);
1057 this->setp(nullptr, nullptr);
10561058 // invariant, char_type is char, else we couldn't get here
10571059 if (__always_noconv_) // need to dump __intbuf_
10581060 {
......@@ -1062,7 +1064,7 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
10621064 __ebs_ = __ibs_;
10631065 __extbuf_ = (char*)__intbuf_;
10641066 __ibs_ = 0;
1065 __intbuf_ = 0;
1067 __intbuf_ = nullptr;
10661068 __owns_ib_ = false;
10671069 }
10681070 else // need to obtain an __intbuf_.
......@@ -1091,7 +1093,7 @@ basic_filebuf<_CharT, _Traits>::__read_mode()
10911093{
10921094 if (!(__cm_ & ios_base::in))
10931095 {
1094 this->setp(0, 0);
1096 this->setp(nullptr, nullptr);
10951097 if (__always_noconv_)
10961098 this->setg((char_type*)__extbuf_,
10971099 (char_type*)__extbuf_ + __ebs_,
......@@ -1110,7 +1112,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
11101112{
11111113 if (!(__cm_ & ios_base::out))
11121114 {
1113 this->setg(0, 0, 0);
1115 this->setg(nullptr, nullptr, nullptr);
11141116 if (__ebs_ > sizeof(__extbuf_min_))
11151117 {
11161118 if (__always_noconv_)
......@@ -1120,7 +1122,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
11201122 this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
11211123 }
11221124 else
1123 this->setp(0, 0);
1125 this->setp(nullptr, nullptr);
11241126 __cm_ = ios_base::out;
11251127 }
11261128}
......@@ -1206,7 +1208,7 @@ inline
12061208basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
12071209 : basic_istream<char_type, traits_type>(&__sb_)
12081210{
1209 if (__sb_.open(__s, __mode | ios_base::in) == 0)
1211 if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
12101212 this->setstate(ios_base::failbit);
12111213}
12121214
......@@ -1216,7 +1218,7 @@ inline
12161218basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
12171219 : basic_istream<char_type, traits_type>(&__sb_)
12181220{
1219 if (__sb_.open(__s, __mode | ios_base::in) == 0)
1221 if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
12201222 this->setstate(ios_base::failbit);
12211223}
12221224#endif
......@@ -1226,7 +1228,7 @@ inline
12261228basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
12271229 : basic_istream<char_type, traits_type>(&__sb_)
12281230{
1229 if (__sb_.open(__s, __mode | ios_base::in) == 0)
1231 if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
12301232 this->setstate(ios_base::failbit);
12311233}
12321234#endif
......@@ -1419,7 +1421,7 @@ inline
14191421basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
14201422 : basic_ostream<char_type, traits_type>(&__sb_)
14211423{
1422 if (__sb_.open(__s, __mode | ios_base::out) == 0)
1424 if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
14231425 this->setstate(ios_base::failbit);
14241426}
14251427
......@@ -1429,7 +1431,7 @@ inline
14291431basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
14301432 : basic_ostream<char_type, traits_type>(&__sb_)
14311433{
1432 if (__sb_.open(__s, __mode | ios_base::out) == 0)
1434 if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
14331435 this->setstate(ios_base::failbit);
14341436}
14351437#endif
......@@ -1439,7 +1441,7 @@ inline
14391441basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
14401442 : basic_ostream<char_type, traits_type>(&__sb_)
14411443{
1442 if (__sb_.open(__s, __mode | ios_base::out) == 0)
1444 if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
14431445 this->setstate(ios_base::failbit);
14441446}
14451447#endif
......@@ -1548,7 +1550,7 @@ inline
15481550void
15491551basic_ofstream<_CharT, _Traits>::close()
15501552{
1551 if (__sb_.close() == 0)
1553 if (__sb_.close() == nullptr)
15521554 this->setstate(ios_base::failbit);
15531555}
15541556
......@@ -1632,7 +1634,7 @@ inline
16321634basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
16331635 : basic_iostream<char_type, traits_type>(&__sb_)
16341636{
1635 if (__sb_.open(__s, __mode) == 0)
1637 if (__sb_.open(__s, __mode) == nullptr)
16361638 this->setstate(ios_base::failbit);
16371639}
16381640
......@@ -1642,7 +1644,7 @@ inline
16421644basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
16431645 : basic_iostream<char_type, traits_type>(&__sb_)
16441646{
1645 if (__sb_.open(__s, __mode) == 0)
1647 if (__sb_.open(__s, __mode) == nullptr)
16461648 this->setstate(ios_base::failbit);
16471649}
16481650#endif
......@@ -1652,7 +1654,7 @@ inline
16521654basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
16531655 : basic_iostream<char_type, traits_type>(&__sb_)
16541656{
1655 if (__sb_.open(__s, __mode) == 0)
1657 if (__sb_.open(__s, __mode) == nullptr)
16561658 this->setstate(ios_base::failbit);
16571659}
16581660#endif
......@@ -1752,10 +1754,16 @@ inline
17521754void
17531755basic_fstream<_CharT, _Traits>::close()
17541756{
1755 if (__sb_.close() == 0)
1757 if (__sb_.close() == nullptr)
17561758 this->setstate(ios_base::failbit);
17571759}
17581760
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
17591767_LIBCPP_END_NAMESPACE_STD
17601768
17611769_LIBCPP_POP_MACROS
lib/libcxx/include/functional+49-49
......@@ -470,6 +470,7 @@ template <> struct hash<bool>;
470470template <> struct hash<char>;
471471template <> struct hash<signed char>;
472472template <> struct hash<unsigned char>;
473template <> struct hash<char8_t>; // since C++20
473474template <> struct hash<char16_t>;
474475template <> struct hash<char32_t>;
475476template <> struct hash<wchar_t>;
......@@ -508,10 +509,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
508509
509510#include <__functional_base>
510511
511#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
512#include <Block.h>
513#endif
514
515512#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
516513#pragma GCC system_header
517514#endif
......@@ -1299,7 +1296,7 @@ public:
12991296 _LIBCPP_INLINE_VISIBILITY
13001297 typename __invoke_return<type, _ArgTypes...>::type
13011298 operator() (_ArgTypes&&... __args) const {
1302 return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
1299 return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
13031300 }
13041301#else
13051302
......@@ -1307,98 +1304,98 @@ public:
13071304 _LIBCPP_INLINE_VISIBILITY
13081305 typename __invoke_return0<type, _A0>::type
13091306 operator() (_A0& __a0) const {
1310 return __invoke(__f_, __a0);
1307 return _VSTD::__invoke(__f_, __a0);
13111308 }
13121309
13131310 template <class _A0>
13141311 _LIBCPP_INLINE_VISIBILITY
13151312 typename __invoke_return0<type, _A0 const>::type
13161313 operator() (_A0 const& __a0) const {
1317 return __invoke(__f_, __a0);
1314 return _VSTD::__invoke(__f_, __a0);
13181315 }
13191316
13201317 template <class _A0, class _A1>
13211318 _LIBCPP_INLINE_VISIBILITY
13221319 typename __invoke_return1<type, _A0, _A1>::type
13231320 operator() (_A0& __a0, _A1& __a1) const {
1324 return __invoke(__f_, __a0, __a1);
1321 return _VSTD::__invoke(__f_, __a0, __a1);
13251322 }
13261323
13271324 template <class _A0, class _A1>
13281325 _LIBCPP_INLINE_VISIBILITY
13291326 typename __invoke_return1<type, _A0 const, _A1>::type
13301327 operator() (_A0 const& __a0, _A1& __a1) const {
1331 return __invoke(__f_, __a0, __a1);
1328 return _VSTD::__invoke(__f_, __a0, __a1);
13321329 }
13331330
13341331 template <class _A0, class _A1>
13351332 _LIBCPP_INLINE_VISIBILITY
13361333 typename __invoke_return1<type, _A0, _A1 const>::type
13371334 operator() (_A0& __a0, _A1 const& __a1) const {
1338 return __invoke(__f_, __a0, __a1);
1335 return _VSTD::__invoke(__f_, __a0, __a1);
13391336 }
13401337
13411338 template <class _A0, class _A1>
13421339 _LIBCPP_INLINE_VISIBILITY
13431340 typename __invoke_return1<type, _A0 const, _A1 const>::type
13441341 operator() (_A0 const& __a0, _A1 const& __a1) const {
1345 return __invoke(__f_, __a0, __a1);
1342 return _VSTD::__invoke(__f_, __a0, __a1);
13461343 }
13471344
13481345 template <class _A0, class _A1, class _A2>
13491346 _LIBCPP_INLINE_VISIBILITY
13501347 typename __invoke_return2<type, _A0, _A1, _A2>::type
13511348 operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
1352 return __invoke(__f_, __a0, __a1, __a2);
1349 return _VSTD::__invoke(__f_, __a0, __a1, __a2);
13531350 }
13541351
13551352 template <class _A0, class _A1, class _A2>
13561353 _LIBCPP_INLINE_VISIBILITY
13571354 typename __invoke_return2<type, _A0 const, _A1, _A2>::type
13581355 operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
1359 return __invoke(__f_, __a0, __a1, __a2);
1356 return _VSTD::__invoke(__f_, __a0, __a1, __a2);
13601357 }
13611358
13621359 template <class _A0, class _A1, class _A2>
13631360 _LIBCPP_INLINE_VISIBILITY
13641361 typename __invoke_return2<type, _A0, _A1 const, _A2>::type
13651362 operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
1366 return __invoke(__f_, __a0, __a1, __a2);
1363 return _VSTD::__invoke(__f_, __a0, __a1, __a2);
13671364 }
13681365
13691366 template <class _A0, class _A1, class _A2>
13701367 _LIBCPP_INLINE_VISIBILITY
13711368 typename __invoke_return2<type, _A0, _A1, _A2 const>::type
13721369 operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
1373 return __invoke(__f_, __a0, __a1, __a2);
1370 return _VSTD::__invoke(__f_, __a0, __a1, __a2);
13741371 }
13751372
13761373 template <class _A0, class _A1, class _A2>
13771374 _LIBCPP_INLINE_VISIBILITY
13781375 typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
13791376 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);
13811378 }
13821379
13831380 template <class _A0, class _A1, class _A2>
13841381 _LIBCPP_INLINE_VISIBILITY
13851382 typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
13861383 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);
13881385 }
13891386
13901387 template <class _A0, class _A1, class _A2>
13911388 _LIBCPP_INLINE_VISIBILITY
13921389 typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
13931390 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);
13951392 }
13961393
13971394 template <class _A0, class _A1, class _A2>
13981395 _LIBCPP_INLINE_VISIBILITY
13991396 typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
14001397 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);
14021399 }
14031400#endif
14041401};
......@@ -1596,7 +1593,7 @@ public:
15961593 const _Target& __target() const { return __f_; }
15971594
15981595 _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)) {}
16001597
16011598 _LIBCPP_INLINE_VISIBILITY
16021599 explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
......@@ -1612,7 +1609,7 @@ public:
16121609 __builtin_new_allocator::__holder_t __hold =
16131610 __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
16141611 __default_alloc_func* __res =
1615 ::new (__hold.get()) __default_alloc_func(__f_);
1612 ::new ((void*)__hold.get()) __default_alloc_func(__f_);
16161613 (void)__hold.release();
16171614 return __res;
16181615 }
......@@ -1703,7 +1700,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
17031700void
17041701__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
17051702{
1706 ::new (__p) __func(__f_.__target(), __f_.__get_allocator());
1703 ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
17071704}
17081705
17091706template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
......@@ -1739,7 +1736,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOE
17391736{
17401737 if (__ti == typeid(_Fp))
17411738 return &__f_.__target();
1742 return (const void*)0;
1739 return nullptr;
17431740}
17441741
17451742template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
......@@ -1769,11 +1766,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
17691766
17701767 public:
17711768 _LIBCPP_INLINE_VISIBILITY
1772 __value_func() _NOEXCEPT : __f_(0) {}
1769 __value_func() _NOEXCEPT : __f_(nullptr) {}
17731770
17741771 template <class _Fp, class _Alloc>
17751772 _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
1776 : __f_(0)
1773 : __f_(nullptr)
17771774 {
17781775 typedef allocator_traits<_Alloc> __alloc_traits;
17791776 typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
......@@ -1803,13 +1800,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18031800 template <class _Fp,
18041801 class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
18051802 _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>()) {}
18071804
18081805 _LIBCPP_INLINE_VISIBILITY
18091806 __value_func(const __value_func& __f)
18101807 {
1811 if (__f.__f_ == 0)
1812 __f_ = 0;
1808 if (__f.__f_ == nullptr)
1809 __f_ = nullptr;
18131810 else if ((void*)__f.__f_ == &__f.__buf_)
18141811 {
18151812 __f_ = __as_base(&__buf_);
......@@ -1822,8 +1819,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18221819 _LIBCPP_INLINE_VISIBILITY
18231820 __value_func(__value_func&& __f) _NOEXCEPT
18241821 {
1825 if (__f.__f_ == 0)
1826 __f_ = 0;
1822 if (__f.__f_ == nullptr)
1823 __f_ = nullptr;
18271824 else if ((void*)__f.__f_ == &__f.__buf_)
18281825 {
18291826 __f_ = __as_base(&__buf_);
......@@ -1832,7 +1829,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18321829 else
18331830 {
18341831 __f_ = __f.__f_;
1835 __f.__f_ = 0;
1832 __f.__f_ = nullptr;
18361833 }
18371834 }
18381835
......@@ -1849,8 +1846,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18491846 __value_func& operator=(__value_func&& __f)
18501847 {
18511848 *this = nullptr;
1852 if (__f.__f_ == 0)
1853 __f_ = 0;
1849 if (__f.__f_ == nullptr)
1850 __f_ = nullptr;
18541851 else if ((void*)__f.__f_ == &__f.__buf_)
18551852 {
18561853 __f_ = __as_base(&__buf_);
......@@ -1859,7 +1856,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18591856 else
18601857 {
18611858 __f_ = __f.__f_;
1862 __f.__f_ = 0;
1859 __f.__f_ = nullptr;
18631860 }
18641861 return *this;
18651862 }
......@@ -1868,7 +1865,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18681865 __value_func& operator=(nullptr_t)
18691866 {
18701867 __func* __f = __f_;
1871 __f_ = 0;
1868 __f_ = nullptr;
18721869 if ((void*)__f == &__buf_)
18731870 __f->destroy();
18741871 else if (__f)
......@@ -1879,7 +1876,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18791876 _LIBCPP_INLINE_VISIBILITY
18801877 _Rp operator()(_ArgTypes&&... __args) const
18811878 {
1882 if (__f_ == 0)
1879 if (__f_ == nullptr)
18831880 __throw_bad_function_call();
18841881 return (*__f_)(_VSTD::forward<_ArgTypes>(__args)...);
18851882 }
......@@ -1895,10 +1892,10 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
18951892 __func* __t = __as_base(&__tempbuf);
18961893 __f_->__clone(__t);
18971894 __f_->destroy();
1898 __f_ = 0;
1895 __f_ = nullptr;
18991896 __f.__f_->__clone(__as_base(&__buf_));
19001897 __f.__f_->destroy();
1901 __f.__f_ = 0;
1898 __f.__f_ = nullptr;
19021899 __f_ = __as_base(&__buf_);
19031900 __t->__clone(__as_base(&__f.__buf_));
19041901 __t->destroy();
......@@ -1923,13 +1920,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
19231920 }
19241921
19251922 _LIBCPP_INLINE_VISIBILITY
1926 _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != 0; }
1923 _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != nullptr; }
19271924
19281925#ifndef _LIBCPP_NO_RTTI
19291926 _LIBCPP_INLINE_VISIBILITY
19301927 const std::type_info& target_type() const _NOEXCEPT
19311928 {
1932 if (__f_ == 0)
1929 if (__f_ == nullptr)
19331930 return typeid(void);
19341931 return __f_->target_type();
19351932 }
......@@ -1937,8 +1934,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
19371934 template <typename _Tp>
19381935 _LIBCPP_INLINE_VISIBILITY const _Tp* target() const _NOEXCEPT
19391936 {
1940 if (__f_ == 0)
1941 return 0;
1937 if (__f_ == nullptr)
1938 return nullptr;
19421939 return (const _Tp*)__f_->target(typeid(_Tp));
19431940 }
19441941#endif // _LIBCPP_NO_RTTI
......@@ -2157,7 +2154,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
21572154 } else {
21582155 __builtin_new_allocator::__holder_t __hold =
21592156 __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));
21612158 (void)__hold.release();
21622159 }
21632160 }
......@@ -2257,6 +2254,9 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
22572254
22582255#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
22592256
2257extern "C" void *_Block_copy(const void *);
2258extern "C" void _Block_release(const void *);
2259
22602260template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
22612261class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
22622262 : public __base<_Rp(_ArgTypes...)>
......@@ -2267,14 +2267,14 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
22672267public:
22682268 _LIBCPP_INLINE_VISIBILITY
22692269 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))
22712271 { }
22722272
22732273 // [TODO] add && to save on a retain
22742274
22752275 _LIBCPP_INLINE_VISIBILITY
22762276 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))
22782278 { }
22792279
22802280 virtual __base<_Rp(_ArgTypes...)>* __clone() const {
......@@ -2286,12 +2286,12 @@ public:
22862286 }
22872287
22882288 virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
2289 ::new (__p) __func(__f_);
2289 ::new ((void*)__p) __func(__f_);
22902290 }
22912291
22922292 virtual void destroy() _NOEXCEPT {
22932293 if (__f_)
2294 Block_release(__f_);
2294 _Block_release(__f_);
22952295 __f_ = 0;
22962296 }
22972297
......@@ -2303,7 +2303,7 @@ public:
23032303 }
23042304
23052305 virtual _Rp operator()(_ArgTypes&& ... __arg) {
2306 return __invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
2306 return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
23072307 }
23082308
23092309#ifndef _LIBCPP_NO_RTTI
......@@ -2518,7 +2518,7 @@ template<class _Rp, class ..._ArgTypes>
25182518function<_Rp(_ArgTypes...)>&
25192519function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
25202520{
2521 __f_ = std::move(__f.__f_);
2521 __f_ = _VSTD::move(__f.__f_);
25222522 return *this;
25232523}
25242524
lib/libcxx/include/future+43-193
......@@ -362,6 +362,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
362362*/
363363
364364#include <__config>
365#include <__availability>
365366#include <system_error>
366367#include <memory>
367368#include <chrono>
......@@ -624,18 +625,10 @@ protected:
624625public:
625626
626627 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);
632629
633630 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);
639632
640633 _Rp move();
641634 typename add_lvalue_reference<_Rp>::type copy();
......@@ -654,16 +647,12 @@ template <class _Rp>
654647template <class _Arg>
655648_LIBCPP_AVAILABILITY_FUTURE
656649void
657#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
658650__assoc_state<_Rp>::set_value(_Arg&& __arg)
659#else
660__assoc_state<_Rp>::set_value(_Arg& __arg)
661#endif
662651{
663652 unique_lock<mutex> __lk(this->__mut_);
664653 if (this->__has_value())
665654 __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));
667656 this->__state_ |= base::__constructed | base::ready;
668657 __cv_.notify_all();
669658}
......@@ -671,16 +660,12 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
671660template <class _Rp>
672661template <class _Arg>
673662void
674#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
675663__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
679664{
680665 unique_lock<mutex> __lk(this->__mut_);
681666 if (this->__has_value())
682667 __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));
684669 this->__state_ |= base::__constructed;
685670 __thread_local_data()->__make_ready_at_thread_exit(this);
686671}
......@@ -856,16 +841,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state
856841 _Fp __func_;
857842
858843public:
859#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
860844 _LIBCPP_INLINE_VISIBILITY
861845 explicit __deferred_assoc_state(_Fp&& __f);
862#endif
863846
864847 virtual void __execute();
865848};
866849
867#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
868
869850template <class _Rp, class _Fp>
870851inline
871852__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
......@@ -874,8 +855,6 @@ __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
874855 this->__set_deferred();
875856}
876857
877#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
878
879858template <class _Rp, class _Fp>
880859void
881860__deferred_assoc_state<_Rp, _Fp>::__execute()
......@@ -903,16 +882,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state<void, _Fp>
903882 _Fp __func_;
904883
905884public:
906#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
907885 _LIBCPP_INLINE_VISIBILITY
908886 explicit __deferred_assoc_state(_Fp&& __f);
909#endif
910887
911888 virtual void __execute();
912889};
913890
914#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
915
916891template <class _Fp>
917892inline
918893__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
......@@ -921,8 +896,6 @@ __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
921896 this->__set_deferred();
922897}
923898
924#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
925
926899template <class _Fp>
927900void
928901__deferred_assoc_state<void, _Fp>::__execute()
......@@ -952,16 +925,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state
952925
953926 virtual void __on_zero_shared() _NOEXCEPT;
954927public:
955#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
956928 _LIBCPP_INLINE_VISIBILITY
957929 explicit __async_assoc_state(_Fp&& __f);
958#endif
959930
960931 virtual void __execute();
961932};
962933
963#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
964
965934template <class _Rp, class _Fp>
966935inline
967936__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
......@@ -969,8 +938,6 @@ __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
969938{
970939}
971940
972#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
973
974941template <class _Rp, class _Fp>
975942void
976943__async_assoc_state<_Rp, _Fp>::__execute()
......@@ -1007,16 +974,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp>
1007974
1008975 virtual void __on_zero_shared() _NOEXCEPT;
1009976public:
1010#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1011977 _LIBCPP_INLINE_VISIBILITY
1012978 explicit __async_assoc_state(_Fp&& __f);
1013#endif
1014979
1015980 virtual void __execute();
1016981};
1017982
1018#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1019
1020983template <class _Fp>
1021984inline
1022985__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
......@@ -1024,8 +987,6 @@ __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
1024987{
1025988}
1026989
1027#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1028
1029990template <class _Fp>
1030991void
1031992__async_assoc_state<void, _Fp>::__execute()
......@@ -1062,19 +1023,11 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
10621023
10631024template <class _Rp, class _Fp>
10641025_LIBCPP_INLINE_VISIBILITY future<_Rp>
1065#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
10661026__make_deferred_assoc_state(_Fp&& __f);
1067#else
1068__make_deferred_assoc_state(_Fp __f);
1069#endif
10701027
10711028template <class _Rp, class _Fp>
10721029_LIBCPP_INLINE_VISIBILITY future<_Rp>
1073#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
10741030__make_async_assoc_state(_Fp&& __f);
1075#else
1076__make_async_assoc_state(_Fp __f);
1077#endif
10781031
10791032template <class _Rp>
10801033class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
......@@ -1086,22 +1039,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
10861039 template <class> friend class promise;
10871040 template <class> friend class shared_future;
10881041
1089#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
10901042 template <class _R1, class _Fp>
10911043 friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
10921044 template <class _R1, class _Fp>
10931045 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
11001046
11011047public:
11021048 _LIBCPP_INLINE_VISIBILITY
11031049 future() _NOEXCEPT : __state_(nullptr) {}
1104#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
11051050 _LIBCPP_INLINE_VISIBILITY
11061051 future(future&& __rhs) _NOEXCEPT
11071052 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
......@@ -1110,15 +1055,10 @@ public:
11101055 _LIBCPP_INLINE_VISIBILITY
11111056 future& operator=(future&& __rhs) _NOEXCEPT
11121057 {
1113 future(std::move(__rhs)).swap(*this);
1058 future(_VSTD::move(__rhs)).swap(*this);
11141059 return *this;
11151060 }
1116#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1117private:
1118 future(const future&);
1119 future& operator=(const future&);
1120public:
1121#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1061
11221062 ~future();
11231063 _LIBCPP_INLINE_VISIBILITY
11241064 shared_future<_Rp> share() _NOEXCEPT;
......@@ -1186,22 +1126,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&>
11861126 template <class> friend class promise;
11871127 template <class> friend class shared_future;
11881128
1189#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
11901129 template <class _R1, class _Fp>
11911130 friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
11921131 template <class _R1, class _Fp>
11931132 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
12001133
12011134public:
12021135 _LIBCPP_INLINE_VISIBILITY
12031136 future() _NOEXCEPT : __state_(nullptr) {}
1204#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
12051137 _LIBCPP_INLINE_VISIBILITY
12061138 future(future&& __rhs) _NOEXCEPT
12071139 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
......@@ -1210,15 +1142,10 @@ public:
12101142 _LIBCPP_INLINE_VISIBILITY
12111143 future& operator=(future&& __rhs) _NOEXCEPT
12121144 {
1213 future(std::move(__rhs)).swap(*this);
1145 future(_VSTD::move(__rhs)).swap(*this);
12141146 return *this;
12151147 }
1216#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1217private:
1218 future(const future&);
1219 future& operator=(const future&);
1220public:
1221#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1148
12221149 ~future();
12231150 _LIBCPP_INLINE_VISIBILITY
12241151 shared_future<_Rp&> share() _NOEXCEPT;
......@@ -1281,22 +1208,14 @@ class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future<void>
12811208 template <class> friend class promise;
12821209 template <class> friend class shared_future;
12831210
1284#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
12851211 template <class _R1, class _Fp>
12861212 friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
12871213 template <class _R1, class _Fp>
12881214 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
12951215
12961216public:
12971217 _LIBCPP_INLINE_VISIBILITY
12981218 future() _NOEXCEPT : __state_(nullptr) {}
1299#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
13001219 _LIBCPP_INLINE_VISIBILITY
13011220 future(future&& __rhs) _NOEXCEPT
13021221 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
......@@ -1305,15 +1224,10 @@ public:
13051224 _LIBCPP_INLINE_VISIBILITY
13061225 future& operator=(future&& __rhs) _NOEXCEPT
13071226 {
1308 future(std::move(__rhs)).swap(*this);
1227 future(_VSTD::move(__rhs)).swap(*this);
13091228 return *this;
13101229 }
1311#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1312private:
1313 future(const future&);
1314 future& operator=(const future&);
1315public:
1316#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1230
13171231 ~future();
13181232 _LIBCPP_INLINE_VISIBILITY
13191233 shared_future<void> share() _NOEXCEPT;
......@@ -1367,32 +1281,21 @@ public:
13671281 promise();
13681282 template <class _Alloc>
13691283 promise(allocator_arg_t, const _Alloc& __a);
1370#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
13711284 _LIBCPP_INLINE_VISIBILITY
13721285 promise(promise&& __rhs) _NOEXCEPT
13731286 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
13741287 promise(const promise& __rhs) = delete;
1375#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1376private:
1377 promise(const promise& __rhs);
1378public:
1379#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
13801288 ~promise();
13811289
13821290 // assignment
1383#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
13841291 _LIBCPP_INLINE_VISIBILITY
13851292 promise& operator=(promise&& __rhs) _NOEXCEPT
13861293 {
1387 promise(std::move(__rhs)).swap(*this);
1294 promise(_VSTD::move(__rhs)).swap(*this);
13881295 return *this;
13891296 }
13901297 promise& operator=(const promise& __rhs) = delete;
1391#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1392private:
1393 promise& operator=(const promise& __rhs);
1394public:
1395#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1298
13961299 _LIBCPP_INLINE_VISIBILITY
13971300 void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
13981301
......@@ -1401,16 +1304,12 @@ public:
14011304
14021305 // setting the result
14031306 void set_value(const _Rp& __r);
1404#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
14051307 void set_value(_Rp&& __r);
1406#endif
14071308 void set_exception(exception_ptr __p);
14081309
14091310 // setting the result with deferred notification
14101311 void set_value_at_thread_exit(const _Rp& __r);
1411#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
14121312 void set_value_at_thread_exit(_Rp&& __r);
1413#endif
14141313 void set_exception_at_thread_exit(exception_ptr __p);
14151314};
14161315
......@@ -1429,7 +1328,7 @@ promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
14291328 typedef __allocator_destructor<_A2> _D2;
14301329 _A2 __a(__a0);
14311330 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);
14331332 __state_ = _VSTD::addressof(*__hold.release());
14341333}
14351334
......@@ -1464,8 +1363,6 @@ promise<_Rp>::set_value(const _Rp& __r)
14641363 __state_->set_value(__r);
14651364}
14661365
1467#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1468
14691366template <class _Rp>
14701367void
14711368promise<_Rp>::set_value(_Rp&& __r)
......@@ -1475,8 +1372,6 @@ promise<_Rp>::set_value(_Rp&& __r)
14751372 __state_->set_value(_VSTD::move(__r));
14761373}
14771374
1478#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1479
14801375template <class _Rp>
14811376void
14821377promise<_Rp>::set_exception(exception_ptr __p)
......@@ -1496,8 +1391,6 @@ promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
14961391 __state_->set_value_at_thread_exit(__r);
14971392}
14981393
1499#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1500
15011394template <class _Rp>
15021395void
15031396promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
......@@ -1507,8 +1400,6 @@ promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
15071400 __state_->set_value_at_thread_exit(_VSTD::move(__r));
15081401}
15091402
1510#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1511
15121403template <class _Rp>
15131404void
15141405promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
......@@ -1535,32 +1426,21 @@ public:
15351426 promise();
15361427 template <class _Allocator>
15371428 promise(allocator_arg_t, const _Allocator& __a);
1538#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
15391429 _LIBCPP_INLINE_VISIBILITY
15401430 promise(promise&& __rhs) _NOEXCEPT
15411431 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
15421432 promise(const promise& __rhs) = delete;
1543#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1544private:
1545 promise(const promise& __rhs);
1546public:
1547#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
15481433 ~promise();
15491434
15501435 // assignment
1551#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
15521436 _LIBCPP_INLINE_VISIBILITY
15531437 promise& operator=(promise&& __rhs) _NOEXCEPT
15541438 {
1555 promise(std::move(__rhs)).swap(*this);
1439 promise(_VSTD::move(__rhs)).swap(*this);
15561440 return *this;
15571441 }
15581442 promise& operator=(const promise& __rhs) = delete;
1559#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1560private:
1561 promise& operator=(const promise& __rhs);
1562public:
1563#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1443
15641444 _LIBCPP_INLINE_VISIBILITY
15651445 void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
15661446
......@@ -1591,7 +1471,7 @@ promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
15911471 typedef __allocator_destructor<_A2> _D2;
15921472 _A2 __a(__a0);
15931473 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);
15951475 __state_ = _VSTD::addressof(*__hold.release());
15961476}
15971477
......@@ -1672,32 +1552,21 @@ public:
16721552 template <class _Allocator>
16731553 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
16741554 promise(allocator_arg_t, const _Allocator& __a);
1675#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
16761555 _LIBCPP_INLINE_VISIBILITY
16771556 promise(promise&& __rhs) _NOEXCEPT
16781557 : __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
16791558 promise(const promise& __rhs) = delete;
1680#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1681private:
1682 promise(const promise& __rhs);
1683public:
1684#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
16851559 ~promise();
16861560
16871561 // assignment
1688#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
16891562 _LIBCPP_INLINE_VISIBILITY
16901563 promise& operator=(promise&& __rhs) _NOEXCEPT
16911564 {
1692 promise(std::move(__rhs)).swap(*this);
1565 promise(_VSTD::move(__rhs)).swap(*this);
16931566 return *this;
16941567 }
16951568 promise& operator=(const promise& __rhs) = delete;
1696#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1697private:
1698 promise& operator=(const promise& __rhs);
1699public:
1700#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1569
17011570 _LIBCPP_INLINE_VISIBILITY
17021571 void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
17031572
......@@ -1721,7 +1590,7 @@ promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
17211590 typedef __allocator_destructor<_A2> _D2;
17221591 _A2 __a(__a0);
17231592 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);
17251594 __state_ = _VSTD::addressof(*__hold.release());
17261595}
17271596
......@@ -1737,8 +1606,6 @@ template <class _Rp, class _Alloc>
17371606 struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc>
17381607 : public true_type {};
17391608
1740#ifndef _LIBCPP_HAS_NO_VARIADICS
1741
17421609// packaged_task
17431610
17441611template<class _Fp> class __packaged_task_base;
......@@ -1788,7 +1655,7 @@ void
17881655__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
17891656 __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
17901657{
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()));
17921659}
17931660
17941661template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
......@@ -1823,6 +1690,10 @@ template<class _Rp, class ..._ArgTypes>
18231690class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)>
18241691{
18251692 typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
1693
1694 _LIBCPP_INLINE_VISIBILITY _LIBCPP_NO_CFI
1695 __base* __get_buf() { return (__base*)&__buf_; }
1696
18261697 typename aligned_storage<3*sizeof(void*)>::type __buf_;
18271698 __base* __f_;
18281699
......@@ -1856,10 +1727,10 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged
18561727{
18571728 if (__f.__f_ == nullptr)
18581729 __f_ = nullptr;
1859 else if (__f.__f_ == (__base*)&__f.__buf_)
1730 else if (__f.__f_ == __f.__get_buf())
18601731 {
1732 __f.__f_->__move_to(__get_buf());
18611733 __f_ = (__base*)&__buf_;
1862 __f.__f_->__move_to(__f_);
18631734 }
18641735 else
18651736 {
......@@ -1877,8 +1748,8 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
18771748 typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
18781749 if (sizeof(_FF) <= sizeof(__buf_))
18791750 {
1751 ::new ((void*)&__buf_) _FF(_VSTD::forward<_Fp>(__f));
18801752 __f_ = (__base*)&__buf_;
1881 ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
18821753 }
18831754 else
18841755 {
......@@ -1886,7 +1757,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
18861757 _Ap __a;
18871758 typedef __allocator_destructor<_Ap> _Dp;
18881759 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));
18901761 __f_ = __hold.release();
18911762 }
18921763}
......@@ -1902,7 +1773,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
19021773 if (sizeof(_FF) <= sizeof(__buf_))
19031774 {
19041775 __f_ = (__base*)&__buf_;
1905 ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
1776 ::new ((void*)__f_) _FF(_VSTD::forward<_Fp>(__f));
19061777 }
19071778 else
19081779 {
......@@ -1910,7 +1781,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
19101781 _Ap __a(__a0);
19111782 typedef __allocator_destructor<_Ap> _Dp;
19121783 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()))
19141785 _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
19151786 __f_ = _VSTD::addressof(*__hold.release());
19161787 }
......@@ -1920,17 +1791,17 @@ template<class _Rp, class ..._ArgTypes>
19201791__packaged_task_function<_Rp(_ArgTypes...)>&
19211792__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
19221793{
1923 if (__f_ == (__base*)&__buf_)
1794 if (__f_ == __get_buf())
19241795 __f_->destroy();
19251796 else if (__f_)
19261797 __f_->destroy_deallocate();
19271798 __f_ = nullptr;
19281799 if (__f.__f_ == nullptr)
19291800 __f_ = nullptr;
1930 else if (__f.__f_ == (__base*)&__f.__buf_)
1801 else if (__f.__f_ == __f.__get_buf())
19311802 {
1932 __f_ = (__base*)&__buf_;
1933 __f.__f_->__move_to(__f_);
1803 __f.__f_->__move_to(__get_buf());
1804 __f_ = __get_buf();
19341805 }
19351806 else
19361807 {
......@@ -1943,13 +1814,14 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&
19431814template<class _Rp, class ..._ArgTypes>
19441815__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
19451816{
1946 if (__f_ == (__base*)&__buf_)
1817 if (__f_ == __get_buf())
19471818 __f_->destroy();
19481819 else if (__f_)
19491820 __f_->destroy_deallocate();
19501821}
19511822
19521823template<class _Rp, class ..._ArgTypes>
1824_LIBCPP_NO_CFI
19531825void
19541826__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
19551827{
......@@ -2268,11 +2140,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
22682140
22692141template <class _Rp, class _Fp>
22702142_LIBCPP_INLINE_VISIBILITY future<_Rp>
2271#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22722143__make_deferred_assoc_state(_Fp&& __f)
2273#else
2274__make_deferred_assoc_state(_Fp __f)
2275#endif
22762144{
22772145 unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
22782146 __h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
......@@ -2281,11 +2149,7 @@ __make_deferred_assoc_state(_Fp __f)
22812149
22822150template <class _Rp, class _Fp>
22832151_LIBCPP_INLINE_VISIBILITY future<_Rp>
2284#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22852152__make_async_assoc_state(_Fp&& __f)
2286#else
2287__make_async_assoc_state(_Fp __f)
2288#endif
22892153{
22902154 unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
22912155 __h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
......@@ -2293,6 +2157,8 @@ __make_async_assoc_state(_Fp __f)
22932157 return future<_Rp>(__h.get());
22942158}
22952159
2160#ifndef _LIBCPP_CXX03_LANG
2161
22962162template <class _Fp, class... _Args>
22972163class _LIBCPP_HIDDEN __async_func
22982164{
......@@ -2360,7 +2226,7 @@ async(_Fp&& __f, _Args&&... __args)
23602226 _VSTD::forward<_Args>(__args)...);
23612227}
23622228
2363#endif // _LIBCPP_HAS_NO_VARIADICS
2229#endif // C++03
23642230
23652231// shared_future
23662232
......@@ -2375,24 +2241,20 @@ public:
23752241 _LIBCPP_INLINE_VISIBILITY
23762242 shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
23772243 {if (__state_) __state_->__add_shared();}
2378#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
23792244 _LIBCPP_INLINE_VISIBILITY
23802245 shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
23812246 {__f.__state_ = nullptr;}
23822247 _LIBCPP_INLINE_VISIBILITY
23832248 shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
23842249 {__rhs.__state_ = nullptr;}
2385#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
23862250 ~shared_future();
23872251 shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
2388#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
23892252 _LIBCPP_INLINE_VISIBILITY
23902253 shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
23912254 {
2392 shared_future(std::move(__rhs)).swap(*this);
2255 shared_future(_VSTD::move(__rhs)).swap(*this);
23932256 return *this;
23942257 }
2395#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
23962258
23972259 // retrieving the value
23982260 _LIBCPP_INLINE_VISIBILITY
......@@ -2449,24 +2311,20 @@ public:
24492311 _LIBCPP_INLINE_VISIBILITY
24502312 shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
24512313 {if (__state_) __state_->__add_shared();}
2452#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
24532314 _LIBCPP_INLINE_VISIBILITY
24542315 shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
24552316 {__f.__state_ = nullptr;}
24562317 _LIBCPP_INLINE_VISIBILITY
24572318 shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
24582319 {__rhs.__state_ = nullptr;}
2459#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
24602320 ~shared_future();
24612321 shared_future& operator=(const shared_future& __rhs);
2462#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
24632322 _LIBCPP_INLINE_VISIBILITY
24642323 shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
24652324 {
2466 shared_future(std::move(__rhs)).swap(*this);
2325 shared_future(_VSTD::move(__rhs)).swap(*this);
24672326 return *this;
24682327 }
2469#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
24702328
24712329 // retrieving the value
24722330 _LIBCPP_INLINE_VISIBILITY
......@@ -2523,24 +2381,20 @@ public:
25232381 _LIBCPP_INLINE_VISIBILITY
25242382 shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
25252383 {if (__state_) __state_->__add_shared();}
2526#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
25272384 _LIBCPP_INLINE_VISIBILITY
25282385 shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
25292386 {__f.__state_ = nullptr;}
25302387 _LIBCPP_INLINE_VISIBILITY
25312388 shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
25322389 {__rhs.__state_ = nullptr;}
2533#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
25342390 ~shared_future();
25352391 shared_future& operator=(const shared_future& __rhs);
2536#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
25372392 _LIBCPP_INLINE_VISIBILITY
25382393 shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
25392394 {
2540 shared_future(std::move(__rhs)).swap(*this);
2395 shared_future(_VSTD::move(__rhs)).swap(*this);
25412396 return *this;
25422397 }
2543#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
25442398
25452399 // retrieving the value
25462400 _LIBCPP_INLINE_VISIBILITY
......@@ -2591,8 +2445,6 @@ future<_Rp&>::share() _NOEXCEPT
25912445 return shared_future<_Rp&>(_VSTD::move(*this));
25922446}
25932447
2594#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2595
25962448inline
25972449shared_future<void>
25982450future<void>::share() _NOEXCEPT
......@@ -2600,8 +2452,6 @@ future<void>::share() _NOEXCEPT
26002452 return shared_future<void>(_VSTD::move(*this));
26012453}
26022454
2603#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2604
26052455_LIBCPP_END_NAMESPACE_STD
26062456
26072457#endif // !_LIBCPP_HAS_NO_THREADS
lib/libcxx/include/iomanip+1-1
......@@ -514,7 +514,7 @@ put_time(const tm* __tm, const _CharT* __fmt)
514514}
515515
516516template <class _CharT, class _Traits, class _ForwardIterator>
517std::basic_ostream<_CharT, _Traits> &
517basic_ostream<_CharT, _Traits> &
518518__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
519519 _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
520520{
lib/libcxx/include/ios+2-29
......@@ -710,7 +710,7 @@ void
710710basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
711711{
712712 ios_base::init(__sb);
713 __tie_ = 0;
713 __tie_ = nullptr;
714714 __fill_ = traits_type::eof();
715715}
716716
......@@ -821,7 +821,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
821821{
822822 ios_base::move(__rhs);
823823 __tie_ = __rhs.__tie_;
824 __rhs.__tie_ = 0;
824 __rhs.__tie_ = nullptr;
825825 __fill_ = __rhs.__fill_;
826826}
827827
......@@ -1035,33 +1035,6 @@ defaultfloat(ios_base& __str)
10351035 return __str;
10361036}
10371037
1038template <class _CharT, class _Traits>
1039class __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&);
1050public:
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
10651038_LIBCPP_END_NAMESPACE_STD
10661039
10671040#endif // _LIBCPP_IOS
lib/libcxx/include/iosfwd+59
......@@ -185,6 +185,36 @@ typedef basic_ifstream<wchar_t> wifstream;
185185typedef basic_ofstream<wchar_t> wofstream;
186186typedef basic_fstream<wchar_t> wfstream;
187187
188template <class _CharT, class _Traits>
189 class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_PREFERRED_NAME(wios) basic_ios;
190
191template <class _CharT, class _Traits>
192 class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_PREFERRED_NAME(wstreambuf) basic_streambuf;
193template <class _CharT, class _Traits>
194 class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_PREFERRED_NAME(wistream) basic_istream;
195template <class _CharT, class _Traits>
196 class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_PREFERRED_NAME(wostream) basic_ostream;
197template <class _CharT, class _Traits>
198 class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_PREFERRED_NAME(wiostream) basic_iostream;
199
200template <class _CharT, class _Traits, class _Allocator>
201 class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_PREFERRED_NAME(wstringbuf) basic_stringbuf;
202template <class _CharT, class _Traits, class _Allocator>
203 class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_PREFERRED_NAME(wistringstream) basic_istringstream;
204template <class _CharT, class _Traits, class _Allocator>
205 class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_PREFERRED_NAME(wostringstream) basic_ostringstream;
206template <class _CharT, class _Traits, class _Allocator>
207 class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_PREFERRED_NAME(wstringstream) basic_stringstream;
208
209template <class _CharT, class _Traits>
210 class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_PREFERRED_NAME(wfilebuf) basic_filebuf;
211template <class _CharT, class _Traits>
212 class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_PREFERRED_NAME(wifstream) basic_ifstream;
213template <class _CharT, class _Traits>
214 class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_PREFERRED_NAME(wofstream) basic_ofstream;
215template <class _CharT, class _Traits>
216 class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_PREFERRED_NAME(wfstream) basic_fstream;
217
188218template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
189219typedef fpos<mbstate_t> streampos;
190220typedef fpos<mbstate_t> wstreampos;
......@@ -210,11 +240,40 @@ template <class _CharT, // for <stdexcept>
210240typedef basic_string<char, char_traits<char>, allocator<char> > string;
211241typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
212242
243template <class _CharT, class _Traits, class _Allocator>
244 class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_PREFERRED_NAME(wstring) basic_string;
213245
214246// Include other forward declarations here
215247template <class _Tp, class _Alloc = allocator<_Tp> >
216248class _LIBCPP_TEMPLATE_VIS vector;
217249
250template <class _CharT, class _Traits>
251class __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&);
262public:
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
218277_LIBCPP_END_NAMESPACE_STD
219278
220279#endif // _LIBCPP_IOSFWD
lib/libcxx/include/istream+21-13
......@@ -150,9 +150,9 @@ template <class charT, class traits>
150150 basic_istream<charT,traits>&
151151 ws(basic_istream<charT,traits>& is);
152152
153template <class charT, class traits, class T>
154 basic_istream<charT, traits>&
155 operator>>(basic_istream<charT, traits>&& is, T& x);
153// rvalue stream extraction
154template <class Stream, class T>
155 Stream&& operator>>(Stream&& is, T&& x);
156156
157157} // std
158158
......@@ -1142,7 +1142,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
11421142 try
11431143 {
11441144#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())
11461146 __state |= ios_base::badbit;
11471147#ifndef _LIBCPP_NO_EXCEPTIONS
11481148 }
......@@ -1179,7 +1179,7 @@ basic_istream<_CharT, _Traits>::unget()
11791179 try
11801180 {
11811181#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())
11831183 __state |= ios_base::badbit;
11841184#ifndef _LIBCPP_NO_EXCEPTIONS
11851185 }
......@@ -1215,7 +1215,7 @@ basic_istream<_CharT, _Traits>::sync()
12151215 try
12161216 {
12171217#endif // _LIBCPP_NO_EXCEPTIONS
1218 if (this->rdbuf() == 0)
1218 if (this->rdbuf() == nullptr)
12191219 return -1;
12201220 if (this->rdbuf()->pubsync() == -1)
12211221 {
......@@ -1378,13 +1378,23 @@ ws(basic_istream<_CharT, _Traits>& __is)
13781378
13791379#ifndef _LIBCPP_CXX03_LANG
13801380
1381template <class _CharT, class _Traits, class _Tp>
1382inline _LIBCPP_INLINE_VISIBILITY
1383basic_istream<_CharT, _Traits>&
1384operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
1381template <class _Stream, class _Tp, class = void>
1382struct __is_istreamable : false_type { };
1383
1384template <class _Stream, class _Tp>
1385struct __is_istreamable<_Stream, _Tp, decltype(
1386 _VSTD::declval<_Stream>() >> _VSTD::declval<_Tp>(), void()
1387)> : true_type { };
1388
1389template <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)
13851395{
13861396 __is >> _VSTD::forward<_Tp>(__x);
1387 return __is;
1397 return _VSTD::move(__is);
13881398}
13891399
13901400#endif // _LIBCPP_CXX03_LANG
......@@ -1638,11 +1648,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
16381648 return __is;
16391649}
16401650
1641#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
16421651_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
16431652_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
16441653_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
1645#endif
16461654
16471655_LIBCPP_END_NAMESPACE_STD
16481656
lib/libcxx/include/iterator+69-52
......@@ -420,10 +420,8 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
420420#include <type_traits>
421421#include <cstddef>
422422#include <initializer_list>
423#include <__memory/base.h>
423424#include <version>
424#ifdef __APPLE__
425#include <Availability.h>
426#endif
427425
428426#include <__debug>
429427
......@@ -498,12 +496,11 @@ struct __has_iterator_typedefs
498496private:
499497 struct __two {char __lx; char __lxx;};
500498 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);
507504public:
508505 static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1;
509506};
......@@ -515,9 +512,9 @@ struct __has_iterator_category
515512private:
516513 struct __two {char __lx; char __lxx;};
517514 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);
519516public:
520 static const bool value = sizeof(__test<_Tp>(0)) == 1;
517 static const bool value = sizeof(__test<_Tp>(nullptr)) == 1;
521518};
522519
523520template <class _Iter, bool> struct __iterator_traits_impl {};
......@@ -667,9 +664,9 @@ void advance(_InputIter& __i, _Distance __orig_n)
667664{
668665 _LIBCPP_ASSERT(__orig_n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
669666 "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;
671668 _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());
673670}
674671
675672template <class _InputIter>
......@@ -696,7 +693,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
696693typename iterator_traits<_InputIter>::difference_type
697694distance(_InputIter __first, _InputIter __last)
698695{
699 return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
696 return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
700697}
701698
702699template <class _InputIter>
......@@ -998,11 +995,11 @@ private:
998995 istream_type* __in_stream_;
999996 _Tp __value_;
1000997public:
1001 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}
998 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
1002999 _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s))
10031000 {
10041001 if (!(*__in_stream_ >> __value_))
1005 __in_stream_ = 0;
1002 __in_stream_ = nullptr;
10061003 }
10071004
10081005 _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;}
......@@ -1010,7 +1007,7 @@ public:
10101007 _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()
10111008 {
10121009 if (!(*__in_stream_ >> __value_))
1013 __in_stream_ = 0;
1010 __in_stream_ = nullptr;
10141011 return *this;
10151012 }
10161013 _LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int)
......@@ -1052,15 +1049,25 @@ class _LIBCPP_TEMPLATE_VIS ostream_iterator
10521049 : public iterator<output_iterator_tag, void, void, void, void>
10531050{
10541051public:
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
10581065private:
10591066 ostream_type* __out_stream_;
10601067 const char_type* __delim_;
10611068public:
10621069 _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) {}
10641071 _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
10651072 : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}
10661073 _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
......@@ -1106,11 +1113,11 @@ private:
11061113 bool __test_for_eof() const
11071114 {
11081115 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;
11111118 }
11121119public:
1113 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
1120 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
11141121 _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
11151122 : __sbuf_(__s.rdbuf()) {}
11161123 _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
......@@ -1151,10 +1158,20 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
11511158 : public iterator<output_iterator_tag, void, void, void, void>
11521159{
11531160public:
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
11581175private:
11591176 streambuf_type* __sbuf_;
11601177public:
......@@ -1165,13 +1182,13 @@ public:
11651182 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
11661183 {
11671184 if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
1168 __sbuf_ = 0;
1185 __sbuf_ = nullptr;
11691186 return *this;
11701187 }
11711188 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
11721189 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
11731190 _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;}
11751192
11761193 template <class _Ch, class _Tr>
11771194 friend
......@@ -1373,13 +1390,13 @@ operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOE
13731390
13741391template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op);
13751392template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2);
1376template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
1377template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
1393template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move(_Ip, _Ip, _Op);
1394template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move_backward(_B1, _B1, _B2);
13781395
13791396#if _LIBCPP_DEBUG_LEVEL < 2
13801397
13811398template <class _Tp>
1382_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1399_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
13831400typename enable_if
13841401<
13851402 is_trivially_copy_assignable<_Tp>::value,
......@@ -1390,7 +1407,7 @@ __unwrap_iter(__wrap_iter<_Tp*>);
13901407#else
13911408
13921409template <class _Tp>
1393inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1410inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
13941411typename enable_if
13951412<
13961413 is_trivially_copy_assignable<_Tp>::value,
......@@ -1418,20 +1435,20 @@ public:
14181435 : __i{}
14191436#endif
14201437 {
1421#if _LIBCPP_DEBUG_LEVEL >= 2
1438#if _LIBCPP_DEBUG_LEVEL == 2
14221439 __get_db()->__insert_i(this);
14231440#endif
14241441 }
14251442 template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
14261443 __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
14281445 : __i(__u.base())
14291446 {
1430#if _LIBCPP_DEBUG_LEVEL >= 2
1447#if _LIBCPP_DEBUG_LEVEL == 2
14311448 __get_db()->__iterator_copy(this, &__u);
14321449#endif
14331450 }
1434#if _LIBCPP_DEBUG_LEVEL >= 2
1451#if _LIBCPP_DEBUG_LEVEL == 2
14351452 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
14361453 __wrap_iter(const __wrap_iter& __x)
14371454 : __i(__x.base())
......@@ -1456,7 +1473,7 @@ public:
14561473#endif
14571474 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT
14581475 {
1459#if _LIBCPP_DEBUG_LEVEL >= 2
1476#if _LIBCPP_DEBUG_LEVEL == 2
14601477 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
14611478 "Attempted to dereference a non-dereferenceable iterator");
14621479#endif
......@@ -1464,7 +1481,7 @@ public:
14641481 }
14651482 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT
14661483 {
1467#if _LIBCPP_DEBUG_LEVEL >= 2
1484#if _LIBCPP_DEBUG_LEVEL == 2
14681485 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
14691486 "Attempted to dereference a non-dereferenceable iterator");
14701487#endif
......@@ -1472,7 +1489,7 @@ public:
14721489 }
14731490 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT
14741491 {
1475#if _LIBCPP_DEBUG_LEVEL >= 2
1492#if _LIBCPP_DEBUG_LEVEL == 2
14761493 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
14771494 "Attempted to increment non-incrementable iterator");
14781495#endif
......@@ -1484,7 +1501,7 @@ public:
14841501
14851502 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT
14861503 {
1487#if _LIBCPP_DEBUG_LEVEL >= 2
1504#if _LIBCPP_DEBUG_LEVEL == 2
14881505 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
14891506 "Attempted to decrement non-decrementable iterator");
14901507#endif
......@@ -1497,7 +1514,7 @@ public:
14971514 {__wrap_iter __w(*this); __w += __n; return __w;}
14981515 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
14991516 {
1500#if _LIBCPP_DEBUG_LEVEL >= 2
1517#if _LIBCPP_DEBUG_LEVEL == 2
15011518 _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
15021519 "Attempted to add/subtract iterator outside of valid range");
15031520#endif
......@@ -1510,7 +1527,7 @@ public:
15101527 {*this += -__n; return *this;}
15111528 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT
15121529 {
1513#if _LIBCPP_DEBUG_LEVEL >= 2
1530#if _LIBCPP_DEBUG_LEVEL == 2
15141531 _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
15151532 "Attempted to subscript iterator outside of valid range");
15161533#endif
......@@ -1520,7 +1537,7 @@ public:
15201537 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;}
15211538
15221539private:
1523#if _LIBCPP_DEBUG_LEVEL >= 2
1540#if _LIBCPP_DEBUG_LEVEL == 2
15241541 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
15251542 {
15261543 __get_db()->__insert_ic(this, __p);
......@@ -1584,12 +1601,12 @@ private:
15841601
15851602 template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op);
15861603 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);
15891606
15901607#if _LIBCPP_DEBUG_LEVEL < 2
15911608 template <class _Tp>
1592 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1609 _LIBCPP_CONSTEXPR friend
15931610 typename enable_if
15941611 <
15951612 is_trivially_copy_assignable<_Tp>::value,
......@@ -1598,7 +1615,7 @@ private:
15981615 __unwrap_iter(__wrap_iter<_Tp*>);
15991616#else
16001617 template <class _Tp>
1601 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1618 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR friend
16021619 typename enable_if
16031620 <
16041621 is_trivially_copy_assignable<_Tp>::value,
......@@ -1621,7 +1638,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
16211638bool
16221639operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
16231640{
1624#if _LIBCPP_DEBUG_LEVEL >= 2
1641#if _LIBCPP_DEBUG_LEVEL == 2
16251642 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
16261643 "Attempted to compare incomparable iterators");
16271644#endif
......@@ -1699,7 +1716,7 @@ auto
16991716operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
17001717-> decltype(__x.base() - __y.base())
17011718{
1702#if _LIBCPP_DEBUG_LEVEL >= 2
1719#if _LIBCPP_DEBUG_LEVEL == 2
17031720 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
17041721 "Attempted to subtract incompatible iterators");
17051722#endif
......@@ -1711,7 +1728,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
17111728typename __wrap_iter<_Iter1>::difference_type
17121729operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
17131730{
1714#if _LIBCPP_DEBUG_LEVEL >= 2
1731#if _LIBCPP_DEBUG_LEVEL == 2
17151732 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
17161733 "Attempted to subtract incompatible iterators");
17171734#endif
lib/libcxx/include/latch+8
......@@ -19,6 +19,8 @@ namespace std
1919 class latch
2020 {
2121 public:
22 static constexpr ptrdiff_t max() noexcept;
23
2224 constexpr explicit latch(ptrdiff_t __expected);
2325 ~latch();
2426
......@@ -39,6 +41,7 @@ namespace std
3941*/
4042
4143#include <__config>
44#include <__availability>
4245#include <atomic>
4346
4447#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -49,6 +52,9 @@ namespace std
4952# error <latch> is not supported on this single threaded system
5053#endif
5154
55_LIBCPP_PUSH_MACROS
56#include <__undef_macros>
57
5258#if _LIBCPP_STD_VER >= 14
5359
5460_LIBCPP_BEGIN_NAMESPACE_STD
......@@ -101,4 +107,6 @@ _LIBCPP_END_NAMESPACE_STD
101107
102108#endif // _LIBCPP_STD_VER >= 14
103109
110_LIBCPP_POP_MACROS
111
104112#endif //_LIBCPP_LATCH
lib/libcxx/include/list+93-93
......@@ -293,7 +293,7 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator
293293
294294 __link_pointer __ptr_;
295295
296#if _LIBCPP_DEBUG_LEVEL >= 2
296#if _LIBCPP_DEBUG_LEVEL == 2
297297 _LIBCPP_INLINE_VISIBILITY
298298 explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
299299 : __ptr_(__p)
......@@ -320,12 +320,12 @@ public:
320320 _LIBCPP_INLINE_VISIBILITY
321321 __list_iterator() _NOEXCEPT : __ptr_(nullptr)
322322 {
323#if _LIBCPP_DEBUG_LEVEL >= 2
323#if _LIBCPP_DEBUG_LEVEL == 2
324324 __get_db()->__insert_i(this);
325325#endif
326326 }
327327
328#if _LIBCPP_DEBUG_LEVEL >= 2
328#if _LIBCPP_DEBUG_LEVEL == 2
329329
330330 _LIBCPP_INLINE_VISIBILITY
331331 __list_iterator(const __list_iterator& __p)
......@@ -351,12 +351,12 @@ public:
351351 return *this;
352352 }
353353
354#endif // _LIBCPP_DEBUG_LEVEL >= 2
354#endif // _LIBCPP_DEBUG_LEVEL == 2
355355
356356 _LIBCPP_INLINE_VISIBILITY
357357 reference operator*() const
358358 {
359#if _LIBCPP_DEBUG_LEVEL >= 2
359#if _LIBCPP_DEBUG_LEVEL == 2
360360 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
361361 "Attempted to dereference a non-dereferenceable list::iterator");
362362#endif
......@@ -365,7 +365,7 @@ public:
365365 _LIBCPP_INLINE_VISIBILITY
366366 pointer operator->() const
367367 {
368#if _LIBCPP_DEBUG_LEVEL >= 2
368#if _LIBCPP_DEBUG_LEVEL == 2
369369 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
370370 "Attempted to dereference a non-dereferenceable list::iterator");
371371#endif
......@@ -375,7 +375,7 @@ public:
375375 _LIBCPP_INLINE_VISIBILITY
376376 __list_iterator& operator++()
377377 {
378#if _LIBCPP_DEBUG_LEVEL >= 2
378#if _LIBCPP_DEBUG_LEVEL == 2
379379 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
380380 "Attempted to increment non-incrementable list::iterator");
381381#endif
......@@ -388,7 +388,7 @@ public:
388388 _LIBCPP_INLINE_VISIBILITY
389389 __list_iterator& operator--()
390390 {
391#if _LIBCPP_DEBUG_LEVEL >= 2
391#if _LIBCPP_DEBUG_LEVEL == 2
392392 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
393393 "Attempted to decrement non-decrementable list::iterator");
394394#endif
......@@ -416,7 +416,7 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator
416416
417417 __link_pointer __ptr_;
418418
419#if _LIBCPP_DEBUG_LEVEL >= 2
419#if _LIBCPP_DEBUG_LEVEL == 2
420420 _LIBCPP_INLINE_VISIBILITY
421421 explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
422422 : __ptr_(__p)
......@@ -440,7 +440,7 @@ public:
440440 _LIBCPP_INLINE_VISIBILITY
441441 __list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
442442 {
443#if _LIBCPP_DEBUG_LEVEL >= 2
443#if _LIBCPP_DEBUG_LEVEL == 2
444444 __get_db()->__insert_i(this);
445445#endif
446446 }
......@@ -448,12 +448,12 @@ public:
448448 __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
449449 : __ptr_(__p.__ptr_)
450450 {
451#if _LIBCPP_DEBUG_LEVEL >= 2
451#if _LIBCPP_DEBUG_LEVEL == 2
452452 __get_db()->__iterator_copy(this, &__p);
453453#endif
454454 }
455455
456#if _LIBCPP_DEBUG_LEVEL >= 2
456#if _LIBCPP_DEBUG_LEVEL == 2
457457
458458 _LIBCPP_INLINE_VISIBILITY
459459 __list_const_iterator(const __list_const_iterator& __p)
......@@ -479,11 +479,11 @@ public:
479479 return *this;
480480 }
481481
482#endif // _LIBCPP_DEBUG_LEVEL >= 2
482#endif // _LIBCPP_DEBUG_LEVEL == 2
483483 _LIBCPP_INLINE_VISIBILITY
484484 reference operator*() const
485485 {
486#if _LIBCPP_DEBUG_LEVEL >= 2
486#if _LIBCPP_DEBUG_LEVEL == 2
487487 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
488488 "Attempted to dereference a non-dereferenceable list::const_iterator");
489489#endif
......@@ -492,7 +492,7 @@ public:
492492 _LIBCPP_INLINE_VISIBILITY
493493 pointer operator->() const
494494 {
495#if _LIBCPP_DEBUG_LEVEL >= 2
495#if _LIBCPP_DEBUG_LEVEL == 2
496496 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
497497 "Attempted to dereference a non-dereferenceable list::const_iterator");
498498#endif
......@@ -502,7 +502,7 @@ public:
502502 _LIBCPP_INLINE_VISIBILITY
503503 __list_const_iterator& operator++()
504504 {
505#if _LIBCPP_DEBUG_LEVEL >= 2
505#if _LIBCPP_DEBUG_LEVEL == 2
506506 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
507507 "Attempted to increment non-incrementable list::const_iterator");
508508#endif
......@@ -515,7 +515,7 @@ public:
515515 _LIBCPP_INLINE_VISIBILITY
516516 __list_const_iterator& operator--()
517517 {
518#if _LIBCPP_DEBUG_LEVEL >= 2
518#if _LIBCPP_DEBUG_LEVEL == 2
519519 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
520520 "Attempted to decrement non-decrementable list::const_iterator");
521521#endif
......@@ -614,7 +614,7 @@ protected:
614614 _LIBCPP_INLINE_VISIBILITY
615615 iterator begin() _NOEXCEPT
616616 {
617#if _LIBCPP_DEBUG_LEVEL >= 2
617#if _LIBCPP_DEBUG_LEVEL == 2
618618 return iterator(__end_.__next_, this);
619619#else
620620 return iterator(__end_.__next_);
......@@ -623,7 +623,7 @@ protected:
623623 _LIBCPP_INLINE_VISIBILITY
624624 const_iterator begin() const _NOEXCEPT
625625 {
626#if _LIBCPP_DEBUG_LEVEL >= 2
626#if _LIBCPP_DEBUG_LEVEL == 2
627627 return const_iterator(__end_.__next_, this);
628628#else
629629 return const_iterator(__end_.__next_);
......@@ -632,7 +632,7 @@ protected:
632632 _LIBCPP_INLINE_VISIBILITY
633633 iterator end() _NOEXCEPT
634634 {
635#if _LIBCPP_DEBUG_LEVEL >= 2
635#if _LIBCPP_DEBUG_LEVEL == 2
636636 return iterator(__end_as_link(), this);
637637#else
638638 return iterator(__end_as_link());
......@@ -641,7 +641,7 @@ protected:
641641 _LIBCPP_INLINE_VISIBILITY
642642 const_iterator end() const _NOEXCEPT
643643 {
644#if _LIBCPP_DEBUG_LEVEL >= 2
644#if _LIBCPP_DEBUG_LEVEL == 2
645645 return const_iterator(__end_as_link(), this);
646646#else
647647 return const_iterator(__end_as_link());
......@@ -696,7 +696,7 @@ private:
696696
697697 _LIBCPP_INLINE_VISIBILITY
698698 void __invalidate_all_iterators() {
699#if _LIBCPP_DEBUG_LEVEL >= 2
699#if _LIBCPP_DEBUG_LEVEL == 2
700700 __get_db()->__invalidate_all(this);
701701#endif
702702 }
......@@ -735,13 +735,13 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
735735#ifndef _LIBCPP_CXX03_LANG
736736template <class _Tp, class _Alloc>
737737inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
738 : __size_alloc_(0, std::move(__a)) {}
738 : __size_alloc_(0, _VSTD::move(__a)) {}
739739#endif
740740
741741template <class _Tp, class _Alloc>
742742__list_imp<_Tp, _Alloc>::~__list_imp() {
743743 clear();
744#if _LIBCPP_DEBUG_LEVEL >= 2
744#if _LIBCPP_DEBUG_LEVEL == 2
745745 __get_db()->__erase_c(this);
746746#endif
747747}
......@@ -783,7 +783,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
783783 "list::swap: Either propagate_on_container_swap must be true"
784784 " or the allocators must compare equal");
785785 using _VSTD::swap;
786 __swap_allocator(__node_alloc(), __c.__node_alloc());
786 _VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc());
787787 swap(__sz(), __c.__sz());
788788 swap(__end_, __c.__end_);
789789 if (__sz() == 0)
......@@ -795,13 +795,13 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
795795 else
796796 __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
797797
798#if _LIBCPP_DEBUG_LEVEL >= 2
798#if _LIBCPP_DEBUG_LEVEL == 2
799799 __libcpp_db* __db = __get_db();
800800 __c_node* __cn1 = __db->__find_c_and_lock(this);
801801 __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_);
805805 for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;)
806806 {
807807 --__p;
......@@ -810,7 +810,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
810810 {
811811 __cn2->__add(*__p);
812812 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*));
814814 }
815815 else
816816 (*__p)->__c_ = __cn1;
......@@ -823,7 +823,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
823823 {
824824 __cn1->__add(*__p);
825825 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*));
827827 }
828828 else
829829 (*__p)->__c_ = __cn2;
......@@ -870,14 +870,14 @@ public:
870870 list()
871871 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
872872 {
873#if _LIBCPP_DEBUG_LEVEL >= 2
873#if _LIBCPP_DEBUG_LEVEL == 2
874874 __get_db()->__insert_c(this);
875875#endif
876876 }
877877 _LIBCPP_INLINE_VISIBILITY
878878 explicit list(const allocator_type& __a) : base(__a)
879879 {
880#if _LIBCPP_DEBUG_LEVEL >= 2
880#if _LIBCPP_DEBUG_LEVEL == 2
881881 __get_db()->__insert_c(this);
882882#endif
883883 }
......@@ -937,7 +937,7 @@ public:
937937 _LIBCPP_INLINE_VISIBILITY
938938 size_type max_size() const _NOEXCEPT
939939 {
940 return std::min<size_type>(
940 return _VSTD::min<size_type>(
941941 base::__node_alloc_max_size(),
942942 numeric_limits<difference_type >::max());
943943 }
......@@ -1117,14 +1117,14 @@ public:
11171117 return __hold_pointer(__p, __node_destructor(__na, 1));
11181118 }
11191119
1120#if _LIBCPP_DEBUG_LEVEL >= 2
1120#if _LIBCPP_DEBUG_LEVEL == 2
11211121
11221122 bool __dereferenceable(const const_iterator* __i) const;
11231123 bool __decrementable(const const_iterator* __i) const;
11241124 bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
11251125 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
11261126
1127#endif // _LIBCPP_DEBUG_LEVEL >= 2
1127#endif // _LIBCPP_DEBUG_LEVEL == 2
11281128
11291129private:
11301130 _LIBCPP_INLINE_VISIBILITY
......@@ -1144,7 +1144,7 @@ private:
11441144
11451145#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
11461146template<class _InputIterator,
1147 class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
1147 class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
11481148 class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
11491149 >
11501150list(_InputIterator, _InputIterator)
......@@ -1207,7 +1207,7 @@ list<_Tp, _Alloc>::__iterator(size_type __n)
12071207template <class _Tp, class _Alloc>
12081208list<_Tp, _Alloc>::list(size_type __n)
12091209{
1210#if _LIBCPP_DEBUG_LEVEL >= 2
1210#if _LIBCPP_DEBUG_LEVEL == 2
12111211 __get_db()->__insert_c(this);
12121212#endif
12131213 for (; __n > 0; --__n)
......@@ -1222,7 +1222,7 @@ list<_Tp, _Alloc>::list(size_type __n)
12221222template <class _Tp, class _Alloc>
12231223list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
12241224{
1225#if _LIBCPP_DEBUG_LEVEL >= 2
1225#if _LIBCPP_DEBUG_LEVEL == 2
12261226 __get_db()->__insert_c(this);
12271227#endif
12281228 for (; __n > 0; --__n)
......@@ -1233,7 +1233,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
12331233template <class _Tp, class _Alloc>
12341234list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
12351235{
1236#if _LIBCPP_DEBUG_LEVEL >= 2
1236#if _LIBCPP_DEBUG_LEVEL == 2
12371237 __get_db()->__insert_c(this);
12381238#endif
12391239 for (; __n > 0; --__n)
......@@ -1244,7 +1244,7 @@ template <class _Tp, class _Alloc>
12441244list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a)
12451245 : base(__a)
12461246{
1247#if _LIBCPP_DEBUG_LEVEL >= 2
1247#if _LIBCPP_DEBUG_LEVEL == 2
12481248 __get_db()->__insert_c(this);
12491249#endif
12501250 for (; __n > 0; --__n)
......@@ -1256,7 +1256,7 @@ template <class _InpIter>
12561256list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
12571257 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
12581258{
1259#if _LIBCPP_DEBUG_LEVEL >= 2
1259#if _LIBCPP_DEBUG_LEVEL == 2
12601260 __get_db()->__insert_c(this);
12611261#endif
12621262 for (; __f != __l; ++__f)
......@@ -1269,7 +1269,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
12691269 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
12701270 : base(__a)
12711271{
1272#if _LIBCPP_DEBUG_LEVEL >= 2
1272#if _LIBCPP_DEBUG_LEVEL == 2
12731273 __get_db()->__insert_c(this);
12741274#endif
12751275 for (; __f != __l; ++__f)
......@@ -1280,7 +1280,7 @@ template <class _Tp, class _Alloc>
12801280list<_Tp, _Alloc>::list(const list& __c)
12811281 : base(__node_alloc_traits::select_on_container_copy_construction(
12821282 __c.__node_alloc())) {
1283#if _LIBCPP_DEBUG_LEVEL >= 2
1283#if _LIBCPP_DEBUG_LEVEL == 2
12841284 __get_db()->__insert_c(this);
12851285#endif
12861286 for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
......@@ -1291,7 +1291,7 @@ template <class _Tp, class _Alloc>
12911291list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a)
12921292 : base(__a)
12931293{
1294#if _LIBCPP_DEBUG_LEVEL >= 2
1294#if _LIBCPP_DEBUG_LEVEL == 2
12951295 __get_db()->__insert_c(this);
12961296#endif
12971297 for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
......@@ -1304,7 +1304,7 @@ template <class _Tp, class _Alloc>
13041304list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
13051305 : base(__a)
13061306{
1307#if _LIBCPP_DEBUG_LEVEL >= 2
1307#if _LIBCPP_DEBUG_LEVEL == 2
13081308 __get_db()->__insert_c(this);
13091309#endif
13101310 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&
13151315template <class _Tp, class _Alloc>
13161316list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
13171317{
1318#if _LIBCPP_DEBUG_LEVEL >= 2
1318#if _LIBCPP_DEBUG_LEVEL == 2
13191319 __get_db()->__insert_c(this);
13201320#endif
13211321 for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
......@@ -1327,7 +1327,7 @@ template <class _Tp, class _Alloc>
13271327inline list<_Tp, _Alloc>::list(list&& __c)
13281328 _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
13291329 : base(_VSTD::move(__c.__node_alloc())) {
1330#if _LIBCPP_DEBUG_LEVEL >= 2
1330#if _LIBCPP_DEBUG_LEVEL == 2
13311331 __get_db()->__insert_c(this);
13321332#endif
13331333 splice(end(), __c);
......@@ -1338,7 +1338,7 @@ inline
13381338list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
13391339 : base(__a)
13401340{
1341#if _LIBCPP_DEBUG_LEVEL >= 2
1341#if _LIBCPP_DEBUG_LEVEL == 2
13421342 __get_db()->__insert_c(this);
13431343#endif
13441344 if (__a == __c.get_allocator())
......@@ -1415,7 +1415,7 @@ list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
14151415 insert(__e, __f, __l);
14161416 else
14171417 erase(__i, __e);
1418#if _LIBCPP_DEBUG_LEVEL >= 2
1418#if _LIBCPP_DEBUG_LEVEL == 2
14191419 __get_db()->__invalidate_all(this);
14201420#endif
14211421}
......@@ -1432,7 +1432,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
14321432 insert(__e, __n, __x);
14331433 else
14341434 erase(__i, __e);
1435#if _LIBCPP_DEBUG_LEVEL >= 2
1435#if _LIBCPP_DEBUG_LEVEL == 2
14361436 __get_db()->__invalidate_all(this);
14371437#endif
14381438}
......@@ -1449,7 +1449,7 @@ template <class _Tp, class _Alloc>
14491449typename list<_Tp, _Alloc>::iterator
14501450list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
14511451{
1452#if _LIBCPP_DEBUG_LEVEL >= 2
1452#if _LIBCPP_DEBUG_LEVEL == 2
14531453 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
14541454 "list::insert(iterator, x) called with an iterator not"
14551455 " referring to this list");
......@@ -1459,7 +1459,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
14591459 __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
14601460 __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link());
14611461 ++base::__sz();
1462#if _LIBCPP_DEBUG_LEVEL >= 2
1462#if _LIBCPP_DEBUG_LEVEL == 2
14631463 return iterator(__hold.release()->__as_link(), this);
14641464#else
14651465 return iterator(__hold.release()->__as_link());
......@@ -1470,7 +1470,7 @@ template <class _Tp, class _Alloc>
14701470typename list<_Tp, _Alloc>::iterator
14711471list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
14721472{
1473#if _LIBCPP_DEBUG_LEVEL >= 2
1473#if _LIBCPP_DEBUG_LEVEL == 2
14741474 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
14751475 "list::insert(iterator, n, x) called with an iterator not"
14761476 " referring to this list");
......@@ -1485,7 +1485,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
14851485 __hold_pointer __hold = __allocate_node(__na);
14861486 __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
14871487 ++__ds;
1488#if _LIBCPP_DEBUG_LEVEL >= 2
1488#if _LIBCPP_DEBUG_LEVEL == 2
14891489 __r = iterator(__hold->__as_link(), this);
14901490#else
14911491 __r = iterator(__hold->__as_link());
......@@ -1515,7 +1515,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
15151515 __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
15161516 if (__prev == 0)
15171517 break;
1518#if _LIBCPP_DEBUG_LEVEL >= 2
1518#if _LIBCPP_DEBUG_LEVEL == 2
15191519 __e = iterator(__prev, this);
15201520#else
15211521 __e = iterator(__prev);
......@@ -1536,7 +1536,7 @@ typename list<_Tp, _Alloc>::iterator
15361536list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
15371537 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
15381538{
1539#if _LIBCPP_DEBUG_LEVEL >= 2
1539#if _LIBCPP_DEBUG_LEVEL == 2
15401540 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
15411541 "list::insert(iterator, range) called with an iterator not"
15421542 " referring to this list");
......@@ -1551,7 +1551,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
15511551 __hold_pointer __hold = __allocate_node(__na);
15521552 __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
15531553 ++__ds;
1554#if _LIBCPP_DEBUG_LEVEL >= 2
1554#if _LIBCPP_DEBUG_LEVEL == 2
15551555 __r = iterator(__hold.get()->__as_link(), this);
15561556#else
15571557 __r = iterator(__hold.get()->__as_link());
......@@ -1581,7 +1581,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
15811581 __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
15821582 if (__prev == 0)
15831583 break;
1584#if _LIBCPP_DEBUG_LEVEL >= 2
1584#if _LIBCPP_DEBUG_LEVEL == 2
15851585 __e = iterator(__prev, this);
15861586#else
15871587 __e = iterator(__prev);
......@@ -1695,7 +1695,7 @@ template <class... _Args>
16951695typename list<_Tp, _Alloc>::iterator
16961696list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
16971697{
1698#if _LIBCPP_DEBUG_LEVEL >= 2
1698#if _LIBCPP_DEBUG_LEVEL == 2
16991699 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
17001700 "list::emplace(iterator, args...) called with an iterator not"
17011701 " referring to this list");
......@@ -1707,7 +1707,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
17071707 __link_nodes(__p.__ptr_, __nl, __nl);
17081708 ++base::__sz();
17091709 __hold.release();
1710#if _LIBCPP_DEBUG_LEVEL >= 2
1710#if _LIBCPP_DEBUG_LEVEL == 2
17111711 return iterator(__nl, this);
17121712#else
17131713 return iterator(__nl);
......@@ -1718,7 +1718,7 @@ template <class _Tp, class _Alloc>
17181718typename list<_Tp, _Alloc>::iterator
17191719list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
17201720{
1721#if _LIBCPP_DEBUG_LEVEL >= 2
1721#if _LIBCPP_DEBUG_LEVEL == 2
17221722 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
17231723 "list::insert(iterator, x) called with an iterator not"
17241724 " referring to this list");
......@@ -1730,7 +1730,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
17301730 __link_nodes(__p.__ptr_, __nl, __nl);
17311731 ++base::__sz();
17321732 __hold.release();
1733#if _LIBCPP_DEBUG_LEVEL >= 2
1733#if _LIBCPP_DEBUG_LEVEL == 2
17341734 return iterator(__nl, this);
17351735#else
17361736 return iterator(__nl);
......@@ -1748,7 +1748,7 @@ list<_Tp, _Alloc>::pop_front()
17481748 __link_pointer __n = base::__end_.__next_;
17491749 base::__unlink_nodes(__n, __n);
17501750 --base::__sz();
1751#if _LIBCPP_DEBUG_LEVEL >= 2
1751#if _LIBCPP_DEBUG_LEVEL == 2
17521752 __c_node* __c = __get_db()->__find_c_and_lock(this);
17531753 for (__i_node** __p = __c->end_; __p != __c->beg_; )
17541754 {
......@@ -1758,7 +1758,7 @@ list<_Tp, _Alloc>::pop_front()
17581758 {
17591759 (*__p)->__c_ = nullptr;
17601760 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*));
17621762 }
17631763 }
17641764 __get_db()->unlock();
......@@ -1777,7 +1777,7 @@ list<_Tp, _Alloc>::pop_back()
17771777 __link_pointer __n = base::__end_.__prev_;
17781778 base::__unlink_nodes(__n, __n);
17791779 --base::__sz();
1780#if _LIBCPP_DEBUG_LEVEL >= 2
1780#if _LIBCPP_DEBUG_LEVEL == 2
17811781 __c_node* __c = __get_db()->__find_c_and_lock(this);
17821782 for (__i_node** __p = __c->end_; __p != __c->beg_; )
17831783 {
......@@ -1787,7 +1787,7 @@ list<_Tp, _Alloc>::pop_back()
17871787 {
17881788 (*__p)->__c_ = nullptr;
17891789 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*));
17911791 }
17921792 }
17931793 __get_db()->unlock();
......@@ -1801,7 +1801,7 @@ template <class _Tp, class _Alloc>
18011801typename list<_Tp, _Alloc>::iterator
18021802list<_Tp, _Alloc>::erase(const_iterator __p)
18031803{
1804#if _LIBCPP_DEBUG_LEVEL >= 2
1804#if _LIBCPP_DEBUG_LEVEL == 2
18051805 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
18061806 "list::erase(iterator) called with an iterator not"
18071807 " referring to this list");
......@@ -1813,7 +1813,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
18131813 __link_pointer __r = __n->__next_;
18141814 base::__unlink_nodes(__n, __n);
18151815 --base::__sz();
1816#if _LIBCPP_DEBUG_LEVEL >= 2
1816#if _LIBCPP_DEBUG_LEVEL == 2
18171817 __c_node* __c = __get_db()->__find_c_and_lock(this);
18181818 for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
18191819 {
......@@ -1823,7 +1823,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
18231823 {
18241824 (*__ip)->__c_ = nullptr;
18251825 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*));
18271827 }
18281828 }
18291829 __get_db()->unlock();
......@@ -1831,7 +1831,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
18311831 __node_pointer __np = __n->__as_node();
18321832 __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
18331833 __node_alloc_traits::deallocate(__na, __np, 1);
1834#if _LIBCPP_DEBUG_LEVEL >= 2
1834#if _LIBCPP_DEBUG_LEVEL == 2
18351835 return iterator(__r, this);
18361836#else
18371837 return iterator(__r);
......@@ -1842,7 +1842,7 @@ template <class _Tp, class _Alloc>
18421842typename list<_Tp, _Alloc>::iterator
18431843list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
18441844{
1845#if _LIBCPP_DEBUG_LEVEL >= 2
1845#if _LIBCPP_DEBUG_LEVEL == 2
18461846 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this,
18471847 "list::erase(iterator, iterator) called with an iterator not"
18481848 " referring to this list");
......@@ -1859,7 +1859,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
18591859 __link_pointer __n = __f.__ptr_;
18601860 ++__f;
18611861 --base::__sz();
1862#if _LIBCPP_DEBUG_LEVEL >= 2
1862#if _LIBCPP_DEBUG_LEVEL == 2
18631863 __c_node* __c = __get_db()->__find_c_and_lock(this);
18641864 for (__i_node** __p = __c->end_; __p != __c->beg_; )
18651865 {
......@@ -1869,7 +1869,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
18691869 {
18701870 (*__p)->__c_ = nullptr;
18711871 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*));
18731873 }
18741874 }
18751875 __get_db()->unlock();
......@@ -1879,7 +1879,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
18791879 __node_alloc_traits::deallocate(__na, __np, 1);
18801880 }
18811881 }
1882#if _LIBCPP_DEBUG_LEVEL >= 2
1882#if _LIBCPP_DEBUG_LEVEL == 2
18831883 return iterator(__l.__ptr_, this);
18841884#else
18851885 return iterator(__l.__ptr_);
......@@ -1900,7 +1900,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
19001900 __hold_pointer __hold = __allocate_node(__na);
19011901 __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
19021902 ++__ds;
1903#if _LIBCPP_DEBUG_LEVEL >= 2
1903#if _LIBCPP_DEBUG_LEVEL == 2
19041904 iterator __r = iterator(__hold.release()->__as_link(), this);
19051905#else
19061906 iterator __r = iterator(__hold.release()->__as_link());
......@@ -1929,7 +1929,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
19291929 __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
19301930 if (__prev == 0)
19311931 break;
1932#if _LIBCPP_DEBUG_LEVEL >= 2
1932#if _LIBCPP_DEBUG_LEVEL == 2
19331933 __e = iterator(__prev, this);
19341934#else
19351935 __e = iterator(__prev);
......@@ -1958,7 +1958,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
19581958 __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
19591959 ++__ds;
19601960 __link_pointer __nl = __hold.release()->__as_link();
1961#if _LIBCPP_DEBUG_LEVEL >= 2
1961#if _LIBCPP_DEBUG_LEVEL == 2
19621962 iterator __r = iterator(__nl, this);
19631963#else
19641964 iterator __r = iterator(__nl);
......@@ -1987,7 +1987,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
19871987 __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
19881988 if (__prev == 0)
19891989 break;
1990#if _LIBCPP_DEBUG_LEVEL >= 2
1990#if _LIBCPP_DEBUG_LEVEL == 2
19911991 __e = iterator(__prev, this);
19921992#else
19931993 __e = iterator(__prev);
......@@ -2007,7 +2007,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
20072007{
20082008 _LIBCPP_ASSERT(this != &__c,
20092009 "list::splice(iterator, list) called with this == &list");
2010#if _LIBCPP_DEBUG_LEVEL >= 2
2010#if _LIBCPP_DEBUG_LEVEL == 2
20112011 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
20122012 "list::splice(iterator, list) called with an iterator not"
20132013 " referring to this list");
......@@ -2020,7 +2020,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
20202020 __link_nodes(__p.__ptr_, __f, __l);
20212021 base::__sz() += __c.__sz();
20222022 __c.__sz() = 0;
2023#if _LIBCPP_DEBUG_LEVEL >= 2
2023#if _LIBCPP_DEBUG_LEVEL == 2
20242024 if (&__c != this) {
20252025 __libcpp_db* __db = __get_db();
20262026 __c_node* __cn1 = __db->__find_c_and_lock(this);
......@@ -2034,7 +2034,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
20342034 __cn1->__add(*__ip);
20352035 (*__ip)->__c_ = __cn1;
20362036 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*));
20382038 }
20392039 }
20402040 __db->unlock();
......@@ -2047,7 +2047,7 @@ template <class _Tp, class _Alloc>
20472047void
20482048list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
20492049{
2050#if _LIBCPP_DEBUG_LEVEL >= 2
2050#if _LIBCPP_DEBUG_LEVEL == 2
20512051 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
20522052 "list::splice(iterator, list, iterator) called with first iterator not"
20532053 " referring to this list");
......@@ -2056,7 +2056,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
20562056 " referring to list argument");
20572057 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i),
20582058 "list::splice(iterator, list, iterator) called with second iterator not"
2059 " derefereceable");
2059 " dereferenceable");
20602060#endif
20612061 if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
20622062 {
......@@ -2065,7 +2065,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
20652065 __link_nodes(__p.__ptr_, __f, __f);
20662066 --__c.__sz();
20672067 ++base::__sz();
2068#if _LIBCPP_DEBUG_LEVEL >= 2
2068#if _LIBCPP_DEBUG_LEVEL == 2
20692069 if (&__c != this) {
20702070 __libcpp_db* __db = __get_db();
20712071 __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)
20792079 __cn1->__add(*__ip);
20802080 (*__ip)->__c_ = __cn1;
20812081 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*));
20832083 }
20842084 }
20852085 __db->unlock();
......@@ -2092,7 +2092,7 @@ template <class _Tp, class _Alloc>
20922092void
20932093list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
20942094{
2095#if _LIBCPP_DEBUG_LEVEL >= 2
2095#if _LIBCPP_DEBUG_LEVEL == 2
20962096 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
20972097 "list::splice(iterator, list, iterator, iterator) called with first iterator not"
20982098 " referring to this list");
......@@ -2121,7 +2121,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
21212121 }
21222122 base::__unlink_nodes(__first, __last);
21232123 __link_nodes(__p.__ptr_, __first, __last);
2124#if _LIBCPP_DEBUG_LEVEL >= 2
2124#if _LIBCPP_DEBUG_LEVEL == 2
21252125 if (&__c != this) {
21262126 __libcpp_db* __db = __get_db();
21272127 __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
21382138 __cn1->__add(*__ip);
21392139 (*__ip)->__c_ = __cn1;
21402140 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*));
21422142 }
21432143 }
21442144 }
......@@ -2258,7 +2258,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
22582258 ++__f1;
22592259 }
22602260 splice(__e1, __c);
2261#if _LIBCPP_DEBUG_LEVEL >= 2
2261#if _LIBCPP_DEBUG_LEVEL == 2
22622262 __libcpp_db* __db = __get_db();
22632263 __c_node* __cn1 = __db->__find_c_and_lock(this);
22642264 __c_node* __cn2 = __db->__find_c(&__c);
......@@ -2271,7 +2271,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
22712271 __cn1->__add(*__p);
22722272 (*__p)->__c_ = __cn1;
22732273 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*));
22752275 }
22762276 }
22772277 __db->unlock();
......@@ -2382,7 +2382,7 @@ list<_Tp, _Alloc>::__invariants() const
23822382 return size() == _VSTD::distance(begin(), end());
23832383}
23842384
2385#if _LIBCPP_DEBUG_LEVEL >= 2
2385#if _LIBCPP_DEBUG_LEVEL == 2
23862386
23872387template <class _Tp, class _Alloc>
23882388bool
......@@ -2412,7 +2412,7 @@ list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
24122412 return false;
24132413}
24142414
2415#endif // _LIBCPP_DEBUG_LEVEL >= 2
2415#endif // _LIBCPP_DEBUG_LEVEL == 2
24162416
24172417template <class _Tp, class _Alloc>
24182418inline _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/locale+63-67
......@@ -197,10 +197,6 @@ template <class charT> class messages_byname;
197197#include <nl_types.h>
198198#endif
199199
200#ifdef __APPLE__
201#include <Availability.h>
202#endif
203
204200#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
205201#include <__bsd_locale_defaults.h>
206202#else
......@@ -261,11 +257,11 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
261257 const unsigned char __does_match = '\2';
262258 unsigned char __statbuf[100];
263259 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);
265261 if (__nkw > sizeof(__statbuf))
266262 {
267263 __status = (unsigned char*)malloc(__nkw);
268 if (__status == 0)
264 if (__status == nullptr)
269265 __throw_bad_alloc();
270266 __stat_hold.reset(__status);
271267 }
......@@ -561,8 +557,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
561557 return 0;
562558}
563559
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>)
566562
567563template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
568564class _LIBCPP_TEMPLATE_VIS num_get
......@@ -877,8 +873,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
877873 const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc());
878874 typedef typename numpunct<_CharT>::string_type string_type;
879875 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);
882878 __v = __i == __names;
883879 return __b;
884880}
......@@ -1099,8 +1095,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
10991095 return __b;
11001096}
11011097
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>)
11041100
11051101struct _LIBCPP_TYPE_VIS __num_put_base
11061102{
......@@ -1249,8 +1245,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
12491245 __op = __ob + (__np - __nb);
12501246}
12511247
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>)
12541250
12551251template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
12561252class _LIBCPP_TEMPLATE_VIS num_put
......@@ -1427,7 +1423,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
14271423 return do_put(__s, __iob, __fl, (unsigned long)__v);
14281424 const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc());
14291425 typedef typename numpunct<char_type>::string_type string_type;
1430#if _LIBCPP_DEBUG_LEVEL >= 2
1426#if _LIBCPP_DEBUG_LEVEL == 2
14311427 string_type __tmp(__v ? __np.truename() : __np.falsename());
14321428 string_type __nm = _VSTD::move(__tmp);
14331429#else
......@@ -1564,14 +1560,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
15641560 (int)__iob.precision(), __v);
15651561 else
15661562 __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);
15681564 if (__nc > static_cast<int>(__nbuf-1))
15691565 {
15701566 if (__specify_precision)
15711567 __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
15721568 else
15731569 __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
1574 if (__nb == 0)
1570 if (__nb == nullptr)
15751571 __throw_bad_alloc();
15761572 __nbh.reset(__nb);
15771573 }
......@@ -1615,14 +1611,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
16151611 (int)__iob.precision(), __v);
16161612 else
16171613 __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);
16191615 if (__nc > static_cast<int>(__nbuf-1))
16201616 {
16211617 if (__specify_precision)
16221618 __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
16231619 else
16241620 __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
1625 if (__nb == 0)
1621 if (__nb == nullptr)
16261622 __throw_bad_alloc();
16271623 __nbh.reset(__nb);
16281624 }
......@@ -1676,8 +1672,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
16761672 return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
16771673}
16781674
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>)
16811677
16821678template <class _CharT, class _InputIterator>
16831679_LIBCPP_HIDDEN
......@@ -1916,7 +1912,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
19161912{
19171913 // Note: ignoring case comes from the POSIX strptime spec
19181914 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;
19201916 if (__i < 14)
19211917 __w = __i % 7;
19221918}
......@@ -1930,7 +1926,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
19301926{
19311927 // Note: ignoring case comes from the POSIX strptime spec
19321928 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;
19341930 if (__i < 24)
19351931 __m = __i % 12;
19361932}
......@@ -1942,7 +1938,7 @@ time_get<_CharT, _InputIterator>::__get_day(int& __d,
19421938 ios_base::iostate& __err,
19431939 const ctype<char_type>& __ct) const
19441940{
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);
19461942 if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
19471943 __d = __t;
19481944 else
......@@ -2102,7 +2098,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
21022098 __err |= ios_base::failbit;
21032099 return;
21042100 }
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;
21062102 if (__i == 0 && __h == 12)
21072103 __h = 0;
21082104 else if (__i == 1 && __h < 12)
......@@ -2362,8 +2358,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
23622358 return __b;
23632359}
23642360
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>)
23672363
23682364class _LIBCPP_TYPE_VIS __time_get
23692365{
......@@ -2462,8 +2458,8 @@ private:
24622458 virtual const string_type& __X() const {return this->__X_;}
24632459};
24642460
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>)
24672463
24682464class _LIBCPP_TYPE_VIS __time_put
24692465{
......@@ -2575,8 +2571,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
25752571 return _VSTD::copy(__nb, __ne, __s);
25762572}
25772573
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>)
25802576
25812577template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
25822578class _LIBCPP_TEMPLATE_VIS time_put_byname
......@@ -2596,8 +2592,8 @@ protected:
25962592 ~time_put_byname() {}
25972593};
25982594
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>)
26012597
26022598// money_base
26032599
......@@ -2663,10 +2659,10 @@ template <class _CharT, bool _International>
26632659const bool
26642660moneypunct<_CharT, _International>::intl;
26652661
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>)
26702666
26712667// moneypunct_byname
26722668
......@@ -2720,10 +2716,10 @@ template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*
27202716template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
27212717template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
27222718
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>)
27272723
27282724// money_get
27292725
......@@ -2779,8 +2775,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
27792775 }
27802776}
27812777
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>)
27842780
27852781template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
27862782class _LIBCPP_TEMPLATE_VIS money_get
......@@ -3108,11 +3104,11 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
31083104 __ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
31093105 char __nbuf[__bz];
31103106 char* __nc = __nbuf;
3111 unique_ptr<char, void(*)(void*)> __h(0, free);
3107 unique_ptr<char, void(*)(void*)> __h(nullptr, free);
31123108 if (__wn - __wb.get() > __bz-2)
31133109 {
31143110 __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
3115 if (__h.get() == 0)
3111 if (__h.get() == nullptr)
31163112 __throw_bad_alloc();
31173113 __nc = __h.get();
31183114 }
......@@ -3162,8 +3158,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
31623158 return __b;
31633159}
31643160
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>)
31673163
31683164// money_put
31693165
......@@ -3337,8 +3333,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
33373333 __mi = __mb;
33383334}
33393335
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>)
33423338
33433339template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
33443340class _LIBCPP_TEMPLATE_VIS money_put
......@@ -3397,13 +3393,13 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
33973393 char_type __digits[__bs];
33983394 char_type* __db = __digits;
33993395 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);
34013397 unique_ptr<char_type, void(*)(void*)> __hd(0, free);
34023398 // secure memory for digit storage
34033399 if (__n > __bs-1)
34043400 {
34053401 __n = static_cast<size_t>(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
3406 if (__bb == 0)
3402 if (__bb == nullptr)
34073403 __throw_bad_alloc();
34083404 __hn.reset(__bb);
34093405 __hd.reset((char_type*)malloc(__n * sizeof(char_type)));
......@@ -3490,8 +3486,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
34903486 return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
34913487}
34923488
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>)
34953491
34963492// messages
34973493
......@@ -3582,7 +3578,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
35823578 char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
35833579 string_type __w;
35843580 __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
3585 __n, __n + strlen(__n));
3581 __n, __n + _VSTD::strlen(__n));
35863582 return __w;
35873583#else // !_LIBCPP_HAS_CATOPEN
35883584 _LIBCPP_UNUSED_VAR(__c);
......@@ -3606,8 +3602,8 @@ messages<_CharT>::do_close(catalog __c) const
36063602#endif // _LIBCPP_HAS_CATOPEN
36073603}
36083604
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>)
36113607
36123608template <class _CharT>
36133609class _LIBCPP_TEMPLATE_VIS messages_byname
......@@ -3630,8 +3626,8 @@ protected:
36303626 ~messages_byname() {}
36313627};
36323628
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>)
36353631
36363632template<class _Codecvt, class _Elem = wchar_t,
36373633 class _Wide_alloc = allocator<_Elem>,
......@@ -3923,7 +3919,7 @@ private:
39233919 wbuffer_convert(const wbuffer_convert&);
39243920 wbuffer_convert& operator=(const wbuffer_convert&);
39253921public:
3926 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
3922 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = nullptr,
39273923 _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
39283924 ~wbuffer_convert();
39293925
......@@ -3961,9 +3957,9 @@ private:
39613957template <class _Codecvt, class _Elem, class _Tr>
39623958wbuffer_convert<_Codecvt, _Elem, _Tr>::
39633959 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),
39673963 __ebs_(0),
39683964 __intbuf_(0),
39693965 __ibs_(0),
......@@ -4003,7 +3999,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
40033999 int_type __c = traits_type::eof();
40044000 if (this->gptr() == this->egptr())
40054001 {
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));
40074003 if (__always_noconv_)
40084004 {
40094005 streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
......@@ -4020,7 +4016,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
40204016 {
40214017 _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
40224018 if (__extbufend_ != __extbufnext_)
4023 memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
4019 _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
40244020 __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
40254021 __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
40264022 streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
......@@ -4336,12 +4332,12 @@ template <class _Codecvt, class _Elem, class _Tr>
43364332wbuffer_convert<_Codecvt, _Elem, _Tr>*
43374333wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
43384334{
4339 wbuffer_convert* __rt = 0;
4340 if (__cv_ != 0 && __bufptr_ != 0)
4335 wbuffer_convert* __rt = nullptr;
4336 if (__cv_ != nullptr && __bufptr_ != nullptr)
43414337 {
43424338 __rt = this;
43434339 if ((__cm_ & ios_base::out) && sync())
4344 __rt = 0;
4340 __rt = nullptr;
43454341 }
43464342 return __rt;
43474343}
lib/libcxx/include/locale.h+5-1
......@@ -35,8 +35,12 @@ Functions:
3535
3636#include <__config>
3737
38#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
39# error "Localization is not supported by this configuration of libc++"
40#endif
41
3842#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
39#pragma GCC system_header
43# pragma GCC system_header
4044#endif
4145
4246#include_next <locale.h>
lib/libcxx/include/map+25-25
......@@ -1230,7 +1230,7 @@ public:
12301230 return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
12311231 _VSTD::piecewise_construct,
12321232 _VSTD::forward_as_tuple(__k),
1233 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
1233 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)).first;
12341234 }
12351235
12361236 template <class... _Args>
......@@ -1240,7 +1240,7 @@ public:
12401240 return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
12411241 _VSTD::piecewise_construct,
12421242 _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;
12441244 }
12451245
12461246 template <class _Vp>
......@@ -1270,30 +1270,30 @@ public:
12701270 }
12711271
12721272 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 }
12841284
12851285 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 }
12971297
12981298#endif // _LIBCPP_STD_VER > 14
12991299
......@@ -1546,7 +1546,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
15461546 __h.get_deleter().__first_constructed = true;
15471547 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
15481548 __h.get_deleter().__second_constructed = true;
1549 return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
1549 return __h;
15501550}
15511551
15521552template <class _Key, class _Tp, class _Compare, class _Allocator>
lib/libcxx/include/memory+365-1377
......@@ -46,7 +46,7 @@ struct pointer_traits<T*>
4646};
4747
4848template <class T> constexpr T* to_address(T* p) noexcept; // C++20
49template <class Ptr> auto to_address(const Ptr& p) noexcept; // C++20
49template <class Ptr> constexpr auto to_address(const Ptr& p) noexcept; // C++20
5050
5151template <class Alloc>
5252struct allocator_traits
......@@ -83,21 +83,19 @@ struct allocator_traits
8383 template <class T> using rebind_alloc = Alloc::rebind<T>::other | Alloc<T, Args...>;
8484 template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
8585
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
8888
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
9090
9191 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
9393
9494 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
9696
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
10199};
102100
103101template <>
......@@ -115,8 +113,8 @@ template <class T>
115113class allocator
116114{
117115public:
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;
120118 typedef T* pointer; // deprecated in C++17, removed in C++20
121119 typedef const T* const_pointer; // deprecated in C++17, removed in C++20
122120 typedef typename add_lvalue_reference<T>::type
......@@ -135,12 +133,12 @@ public:
135133 constexpr allocator(const allocator&) noexcept; // constexpr in C++20
136134 template <class U>
137135 constexpr allocator(const allocator<U>&) noexcept; // constexpr in C++20
138 ~allocator();
136 ~allocator(); // constexpr in C++20
139137 pointer address(reference x) const noexcept; // deprecated in C++17, removed in C++20
140138 const_pointer address(const_reference x) const noexcept; // deprecated in C++17, removed in C++20
141139 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
144142 size_type max_size() const noexcept; // deprecated in C++17, removed in C++20
145143 template<class U, class... Args>
146144 void construct(U* p, Args&&... args); // deprecated in C++17, removed in C++20
......@@ -149,10 +147,10 @@ public:
149147};
150148
151149template <class T, class U>
152bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
150bool operator==(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20
153151
154152template <class T, class U>
155bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;
153bool operator!=(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20
156154
157155template <class OutputIterator, class T>
158156class raw_storage_iterator
......@@ -191,14 +189,17 @@ template <class ForwardIterator, class Size, class T>
191189ForwardIterator
192190uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
193191
192template <class T, class ...Args>
193constexpr T* construct_at(T* location, Args&& ...args); // since C++20
194
194195template <class T>
195void destroy_at(T* location);
196void destroy_at(T* location); // constexpr in C++20
196197
197198template <class ForwardIterator>
198 void destroy(ForwardIterator first, ForwardIterator last);
199void destroy(ForwardIterator first, ForwardIterator last); // constexpr in C++20
199200
200201template <class ForwardIterator, class Size>
201 ForwardIterator destroy_n(ForwardIterator first, Size n);
202ForwardIterator destroy_n(ForwardIterator first, Size n); // constexpr in C++20
202203
203204template <class InputIterator, class ForwardIterator>
204205 ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result);
......@@ -338,7 +339,7 @@ public:
338339 pointer release() noexcept;
339340 void reset(pointer p = pointer()) noexcept;
340341 void reset(nullptr_t) noexcept;
341 template <class U> void reset(U) = delete;
342 template <class U> void reset(U) = delete;
342343 void swap(unique_ptr& u) noexcept;
343344};
344345
......@@ -664,6 +665,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
664665*/
665666
666667#include <__config>
668#include <__availability>
667669#include <type_traits>
668670#include <typeinfo>
669671#include <cstddef>
......@@ -677,6 +679,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
677679#include <tuple>
678680#include <stdexcept>
679681#include <cstring>
682#include <__memory/allocator_traits.h>
683#include <__memory/base.h>
684#include <__memory/pointer_traits.h>
685#include <__memory/utilities.h>
680686#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
681687# include <atomic>
682688#endif
......@@ -716,413 +722,11 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) {
716722#endif
717723}
718724
719// addressof moved to <type_traits>
720
721template <class _Tp> class allocator;
722
723#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
724template <>
725class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
726{
727public:
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
735template <>
736class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void>
737{
738public:
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
749template <class _Tp, class = void>
750struct __has_element_type : false_type {};
751
752template <class _Tp>
753struct __has_element_type<_Tp,
754 typename __void_t<typename _Tp::element_type>::type> : true_type {};
755
756template <class _Ptr, bool = __has_element_type<_Ptr>::value>
757struct __pointer_traits_element_type;
758
759template <class _Ptr>
760struct __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
767template <template <class, class...> class _Sp, class _Tp, class ..._Args>
768struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
769{
770 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
771};
772
773template <template <class, class...> class _Sp, class _Tp, class ..._Args>
774struct __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
781template <template <class> class _Sp, class _Tp>
782struct __pointer_traits_element_type<_Sp<_Tp>, true>
783{
784 typedef typename _Sp<_Tp>::element_type type;
785};
786
787template <template <class> class _Sp, class _Tp>
788struct __pointer_traits_element_type<_Sp<_Tp>, false>
789{
790 typedef _Tp type;
791};
792
793template <template <class, class> class _Sp, class _Tp, class _A0>
794struct __pointer_traits_element_type<_Sp<_Tp, _A0>, true>
795{
796 typedef typename _Sp<_Tp, _A0>::element_type type;
797};
798
799template <template <class, class> class _Sp, class _Tp, class _A0>
800struct __pointer_traits_element_type<_Sp<_Tp, _A0>, false>
801{
802 typedef _Tp type;
803};
804
805template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>
806struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, true>
807{
808 typedef typename _Sp<_Tp, _A0, _A1>::element_type type;
809};
810
811template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>
812struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, false>
813{
814 typedef _Tp type;
815};
816
817template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
818 class _A1, class _A2>
819struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, true>
820{
821 typedef typename _Sp<_Tp, _A0, _A1, _A2>::element_type type;
822};
823
824template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
825 class _A1, class _A2>
826struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, false>
827{
828 typedef _Tp type;
829};
830
831#endif // _LIBCPP_HAS_NO_VARIADICS
832
833template <class _Tp, class = void>
834struct __has_difference_type : false_type {};
835
836template <class _Tp>
837struct __has_difference_type<_Tp,
838 typename __void_t<typename _Tp::difference_type>::type> : true_type {};
839
840template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
841struct __pointer_traits_difference_type
842{
843 typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
844};
845
846template <class _Ptr>
847struct __pointer_traits_difference_type<_Ptr, true>
848{
849 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
850};
851
852template <class _Tp, class _Up>
853struct __has_rebind
854{
855private:
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
861public:
862 static const bool value = sizeof(__test<_Tp>(0)) == 1;
863};
864
865template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
866struct __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
877template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
878struct __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
887template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
888struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
889{
890 typedef _Sp<_Up, _Args...> type;
891};
892
893#else // _LIBCPP_HAS_NO_VARIADICS
894
895template <template <class> class _Sp, class _Tp, class _Up>
896struct __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
905template <template <class> class _Sp, class _Tp, class _Up>
906struct __pointer_traits_rebind<_Sp<_Tp>, _Up, false>
907{
908 typedef _Sp<_Up> type;
909};
910
911template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>
912struct __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
921template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>
922struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, false>
923{
924 typedef _Sp<_Up, _A0> type;
925};
926
927template <template <class, class, class> class _Sp, class _Tp, class _A0,
928 class _A1, class _Up>
929struct __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
938template <template <class, class, class> class _Sp, class _Tp, class _A0,
939 class _A1, class _Up>
940struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, false>
941{
942 typedef _Sp<_Up, _A0, _A1> type;
943};
944
945template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
946 class _A1, class _A2, class _Up>
947struct __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
956template <template <class, class, class, class> class _Sp, class _Tp, class _A0,
957 class _A1, class _A2, class _Up>
958struct __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
965template <class _Ptr>
966struct _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
979private:
980 struct __nat {};
981public:
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
988template <class _Tp>
989struct _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
1001private:
1002 struct __nat {};
1003public:
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
1010template <class _From, class _To>
1011struct __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
1021template <class _Tp, class = void>
1022struct __has_pointer_type : false_type {};
1023
1024template <class _Tp>
1025struct __has_pointer_type<_Tp,
1026 typename __void_t<typename _Tp::pointer>::type> : true_type {};
1027
1028namespace __pointer_type_imp
1029{
1030
1031template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
1032struct __pointer_type
1033{
1034 typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
1035};
1036
1037template <class _Tp, class _Dp>
1038struct __pointer_type<_Tp, _Dp, false>
1039{
1040 typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
1041};
1042
1043} // __pointer_type_imp
1044
1045template <class _Tp, class _Dp>
1046struct __pointer_type
1047{
1048 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
1049};
1050
1051template <class _Tp, class = void>
1052struct __has_const_pointer : false_type {};
1053
1054template <class _Tp>
1055struct __has_const_pointer<_Tp,
1056 typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
1057
1058template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
1059struct __const_pointer
1060{
1061 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
1062};
1063
1064template <class _Tp, class _Ptr, class _Alloc>
1065struct __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
1074template <class _Tp, class = void>
1075struct __has_void_pointer : false_type {};
1076
1077template <class _Tp>
1078struct __has_void_pointer<_Tp,
1079 typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
1080
1081template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
1082struct __void_pointer
1083{
1084 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
1085};
1086
1087template <class _Ptr, class _Alloc>
1088struct __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
1097template <class _Tp, class = void>
1098struct __has_const_void_pointer : false_type {};
1099
1100template <class _Tp>
1101struct __has_const_void_pointer<_Tp,
1102 typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
1103
1104template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
1105struct __const_void_pointer
1106{
1107 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
1108};
1109
1110template <class _Ptr, class _Alloc>
1111struct __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
1121725template <bool _UsePointerTraits> struct __to_address_helper;
1122726
1123727template <> struct __to_address_helper<true> {
1124728 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&>()));
1126730
1127731 template <class _Pointer>
1128732 _LIBCPP_CONSTEXPR
......@@ -1157,7 +761,7 @@ template <> struct __to_address_helper<false> {
1157761 template <class _Pointer>
1158762 _LIBCPP_CONSTEXPR
1159763 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->()); }
1161765};
1162766
1163767
......@@ -1172,7 +776,7 @@ to_address(_Tp* __p) _NOEXCEPT
1172776}
1173777
1174778template <class _Pointer>
1175inline _LIBCPP_INLINE_VISIBILITY
779inline _LIBCPP_INLINE_VISIBILITY constexpr
1176780auto
1177781to_address(const _Pointer& __p) _NOEXCEPT
1178782{
......@@ -1180,635 +784,112 @@ to_address(const _Pointer& __p) _NOEXCEPT
1180784}
1181785#endif
1182786
1183template <class _Tp, class = void>
1184struct __has_size_type : false_type {};
1185
1186template <class _Tp>
1187struct __has_size_type<_Tp,
1188 typename __void_t<typename _Tp::size_type>::type> : true_type {};
787template <class _Tp> class allocator;
1189788
1190template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
1191struct __size_type
789#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
790template <>
791class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
1192792{
1193 typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
1194};
793public:
794 typedef void* pointer;
795 typedef const void* const_pointer;
796 typedef void value_type;
1195797
1196template <class _Alloc, class _DiffType>
1197struct __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;};
1200799};
1201800
1202template <class _Tp, class = void>
1203struct __has_propagate_on_container_copy_assignment : false_type {};
1204
1205template <class _Tp>
1206struct __has_propagate_on_container_copy_assignment<_Tp,
1207 typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
1208 : true_type {};
1209
1210template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
1211struct __propagate_on_container_copy_assignment
801template <>
802class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void>
1212803{
1213 typedef _LIBCPP_NODEBUG_TYPE false_type type;
1214};
804public:
805 typedef const void* pointer;
806 typedef const void* const_pointer;
807 typedef const void value_type;
1215808
1216template <class _Alloc>
1217struct __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;};
1220810};
811#endif
1221812
1222template <class _Tp, class = void>
1223struct __has_propagate_on_container_move_assignment : false_type {};
813// allocator
1224814
1225815template <class _Tp>
1226struct __has_propagate_on_container_move_assignment<_Tp,
1227 typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
1228 : true_type {};
1229
1230template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
1231struct __propagate_on_container_move_assignment
816class _LIBCPP_TEMPLATE_VIS allocator
1232817{
1233 typedef false_type type;
1234};
1235
1236template <class _Alloc>
1237struct __propagate_on_container_move_assignment<_Alloc, true>
1238{
1239 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
1240};
1241
1242template <class _Tp, class = void>
1243struct __has_propagate_on_container_swap : false_type {};
1244
1245template <class _Tp>
1246struct __has_propagate_on_container_swap<_Tp,
1247 typename __void_t<typename _Tp::propagate_on_container_swap>::type>
1248 : true_type {};
1249
1250template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
1251struct __propagate_on_container_swap
1252{
1253 typedef false_type type;
1254};
1255
1256template <class _Alloc>
1257struct __propagate_on_container_swap<_Alloc, true>
1258{
1259 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
1260};
1261
1262template <class _Tp, class = void>
1263struct __has_is_always_equal : false_type {};
1264
1265template <class _Tp>
1266struct __has_is_always_equal<_Tp,
1267 typename __void_t<typename _Tp::is_always_equal>::type>
1268 : true_type {};
1269
1270template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
1271struct __is_always_equal
1272{
1273 typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
1274};
1275
1276template <class _Alloc>
1277struct __is_always_equal<_Alloc, true>
1278{
1279 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
1280};
1281
1282template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
1283struct __has_rebind_other
1284{
1285private:
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
1291818public:
1292 static const bool value = sizeof(__test<_Tp>(0)) == 1;
1293};
1294
1295template <class _Tp, class _Up>
1296struct __has_rebind_other<_Tp, _Up, false>
1297{
1298 static const bool value = false;
1299};
1300
1301template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
1302struct __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
1309template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
1310struct __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
1317template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
1318struct __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
1326template <class _Alloc, class _SizeType, class _ConstVoidPtr>
1327auto
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
1332template <class _Alloc, class _SizeType, class _ConstVoidPtr>
1333auto
1334__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
1335 -> false_type;
1336
1337template <class _Alloc, class _SizeType, class _ConstVoidPtr>
1338struct __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
1347template <class _Alloc, class _SizeType, class _ConstVoidPtr>
1348struct __has_allocate_hint
1349 : true_type
1350{
1351};
1352
1353#endif // _LIBCPP_CXX03_LANG
1354
1355_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1356template <class _Alloc, class ..._Args,
1357 class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))>
1358static true_type __test_has_construct(int);
1359_LIBCPP_SUPPRESS_DEPRECATED_POP
1360
1361template <class _Alloc, class...>
1362static false_type __test_has_construct(...);
1363
1364template <class _Alloc, class ..._Args>
1365struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {};
1366
1367#if !defined(_LIBCPP_CXX03_LANG)
1368
1369_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1370template <class _Alloc, class _Pointer>
1371auto
1372__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
1373 -> decltype(__a.destroy(__p), true_type());
1374_LIBCPP_SUPPRESS_DEPRECATED_POP
1375
1376template <class _Alloc, class _Pointer>
1377auto
1378__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
1379 -> false_type;
1380
1381template <class _Alloc, class _Pointer>
1382struct __has_destroy
1383 : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
1384 declval<_Pointer>()))
1385{
1386};
1387
1388_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1389template <class _Alloc>
1390auto
1391__has_max_size_test(_Alloc&& __a)
1392 -> decltype(__a.max_size(), true_type());
1393_LIBCPP_SUPPRESS_DEPRECATED_POP
1394
1395template <class _Alloc>
1396auto
1397__has_max_size_test(const volatile _Alloc& __a)
1398 -> false_type;
1399
1400template <class _Alloc>
1401struct __has_max_size
1402 : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
1403{
1404};
1405
1406template <class _Alloc>
1407auto
1408__has_select_on_container_copy_construction_test(_Alloc&& __a)
1409 -> decltype(__a.select_on_container_copy_construction(), true_type());
1410
1411template <class _Alloc>
1412auto
1413__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
1414 -> false_type;
1415
1416template <class _Alloc>
1417struct __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
1424template <class _Alloc, class _Pointer, class = void>
1425struct __has_destroy : false_type {};
1426
1427template <class _Alloc, class _Pointer>
1428struct __has_destroy<_Alloc, _Pointer, typename __void_t<
1429 decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>()))
1430>::type> : std::true_type {};
1431
1432template <class _Alloc>
1433struct __has_max_size
1434 : true_type
1435{
1436};
1437
1438template <class _Alloc>
1439struct __has_select_on_container_copy_construction
1440 : false_type
1441{
1442};
1443
1444#endif // _LIBCPP_CXX03_LANG
1445
1446template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
1447struct __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;
1451824
1452template <class _Alloc, class _Ptr>
1453struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
1454{
1455 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
1456};
1457
1458template <class _Tp>
1459struct __is_default_allocator : false_type {};
1460
1461template <class _Tp>
1462struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
1463
1464
1465
1466template <class _Alloc,
1467 bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
1468 >
1469struct __is_cpp17_move_insertable;
1470template <class _Alloc>
1471struct __is_cpp17_move_insertable<_Alloc, true> : std::true_type {};
1472template <class _Alloc>
1473struct __is_cpp17_move_insertable<_Alloc, false> : std::is_move_constructible<typename _Alloc::value_type> {};
1474
1475template <class _Alloc,
1476 bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
1477 >
1478struct __is_cpp17_copy_insertable;
1479template <class _Alloc>
1480struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
1481template <class _Alloc>
1482struct __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
1489template <class _Alloc>
1490struct _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 { }
1627827
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 { }
1648831
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)));
1665841 }
842 }
1666843
1667private:
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));
1676850 }
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
1735template <class _Traits, class _Tp>
1736struct __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 }
1746852
1747template <class _Tp>
1748class _LIBCPP_TEMPLATE_VIS allocator
1749{
1750public:
853 // C++20 Removed members
1751854#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;
1754855 _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer;
1755856 _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
1756857 _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference;
1757858 _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
1758859
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
1770860 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 };
1773864
1774#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
1775865 _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 }
1778869 _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 }
1791873
1792#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
1793874 _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 }
1799878
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 }
1803882
1804883 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 }
1812893#endif
1813894};
1814895
......@@ -1816,129 +897,174 @@ template <class _Tp>
1816897class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
1817898{
1818899public:
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;
1834905
1835906 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1836 allocator() _NOEXCEPT {}
907 allocator() _NOEXCEPT { }
1837908
1838909 template <class _Up>
1839910 _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 { }
1847912
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))
1852916 __throw_length_error("allocator<const T>::allocate(size_t n)"
1853917 " '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 }
1855932 }
1856933
934 // C++20 Removed members
1857935#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;
1861940
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 };
1864945
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 }
1868959
1869#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1870960 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 }
1885965
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 }
1931970#endif
1932971};
1933972
1934973template <class _Tp, class _Up>
1935inline _LIBCPP_INLINE_VISIBILITY
974inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1936975bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
1937976
1938977template <class _Tp, class _Up>
1939inline _LIBCPP_INLINE_VISIBILITY
978inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1940979bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
1941980
981template <class _Alloc, class _Ptr>
982_LIBCPP_INLINE_VISIBILITY
983void __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
998template <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
1003void __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
1011template <class _Alloc, class _Iter, class _Ptr>
1012_LIBCPP_INLINE_VISIBILITY
1013void __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
1020template <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
1030void __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
1038template <class _Alloc, class _Ptr>
1039_LIBCPP_INLINE_VISIBILITY
1040void __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
1056template <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
1061void __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
19421068template <class _OutputIterator, class _Tp>
19431069class _LIBCPP_TEMPLATE_VIS raw_storage_iterator
19441070 : public iterator<output_iterator_tag,
......@@ -1953,10 +1079,10 @@ public:
19531079 _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
19541080 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
19551081 _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;}
19571083#if _LIBCPP_STD_VER >= 14
19581084 _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;}
19601086#endif
19611087 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
19621088 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
......@@ -1982,8 +1108,8 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
19821108#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
19831109 if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp)))
19841110 {
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);
19871113 __r.first = static_cast<_Tp*>(::operator new(
19881114 __n * sizeof(_Tp), __al, nothrow));
19891115 } else {
......@@ -2052,7 +1178,7 @@ public:
20521178 _LIBCPP_INLINE_VISIBILITY _Tp* release() _NOEXCEPT
20531179 {
20541180 _Tp* __t = __ptr_;
2055 __ptr_ = 0;
1181 __ptr_ = nullptr;
20561182 return __t;
20571183 }
20581184 _LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) _NOEXCEPT
......@@ -2168,7 +1294,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
21681294 // (The exception is std::function where it is possible that the function
21691295 // object and the allocator have the same type).
21701296 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; "
21721298 "The current implementation is NOT ABI-compatible with the previous "
21731299 "implementation for this configuration");
21741300
......@@ -2185,7 +1311,7 @@ public:
21851311 template <class _U1, class _U2>
21861312 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
21871313 __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)) {}
21891315
21901316#ifndef _LIBCPP_CXX03_LANG
21911317 template <class... _Args1, class... _Args2>
......@@ -2223,7 +1349,7 @@ public:
22231349 _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
22241350 __is_nothrow_swappable<_T2>::value)
22251351 {
2226 using std::swap;
1352 using _VSTD::swap;
22271353 swap(first(), __x.first());
22281354 swap(second(), __x.second());
22291355 }
......@@ -2316,8 +1442,14 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {
23161442 typedef false_type __enable_rval_overload;
23171443};
23181444
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
23191451template <class _Tp, class _Dp = default_delete<_Tp> >
2320class _LIBCPP_TEMPLATE_VIS unique_ptr {
1452class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr {
23211453public:
23221454 typedef _Tp element_type;
23231455 typedef _Dp deleter_type;
......@@ -2525,7 +1657,7 @@ public:
25251657
25261658
25271659template <class _Tp, class _Dp>
2528class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
1660class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
25291661public:
25301662 typedef _Tp element_type;
25311663 typedef _Dp deleter_type;
......@@ -2987,7 +2119,7 @@ public:
29872119 : __size_(__s) {}
29882120
29892121 template <class _Tp>
2990 _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT
2122 _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT
29912123 {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
29922124
29932125 template <class _Tp>
......@@ -3029,7 +2161,7 @@ uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r)
30292161 {
30302162#endif
30312163 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);
30332165#ifndef _LIBCPP_NO_EXCEPTIONS
30342166 }
30352167 catch (...)
......@@ -3053,7 +2185,7 @@ uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r)
30532185 {
30542186#endif
30552187 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);
30572189#ifndef _LIBCPP_NO_EXCEPTIONS
30582190 }
30592191 catch (...)
......@@ -3077,7 +2209,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
30772209 {
30782210#endif
30792211 for (; __f != __l; ++__f)
3080 ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
2212 ::new ((void*)_VSTD::addressof(*__f)) value_type(__x);
30812213#ifndef _LIBCPP_NO_EXCEPTIONS
30822214 }
30832215 catch (...)
......@@ -3100,7 +2232,7 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
31002232 {
31012233#endif
31022234 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);
31042236#ifndef _LIBCPP_NO_EXCEPTIONS
31052237 }
31062238 catch (...)
......@@ -3115,22 +2247,15 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
31152247
31162248#if _LIBCPP_STD_VER > 14
31172249
3118template <class _Tp>
3119inline _LIBCPP_INLINE_VISIBILITY
3120void destroy_at(_Tp* __loc) {
3121 _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
3122 __loc->~_Tp();
3123}
3124
31252250template <class _ForwardIterator>
3126inline _LIBCPP_INLINE_VISIBILITY
2251inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
31272252void destroy(_ForwardIterator __first, _ForwardIterator __last) {
31282253 for (; __first != __last; ++__first)
31292254 _VSTD::destroy_at(_VSTD::addressof(*__first));
31302255}
31312256
31322257template <class _ForwardIterator, class _Size>
3133inline _LIBCPP_INLINE_VISIBILITY
2258inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
31342259_ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) {
31352260 for (; __n > 0; (void)++__first, --__n)
31362261 _VSTD::destroy_at(_VSTD::addressof(*__first));
......@@ -3146,7 +2271,7 @@ void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator
31462271 try {
31472272#endif
31482273 for (; __idx != __last; ++__idx)
3149 ::new((void*)_VSTD::addressof(*__idx)) _Vt;
2274 ::new ((void*)_VSTD::addressof(*__idx)) _Vt;
31502275#ifndef _LIBCPP_NO_EXCEPTIONS
31512276 } catch (...) {
31522277 _VSTD::destroy(__first, __idx);
......@@ -3164,7 +2289,7 @@ _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Si
31642289 try {
31652290#endif
31662291 for (; __n > 0; (void)++__idx, --__n)
3167 ::new((void*)_VSTD::addressof(*__idx)) _Vt;
2292 ::new ((void*)_VSTD::addressof(*__idx)) _Vt;
31682293 return __idx;
31692294#ifndef _LIBCPP_NO_EXCEPTIONS
31702295 } catch (...) {
......@@ -3184,7 +2309,7 @@ void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __
31842309 try {
31852310#endif
31862311 for (; __idx != __last; ++__idx)
3187 ::new((void*)_VSTD::addressof(*__idx)) _Vt();
2312 ::new ((void*)_VSTD::addressof(*__idx)) _Vt();
31882313#ifndef _LIBCPP_NO_EXCEPTIONS
31892314 } catch (...) {
31902315 _VSTD::destroy(__first, __idx);
......@@ -3202,7 +2327,7 @@ _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size
32022327 try {
32032328#endif
32042329 for (; __n > 0; (void)++__idx, --__n)
3205 ::new((void*)_VSTD::addressof(*__idx)) _Vt();
2330 ::new ((void*)_VSTD::addressof(*__idx)) _Vt();
32062331 return __idx;
32072332#ifndef _LIBCPP_NO_EXCEPTIONS
32082333 } catch (...) {
......@@ -3222,7 +2347,7 @@ _ForwardIt uninitialized_move(_InputIt __first, _InputIt __last, _ForwardIt __fi
32222347 try {
32232348#endif
32242349 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));
32262351 return __idx;
32272352#ifndef _LIBCPP_NO_EXCEPTIONS
32282353 } catch (...) {
......@@ -3242,7 +2367,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {
32422367 try {
32432368#endif
32442369 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));
32462371 return {__first, __idx};
32472372#ifndef _LIBCPP_NO_EXCEPTIONS
32482373 } catch (...) {
......@@ -3389,13 +2514,7 @@ public:
33892514 long use_count() const _NOEXCEPT {return __shared_count::use_count();}
33902515 __shared_weak_count* lock() _NOEXCEPT;
33912516
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)
33972517 virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
3398#endif
33992518private:
34002519 virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
34012520};
......@@ -3452,68 +2571,47 @@ __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
34522571}
34532572
34542573template <class _Tp, class _Alloc>
3455class __shared_ptr_emplace
3456 : public __shared_weak_count
2574struct __shared_ptr_emplace
2575 : __shared_weak_count
34572576{
3458 __compressed_pair<_Alloc, _Tp> __data_;
3459public:
2577 _LIBCPP_HIDE_FROM_ABI
2578 explicit __shared_ptr_emplace(_Alloc __a)
2579 : __data_(_VSTD::move(__a), __value_init_tag())
2580 { }
34602581
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
34672582 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 { }
34832592
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()); }
34882595
3489#endif // _LIBCPP_HAS_NO_VARIADICS
2596 _LIBCPP_HIDE_FROM_ABI
2597 _Alloc* __get_alloc() _NOEXCEPT { return _VSTD::addressof(__data_.first()); }
34902598
34912599private:
3492 virtual void __on_zero_shared() _NOEXCEPT;
3493 virtual void __on_zero_shared_weak() _NOEXCEPT;
3494public:
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 }
34982603
3499template <class _Tp, class _Alloc>
3500void
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 }
35052612
3506template <class _Tp, class _Alloc>
3507void
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};
35172615
35182616struct __shared_ptr_dummy_rebind_allocator_type;
35192617template <>
......@@ -3537,8 +2635,14 @@ struct __compatible_with
35372635 : is_convertible<_Tp*, _Up*> {};
35382636#endif // _LIBCPP_STD_VER > 14
35392637
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
35402644template<class _Tp>
3541class _LIBCPP_TEMPLATE_VIS shared_ptr
2645class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
35422646{
35432647public:
35442648#if _LIBCPP_STD_VER > 14
......@@ -3577,25 +2681,17 @@ public:
35772681 shared_ptr(const shared_ptr<_Yp>& __r,
35782682 typename enable_if<__compatible_with<_Yp, element_type>::value, __nat>::type = __nat())
35792683 _NOEXCEPT;
3580#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
35812684 _LIBCPP_INLINE_VISIBILITY
35822685 shared_ptr(shared_ptr&& __r) _NOEXCEPT;
35832686 template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
35842687 typename enable_if<__compatible_with<_Yp, element_type>::value, __nat>::type = __nat())
35852688 _NOEXCEPT;
3586#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
35872689 template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
35882690 typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type= __nat());
35892691#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
3590#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
35912692 template<class _Yp>
35922693 shared_ptr(auto_ptr<_Yp>&& __r,
35932694 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
35992695#endif
36002696 template <class _Yp, class _Dp>
36012697 shared_ptr(unique_ptr<_Yp, _Dp>&&,
......@@ -3628,7 +2724,6 @@ public:
36282724 >::type
36292725 _LIBCPP_INLINE_VISIBILITY
36302726 operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
3631#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
36322727 _LIBCPP_INLINE_VISIBILITY
36332728 shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
36342729 template<class _Yp>
......@@ -3649,19 +2744,6 @@ public:
36492744 shared_ptr
36502745 >::type&
36512746 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
36652747#endif
36662748 template <class _Yp, class _Dp>
36672749 typename enable_if
......@@ -3670,13 +2752,8 @@ public:
36702752 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
36712753 shared_ptr&
36722754 >::type
3673#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
36742755 _LIBCPP_INLINE_VISIBILITY
36752756 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
36802757
36812758 _LIBCPP_INLINE_VISIBILITY
36822759 void swap(shared_ptr& __r) _NOEXCEPT;
......@@ -3724,7 +2801,7 @@ public:
37242801 _LIBCPP_INLINE_VISIBILITY
37252802 bool unique() const _NOEXCEPT {return use_count() == 1;}
37262803 _LIBCPP_INLINE_VISIBILITY
3727 _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
2804 _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != nullptr;}
37282805 template <class _Up>
37292806 _LIBCPP_INLINE_VISIBILITY
37302807 bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
......@@ -3828,8 +2905,8 @@ template<class _Tp>
38282905inline
38292906_LIBCPP_CONSTEXPR
38302907shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
3831 : __ptr_(0),
3832 __cntrl_(0)
2908 : __ptr_(nullptr),
2909 __cntrl_(nullptr)
38332910{
38342911}
38352912
......@@ -3837,8 +2914,8 @@ template<class _Tp>
38372914inline
38382915_LIBCPP_CONSTEXPR
38392916shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
3840 : __ptr_(0),
3841 __cntrl_(0)
2917 : __ptr_(nullptr),
2918 __cntrl_(nullptr)
38422919{
38432920}
38442921
......@@ -3883,7 +2960,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
38832960template<class _Tp>
38842961template<class _Dp>
38852962shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
3886 : __ptr_(0)
2963 : __ptr_(nullptr)
38872964{
38882965#ifndef _LIBCPP_NO_EXCEPTIONS
38892966 try
......@@ -3917,8 +2994,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
39172994 typedef __allocator_destructor<_A2> _D2;
39182995 _A2 __a2(__a);
39192996 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);
39222998 __cntrl_ = _VSTD::addressof(*__hold2.release());
39232999 __enable_weak_this(__p, __p);
39243000#ifndef _LIBCPP_NO_EXCEPTIONS
......@@ -3934,7 +3010,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
39343010template<class _Tp>
39353011template<class _Dp, class _Alloc>
39363012shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
3937 : __ptr_(0)
3013 : __ptr_(nullptr)
39383014{
39393015#ifndef _LIBCPP_NO_EXCEPTIONS
39403016 try
......@@ -3945,8 +3021,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
39453021 typedef __allocator_destructor<_A2> _D2;
39463022 _A2 __a2(__a);
39473023 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);
39503025 __cntrl_ = _VSTD::addressof(*__hold2.release());
39513026#ifndef _LIBCPP_NO_EXCEPTIONS
39523027 }
......@@ -3992,16 +3067,14 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
39923067 __cntrl_->__add_shared();
39933068}
39943069
3995#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3996
39973070template<class _Tp>
39983071inline
39993072shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
40003073 : __ptr_(__r.__ptr_),
40013074 __cntrl_(__r.__cntrl_)
40023075{
4003 __r.__ptr_ = 0;
4004 __r.__cntrl_ = 0;
3076 __r.__ptr_ = nullptr;
3077 __r.__cntrl_ = nullptr;
40053078}
40063079
40073080template<class _Tp>
......@@ -4013,20 +3086,14 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
40133086 : __ptr_(__r.__ptr_),
40143087 __cntrl_(__r.__cntrl_)
40153088{
4016 __r.__ptr_ = 0;
4017 __r.__cntrl_ = 0;
3089 __r.__ptr_ = nullptr;
3090 __r.__cntrl_ = nullptr;
40183091}
40193092
4020#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
4021
40223093#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
40233094template<class _Tp>
40243095template<class _Yp>
4025#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
40263096shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r,
4027#else
4028shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,
4029#endif
40303097 typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
40313098 : __ptr_(__r.get())
40323099{
......@@ -4121,8 +3188,6 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
41213188 return *this;
41223189}
41233190
4124#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4125
41263191template<class _Tp>
41273192inline
41283193shared_ptr<_Tp>&
......@@ -4179,43 +3244,6 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r)
41793244 return *this;
41803245}
41813246
4182#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
4183
4184#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
4185template<class _Tp>
4186template<class _Yp>
4187inline _LIBCPP_INLINE_VISIBILITY
4188typename 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
4194shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r)
4195{
4196 shared_ptr(__r).swap(*this);
4197 return *this;
4198}
4199#endif
4200
4201template<class _Tp>
4202template <class _Yp, class _Dp>
4203inline _LIBCPP_INLINE_VISIBILITY
4204typename 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
4211shared_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
42193247template<class _Tp>
42203248inline
42213249void
......@@ -4272,50 +3300,26 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
42723300 shared_ptr(__p, __d, __a).swap(*this);
42733301}
42743302
4275template<class _Tp, class ..._Args>
4276inline _LIBCPP_INLINE_VISIBILITY
4277typename enable_if
4278<
4279 !is_array<_Tp>::value,
4280 shared_ptr<_Tp>
4281>::type
4282make_shared(_Args&& ...__args)
3303//
3304// std::allocate_shared and std::make_shared
3305//
3306template<class _Tp, class _Alloc, class ..._Args, class = _EnableIf<!is_array<_Tp>::value> >
3307_LIBCPP_HIDE_FROM_ABI
3308shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args)
42833309{
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));
42953316}
42963317
4297template<class _Tp, class _Alloc, class ..._Args>
4298inline _LIBCPP_INLINE_VISIBILITY
4299typename enable_if
4300<
4301 !is_array<_Tp>::value,
4302 shared_ptr<_Tp>
4303>::type
4304allocate_shared(const _Alloc& __a, _Args&& ...__args)
3318template<class _Tp, class ..._Args, class = _EnableIf<!is_array<_Tp>::value> >
3319_LIBCPP_HIDE_FROM_ABI
3320shared_ptr<_Tp> make_shared(_Args&& ...__args)
43053321{
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)...);
43193323}
43203324
43213325template<class _Tp, class _Up>
......@@ -4526,7 +3530,7 @@ get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
45263530#endif // _LIBCPP_NO_RTTI
45273531
45283532template<class _Tp>
4529class _LIBCPP_TEMPLATE_VIS weak_ptr
3533class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr
45303534{
45313535public:
45323536 typedef _Tp element_type;
......@@ -4546,13 +3550,11 @@ public:
45463550 typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
45473551 _NOEXCEPT;
45483552
4549#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
45503553 _LIBCPP_INLINE_VISIBILITY
45513554 weak_ptr(weak_ptr&& __r) _NOEXCEPT;
45523555 template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
45533556 typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
45543557 _NOEXCEPT;
4555#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
45563558 ~weak_ptr();
45573559
45583560 _LIBCPP_INLINE_VISIBILITY
......@@ -4566,8 +3568,6 @@ public:
45663568 _LIBCPP_INLINE_VISIBILITY
45673569 operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
45683570
4569#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4570
45713571 _LIBCPP_INLINE_VISIBILITY
45723572 weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
45733573 template<class _Yp>
......@@ -4579,8 +3579,6 @@ public:
45793579 _LIBCPP_INLINE_VISIBILITY
45803580 operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
45813581
4582#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
4583
45843582 template<class _Yp>
45853583 typename enable_if
45863584 <
......@@ -4600,7 +3598,7 @@ public:
46003598 {return __cntrl_ ? __cntrl_->use_count() : 0;}
46013599 _LIBCPP_INLINE_VISIBILITY
46023600 bool expired() const _NOEXCEPT
4603 {return __cntrl_ == 0 || __cntrl_->use_count() == 0;}
3601 {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;}
46043602 shared_ptr<_Tp> lock() const _NOEXCEPT;
46053603 template<class _Up>
46063604 _LIBCPP_INLINE_VISIBILITY
......@@ -4624,8 +3622,8 @@ template<class _Tp>
46243622inline
46253623_LIBCPP_CONSTEXPR
46263624weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
4627 : __ptr_(0),
4628 __cntrl_(0)
3625 : __ptr_(nullptr),
3626 __cntrl_(nullptr)
46293627{
46303628}
46313629
......@@ -4665,16 +3663,14 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
46653663 __cntrl_->__add_weak();
46663664}
46673665
4668#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4669
46703666template<class _Tp>
46713667inline
46723668weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
46733669 : __ptr_(__r.__ptr_),
46743670 __cntrl_(__r.__cntrl_)
46753671{
4676 __r.__ptr_ = 0;
4677 __r.__cntrl_ = 0;
3672 __r.__ptr_ = nullptr;
3673 __r.__cntrl_ = nullptr;
46783674}
46793675
46803676template<class _Tp>
......@@ -4686,12 +3682,10 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
46863682 : __ptr_(__r.__ptr_),
46873683 __cntrl_(__r.__cntrl_)
46883684{
4689 __r.__ptr_ = 0;
4690 __r.__cntrl_ = 0;
3685 __r.__ptr_ = nullptr;
3686 __r.__cntrl_ = nullptr;
46913687}
46923688
4693#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
4694
46953689template<class _Tp>
46963690weak_ptr<_Tp>::~weak_ptr()
46973691{
......@@ -4722,8 +3716,6 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
47223716 return *this;
47233717}
47243718
4725#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4726
47273719template<class _Tp>
47283720inline
47293721weak_ptr<_Tp>&
......@@ -4747,8 +3739,6 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
47473739 return *this;
47483740}
47493741
4750#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
4751
47523742template<class _Tp>
47533743template<class _Yp>
47543744inline
......@@ -4795,7 +3785,7 @@ shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r,
47953785 : __ptr_(__r.__ptr_),
47963786 __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_)
47973787{
4798 if (__cntrl_ == 0)
3788 if (__cntrl_ == nullptr)
47993789 __throw_bad_weak_ptr();
48003790}
48013791
......@@ -5130,35 +4120,35 @@ _LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t&
51304120
51314121// --- Helper for container swap --
51324122template <typename _Alloc>
5133inline _LIBCPP_INLINE_VISIBILITY
5134void __swap_allocator(_Alloc & __a1, _Alloc & __a2)
4123_LIBCPP_INLINE_VISIBILITY
4124void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type)
51354125#if _LIBCPP_STD_VER >= 14
51364126 _NOEXCEPT
51374127#else
51384128 _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
51394129#endif
51404130{
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);
51434133}
51444134
51454135template <typename _Alloc>
5146_LIBCPP_INLINE_VISIBILITY
5147void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type)
4136inline _LIBCPP_INLINE_VISIBILITY
4137void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
4138
4139template <typename _Alloc>
4140inline _LIBCPP_INLINE_VISIBILITY
4141void __swap_allocator(_Alloc & __a1, _Alloc & __a2)
51484142#if _LIBCPP_STD_VER >= 14
51494143 _NOEXCEPT
51504144#else
51514145 _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
51524146#endif
51534147{
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>());
51564150}
51574151
5158template <typename _Alloc>
5159inline _LIBCPP_INLINE_VISIBILITY
5160void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
5161
51624152template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
51634153struct __noexcept_move_assign_container : public integral_constant<bool,
51644154 _Traits::propagate_on_container_move_assignment::value
......@@ -5170,7 +4160,6 @@ struct __noexcept_move_assign_container : public integral_constant<bool,
51704160 > {};
51714161
51724162
5173#ifndef _LIBCPP_HAS_NO_VARIADICS
51744163template <class _Tp, class _Alloc>
51754164struct __temp_value {
51764165 typedef allocator_traits<_Alloc> _Traits;
......@@ -5190,7 +4179,6 @@ struct __temp_value {
51904179
51914180 ~__temp_value() { _Traits::destroy(__a, __addr()); }
51924181 };
5193#endif
51944182
51954183template<typename _Alloc, typename = void, typename = void>
51964184struct __is_allocator : false_type {};
......@@ -5214,7 +4202,7 @@ struct __builtin_new_allocator {
52144202 : __size_(__size), __align_(__align) {}
52154203
52164204 void operator()(void* p) const _NOEXCEPT {
5217 std::__libcpp_deallocate(p, __size_, __align_);
4205 _VSTD::__libcpp_deallocate(p, __size_, __align_);
52184206 }
52194207
52204208 private:
......@@ -5225,13 +4213,13 @@ struct __builtin_new_allocator {
52254213 typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
52264214
52274215 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),
52294217 __builtin_new_deleter(__s, __align));
52304218 }
52314219
52324220 static void __deallocate_bytes(void* __p, size_t __s,
52334221 size_t __align) _NOEXCEPT {
5234 std::__libcpp_deallocate(__p, __s, __align);
4222 _VSTD::__libcpp_deallocate(__p, __s, __align);
52354223 }
52364224
52374225 template <class _Tp>
lib/libcxx/include/new+70-83
......@@ -87,13 +87,12 @@ void operator delete[](void* ptr, void*) noexcept;
8787*/
8888
8989#include <__config>
90#include <__availability>
91#include <cstddef>
92#include <cstdlib>
9093#include <exception>
9194#include <type_traits>
92#include <cstddef>
9395#include <version>
94#ifdef _LIBCPP_NO_EXCEPTIONS
95#include <cstdlib>
96#endif
9796
9897#if defined(_LIBCPP_ABI_VCRUNTIME)
9998#include <new.h>
......@@ -117,11 +116,6 @@ void operator delete[](void* ptr, void*) noexcept;
117116# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
118117#endif
119118
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
125119namespace std // purposefully not using versioning namespace
126120{
127121
......@@ -234,31 +228,54 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new
234228#endif
235229}
236230
237inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) {
231template <class ..._Args>
232_LIBCPP_INLINE_VISIBILITY
233void* __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
241template <class ..._Args>
242_LIBCPP_INLINE_VISIBILITY
243void __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
251inline _LIBCPP_INLINE_VISIBILITY
252void *__libcpp_allocate(size_t __size, size_t __align) {
238253#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
239254 if (__is_overaligned_for_new(__align)) {
240255 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);
246257 }
247#else
248 ((void)__align);
249258#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
264template <class ..._Args>
265_LIBCPP_INLINE_VISIBILITY
266void __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...);
252270#else
253 return __builtin_operator_new(__size);
271 return __libcpp_operator_delete(__ptr, __size, __args...);
254272#endif
255273}
256274
257struct _DeallocateCaller {
258 static inline _LIBCPP_INLINE_VISIBILITY
259 void __do_deallocate_handle_size_align(void *__ptr, size_t __size, size_t __align) {
275inline _LIBCPP_INLINE_VISIBILITY
276void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
260277#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
261 ((void)__align);
278 (void)__align;
262279 return __do_deallocate_handle_size(__ptr, __size);
263280#else
264281 if (__is_overaligned_for_new(__align)) {
......@@ -268,81 +285,51 @@ struct _DeallocateCaller {
268285 return __do_deallocate_handle_size(__ptr, __size);
269286 }
270287#endif
271 }
288}
272289
273 static inline _LIBCPP_INLINE_VISIBILITY
274 void __do_deallocate_handle_align(void *__ptr, size_t __align) {
290inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
275291#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
276 ((void)__align);
277 return __do_call(__ptr);
292 (void)__align;
293 return __libcpp_operator_delete(__ptr);
278294#else
279295 if (__is_overaligned_for_new(__align)) {
280296 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);
282298 } else {
283 return __do_call(__ptr);
299 return __libcpp_operator_delete(__ptr);
284300 }
285301#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
309private:
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}
319303
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.
311inline _LIBCPP_INLINE_VISIBILITY
312void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
313#if defined(_LIBCPP_MSVCRT_LIKE)
314 return ::_aligned_malloc(__size, __alignment);
325315#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;
327320#endif
328 }
321}
329322
330 static inline void __do_call(void *__ptr) {
331#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
332 return ::operator delete(__ptr);
323inline _LIBCPP_INLINE_VISIBILITY
324void __libcpp_aligned_free(void* __ptr) {
325#if defined(_LIBCPP_MSVCRT_LIKE)
326 ::_aligned_free(__ptr);
333327#else
334 return __builtin_operator_delete(__ptr);
328 ::free(__ptr);
335329#endif
336 }
337};
338
339inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
340 _DeallocateCaller::__do_deallocate_handle_size_align(__ptr, __size, __align);
341330}
331#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION
342332
343inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
344 _DeallocateCaller::__do_deallocate_handle_align(__ptr, __align);
345}
346333
347334template <class _Tp>
348335_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>{};
100100template <class T> inline constexpr T phi_v = __illformed<T>{};
101101
102102template <class T>
103concept __floating_point = std::is_floating_point_v<T>;
103concept __floating_point = is_floating_point_v<T>;
104104
105105template <__floating_point T> inline constexpr T e_v<T> = 2.718281828459045235360287471352662;
106106template <__floating_point T> inline constexpr T log2e_v<T> = 1.442695040888963407359924681001892;
lib/libcxx/include/numeric+118-73
......@@ -17,115 +17,116 @@ namespace std
1717{
1818
1919template <class InputIterator, class T>
20 T
20 constexpr T // constexpr since C++20
2121 accumulate(InputIterator first, InputIterator last, T init);
2222
2323template <class InputIterator, class T, class BinaryOperation>
24 T
24 constexpr T // constexpr since C++20
2525 accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
2626
2727template<class InputIterator>
28 typename iterator_traits<InputIterator>::value_type
28 constexpr typename iterator_traits<InputIterator>::value_type // constexpr since C++20
2929 reduce(InputIterator first, InputIterator last); // C++17
3030
3131template<class InputIterator, class T>
32 T
32 constexpr T // constexpr since C++20
3333 reduce(InputIterator first, InputIterator last, T init); // C++17
3434
3535template<class InputIterator, class T, class BinaryOperation>
36 T
36 constexpr T // constexpr since C++20
3737 reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17
3838
3939template <class InputIterator1, class InputIterator2, class T>
40 T
40 constexpr T // constexpr since C++20
4141 inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init);
4242
4343template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
44 T
44 constexpr T // constexpr since C++20
4545 inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
4646 T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
4747
4848
4949template<class InputIterator1, class InputIterator2, class T>
50 T
50 constexpr T // constexpr since C++20
5151 transform_reduce(InputIterator1 first1, InputIterator1 last1,
5252 InputIterator2 first2, T init); // C++17
5353
5454template<class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
55 T
55 constexpr T // constexpr since C++20
5656 transform_reduce(InputIterator1 first1, InputIterator1 last1,
5757 InputIterator2 first2, T init,
5858 BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17
5959
6060template<class InputIterator, class T, class BinaryOperation, class UnaryOperation>
61 T
61 constexpr T // constexpr since C++20
6262 transform_reduce(InputIterator first, InputIterator last, T init,
6363 BinaryOperation binary_op, UnaryOperation unary_op); // C++17
6464
6565template <class InputIterator, class OutputIterator>
66 OutputIterator
66 constexpr OutputIterator // constexpr since C++20
6767 partial_sum(InputIterator first, InputIterator last, OutputIterator result);
6868
6969template <class InputIterator, class OutputIterator, class BinaryOperation>
70 OutputIterator
70 constexpr OutputIterator // constexpr since C++20
7171 partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
7272
7373template<class InputIterator, class OutputIterator, class T>
74 OutputIterator
74 constexpr OutputIterator // constexpr since C++20
7575 exclusive_scan(InputIterator first, InputIterator last,
7676 OutputIterator result, T init); // C++17
7777
7878template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
79 OutputIterator
79 constexpr OutputIterator // constexpr since C++20
8080 exclusive_scan(InputIterator first, InputIterator last,
8181 OutputIterator result, T init, BinaryOperation binary_op); // C++17
8282
8383template<class InputIterator, class OutputIterator>
84 OutputIterator
84 constexpr OutputIterator // constexpr since C++20
8585 inclusive_scan(InputIterator first, InputIterator last, OutputIterator result); // C++17
8686
8787template<class InputIterator, class OutputIterator, class BinaryOperation>
88 OutputIterator
88 constexpr OutputIterator // constexpr since C++20
8989 inclusive_scan(InputIterator first, InputIterator last,
9090 OutputIterator result, BinaryOperation binary_op); // C++17
9191
9292template<class InputIterator, class OutputIterator, class BinaryOperation, class T>
93 OutputIterator
93 constexpr OutputIterator // constexpr since C++20
9494 inclusive_scan(InputIterator first, InputIterator last,
9595 OutputIterator result, BinaryOperation binary_op, T init); // C++17
9696
9797template<class InputIterator, class OutputIterator, class T,
9898 class BinaryOperation, class UnaryOperation>
99 OutputIterator
99 constexpr OutputIterator // constexpr since C++20
100100 transform_exclusive_scan(InputIterator first, InputIterator last,
101101 OutputIterator result, T init,
102102 BinaryOperation binary_op, UnaryOperation unary_op); // C++17
103103
104104template<class InputIterator, class OutputIterator,
105105 class BinaryOperation, class UnaryOperation>
106 OutputIterator
106 constexpr OutputIterator // constexpr since C++20
107107 transform_inclusive_scan(InputIterator first, InputIterator last,
108108 OutputIterator result,
109109 BinaryOperation binary_op, UnaryOperation unary_op); // C++17
110110
111111template<class InputIterator, class OutputIterator,
112112 class BinaryOperation, class UnaryOperation, class T>
113 OutputIterator
113 constexpr OutputIterator // constexpr since C++20
114114 transform_inclusive_scan(InputIterator first, InputIterator last,
115115 OutputIterator result,
116116 BinaryOperation binary_op, UnaryOperation unary_op,
117117 T init); // C++17
118118
119119template <class InputIterator, class OutputIterator>
120 OutputIterator
120 constexpr OutputIterator // constexpr since C++20
121121 adjacent_difference(InputIterator first, InputIterator last, OutputIterator result);
122122
123123template <class InputIterator, class OutputIterator, class BinaryOperation>
124 OutputIterator
124 constexpr OutputIterator // constexpr since C++20
125125 adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
126126
127127template <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);
129130
130131template <class M, class N>
131132 constexpr common_type_t<M,N> gcd(M m, N n); // C++17
......@@ -133,9 +134,11 @@ template <class M, class N>
133134template <class M, class N>
134135 constexpr common_type_t<M,N> lcm(M m, N n); // C++17
135136
136integer midpoint(integer a, integer b); // C++20
137pointer midpoint(pointer a, pointer b); // C++20
138floating_point midpoint(floating_point a, floating_point b); // C++20
137template<class T>
138 constexpr T midpoint(T a, T b) noexcept; // C++20
139
140template<class T>
141 constexpr T* midpoint(T* a, T* b); // C++20
139142
140143} // std
141144
......@@ -158,28 +161,36 @@ _LIBCPP_PUSH_MACROS
158161_LIBCPP_BEGIN_NAMESPACE_STD
159162
160163template <class _InputIterator, class _Tp>
161inline _LIBCPP_INLINE_VISIBILITY
164_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
162165_Tp
163166accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
164167{
165168 for (; __first != __last; ++__first)
169#if _LIBCPP_STD_VER > 17
170 __init = _VSTD::move(__init) + *__first;
171#else
166172 __init = __init + *__first;
173#endif
167174 return __init;
168175}
169176
170177template <class _InputIterator, class _Tp, class _BinaryOperation>
171inline _LIBCPP_INLINE_VISIBILITY
178_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
172179_Tp
173180accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
174181{
175182 for (; __first != __last; ++__first)
183#if _LIBCPP_STD_VER > 17
184 __init = __binary_op(_VSTD::move(__init), *__first);
185#else
176186 __init = __binary_op(__init, *__first);
187#endif
177188 return __init;
178189}
179190
180191#if _LIBCPP_STD_VER > 14
181192template <class _InputIterator, class _Tp, class _BinaryOp>
182inline _LIBCPP_INLINE_VISIBILITY
193_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
183194_Tp
184195reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b)
185196{
......@@ -189,7 +200,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b)
189200}
190201
191202template <class _InputIterator, class _Tp>
192inline _LIBCPP_INLINE_VISIBILITY
203_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
193204_Tp
194205reduce(_InputIterator __first, _InputIterator __last, _Tp __init)
195206{
......@@ -197,7 +208,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init)
197208}
198209
199210template <class _InputIterator>
200inline _LIBCPP_INLINE_VISIBILITY
211_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
201212typename iterator_traits<_InputIterator>::value_type
202213reduce(_InputIterator __first, _InputIterator __last)
203214{
......@@ -207,29 +218,37 @@ reduce(_InputIterator __first, _InputIterator __last)
207218#endif
208219
209220template <class _InputIterator1, class _InputIterator2, class _Tp>
210inline _LIBCPP_INLINE_VISIBILITY
221_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
211222_Tp
212223inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
213224{
214225 for (; __first1 != __last1; ++__first1, (void) ++__first2)
226#if _LIBCPP_STD_VER > 17
227 __init = _VSTD::move(__init) + *__first1 * *__first2;
228#else
215229 __init = __init + *__first1 * *__first2;
230#endif
216231 return __init;
217232}
218233
219234template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
220inline _LIBCPP_INLINE_VISIBILITY
235_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
221236_Tp
222237inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
223238 _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
224239{
225240 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
226244 __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
245#endif
227246 return __init;
228247}
229248
230249#if _LIBCPP_STD_VER > 14
231250template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
232inline _LIBCPP_INLINE_VISIBILITY
251_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
233252_Tp
234253transform_reduce(_InputIterator __first, _InputIterator __last,
235254 _Tp __init, _BinaryOp __b, _UnaryOp __u)
......@@ -241,7 +260,7 @@ transform_reduce(_InputIterator __first, _InputIterator __last,
241260
242261template <class _InputIterator1, class _InputIterator2,
243262 class _Tp, class _BinaryOp1, class _BinaryOp2>
244inline _LIBCPP_INLINE_VISIBILITY
263_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
245264_Tp
246265transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
247266 _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2)
......@@ -252,7 +271,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
252271}
253272
254273template <class _InputIterator1, class _InputIterator2, class _Tp>
255inline _LIBCPP_INLINE_VISIBILITY
274_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
256275_Tp
257276transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
258277 _InputIterator2 __first2, _Tp __init)
......@@ -263,7 +282,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
263282#endif
264283
265284template <class _InputIterator, class _OutputIterator>
266inline _LIBCPP_INLINE_VISIBILITY
285_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
267286_OutputIterator
268287partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
269288{
......@@ -273,7 +292,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
273292 *__result = __t;
274293 for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
275294 {
295#if _LIBCPP_STD_VER > 17
296 __t = _VSTD::move(__t) + *__first;
297#else
276298 __t = __t + *__first;
299#endif
277300 *__result = __t;
278301 }
279302 }
......@@ -281,7 +304,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
281304}
282305
283306template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
284inline _LIBCPP_INLINE_VISIBILITY
307_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
285308_OutputIterator
286309partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
287310 _BinaryOperation __binary_op)
......@@ -292,7 +315,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
292315 *__result = __t;
293316 for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
294317 {
318#if _LIBCPP_STD_VER > 17
319 __t = __binary_op(_VSTD::move(__t), *__first);
320#else
295321 __t = __binary_op(__t, *__first);
322#endif
296323 *__result = __t;
297324 }
298325 }
......@@ -301,27 +328,30 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
301328
302329#if _LIBCPP_STD_VER > 14
303330template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
304inline _LIBCPP_INLINE_VISIBILITY
331_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
305332_OutputIterator
306333exclusive_scan(_InputIterator __first, _InputIterator __last,
307334 _OutputIterator __result, _Tp __init, _BinaryOp __b)
308335{
309336 if (__first != __last)
310337 {
311 _Tp __saved = __init;
312 do
338 _Tp __tmp(__b(__init, *__first));
339 while (true)
313340 {
314 __init = __b(__init, *__first);
315 *__result = __saved;
316 __saved = __init;
341 *__result = _VSTD::move(__init);
317342 ++__result;
318 } while (++__first != __last);
343 ++__first;
344 if (__first == __last)
345 break;
346 __init = _VSTD::move(__tmp);
347 __tmp = __b(__init, *__first);
348 }
319349 }
320350 return __result;
321351}
322352
323353template <class _InputIterator, class _OutputIterator, class _Tp>
324inline _LIBCPP_INLINE_VISIBILITY
354_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
325355_OutputIterator
326356exclusive_scan(_InputIterator __first, _InputIterator __last,
327357 _OutputIterator __result, _Tp __init)
......@@ -330,40 +360,43 @@ exclusive_scan(_InputIterator __first, _InputIterator __last,
330360}
331361
332362template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
363_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
333364_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
334365 _OutputIterator __result, _BinaryOp __b, _Tp __init)
335366{
336367 for (; __first != __last; ++__first, (void) ++__result) {
337368 __init = __b(__init, *__first);
338369 *__result = __init;
339 }
370 }
340371 return __result;
341372}
342373
343374template <class _InputIterator, class _OutputIterator, class _BinaryOp>
375_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
344376_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
345377 _OutputIterator __result, _BinaryOp __b)
346378{
347379 if (__first != __last) {
348 typename std::iterator_traits<_InputIterator>::value_type __init = *__first;
380 typename iterator_traits<_InputIterator>::value_type __init = *__first;
349381 *__result++ = __init;
350382 if (++__first != __last)
351383 return _VSTD::inclusive_scan(__first, __last, __result, __b, __init);
352 }
384 }
353385
354386 return __result;
355387}
356388
357389template <class _InputIterator, class _OutputIterator>
390_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
358391_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
359392 _OutputIterator __result)
360393{
361 return _VSTD::inclusive_scan(__first, __last, __result, std::plus<>());
394 return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>());
362395}
363396
364397template <class _InputIterator, class _OutputIterator, class _Tp,
365398 class _BinaryOp, class _UnaryOp>
366inline _LIBCPP_INLINE_VISIBILITY
399_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
367400_OutputIterator
368401transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
369402 _OutputIterator __result, _Tp __init,
......@@ -384,7 +417,9 @@ transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
384417}
385418
386419template <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
422transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
388423 _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init)
389424{
390425 for (; __first != __last; ++__first, (void) ++__result) {
......@@ -396,61 +431,71 @@ _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator
396431}
397432
398433template <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
436transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
400437 _OutputIterator __result, _BinaryOp __b, _UnaryOp __u)
401438{
402439 if (__first != __last) {
403 typename std::iterator_traits<_InputIterator>::value_type __init = __u(*__first);
440 typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
404441 *__result++ = __init;
405442 if (++__first != __last)
406443 return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
407 }
444 }
408445
409446 return __result;
410447}
411448#endif
412449
413450template <class _InputIterator, class _OutputIterator>
414inline _LIBCPP_INLINE_VISIBILITY
451_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
415452_OutputIterator
416453adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
417454{
418455 if (__first != __last)
419456 {
420 typename iterator_traits<_InputIterator>::value_type __t1(*__first);
421 *__result = __t1;
457 typename iterator_traits<_InputIterator>::value_type __acc(*__first);
458 *__result = __acc;
422459 for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
423460 {
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);
427468 }
428469 }
429470 return __result;
430471}
431472
432473template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
433inline _LIBCPP_INLINE_VISIBILITY
474_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
434475_OutputIterator
435476adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
436477 _BinaryOperation __binary_op)
437478{
438479 if (__first != __last)
439480 {
440 typename iterator_traits<_InputIterator>::value_type __t1(*__first);
441 *__result = __t1;
481 typename iterator_traits<_InputIterator>::value_type __acc(*__first);
482 *__result = __acc;
442483 for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
443484 {
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);
447492 }
448493 }
449494 return __result;
450495}
451496
452497template <class _ForwardIterator, class _Tp>
453inline _LIBCPP_INLINE_VISIBILITY
498_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
454499void
455500iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
456501{
......@@ -467,9 +512,9 @@ struct __ct_abs<_Result, _Source, true> {
467512 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
468513 _Result operator()(_Source __t) const noexcept
469514 {
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;
473518 }
474519};
475520
......@@ -531,8 +576,8 @@ enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_T
531576midpoint(_Tp __a, _Tp __b) noexcept
532577_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
533578{
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;
536581
537582 _Up __diff = _Up(__b) - _Up(__a);
538583 _Up __sign_bit = __b < __a;
lib/libcxx/include/optional+3-2
......@@ -147,6 +147,7 @@ template<class T>
147147*/
148148
149149#include <__config>
150#include <__availability>
150151#include <__debug>
151152#include <__functional_base>
152153#include <functional>
......@@ -320,7 +321,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp>
320321 void __construct(_Args&&... __args)
321322 {
322323 _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)...);
324325 this->__engaged_ = true;
325326 }
326327
......@@ -656,7 +657,7 @@ private:
656657 }
657658 template <class _Up, class _QUp = _QualUp>
658659 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
660661 // checked.
661662 return !__check_constructible_from_opt<_Up>::value &&
662663 !__check_assignable_from_opt<_Up>::value;
lib/libcxx/include/ostream+15-13
......@@ -126,9 +126,8 @@ template <class charT, class traits>
126126 basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
127127
128128// rvalue stream insertion
129template <class charT, class traits, class T>
130 basic_ostream<charT, traits>&
131 operator<<(basic_ostream<charT, traits>&& os, const T& x);
129template <class Stream, class T>
130 Stream&& operator<<(Stream&& os, const T& x);
132131
133132} // std
134133
......@@ -1028,15 +1027,20 @@ flush(basic_ostream<_CharT, _Traits>& __os)
10281027
10291028#ifndef _LIBCPP_CXX03_LANG
10301029
1030template <class _Stream, class _Tp, class = void>
1031struct __is_ostreamable : false_type { };
1032
10311033template <class _Stream, class _Tp>
1032inline _LIBCPP_INLINE_VISIBILITY
1033typename enable_if
1034<
1035 !is_lvalue_reference<_Stream>::value &&
1036 is_base_of<ios_base, _Stream>::value,
1037 _Stream&&
1038>::type
1039operator<<(_Stream&& __os, const _Tp& __x)
1034struct __is_ostreamable<_Stream, _Tp, decltype(
1035 _VSTD::declval<_Stream>() << _VSTD::declval<_Tp>(), void()
1036)> : true_type { };
1037
1038template <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)
10401044{
10411045 __os << __x;
10421046 return _VSTD::move(__os);
......@@ -1097,10 +1101,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
10971101 use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
10981102}
10991103
1100#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
11011104_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>)
11021105_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>)
1103#endif
11041106
11051107_LIBCPP_END_NAMESPACE_STD
11061108
lib/libcxx/include/random+145-77
......@@ -1642,8 +1642,7 @@ class piecewise_linear_distribution
16421642#include <numeric>
16431643#include <vector>
16441644#include <string>
1645#include <istream>
1646#include <ostream>
1645#include <iosfwd>
16471646
16481647#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16491648#pragma GCC system_header
......@@ -1669,7 +1668,23 @@ struct __is_seed_sequence
16691668
16701669template <unsigned long long __a, unsigned long long __c,
16711670 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
1674struct __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
1685template <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>
16731688struct __lce_ta;
16741689
16751690// 64
......@@ -1843,6 +1858,7 @@ private:
18431858
18441859 static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
18451860 static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
1861 static_assert(_VSTD::is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
18461862public:
18471863 static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u;
18481864 static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u;
......@@ -1982,7 +1998,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
19821998 const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
19831999{
19842000 __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);
19862003 __os.fill(__os.widen(' '));
19872004 return __os << __x.__x_;
19882005}
......@@ -1994,7 +2011,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
19942011 linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
19952012{
19962013 __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);
19982016 _UIntType __t;
19992017 __is >> __t;
20002018 if (!__is.fail())
......@@ -2453,7 +2471,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
24532471 _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
24542472{
24552473 __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);
24572476 _CharT __sp = __os.widen(' ');
24582477 __os.fill(__sp);
24592478 __os << __x.__x_[__x.__i_];
......@@ -2474,7 +2493,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
24742493 _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
24752494{
24762495 __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);
24782498 _UInt __t[_Np];
24792499 for (size_t __i = 0; __i < _Np; ++__i)
24802500 __is >> __t[__i];
......@@ -2773,7 +2793,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
27732793 const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
27742794{
27752795 __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);
27772798 _CharT __sp = __os.widen(' ');
27782799 __os.fill(__sp);
27792800 __os << __x.__x_[__x.__i_];
......@@ -2792,7 +2813,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
27922813 subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
27932814{
27942815 __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);
27962818 _UInt __t[_Rp+1];
27972819 for (size_t __i = 0; __i < _Rp+1; ++__i)
27982820 __is >> __t[__i];
......@@ -2955,7 +2977,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
29552977 const discard_block_engine<_Eng, _Pp, _Rp>& __x)
29562978{
29572979 __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);
29592982 _CharT __sp = __os.widen(' ');
29602983 __os.fill(__sp);
29612984 return __os << __x.__e_ << __sp << __x.__n_;
......@@ -2968,7 +2991,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
29682991 discard_block_engine<_Eng, _Pp, _Rp>& __x)
29692992{
29702993 __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);
29722996 _Eng __e;
29732997 int __n;
29742998 __is >> __e >> __n;
......@@ -3440,7 +3464,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
34403464 const shuffle_order_engine<_Eng, _Kp>& __x)
34413465{
34423466 __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);
34443469 _CharT __sp = __os.widen(' ');
34453470 __os.fill(__sp);
34463471 __os << __x.__e_ << __sp << __x._V_[0];
......@@ -3457,7 +3482,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
34573482{
34583483 typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
34593484 __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);
34613487 _Eng __e;
34623488 result_type _Vp[_Kp+1];
34633489 __is >> __e;
......@@ -3477,6 +3503,8 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
34773503
34783504// random_device
34793505
3506#if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
3507
34803508class _LIBCPP_TYPE_VIS random_device
34813509{
34823510#ifdef _LIBCPP_USING_DEV_RANDOM
......@@ -3511,6 +3539,8 @@ private:
35113539 random_device& operator=(const random_device&); // = delete;
35123540};
35133541
3542#endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE
3543
35143544// seed_seq
35153545
35163546class _LIBCPP_TEMPLATE_VIS seed_seq
......@@ -3663,7 +3693,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
36633693 const uniform_int_distribution<_IT>& __x)
36643694{
36653695 __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);
36673698 _CharT __sp = __os.widen(' ');
36683699 __os.fill(__sp);
36693700 return __os << __x.a() << __sp << __x.b();
......@@ -3678,7 +3709,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
36783709 typedef typename _Eng::result_type result_type;
36793710 typedef typename _Eng::param_type param_type;
36803711 __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);
36823714 result_type __a;
36833715 result_type __b;
36843716 __is >> __a >> __b;
......@@ -3784,8 +3816,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
37843816 const uniform_real_distribution<_RT>& __x)
37853817{
37863818 __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);
37893822 _CharT __sp = __os.widen(' ');
37903823 __os.fill(__sp);
37913824 return __os << __x.a() << __sp << __x.b();
......@@ -3800,7 +3833,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
38003833 typedef typename _Eng::result_type result_type;
38013834 typedef typename _Eng::param_type param_type;
38023835 __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);
38043838 result_type __a;
38053839 result_type __b;
38063840 __is >> __a >> __b;
......@@ -3895,8 +3929,9 @@ basic_ostream<_CharT, _Traits>&
38953929operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
38963930{
38973931 __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);
39003935 _CharT __sp = __os.widen(' ');
39013936 __os.fill(__sp);
39023937 return __os << __x.p();
......@@ -3909,7 +3944,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
39093944 typedef bernoulli_distribution _Eng;
39103945 typedef typename _Eng::param_type param_type;
39113946 __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);
39133949 double __p;
39143950 __is >> __p;
39153951 if (!__is.fail())
......@@ -3999,12 +4035,12 @@ public:
39994035 {return !(__x == __y);}
40004036};
40014037
4002#ifndef _LIBCPP_MSVCRT
4038#ifndef _LIBCPP_MSVCRT_LIKE
40034039extern "C" double lgamma_r(double, int *);
40044040#endif
40054041
40064042inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) {
4007#if defined(_LIBCPP_MSVCRT)
4043#if defined(_LIBCPP_MSVCRT_LIKE)
40084044 return lgamma(__d);
40094045#else
40104046 int __sign;
......@@ -4079,8 +4115,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
40794115 const binomial_distribution<_IntType>& __x)
40804116{
40814117 __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);
40844121 _CharT __sp = __os.widen(' ');
40854122 __os.fill(__sp);
40864123 return __os << __x.t() << __sp << __x.p();
......@@ -4095,7 +4132,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
40954132 typedef typename _Eng::result_type result_type;
40964133 typedef typename _Eng::param_type param_type;
40974134 __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);
40994137 result_type __t;
41004138 double __p;
41014139 __is >> __t >> __p;
......@@ -4197,8 +4235,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
41974235 const exponential_distribution<_RealType>& __x)
41984236{
41994237 __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);
42024241 return __os << __x.lambda();
42034242}
42044243
......@@ -4211,7 +4250,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
42114250 typedef typename _Eng::result_type result_type;
42124251 typedef typename _Eng::param_type param_type;
42134252 __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);
42154255 result_type __lambda;
42164256 __is >> __lambda;
42174257 if (!__is.fail())
......@@ -4351,8 +4391,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
43514391 const normal_distribution<_RT>& __x)
43524392{
43534393 __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);
43564397 _CharT __sp = __os.widen(' ');
43574398 __os.fill(__sp);
43584399 __os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_;
......@@ -4370,7 +4411,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
43704411 typedef typename _Eng::result_type result_type;
43714412 typedef typename _Eng::param_type param_type;
43724413 __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);
43744416 result_type __mean;
43754417 result_type __stddev;
43764418 result_type _Vp = 0;
......@@ -4618,7 +4660,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
46184660 {
46194661 __s_ = _VSTD::sqrt(__mean_);
46204662 __d_ = 6 * __mean_ * __mean_;
4621 __l_ = std::trunc(__mean_ - 1.1484);
4663 __l_ = _VSTD::trunc(__mean_ - 1.1484);
46224664 __omega_ = .3989423 / __s_;
46234665 double __b1_ = .4166667E-1 / __mean_;
46244666 double __b2_ = .3 * __b1_ * __b1_;
......@@ -4650,13 +4692,13 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
46504692 double __u;
46514693 if (__g > 0)
46524694 {
4653 __tx = std::trunc(__g);
4695 __tx = _VSTD::trunc(__g);
46544696 if (__tx >= __pr.__l_)
4655 return std::__clamp_to_integral<result_type>(__tx);
4697 return _VSTD::__clamp_to_integral<result_type>(__tx);
46564698 __difmuk = __pr.__mean_ - __tx;
46574699 __u = __urd(__urng);
46584700 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);
46604702 }
46614703 exponential_distribution<double> __edist;
46624704 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
46724714 __u += __u - 1;
46734715 __t = 1.8 + (__u < 0 ? -__e : __e);
46744716 } while (__t <= -.6744);
4675 __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
4717 __tx = _VSTD::trunc(__pr.__mean_ + __pr.__s_ * __t);
46764718 __difmuk = __pr.__mean_ - __tx;
46774719 __using_exp_dist = true;
46784720 }
......@@ -4716,7 +4758,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
47164758 }
47174759 }
47184760 }
4719 return std::__clamp_to_integral<result_type>(__tx);
4761 return _VSTD::__clamp_to_integral<result_type>(__tx);
47204762}
47214763
47224764template <class _CharT, class _Traits, class _IntType>
......@@ -4725,8 +4767,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
47254767 const poisson_distribution<_IntType>& __x)
47264768{
47274769 __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);
47304773 return __os << __x.mean();
47314774}
47324775
......@@ -4738,7 +4781,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
47384781 typedef poisson_distribution<_IntType> _Eng;
47394782 typedef typename _Eng::param_type param_type;
47404783 __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);
47424786 double __mean;
47434787 __is >> __mean;
47444788 if (!__is.fail())
......@@ -4836,8 +4880,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
48364880 const weibull_distribution<_RT>& __x)
48374881{
48384882 __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);
48414886 _CharT __sp = __os.widen(' ');
48424887 __os.fill(__sp);
48434888 __os << __x.a() << __sp << __x.b();
......@@ -4853,7 +4898,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
48534898 typedef typename _Eng::result_type result_type;
48544899 typedef typename _Eng::param_type param_type;
48554900 __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);
48574903 result_type __a;
48584904 result_type __b;
48594905 __is >> __a >> __b;
......@@ -4955,8 +5001,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
49555001 const extreme_value_distribution<_RT>& __x)
49565002{
49575003 __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);
49605007 _CharT __sp = __os.widen(' ');
49615008 __os.fill(__sp);
49625009 __os << __x.a() << __sp << __x.b();
......@@ -4972,7 +5019,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
49725019 typedef typename _Eng::result_type result_type;
49735020 typedef typename _Eng::param_type param_type;
49745021 __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);
49765024 result_type __a;
49775025 result_type __b;
49785026 __is >> __a >> __b;
......@@ -5127,8 +5175,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
51275175 const gamma_distribution<_RT>& __x)
51285176{
51295177 __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);
51325181 _CharT __sp = __os.widen(' ');
51335182 __os.fill(__sp);
51345183 __os << __x.alpha() << __sp << __x.beta();
......@@ -5144,7 +5193,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
51445193 typedef typename _Eng::result_type result_type;
51455194 typedef typename _Eng::param_type param_type;
51465195 __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);
51485198 result_type __alpha;
51495199 result_type __beta;
51505200 __is >> __alpha >> __beta;
......@@ -5263,8 +5313,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
52635313 const negative_binomial_distribution<_IntType>& __x)
52645314{
52655315 __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);
52685319 _CharT __sp = __os.widen(' ');
52695320 __os.fill(__sp);
52705321 return __os << __x.k() << __sp << __x.p();
......@@ -5279,7 +5330,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
52795330 typedef typename _Eng::result_type result_type;
52805331 typedef typename _Eng::param_type param_type;
52815332 __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);
52835335 result_type __k;
52845336 double __p;
52855337 __is >> __k >> __p;
......@@ -5369,8 +5421,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
53695421 const geometric_distribution<_IntType>& __x)
53705422{
53715423 __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);
53745427 return __os << __x.p();
53755428}
53765429
......@@ -5382,7 +5435,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
53825435 typedef geometric_distribution<_IntType> _Eng;
53835436 typedef typename _Eng::param_type param_type;
53845437 __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);
53865440 double __p;
53875441 __is >> __p;
53885442 if (!__is.fail())
......@@ -5473,8 +5527,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
54735527 const chi_squared_distribution<_RT>& __x)
54745528{
54755529 __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);
54785533 __os << __x.n();
54795534 return __os;
54805535}
......@@ -5488,7 +5543,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
54885543 typedef typename _Eng::result_type result_type;
54895544 typedef typename _Eng::param_type param_type;
54905545 __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);
54925548 result_type __n;
54935549 __is >> __n;
54945550 if (!__is.fail())
......@@ -5593,8 +5649,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
55935649 const cauchy_distribution<_RT>& __x)
55945650{
55955651 __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);
55985655 _CharT __sp = __os.widen(' ');
55995656 __os.fill(__sp);
56005657 __os << __x.a() << __sp << __x.b();
......@@ -5610,7 +5667,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
56105667 typedef typename _Eng::result_type result_type;
56115668 typedef typename _Eng::param_type param_type;
56125669 __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);
56145672 result_type __a;
56155673 result_type __b;
56165674 __is >> __a >> __b;
......@@ -5715,8 +5773,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
57155773 const fisher_f_distribution<_RT>& __x)
57165774{
57175775 __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);
57205779 _CharT __sp = __os.widen(' ');
57215780 __os.fill(__sp);
57225781 __os << __x.m() << __sp << __x.n();
......@@ -5732,7 +5791,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
57325791 typedef typename _Eng::result_type result_type;
57335792 typedef typename _Eng::param_type param_type;
57345793 __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);
57365796 result_type __m;
57375797 result_type __n;
57385798 __is >> __m >> __n;
......@@ -5831,8 +5891,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
58315891 const student_t_distribution<_RT>& __x)
58325892{
58335893 __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);
58365897 __os << __x.n();
58375898 return __os;
58385899}
......@@ -5846,7 +5907,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
58465907 typedef typename _Eng::result_type result_type;
58475908 typedef typename _Eng::param_type param_type;
58485909 __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);
58505912 result_type __n;
58515913 __is >> __n;
58525914 if (!__is.fail())
......@@ -6054,8 +6116,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
60546116 const discrete_distribution<_IT>& __x)
60556117{
60566118 __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);
60596122 _CharT __sp = __os.widen(' ');
60606123 __os.fill(__sp);
60616124 size_t __n = __x.__p_.__p_.size();
......@@ -6071,7 +6134,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
60716134 discrete_distribution<_IT>& __x)
60726135{
60736136 __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);
60756139 size_t __n;
60766140 __is >> __n;
60776141 vector<double> __p(__n);
......@@ -6356,8 +6420,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
63566420 const piecewise_constant_distribution<_RT>& __x)
63576421{
63586422 __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);
63616426 _CharT __sp = __os.widen(' ');
63626427 __os.fill(__sp);
63636428 size_t __n = __x.__p_.__b_.size();
......@@ -6383,7 +6448,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
63836448 typedef piecewise_constant_distribution<_RT> _Eng;
63846449 typedef typename _Eng::result_type result_type;
63856450 __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);
63876453 size_t __n;
63886454 __is >> __n;
63896455 vector<result_type> __b(__n);
......@@ -6696,8 +6762,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
66966762 const piecewise_linear_distribution<_RT>& __x)
66976763{
66986764 __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);
67016768 _CharT __sp = __os.widen(' ');
67026769 __os.fill(__sp);
67036770 size_t __n = __x.__p_.__b_.size();
......@@ -6723,7 +6790,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
67236790 typedef piecewise_linear_distribution<_RT> _Eng;
67246791 typedef typename _Eng::result_type result_type;
67256792 __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);
67276795 size_t __n;
67286796 __is >> __n;
67296797 vector<result_type> __b(__n);
lib/libcxx/include/regex+122-51
......@@ -32,7 +32,8 @@ enum syntax_option_type
3232 extended = unspecified,
3333 awk = unspecified,
3434 grep = unspecified,
35 egrep = unspecified
35 egrep = unspecified,
36 multiline = unspecified
3637};
3738
3839constexpr syntax_option_type operator~(syntax_option_type f);
......@@ -142,6 +143,7 @@ public:
142143 static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
143144 static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
144145 static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
146 static constexpr regex_constants::syntax_option_type multiline = regex_constants::multiline;
145147
146148 // construct/copy/destroy:
147149 basic_regex();
......@@ -802,7 +804,9 @@ enum syntax_option_type
802804 extended = 1 << 5,
803805 awk = 1 << 6,
804806 grep = 1 << 7,
805 egrep = 1 << 8
807 egrep = 1 << 8,
808 // 1 << 9 may be used by ECMAScript
809 multiline = 1 << 10
806810};
807811
808812inline _LIBCPP_CONSTEXPR
......@@ -1982,24 +1986,33 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
19821986// __l_anchor
19831987
19841988template <class _CharT>
1985class __l_anchor
1989_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1990bool __is_eol(_CharT c)
1991{
1992 return c == '\r' || c == '\n';
1993}
1994
1995template <class _CharT>
1996class __l_anchor_multiline
19861997 : public __owns_one_state<_CharT>
19871998{
19881999 typedef __owns_one_state<_CharT> base;
19892000
2001 bool __multiline;
2002
19902003public:
19912004 typedef _VSTD::__state<_CharT> __state;
19922005
19932006 _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) {}
19962009
19972010 virtual void __exec(__state&) const;
19982011};
19992012
20002013template <class _CharT>
20012014void
2002__l_anchor<_CharT>::__exec(__state& __s) const
2015__l_anchor_multiline<_CharT>::__exec(__state& __s) const
20032016{
20042017 if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
20052018 !(__s.__flags_ & regex_constants::match_not_bol))
......@@ -2007,6 +2020,13 @@ __l_anchor<_CharT>::__exec(__state& __s) const
20072020 __s.__do_ = __state::__accept_but_not_consume;
20082021 __s.__node_ = this->first();
20092022 }
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 }
20102030 else
20112031 {
20122032 __s.__do_ = __state::__reject;
......@@ -2017,24 +2037,26 @@ __l_anchor<_CharT>::__exec(__state& __s) const
20172037// __r_anchor
20182038
20192039template <class _CharT>
2020class __r_anchor
2040class __r_anchor_multiline
20212041 : public __owns_one_state<_CharT>
20222042{
20232043 typedef __owns_one_state<_CharT> base;
20242044
2045 bool __multiline;
2046
20252047public:
20262048 typedef _VSTD::__state<_CharT> __state;
20272049
20282050 _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) {}
20312053
20322054 virtual void __exec(__state&) const;
20332055};
20342056
20352057template <class _CharT>
20362058void
2037__r_anchor<_CharT>::__exec(__state& __s) const
2059__r_anchor_multiline<_CharT>::__exec(__state& __s) const
20382060{
20392061 if (__s.__current_ == __s.__last_ &&
20402062 !(__s.__flags_ & regex_constants::match_not_eol))
......@@ -2042,6 +2064,11 @@ __r_anchor<_CharT>::__exec(__state& __s) const
20422064 __s.__do_ = __state::__accept_but_not_consume;
20432065 __s.__node_ = this->first();
20442066 }
2067 else if (__multiline && __is_eol(*__s.__current_))
2068 {
2069 __s.__do_ = __state::__accept_but_not_consume;
2070 __s.__node_ = this->first();
2071 }
20452072 else
20462073 {
20472074 __s.__do_ = __state::__reject;
......@@ -2448,7 +2475,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
24482475 {
24492476 const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
24502477 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) !=
24522479 __neg_chars_.end();
24532480 if (!(__in_neg_mask || __in_neg_chars))
24542481 {
......@@ -2507,7 +2534,17 @@ __exit:
25072534template <class _CharT, class _Traits> class __lookahead;
25082535
25092536template <class _CharT, class _Traits = regex_traits<_CharT> >
2510class _LIBCPP_TEMPLATE_VIS basic_regex
2537 class _LIBCPP_TEMPLATE_VIS basic_regex;
2538
2539typedef basic_regex<char> regex;
2540typedef basic_regex<wchar_t> wregex;
2541
2542template <class _CharT, class _Traits>
2543class
2544 _LIBCPP_TEMPLATE_VIS
2545 _LIBCPP_PREFERRED_NAME(regex)
2546 _LIBCPP_PREFERRED_NAME(wregex)
2547 basic_regex
25112548{
25122549public:
25132550 // types:
......@@ -2541,17 +2578,18 @@ public:
25412578 static const regex_constants::syntax_option_type awk = regex_constants::awk;
25422579 static const regex_constants::syntax_option_type grep = regex_constants::grep;
25432580 static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
2581 static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
25442582
25452583 // construct/copy/destroy:
25462584 _LIBCPP_INLINE_VISIBILITY
25472585 basic_regex()
25482586 : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
2549 __end_(0)
2587 __end_(nullptr)
25502588 {}
25512589 _LIBCPP_INLINE_VISIBILITY
25522590 explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
25532591 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2554 __end_(0)
2592 __end_(nullptr)
25552593 {
25562594 __init(__p, __p + __traits_.length(__p));
25572595 }
......@@ -2559,7 +2597,7 @@ public:
25592597 _LIBCPP_INLINE_VISIBILITY
25602598 basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
25612599 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2562 __end_(0)
2600 __end_(nullptr)
25632601 {
25642602 __init(__p, __p + __len);
25652603 }
......@@ -2571,7 +2609,7 @@ public:
25712609 explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
25722610 flag_type __f = regex_constants::ECMAScript)
25732611 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2574 __end_(0)
2612 __end_(nullptr)
25752613 {
25762614 __init(__p.begin(), __p.end());
25772615 }
......@@ -2581,7 +2619,7 @@ public:
25812619 basic_regex(_ForwardIterator __first, _ForwardIterator __last,
25822620 flag_type __f = regex_constants::ECMAScript)
25832621 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2584 __end_(0)
2622 __end_(nullptr)
25852623 {
25862624 __init(__first, __last);
25872625 }
......@@ -2590,7 +2628,7 @@ public:
25902628 basic_regex(initializer_list<value_type> __il,
25912629 flag_type __f = regex_constants::ECMAScript)
25922630 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2593 __end_(0)
2631 __end_(nullptr)
25942632 {
25952633 __init(__il.begin(), __il.end());
25962634 }
......@@ -2707,6 +2745,12 @@ private:
27072745 _LIBCPP_INLINE_VISIBILITY
27082746 unsigned __loop_count() const {return __loop_count_;}
27092747
2748 _LIBCPP_INLINE_VISIBILITY
2749 bool __use_multiline() const
2750 {
2751 return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
2752 }
2753
27102754 template <class _ForwardIterator>
27112755 void
27122756 __init(_ForwardIterator __first, _ForwardIterator __last);
......@@ -4119,7 +4163,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
41194163 __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
41204164 ++__first)
41214165 {
4122 if (__c >= std::numeric_limits<int>::max() / 10)
4166 if (__c >= numeric_limits<int>::max() / 10)
41234167 __throw_regex_error<regex_constants::error_badbrace>();
41244168 __c *= 10;
41254169 __c += __val;
......@@ -4383,7 +4427,7 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
43834427 for (++__first;
43844428 __first != __last && '0' <= *__first && *__first <= '9'; ++__first)
43854429 {
4386 if (__v >= std::numeric_limits<unsigned>::max() / 10)
4430 if (__v >= numeric_limits<unsigned>::max() / 10)
43874431 __throw_regex_error<regex_constants::error_backref>();
43884432 __v = 10 * __v + *__first - '0';
43894433 }
......@@ -4746,7 +4790,7 @@ template <class _CharT, class _Traits>
47464790void
47474791basic_regex<_CharT, _Traits>::__push_l_anchor()
47484792{
4749 __end_->first() = new __l_anchor<_CharT>(__end_->first());
4793 __end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
47504794 __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
47514795}
47524796
......@@ -4754,7 +4798,7 @@ template <class _CharT, class _Traits>
47544798void
47554799basic_regex<_CharT, _Traits>::__push_r_anchor()
47564800{
4757 __end_->first() = new __r_anchor<_CharT>(__end_->first());
4801 __end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
47584802 __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
47594803}
47604804
......@@ -4845,13 +4889,21 @@ basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
48454889 __end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
48464890}
48474891
4848typedef basic_regex<char> regex;
4849typedef basic_regex<wchar_t> wregex;
4850
48514892// sub_match
48524893
4894typedef sub_match<const char*> csub_match;
4895typedef sub_match<const wchar_t*> wcsub_match;
4896typedef sub_match<string::const_iterator> ssub_match;
4897typedef sub_match<wstring::const_iterator> wssub_match;
4898
48534899template <class _BidirectionalIterator>
4854class _LIBCPP_TEMPLATE_VIS sub_match
4900class
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
48554907 : public pair<_BidirectionalIterator, _BidirectionalIterator>
48564908{
48574909public:
......@@ -4886,11 +4938,6 @@ public:
48864938 {return str().compare(__s);}
48874939};
48884940
4889typedef sub_match<const char*> csub_match;
4890typedef sub_match<const wchar_t*> wcsub_match;
4891typedef sub_match<string::const_iterator> ssub_match;
4892typedef sub_match<wstring::const_iterator> wssub_match;
4893
48944941template <class _BiIter>
48954942inline _LIBCPP_INLINE_VISIBILITY
48964943bool
......@@ -5273,8 +5320,19 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
52735320 return __os << __m.str();
52745321}
52755322
5323typedef match_results<const char*> cmatch;
5324typedef match_results<const wchar_t*> wcmatch;
5325typedef match_results<string::const_iterator> smatch;
5326typedef match_results<wstring::const_iterator> wsmatch;
5327
52765328template <class _BidirectionalIterator, class _Allocator>
5277class _LIBCPP_TEMPLATE_VIS match_results
5329class
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
52785336{
52795337public:
52805338 typedef _Allocator allocator_type;
......@@ -5556,7 +5614,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
55565614 '0' <= __fmt_first[1] && __fmt_first[1] <= '9')
55575615 {
55585616 ++__fmt_first;
5559 if (__idx >= std::numeric_limits<size_t>::max() / 10)
5617 if (__idx >= numeric_limits<size_t>::max() / 10)
55605618 __throw_regex_error<regex_constants::error_escape>();
55615619 __idx = 10 * __idx + *__fmt_first - '0';
55625620 }
......@@ -5594,11 +5652,6 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
55945652 swap(__ready_, __m.__ready_);
55955653}
55965654
5597typedef match_results<const char*> cmatch;
5598typedef match_results<const wchar_t*> wcmatch;
5599typedef match_results<string::const_iterator> smatch;
5600typedef match_results<wstring::const_iterator> wsmatch;
5601
56025655template <class _BidirectionalIterator, class _Allocator>
56035656bool
56045657operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
......@@ -6182,7 +6235,21 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
61826235template <class _BidirectionalIterator,
61836236 class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
61846237 class _Traits = regex_traits<_CharT> >
6185class _LIBCPP_TEMPLATE_VIS regex_iterator
6238 class _LIBCPP_TEMPLATE_VIS regex_iterator;
6239
6240typedef regex_iterator<const char*> cregex_iterator;
6241typedef regex_iterator<const wchar_t*> wcregex_iterator;
6242typedef regex_iterator<string::const_iterator> sregex_iterator;
6243typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
6244
6245template <class _BidirectionalIterator, class _CharT, class _Traits>
6246class
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
61866253{
61876254public:
61886255 typedef basic_regex<_CharT, _Traits> regex_type;
......@@ -6291,17 +6358,26 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
62916358 return *this;
62926359}
62936360
6294typedef regex_iterator<const char*> cregex_iterator;
6295typedef regex_iterator<const wchar_t*> wcregex_iterator;
6296typedef regex_iterator<string::const_iterator> sregex_iterator;
6297typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
6298
62996361// regex_token_iterator
63006362
63016363template <class _BidirectionalIterator,
63026364 class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
63036365 class _Traits = regex_traits<_CharT> >
6304class _LIBCPP_TEMPLATE_VIS regex_token_iterator
6366 class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
6367
6368typedef regex_token_iterator<const char*> cregex_token_iterator;
6369typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
6370typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
6371typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
6372
6373template <class _BidirectionalIterator, class _CharT, class _Traits>
6374class
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
63056381{
63066382public:
63076383 typedef basic_regex<_CharT, _Traits> regex_type;
......@@ -6367,7 +6443,7 @@ public:
63676443 regex_constants::match_flag_type __m =
63686444 regex_constants::match_default);
63696445#if _LIBCPP_STD_VER > 11
6370 template <std::size_t _Np>
6446 template <size_t _Np>
63716447 regex_token_iterator(_BidirectionalIterator __a,
63726448 _BidirectionalIterator __b,
63736449 const regex_type&& __re,
......@@ -6579,11 +6655,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
65796655 return *this;
65806656}
65816657
6582typedef regex_token_iterator<const char*> cregex_token_iterator;
6583typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
6584typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
6585typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
6586
65876658// regex_replace
65886659
65896660template <class _OutputIterator, class _BidirectionalIterator,
lib/libcxx/include/semaphore+7-2
......@@ -46,9 +46,9 @@ using binary_semaphore = counting_semaphore<1>;
4646*/
4747
4848#include <__config>
49#include <__availability>
4950#include <__threading_support>
5051#include <atomic>
51#include <cassert>
5252
5353#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
5454#pragma GCC system_header
......@@ -58,6 +58,9 @@ using binary_semaphore = counting_semaphore<1>;
5858# error <semaphore> is not supported on this single threaded system
5959#endif
6060
61_LIBCPP_PUSH_MACROS
62#include <__undef_macros>
63
6164#if _LIBCPP_STD_VER >= 14
6265
6366_LIBCPP_BEGIN_NAMESPACE_STD
......@@ -68,7 +71,7 @@ __atomic_semaphore_base is the general-case implementation, to be used for
6871user-requested least-max values that exceed the OS implementation support
6972(incl. when the OS has no support of its own) and for binary semaphores.
7073
71It is a typical Dijsktra semaphore algorithm over atomics, wait and notify
74It is a typical Dijkstra semaphore algorithm over atomics, wait and notify
7275functions. It avoids contention against users' own use of those facilities.
7376
7477*/
......@@ -232,4 +235,6 @@ _LIBCPP_END_NAMESPACE_STD
232235
233236#endif // _LIBCPP_STD_VER >= 14
234237
238_LIBCPP_POP_MACROS
239
235240#endif //_LIBCPP_SEMAPHORE
lib/libcxx/include/shared_mutex+1
......@@ -123,6 +123,7 @@ template <class Mutex>
123123*/
124124
125125#include <__config>
126#include <__availability>
126127#include <version>
127128
128129_LIBCPP_PUSH_MACROS
lib/libcxx/include/span+6-1
......@@ -132,11 +132,14 @@ template<class Container>
132132#pragma GCC system_header
133133#endif
134134
135_LIBCPP_PUSH_MACROS
136#include <__undef_macros>
137
135138_LIBCPP_BEGIN_NAMESPACE_STD
136139
137140#if _LIBCPP_STD_VER > 17
138141
139inline constexpr size_t dynamic_extent = (numeric_limits<size_t>::max)();
142inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
140143template <typename _Tp, size_t _Extent = dynamic_extent> class span;
141144
142145
......@@ -546,4 +549,6 @@ template<class _Container>
546549
547550_LIBCPP_END_NAMESPACE_STD
548551
552_LIBCPP_POP_MACROS
553
549554#endif // _LIBCPP_SPAN
lib/libcxx/include/sstream+148-283
......@@ -208,17 +208,23 @@ private:
208208
209209public:
210210 // 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
214217 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
217224 basic_stringbuf(basic_stringbuf&& __rhs);
218225
219226 // 27.8.1.2 Assign and swap:
220227 basic_stringbuf& operator=(basic_stringbuf&& __rhs);
221#endif
222228 void swap(basic_stringbuf& __rhs);
223229
224230 // 27.8.1.3 Get and set:
......@@ -232,30 +238,13 @@ protected:
232238 virtual int_type overflow (int_type __c = traits_type::eof());
233239 virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
234240 ios_base::openmode __wch = ios_base::in | ios_base::out);
235 inline _LIBCPP_INLINE_VISIBILITY
241 _LIBCPP_INLINE_VISIBILITY
236242 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 }
238246};
239247
240template <class _CharT, class _Traits, class _Allocator>
241basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch)
242 : __hm_(0),
243 __mode_(__wch)
244{
245}
246
247template <class _CharT, class _Traits, class _Allocator>
248basic_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
259248template <class _CharT, class _Traits, class _Allocator>
260249basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
261250 : __mode_(__rhs.__mode_)
......@@ -345,8 +334,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
345334 return *this;
346335}
347336
348#endif // _LIBCPP_CXX03_LANG
349
350337template <class _CharT, class _Traits, class _Allocator>
351338void
352339basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
......@@ -453,7 +440,7 @@ void
453440basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s)
454441{
455442 __str_ = __s;
456 __hm_ = 0;
443 __hm_ = nullptr;
457444 if (__mode_ & ios_base::in)
458445 {
459446 __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size();
......@@ -600,9 +587,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
600587 return pos_type(-1);
601588 if (__noff != 0)
602589 {
603 if ((__wch & ios_base::in) && this->gptr() == 0)
590 if ((__wch & ios_base::in) && this->gptr() == nullptr)
604591 return pos_type(-1);
605 if ((__wch & ios_base::out) && this->pptr() == 0)
592 if ((__wch & ios_base::out) && this->pptr() == nullptr)
606593 return pos_type(-1);
607594 }
608595 if (__wch & ios_base::in)
......@@ -615,14 +602,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
615602 return pos_type(__noff);
616603}
617604
618template <class _CharT, class _Traits, class _Allocator>
619typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
620basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
621 ios_base::openmode __wch)
622{
623 return seekoff(__sp, ios_base::beg, __wch);
624}
625
626605// basic_istringstream
627606
628607template <class _CharT, class _Traits, class _Allocator>
......@@ -644,73 +623,53 @@ private:
644623
645624public:
646625 // 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
650632 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 }
655645
656646 // 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 }
661657
662658 // 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 }
669671};
670672
671template <class _CharT, class _Traits, class _Allocator>
672basic_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
678template <class _CharT, class _Traits, class _Allocator>
679basic_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
688template <class _CharT, class _Traits, class _Allocator>
689basic_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
696template <class _CharT, class _Traits, class _Allocator>
697basic_istringstream<_CharT, _Traits, _Allocator>&
698basic_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
707template <class _CharT, class _Traits, class _Allocator>
708void 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
714673template <class _CharT, class _Traits, class _Allocator>
715674inline _LIBCPP_INLINE_VISIBILITY
716675void
......@@ -720,26 +679,6 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
720679 __x.swap(__y);
721680}
722681
723template <class _CharT, class _Traits, class _Allocator>
724basic_stringbuf<_CharT, _Traits, _Allocator>*
725basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
726{
727 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
728}
729
730template <class _CharT, class _Traits, class _Allocator>
731basic_string<_CharT, _Traits, _Allocator>
732basic_istringstream<_CharT, _Traits, _Allocator>::str() const
733{
734 return __sb_.str();
735}
736
737template <class _CharT, class _Traits, class _Allocator>
738void basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
739{
740 __sb_.str(__s);
741}
742
743682// basic_ostringstream
744683
745684template <class _CharT, class _Traits, class _Allocator>
......@@ -761,74 +700,55 @@ private:
761700
762701public:
763702 // 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
767710 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 }
772723
773724 // 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 }
778736
779737 // 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 }
786750};
787751
788template <class _CharT, class _Traits, class _Allocator>
789basic_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
795template <class _CharT, class _Traits, class _Allocator>
796basic_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
805template <class _CharT, class _Traits, class _Allocator>
806basic_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
813template <class _CharT, class _Traits, class _Allocator>
814basic_ostringstream<_CharT, _Traits, _Allocator>&
815basic_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
824template <class _CharT, class _Traits, class _Allocator>
825void
826basic_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
832752template <class _CharT, class _Traits, class _Allocator>
833753inline _LIBCPP_INLINE_VISIBILITY
834754void
......@@ -838,27 +758,6 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
838758 __x.swap(__y);
839759}
840760
841template <class _CharT, class _Traits, class _Allocator>
842basic_stringbuf<_CharT, _Traits, _Allocator>*
843basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
844{
845 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
846}
847
848template <class _CharT, class _Traits, class _Allocator>
849basic_string<_CharT, _Traits, _Allocator>
850basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
851{
852 return __sb_.str();
853}
854
855template <class _CharT, class _Traits, class _Allocator>
856void
857basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
858{
859 __sb_.str(__s);
860}
861
862761// basic_stringstream
863762
864763template <class _CharT, class _Traits, class _Allocator>
......@@ -880,74 +779,54 @@ private:
880779
881780public:
882781 // 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
886789 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 }
891802
892803 // 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 }
897814
898815 // 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 }
905828};
906829
907template <class _CharT, class _Traits, class _Allocator>
908basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch)
909 : basic_iostream<_CharT, _Traits>(&__sb_),
910 __sb_(__wch)
911{
912}
913
914template <class _CharT, class _Traits, class _Allocator>
915basic_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
924template <class _CharT, class _Traits, class _Allocator>
925basic_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
932template <class _CharT, class _Traits, class _Allocator>
933basic_stringstream<_CharT, _Traits, _Allocator>&
934basic_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
943template <class _CharT, class _Traits, class _Allocator>
944void
945basic_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
951830template <class _CharT, class _Traits, class _Allocator>
952831inline _LIBCPP_INLINE_VISIBILITY
953832void
......@@ -957,26 +836,12 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
957836 __x.swap(__y);
958837}
959838
960template <class _CharT, class _Traits, class _Allocator>
961basic_stringbuf<_CharT, _Traits, _Allocator>*
962basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
963{
964 return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
965}
966
967template <class _CharT, class _Traits, class _Allocator>
968basic_string<_CharT, _Traits, _Allocator>
969basic_stringstream<_CharT, _Traits, _Allocator>::str() const
970{
971 return __sb_.str();
972}
973
974template <class _CharT, class _Traits, class _Allocator>
975void
976basic_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
980845
981846_LIBCPP_END_NAMESPACE_STD
982847
lib/libcxx/include/stdexcept+1-3
......@@ -42,11 +42,9 @@ public:
4242*/
4343
4444#include <__config>
45#include <cstdlib>
4546#include <exception>
4647#include <iosfwd> // for string forward decl
47#ifdef _LIBCPP_NO_EXCEPTIONS
48#include <cstdlib>
49#endif
5048
5149#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
5250#pragma GCC system_header
lib/libcxx/include/streambuf+6-8
......@@ -308,12 +308,12 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
308308
309309template <class _CharT, class _Traits>
310310basic_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)
317317{
318318}
319319
......@@ -485,13 +485,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
485485 return traits_type::eof();
486486}
487487
488#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
489488_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>)
490489_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>)
491490
492491_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>)
493492_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>)
494#endif
495493
496494_LIBCPP_END_NAMESPACE_STD
497495
lib/libcxx/include/string+174-138
......@@ -153,7 +153,8 @@ public:
153153 void resize(size_type n, value_type c);
154154 void resize(size_type n);
155155
156 void reserve(size_type res_arg = 0);
156 void reserve(size_type res_arg);
157 void reserve(); // deprecated in C++20
157158 void shrink_to_fit();
158159 void clear() noexcept;
159160 bool empty() const noexcept;
......@@ -448,15 +449,15 @@ typedef basic_string<wchar_t> wstring;
448449typedef basic_string<char16_t> u16string;
449450typedef basic_string<char32_t> u32string;
450451
451int stoi (const string& str, size_t* idx = 0, int base = 10);
452long stol (const string& str, size_t* idx = 0, int base = 10);
453unsigned long stoul (const string& str, size_t* idx = 0, int base = 10);
454long long stoll (const string& str, size_t* idx = 0, int base = 10);
455unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
452int stoi (const string& str, size_t* idx = nullptr, int base = 10);
453long stol (const string& str, size_t* idx = nullptr, int base = 10);
454unsigned long stoul (const string& str, size_t* idx = nullptr, int base = 10);
455long long stoll (const string& str, size_t* idx = nullptr, int base = 10);
456unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
456457
457float stof (const string& str, size_t* idx = 0);
458double stod (const string& str, size_t* idx = 0);
459long double stold(const string& str, size_t* idx = 0);
458float stof (const string& str, size_t* idx = nullptr);
459double stod (const string& str, size_t* idx = nullptr);
460long double stold(const string& str, size_t* idx = nullptr);
460461
461462string to_string(int val);
462463string to_string(unsigned val);
......@@ -468,15 +469,15 @@ string to_string(float val);
468469string to_string(double val);
469470string to_string(long double val);
470471
471int stoi (const wstring& str, size_t* idx = 0, int base = 10);
472long stol (const wstring& str, size_t* idx = 0, int base = 10);
473unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10);
474long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
475unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
472int stoi (const wstring& str, size_t* idx = nullptr, int base = 10);
473long stol (const wstring& str, size_t* idx = nullptr, int base = 10);
474unsigned long stoul (const wstring& str, size_t* idx = nullptr, int base = 10);
475long long stoll (const wstring& str, size_t* idx = nullptr, int base = 10);
476unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
476477
477float stof (const wstring& str, size_t* idx = 0);
478double stod (const wstring& str, size_t* idx = 0);
479long double stold(const wstring& str, size_t* idx = 0);
478float stof (const wstring& str, size_t* idx = nullptr);
479double stod (const wstring& str, size_t* idx = nullptr);
480long double stold(const wstring& str, size_t* idx = nullptr);
480481
481482wstring to_wstring(int val);
482483wstring to_wstring(unsigned val);
......@@ -665,8 +666,26 @@ struct __padding<_CharT, 1>
665666
666667#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
667668
669#ifndef _LIBCPP_NO_HAS_CHAR8_T
670typedef basic_string<char8_t> u8string;
671#endif
672
673#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
674typedef basic_string<char16_t> u16string;
675typedef basic_string<char32_t> u32string;
676#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
677
668678template<class _CharT, class _Traits, class _Allocator>
669class _LIBCPP_TEMPLATE_VIS basic_string
679class
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
670689 : private __basic_string_common<true>
671690{
672691public:
......@@ -816,7 +835,7 @@ public:
816835 basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
817836 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
818837 __init(__s, traits_type::length(__s));
819# if _LIBCPP_DEBUG_LEVEL >= 2
838# if _LIBCPP_DEBUG_LEVEL == 2
820839 __get_db()->__insert_c(this);
821840# endif
822841 }
......@@ -890,7 +909,7 @@ public:
890909 _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
891910 basic_string& operator=(value_type __c);
892911
893#if _LIBCPP_DEBUG_LEVEL >= 2
912#if _LIBCPP_DEBUG_LEVEL == 2
894913 _LIBCPP_INLINE_VISIBILITY
895914 iterator begin() _NOEXCEPT
896915 {return iterator(this, __get_pointer());}
......@@ -916,7 +935,7 @@ public:
916935 _LIBCPP_INLINE_VISIBILITY
917936 const_iterator end() const _NOEXCEPT
918937 {return const_iterator(__get_pointer() + size());}
919#endif // _LIBCPP_DEBUG_LEVEL >= 2
938#endif // _LIBCPP_DEBUG_LEVEL == 2
920939 _LIBCPP_INLINE_VISIBILITY
921940 reverse_iterator rbegin() _NOEXCEPT
922941 {return reverse_iterator(end());}
......@@ -954,13 +973,13 @@ public:
954973 void resize(size_type __n, value_type __c);
955974 _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
956975
957 void reserve(size_type __res_arg);
976 void reserve(size_type __requested_capacity);
958977 _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n);
959978
979 _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY
980 void reserve() _NOEXCEPT {shrink_to_fit();}
960981 _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;
964983 _LIBCPP_INLINE_VISIBILITY
965984 void clear() _NOEXCEPT;
966985 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
......@@ -1418,18 +1437,20 @@ public:
14181437
14191438 _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
14201439
1440 _LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity);
1441
14211442 _LIBCPP_INLINE_VISIBILITY
14221443 bool __is_long() const _NOEXCEPT
14231444 {return bool(__r_.first().__s.__size_ & __short_mask);}
14241445
1425#if _LIBCPP_DEBUG_LEVEL >= 2
1446#if _LIBCPP_DEBUG_LEVEL == 2
14261447
14271448 bool __dereferenceable(const const_iterator* __i) const;
14281449 bool __decrementable(const const_iterator* __i) const;
14291450 bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
14301451 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
14311452
1432#endif // _LIBCPP_DEBUG_LEVEL >= 2
1453#endif // _LIBCPP_DEBUG_LEVEL == 2
14331454
14341455private:
14351456 _LIBCPP_INLINE_VISIBILITY
......@@ -1726,21 +1747,21 @@ inline
17261747void
17271748basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
17281749{
1729#if _LIBCPP_DEBUG_LEVEL >= 2
1750#if _LIBCPP_DEBUG_LEVEL == 2
17301751 __get_db()->__invalidate_all(this);
1731#endif // _LIBCPP_DEBUG_LEVEL >= 2
1752#endif
17321753}
17331754
17341755template <class _CharT, class _Traits, class _Allocator>
17351756inline
17361757void
17371758basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
1738#if _LIBCPP_DEBUG_LEVEL >= 2
1759#if _LIBCPP_DEBUG_LEVEL == 2
17391760 __pos
17401761#endif
17411762 )
17421763{
1743#if _LIBCPP_DEBUG_LEVEL >= 2
1764#if _LIBCPP_DEBUG_LEVEL == 2
17441765 __c_node* __c = __get_db()->__find_c_and_lock(this);
17451766 if (__c)
17461767 {
......@@ -1753,12 +1774,12 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
17531774 {
17541775 (*__p)->__c_ = nullptr;
17551776 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*));
17571778 }
17581779 }
17591780 __get_db()->unlock();
17601781 }
1761#endif // _LIBCPP_DEBUG_LEVEL >= 2
1782#endif // _LIBCPP_DEBUG_LEVEL == 2
17621783}
17631784
17641785template <class _CharT, class _Traits, class _Allocator>
......@@ -1767,7 +1788,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string()
17671788 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
17681789 : __r_(__default_init_tag(), __default_init_tag())
17691790{
1770#if _LIBCPP_DEBUG_LEVEL >= 2
1791#if _LIBCPP_DEBUG_LEVEL == 2
17711792 __get_db()->__insert_c(this);
17721793#endif
17731794 __zero();
......@@ -1783,7 +1804,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
17831804#endif
17841805: __r_(__default_init_tag(), __a)
17851806{
1786#if _LIBCPP_DEBUG_LEVEL >= 2
1807#if _LIBCPP_DEBUG_LEVEL == 2
17871808 __get_db()->__insert_c(this);
17881809#endif
17891810 __zero();
......@@ -1845,7 +1866,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const
18451866{
18461867 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
18471868 __init(__s, traits_type::length(__s));
1848#if _LIBCPP_DEBUG_LEVEL >= 2
1869#if _LIBCPP_DEBUG_LEVEL == 2
18491870 __get_db()->__insert_c(this);
18501871#endif
18511872}
......@@ -1857,7 +1878,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
18571878{
18581879 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
18591880 __init(__s, __n);
1860#if _LIBCPP_DEBUG_LEVEL >= 2
1881#if _LIBCPP_DEBUG_LEVEL == 2
18611882 __get_db()->__insert_c(this);
18621883#endif
18631884}
......@@ -1869,7 +1890,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
18691890{
18701891 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
18711892 __init(__s, __n);
1872#if _LIBCPP_DEBUG_LEVEL >= 2
1893#if _LIBCPP_DEBUG_LEVEL == 2
18731894 __get_db()->__insert_c(this);
18741895#endif
18751896}
......@@ -1884,7 +1905,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
18841905 __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()),
18851906 __str.__get_long_size());
18861907
1887#if _LIBCPP_DEBUG_LEVEL >= 2
1908#if _LIBCPP_DEBUG_LEVEL == 2
18881909 __get_db()->__insert_c(this);
18891910#endif
18901911}
......@@ -1899,7 +1920,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
18991920 else
19001921 __init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()),
19011922 __str.__get_long_size());
1902#if _LIBCPP_DEBUG_LEVEL >= 2
1923#if _LIBCPP_DEBUG_LEVEL == 2
19031924 __get_db()->__insert_c(this);
19041925#endif
19051926}
......@@ -1936,7 +1957,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
19361957 : __r_(_VSTD::move(__str.__r_))
19371958{
19381959 __str.__zero();
1939#if _LIBCPP_DEBUG_LEVEL >= 2
1960#if _LIBCPP_DEBUG_LEVEL == 2
19401961 __get_db()->__insert_c(this);
19411962 if (__is_long())
19421963 __get_db()->swap(this, &__str);
......@@ -1955,7 +1976,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
19551976 __r_.first().__r = __str.__r_.first().__r;
19561977 __str.__zero();
19571978 }
1958#if _LIBCPP_DEBUG_LEVEL >= 2
1979#if _LIBCPP_DEBUG_LEVEL == 2
19591980 __get_db()->__insert_c(this);
19601981 if (__is_long())
19611982 __get_db()->swap(this, &__str);
......@@ -1994,7 +2015,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
19942015 : __r_(__default_init_tag(), __default_init_tag())
19952016{
19962017 __init(__n, __c);
1997#if _LIBCPP_DEBUG_LEVEL >= 2
2018#if _LIBCPP_DEBUG_LEVEL == 2
19982019 __get_db()->__insert_c(this);
19992020#endif
20002021}
......@@ -2005,7 +2026,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
20052026 : __r_(__default_init_tag(), __a)
20062027{
20072028 __init(__n, __c);
2008#if _LIBCPP_DEBUG_LEVEL >= 2
2029#if _LIBCPP_DEBUG_LEVEL == 2
20092030 __get_db()->__insert_c(this);
20102031#endif
20112032}
......@@ -2020,7 +2041,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
20202041 if (__pos > __str_sz)
20212042 this->__throw_out_of_range();
20222043 __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
2023#if _LIBCPP_DEBUG_LEVEL >= 2
2044#if _LIBCPP_DEBUG_LEVEL == 2
20242045 __get_db()->__insert_c(this);
20252046#endif
20262047}
......@@ -2035,7 +2056,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
20352056 if (__pos > __str_sz)
20362057 this->__throw_out_of_range();
20372058 __init(__str.data() + __pos, __str_sz - __pos);
2038#if _LIBCPP_DEBUG_LEVEL >= 2
2059#if _LIBCPP_DEBUG_LEVEL == 2
20392060 __get_db()->__insert_c(this);
20402061#endif
20412062}
......@@ -2049,7 +2070,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
20492070 __self_view __sv0 = __t;
20502071 __self_view __sv = __sv0.substr(__pos, __n);
20512072 __init(__sv.data(), __sv.size());
2052#if _LIBCPP_DEBUG_LEVEL >= 2
2073#if _LIBCPP_DEBUG_LEVEL == 2
20532074 __get_db()->__insert_c(this);
20542075#endif
20552076}
......@@ -2061,7 +2082,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
20612082{
20622083 __self_view __sv = __t;
20632084 __init(__sv.data(), __sv.size());
2064#if _LIBCPP_DEBUG_LEVEL >= 2
2085#if _LIBCPP_DEBUG_LEVEL == 2
20652086 __get_db()->__insert_c(this);
20662087#endif
20672088}
......@@ -2073,7 +2094,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _
20732094{
20742095 __self_view __sv = __t;
20752096 __init(__sv.data(), __sv.size());
2076#if _LIBCPP_DEBUG_LEVEL >= 2
2097#if _LIBCPP_DEBUG_LEVEL == 2
20772098 __get_db()->__insert_c(this);
20782099#endif
20792100}
......@@ -2141,7 +2162,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
21412162 : __r_(__default_init_tag(), __default_init_tag())
21422163{
21432164 __init(__first, __last);
2144#if _LIBCPP_DEBUG_LEVEL >= 2
2165#if _LIBCPP_DEBUG_LEVEL == 2
21452166 __get_db()->__insert_c(this);
21462167#endif
21472168}
......@@ -2154,7 +2175,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
21542175 : __r_(__default_init_tag(), __a)
21552176{
21562177 __init(__first, __last);
2157#if _LIBCPP_DEBUG_LEVEL >= 2
2178#if _LIBCPP_DEBUG_LEVEL == 2
21582179 __get_db()->__insert_c(this);
21592180#endif
21602181}
......@@ -2168,7 +2189,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
21682189 : __r_(__default_init_tag(), __default_init_tag())
21692190{
21702191 __init(__il.begin(), __il.end());
2171#if _LIBCPP_DEBUG_LEVEL >= 2
2192#if _LIBCPP_DEBUG_LEVEL == 2
21722193 __get_db()->__insert_c(this);
21732194#endif
21742195}
......@@ -2181,7 +2202,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
21812202 : __r_(__default_init_tag(), __a)
21822203{
21832204 __init(__il.begin(), __il.end());
2184#if _LIBCPP_DEBUG_LEVEL >= 2
2205#if _LIBCPP_DEBUG_LEVEL == 2
21852206 __get_db()->__insert_c(this);
21862207#endif
21872208}
......@@ -2191,7 +2212,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
21912212template <class _CharT, class _Traits, class _Allocator>
21922213basic_string<_CharT, _Traits, _Allocator>::~basic_string()
21932214{
2194#if _LIBCPP_DEBUG_LEVEL >= 2
2215#if _LIBCPP_DEBUG_LEVEL == 2
21952216 __get_db()->__erase_c(this);
21962217#endif
21972218 if (__is_long())
......@@ -2768,7 +2789,7 @@ _EnableIf
27682789>
27692790basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
27702791{
2771#if _LIBCPP_DEBUG_LEVEL >= 2
2792#if _LIBCPP_DEBUG_LEVEL == 2
27722793 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
27732794 "string::insert(iterator, range) called with an iterator not"
27742795 " referring to this string");
......@@ -2787,7 +2808,7 @@ _EnableIf
27872808>
27882809basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
27892810{
2790#if _LIBCPP_DEBUG_LEVEL >= 2
2811#if _LIBCPP_DEBUG_LEVEL == 2
27912812 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
27922813 "string::insert(iterator, range) called with an iterator not"
27932814 " referring to this string");
......@@ -2903,7 +2924,7 @@ inline
29032924typename basic_string<_CharT, _Traits, _Allocator>::iterator
29042925basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
29052926{
2906#if _LIBCPP_DEBUG_LEVEL >= 2
2927#if _LIBCPP_DEBUG_LEVEL == 2
29072928 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
29082929 "string::insert(iterator, n, value) called with an iterator not"
29092930 " referring to this string");
......@@ -3137,7 +3158,7 @@ inline
31373158typename basic_string<_CharT, _Traits, _Allocator>::iterator
31383159basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
31393160{
3140#if _LIBCPP_DEBUG_LEVEL >= 2
3161#if _LIBCPP_DEBUG_LEVEL == 2
31413162 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
31423163 "string::erase(iterator) called with an iterator not"
31433164 " referring to this string");
......@@ -3155,7 +3176,7 @@ inline
31553176typename basic_string<_CharT, _Traits, _Allocator>::iterator
31563177basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
31573178{
3158#if _LIBCPP_DEBUG_LEVEL >= 2
3179#if _LIBCPP_DEBUG_LEVEL == 2
31593180 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
31603181 "string::erase(iterator, iterator) called with an iterator not"
31613182 " referring to this string");
......@@ -3262,65 +3283,88 @@ basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
32623283
32633284template <class _CharT, class _Traits, class _Allocator>
32643285void
3265basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
3286basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
32663287{
3267 if (__res_arg > max_size())
3288 if (__requested_capacity > max_size())
32683289 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
3303template <class _CharT, class _Traits, class _Allocator>
3304void
3305basic_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
3313template <class _CharT, class _Traits, class _Allocator>
3314void
3315basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)
3316{
32693317 size_type __cap = capacity();
32703318 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)
32743323 {
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);
32843333 else
32853334 {
3286 if (__res_arg > __cap)
3287 __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
3288 else
3335 #ifndef _LIBCPP_NO_EXCEPTIONS
3336 try
32893337 {
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
33053341 }
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
33193350 }
3320 else
3321 __set_short_size(__sz);
3322 __invalidate_all_iterators();
3351 __now_long = true;
3352 __was_long = __is_long();
3353 __p = __get_pointer();
33233354 }
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();
33243368}
33253369
33263370template <class _CharT, class _Traits, class _Allocator>
......@@ -3426,7 +3470,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
34263470 __is_nothrow_swappable<allocator_type>::value)
34273471#endif
34283472{
3429#if _LIBCPP_DEBUG_LEVEL >= 2
3473#if _LIBCPP_DEBUG_LEVEL == 2
34303474 if (!__is_long())
34313475 __get_db()->__invalidate_all(this);
34323476 if (!__str.__is_long())
......@@ -3438,7 +3482,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
34383482 __alloc_traits::is_always_equal::value ||
34393483 __alloc() == __str.__alloc(), "swapping non-equal allocators");
34403484 _VSTD::swap(__r_.first(), __str.__r_.first());
3441 __swap_allocator(__alloc(), __str.__alloc());
3485 _VSTD::__swap_allocator(__alloc(), __str.__alloc());
34423486}
34433487
34443488// find
......@@ -3939,9 +3983,9 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
39393983 return false;
39403984 if (capacity() < __min_cap - 1)
39413985 return false;
3942 if (data() == 0)
3986 if (data() == nullptr)
39433987 return false;
3944 if (data()[size()] != value_type(0))
3988 if (data()[size()] != value_type())
39453989 return false;
39463990 return true;
39473991}
......@@ -3959,6 +4003,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
39594003 __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1);
39604004 __set_long_cap(0);
39614005 __set_short_size(0);
4006 traits_type::assign(*__get_short_pointer(), value_type());
39624007 }
39634008}
39644009
......@@ -4300,24 +4345,15 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
43004345 __lhs.swap(__rhs);
43014346}
43024347
4303#ifndef _LIBCPP_NO_HAS_CHAR8_T
4304typedef basic_string<char8_t> u8string;
4305#endif
4306
4307#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
4308typedef basic_string<char16_t> u16string;
4309typedef 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);
43174353
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);
43214357
43224358_LIBCPP_FUNC_VIS string to_string(int __val);
43234359_LIBCPP_FUNC_VIS string to_string(unsigned __val);
......@@ -4329,15 +4365,15 @@ _LIBCPP_FUNC_VIS string to_string(float __val);
43294365_LIBCPP_FUNC_VIS string to_string(double __val);
43304366_LIBCPP_FUNC_VIS string to_string(long double __val);
43314367
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);
43374373
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);
43414377
43424378_LIBCPP_FUNC_VIS wstring to_wstring(int __val);
43434379_LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val);
......@@ -4425,7 +4461,7 @@ inline _LIBCPP_INLINE_VISIBILITY
44254461}
44264462#endif
44274463
4428#if _LIBCPP_DEBUG_LEVEL >= 2
4464#if _LIBCPP_DEBUG_LEVEL == 2
44294465
44304466template<class _CharT, class _Traits, class _Allocator>
44314467bool
......@@ -4459,7 +4495,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
44594495 return this->data() <= __p && __p < this->data() + this->size();
44604496}
44614497
4462#endif // _LIBCPP_DEBUG_LEVEL >= 2
4498#endif // _LIBCPP_DEBUG_LEVEL == 2
44634499
44644500#if _LIBCPP_STD_VER > 11
44654501// Literal suffixes for basic_string [basic.string.literals]
lib/libcxx/include/string_view+24-11
......@@ -192,7 +192,26 @@ _LIBCPP_PUSH_MACROS
192192_LIBCPP_BEGIN_NAMESPACE_STD
193193
194194template<class _CharT, class _Traits = char_traits<_CharT> >
195class _LIBCPP_TEMPLATE_VIS basic_string_view {
195 class _LIBCPP_TEMPLATE_VIS basic_string_view;
196
197typedef basic_string_view<char> string_view;
198#ifndef _LIBCPP_NO_HAS_CHAR8_T
199typedef basic_string_view<char8_t> u8string_view;
200#endif
201typedef basic_string_view<char16_t> u16string_view;
202typedef basic_string_view<char32_t> u32string_view;
203typedef basic_string_view<wchar_t> wstring_view;
204
205template<class _CharT, class _Traits>
206class
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 {
196215public:
197216 // types
198217 typedef _Traits traits_type;
......@@ -236,7 +255,7 @@ public:
236255
237256 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
238257 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)) {}
240259
241260 // [string.view.iterators], iterators
242261 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
......@@ -278,7 +297,9 @@ public:
278297
279298 // [string.view.access], element access
280299 _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 }
282303
283304 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
284305 const_reference at(size_type __pos) const
......@@ -774,14 +795,6 @@ basic_ostream<_CharT, _Traits>&
774795operator<<(basic_ostream<_CharT, _Traits>& __os,
775796 basic_string_view<_CharT, _Traits> __str);
776797
777typedef basic_string_view<char> string_view;
778#ifndef _LIBCPP_NO_HAS_CHAR8_T
779typedef basic_string_view<char8_t> u8string_view;
780#endif
781typedef basic_string_view<char16_t> u16string_view;
782typedef basic_string_view<char32_t> u32string_view;
783typedef basic_string_view<wchar_t> wstring_view;
784
785798// [string.view.hash]
786799template<class _CharT>
787800struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > >
lib/libcxx/include/strstream+8-8
......@@ -19,12 +19,12 @@ class strstreambuf
1919public:
2020 explicit strstreambuf(streamsize alsize_arg = 0);
2121 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);
2323 strstreambuf(const char* gnext_arg, streamsize n);
2424
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);
2626 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);
2828 strstreambuf(const unsigned char* gnext_arg, streamsize n);
2929
3030 strstreambuf(strstreambuf&& rhs);
......@@ -142,12 +142,12 @@ class _LIBCPP_TYPE_VIS strstreambuf
142142public:
143143 explicit strstreambuf(streamsize __alsize = 0);
144144 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);
146146 strstreambuf(const char* __gnext, streamsize __n);
147147
148 strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0);
148 strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
149149 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);
151151 strstreambuf(const unsigned char* __gnext, streamsize __n);
152152
153153#ifndef _LIBCPP_CXX03_LANG
......@@ -290,7 +290,7 @@ public:
290290 _LIBCPP_INLINE_VISIBILITY
291291 ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
292292 : 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))
294294 {}
295295
296296#ifndef _LIBCPP_CXX03_LANG
......@@ -350,7 +350,7 @@ public:
350350 _LIBCPP_INLINE_VISIBILITY
351351 strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
352352 : 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))
354354 {}
355355
356356#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
15inline 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 @@
1111#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
1212#include <support/ibm/locale_mgmt_aix.h>
1313
14#if defined(_AIX)
1514#include "cstdlib"
1615
1716#ifdef __cplusplus
1817extern "C" {
1918#endif
2019
20#if defined(_AIX)
2121#if !defined(_AIX71)
2222// AIX 7.1 and higher has these definitions. Definitions and stubs
2323// 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,
207207}
208208#endif // !defined(_AIX71)
209209
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.
212212static inline
213213size_t strftime_l(char *__s, size_t __size, const char *__fmt,
214214 const struct tm *__tm, locale_t locale) {
215215 return __xstrftime(locale, __s, __size, __fmt, __tm);
216216}
217217
218#elif defined(__MVS__)
219#include <wctype.h>
220// POSIX routines
221#include <support/xlocale/__posix_l_fallback.h>
222#endif // defined(__MVS__)
223
218224// The following are not POSIX routines. These are quick-and-dirty hacks
219225// to make things pretend to work
220226static inline
......@@ -266,5 +272,4 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
266272#ifdef __cplusplus
267273}
268274#endif
269#endif // defined(_AIX)
270275#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 );
201201#define strtof_l _strtof_l
202202#define strtold_l _strtold_l
203203#else
204float strtof_l(const char*, char**, locale_t);
205long 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);
206206#endif
207207inline _LIBCPP_INLINE_VISIBILITY
208208int
lib/libcxx/include/system_error+2-2
......@@ -253,7 +253,7 @@ public:
253253 template <class _Ep>
254254 _LIBCPP_INLINE_VISIBILITY
255255 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
257257 ) _NOEXCEPT
258258 {*this = make_error_condition(__e);}
259259
......@@ -325,7 +325,7 @@ public:
325325 template <class _Ep>
326326 _LIBCPP_INLINE_VISIBILITY
327327 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
329329 ) _NOEXCEPT
330330 {*this = make_error_code(__e);}
331331
lib/libcxx/include/thread+21-24
......@@ -277,18 +277,18 @@ inline _LIBCPP_INLINE_VISIBILITY
277277void
278278__thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
279279{
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))...);
281281}
282282
283283template <class _Fp>
284284_LIBCPP_INLINE_VISIBILITY
285285void* __thread_proxy(void* __vp)
286286{
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());
290290 typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
291 __thread_execute(*__p, _Index());
291 _VSTD::__thread_execute(*__p.get(), _Index());
292292 return nullptr;
293293}
294294
......@@ -300,11 +300,11 @@ thread::thread(_Fp&& __f, _Args&&... __args)
300300 typedef unique_ptr<__thread_struct> _TSPtr;
301301 _TSPtr __tsp(new __thread_struct);
302302 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());
308308 if (__ec == 0)
309309 __p.release();
310310 else
......@@ -326,7 +326,7 @@ struct __thread_invoke_pair {
326326template <class _Fp>
327327void* __thread_proxy_cxx03(void* __vp)
328328{
329 std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
329 unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
330330 __thread_local_data().set_pointer(__p->__tsp_.release());
331331 (__p->__fn_)();
332332 return nullptr;
......@@ -337,9 +337,9 @@ thread::thread(_Fp __f)
337337{
338338
339339 typedef __thread_invoke_pair<_Fp> _InvokePair;
340 typedef std::unique_ptr<_InvokePair> _PairPtr;
340 typedef unique_ptr<_InvokePair> _PairPtr;
341341 _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());
343343 if (__ec == 0)
344344 __pp.release();
345345 else
......@@ -360,25 +360,24 @@ template <class _Rep, class _Period>
360360void
361361sleep_for(const chrono::duration<_Rep, _Period>& __d)
362362{
363 using namespace chrono;
364 if (__d > duration<_Rep, _Period>::zero())
363 if (__d > chrono::duration<_Rep, _Period>::zero())
365364 {
366365#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
367366 // 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) ;
369368#else
370 _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
369 _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::nanoseconds::max();
371370#endif
372 nanoseconds __ns;
371 chrono::nanoseconds __ns;
373372 if (__d < _Max)
374373 {
375 __ns = duration_cast<nanoseconds>(__d);
374 __ns = chrono::duration_cast<chrono::nanoseconds>(__d);
376375 if (__ns < __d)
377376 ++__ns;
378377 }
379378 else
380 __ns = nanoseconds::max();
381 sleep_for(__ns);
379 __ns = chrono::nanoseconds::max();
380 this_thread::sleep_for(__ns);
382381 }
383382}
384383
......@@ -386,7 +385,6 @@ template <class _Clock, class _Duration>
386385void
387386sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
388387{
389 using namespace chrono;
390388 mutex __mut;
391389 condition_variable __cv;
392390 unique_lock<mutex> __lk(__mut);
......@@ -399,8 +397,7 @@ inline _LIBCPP_INLINE_VISIBILITY
399397void
400398sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
401399{
402 using namespace chrono;
403 sleep_for(__t - steady_clock::now());
400 this_thread::sleep_for(__t - chrono::steady_clock::now());
404401}
405402
406403inline _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/tuple+1-1
......@@ -1393,7 +1393,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
13931393
13941394template <class _T1, class _T2>
13951395template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
1396inline _LIBCPP_INLINE_VISIBILITY
1396inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
13971397pair<_T1, _T2>::pair(piecewise_construct_t,
13981398 tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
13991399 __tuple_indices<_I1...>, __tuple_indices<_I2...>)
lib/libcxx/include/type_traits+93-238
......@@ -514,7 +514,7 @@ template <template <class...> class, class ...>
514514false_type __sfinae_test_impl(...);
515515
516516template <template <class ...> class _Templ, class ..._Args>
517using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
517using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(__sfinae_test_impl<_Templ, _Args...>(0));
518518
519519template <class>
520520struct __void_t { typedef void type; };
......@@ -595,75 +595,6 @@ using __is_primary_template = _IsValidExpansion<
595595 __test_for_primary_template, _Tp
596596 >;
597597
598// addressof
599#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
600
601template <class _Tp>
602inline _LIBCPP_CONSTEXPR_AFTER_CXX14
603_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
604_Tp*
605addressof(_Tp& __x) _NOEXCEPT
606{
607 return __builtin_addressof(__x);
608}
609
610#else
611
612template <class _Tp>
613inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
614_Tp*
615addressof(_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.
628template <class _Tp>
629inline _LIBCPP_INLINE_VISIBILITY
630__strong _Tp*
631addressof(__strong _Tp& __x) _NOEXCEPT
632{
633 return &__x;
634}
635
636#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
637template <class _Tp>
638inline _LIBCPP_INLINE_VISIBILITY
639__weak _Tp*
640addressof(__weak _Tp& __x) _NOEXCEPT
641{
642 return &__x;
643}
644#endif
645
646template <class _Tp>
647inline _LIBCPP_INLINE_VISIBILITY
648__autoreleasing _Tp*
649addressof(__autoreleasing _Tp& __x) _NOEXCEPT
650{
651 return &__x;
652}
653
654template <class _Tp>
655inline _LIBCPP_INLINE_VISIBILITY
656__unsafe_unretained _Tp*
657addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
658{
659 return &__x;
660}
661#endif
662
663#if !defined(_LIBCPP_CXX03_LANG)
664template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
665#endif
666
667598struct __two {char __lx[2];};
668599
669600// helper class:
......@@ -1821,7 +1752,7 @@ template <typename _Tp>
18211752static void __test_noexcept(_Tp) noexcept;
18221753
18231754template<typename _Fm, typename _To>
1824static bool_constant<noexcept(__test_noexcept<_To>(declval<_Fm>()))>
1755static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(declval<_Fm>()))>
18251756__is_nothrow_convertible_test();
18261757
18271758template <typename _Fm, typename _To>
......@@ -2550,7 +2481,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v = __is_destructible(
25502481// if it's a function, return false
25512482// if it's void, return false
25522483// 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
25542485// where _Up is remove_all_extents<_Tp>::type
25552486
25562487template <class>
......@@ -2876,167 +2807,13 @@ struct __member_pointer_class_type<_Ret _ClassType::*> {
28762807 typedef _ClassType type;
28772808};
28782809
2879// result_of
2880
2881template <class _Callable> class result_of;
2882
2883#ifdef _LIBCPP_HAS_NO_VARIADICS
2884
2885template <class _Fn, bool, bool>
2886class __result_of
2887{
2888};
2889
2890template <class _Fn>
2891class __result_of<_Fn(), true, false>
2892{
2893public:
2894 typedef decltype(declval<_Fn>()()) type;
2895};
2896
2897template <class _Fn, class _A0>
2898class __result_of<_Fn(_A0), true, false>
2899{
2900public:
2901 typedef decltype(declval<_Fn>()(declval<_A0>())) type;
2902};
2903
2904template <class _Fn, class _A0, class _A1>
2905class __result_of<_Fn(_A0, _A1), true, false>
2906{
2907public:
2908 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
2909};
2910
2911template <class _Fn, class _A0, class _A1, class _A2>
2912class __result_of<_Fn(_A0, _A1, _A2), true, false>
2913{
2914public:
2915 typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
2916};
2917
2918template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
2919struct __result_of_mp;
2920
2921// member function pointer
2922
2923template <class _MP, class _Tp>
2924struct __result_of_mp<_MP, _Tp, true>
2925 : public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
2926{
2927};
2928
2929// member data pointer
2930
2931template <class _MP, class _Tp, bool>
2932struct __result_of_mdp;
2933
2934template <class _Rp, class _Class, class _Tp>
2935struct __result_of_mdp<_Rp _Class::*, _Tp, false>
2936{
2937 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
2938};
2939
2940template <class _Rp, class _Class, class _Tp>
2941struct __result_of_mdp<_Rp _Class::*, _Tp, true>
2942{
2943 typedef typename __apply_cv<_Tp, _Rp>::type& type;
2944};
2945
2946template <class _Rp, class _Class, class _Tp>
2947struct __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
2955template <class _Fn, class _Tp>
2956class __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
2963template <class _Fn, class _Tp, class _A0>
2964class __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
2971template <class _Fn, class _Tp, class _A0, class _A1>
2972class __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
2979template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
2980class __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
2989template <class _Fn>
2990class _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
2999template <class _Fn, class _A0>
3000class _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
3009template <class _Fn, class _A0, class _A1>
3010class _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
3019template <class _Fn, class _A0, class _A1, class _A2>
3020class _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
30312810// template <class T, class... Args> struct is_constructible;
30322811
3033namespace __is_construct
3034{
3035struct __nat {};
3036}
2812#if defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW >= 10000
2813# define _LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE
2814#endif
30372815
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)
30402817
30412818template <class _Tp, class... _Args>
30422819struct __libcpp_is_constructible;
......@@ -3151,7 +2928,7 @@ struct __libcpp_is_constructible<_Tp&&, _A0>
31512928
31522929#endif
31532930
3154#if __has_feature(is_constructible)
2931#if __has_feature(is_constructible) || defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE)
31552932template <class _Tp, class ..._Args>
31562933struct _LIBCPP_TEMPLATE_VIS is_constructible
31572934 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
......@@ -3442,7 +3219,7 @@ void __implicit_conversion_to(_Tp) noexcept { }
34423219
34433220template <class _Tp, class _Arg>
34443221struct __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>()))>
34463223{
34473224};
34483225
......@@ -3982,14 +3759,97 @@ struct __invoke_of
39823759{
39833760};
39843761
3762#endif // _LIBCPP_CXX03_LANG
3763
39853764// result_of
39863765
3766template <class _Callable> class result_of;
3767
3768#ifndef _LIBCPP_CXX03_LANG
3769
39873770template <class _Fp, class ..._Args>
39883771class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
39893772 : public __invoke_of<_Fp, _Args...>
39903773{
39913774};
39923775
3776#else // C++03
3777
3778template <class _Fn, bool, bool>
3779class __result_of
3780{
3781};
3782
3783template <class _Fn, class ..._Args>
3784class __result_of<_Fn(_Args...), true, false>
3785{
3786public:
3787 typedef decltype(declval<_Fn>()(declval<_Args>()...)) type;
3788};
3789
3790template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
3791struct __result_of_mp;
3792
3793// member function pointer
3794
3795template <class _MP, class _Tp>
3796struct __result_of_mp<_MP, _Tp, true>
3797 : public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
3798{
3799};
3800
3801// member data pointer
3802
3803template <class _MP, class _Tp, bool>
3804struct __result_of_mdp;
3805
3806template <class _Rp, class _Class, class _Tp>
3807struct __result_of_mdp<_Rp _Class::*, _Tp, false>
3808{
3809 typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
3810};
3811
3812template <class _Rp, class _Class, class _Tp>
3813struct __result_of_mdp<_Rp _Class::*, _Tp, true>
3814{
3815 typedef typename __apply_cv<_Tp, _Rp>::type& type;
3816};
3817
3818template <class _Rp, class _Class, class _Tp>
3819struct __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
3825template <class _Fn, class _Tp>
3826class __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
3833template <class _Fn, class _Tp, class ..._Args>
3834class __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
3841template <class _Fn, class ..._Args>
3842class _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
39933853#if _LIBCPP_STD_VER > 11
39943854template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
39953855#endif
......@@ -4045,8 +3905,6 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v
40453905
40463906#endif // _LIBCPP_STD_VER > 14
40473907
4048#endif // !defined(_LIBCPP_CXX03_LANG)
4049
40503908template <class _Tp> struct __is_swappable;
40513909template <class _Tp> struct __is_nothrow_swappable;
40523910
......@@ -4341,7 +4199,6 @@ _LIBCPP_INLINE_VAR constexpr bool negation_v
43414199#endif // _LIBCPP_STD_VER > 14
43424200
43434201// These traits are used in __tree and __hash_table
4344#ifndef _LIBCPP_CXX03_LANG
43454202struct __extract_key_fail_tag {};
43464203struct __extract_key_self_tag {};
43474204struct __extract_key_first_tag {};
......@@ -4353,7 +4210,7 @@ struct __can_extract_key
43534210 __extract_key_fail_tag>::type {};
43544211
43554212template <class _Pair, class _Key, class _First, class _Second>
4356struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
4213struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
43574214 : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value,
43584215 __extract_key_first_tag, __extract_key_fail_tag>::type {};
43594216
......@@ -4371,8 +4228,6 @@ template <class _ValTy, class _Key, class _RawValTy>
43714228struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
43724229 : false_type {};
43734230
4374#endif
4375
43764231#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
43774232#if _LIBCPP_STD_VER > 17
43784233_LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/typeinfo+24-5
......@@ -57,6 +57,7 @@ public:
5757*/
5858
5959#include <__config>
60#include <__availability>
6061#include <exception>
6162#include <cstddef>
6263#include <cstdint>
......@@ -141,7 +142,7 @@ public:
141142// comparison is equal.
142143// -------------------------------------------------------------------------- //
143144// NonUniqueARMRTTIBit
144// (selected on ARM64 regardless of _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
145// (_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 3)
145146// -------------------------------------------------------------------------- //
146147// This implementation of type_info does not assume always a unique copy of
147148// the RTTI for a given type inside a program. It packs the pointer to the
......@@ -160,6 +161,24 @@ public:
160161// the pointer when it constructs the type_info, depending on whether it can
161162// guarantee uniqueness for that specific type_info.
162163
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
163182struct __type_info_implementations {
164183 struct __string_impl_base {
165184 typedef const char* __type_name_t;
......@@ -243,7 +262,7 @@ struct __type_info_implementations {
243262 private:
244263 // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
245264 // this implementation is actually used.
246 typedef std::integral_constant<__type_name_t,
265 typedef integral_constant<__type_name_t,
247266 (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
248267
249268 _LIBCPP_INLINE_VISIBILITY
......@@ -257,12 +276,12 @@ struct __type_info_implementations {
257276 };
258277
259278 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
263280 __unique_impl
264281#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
265282 __non_unique_impl
283#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
284 __non_unique_arm_rtti_bit_impl
266285#else
267286# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
268287#endif
lib/libcxx/include/unordered_map+203-67
......@@ -173,10 +173,22 @@ public:
173173
174174 iterator find(const key_type& k);
175175 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
176180 size_type count(const key_type& k) const;
181 template<typename K>
182 size_type count(const K& k) const; // C++20
177183 bool contains(const key_type& k) const; // C++20
184 template<typename K>
185 bool contains(const K& k) const; // C++20
178186 pair<iterator, iterator> equal_range(const key_type& k);
179187 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
180192
181193 mapped_type& operator[](const key_type& k);
182194 mapped_type& operator[](key_type&& k);
......@@ -355,10 +367,22 @@ public:
355367
356368 iterator find(const key_type& k);
357369 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
358374 size_type count(const key_type& k) const;
375 template<typename K>
376 size_type count(const K& k) const; // C++20
359377 bool contains(const key_type& k) const; // C++20
378 template<typename K>
379 bool contains(const K& k) const; // C++20
360380 pair<iterator, iterator> equal_range(const key_type& k);
361381 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
362386
363387 size_type bucket_count() const noexcept;
364388 size_type max_bucket_count() const noexcept;
......@@ -423,7 +447,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
423447
424448_LIBCPP_BEGIN_NAMESPACE_STD
425449
426template <class _Key, class _Cp, class _Hash,
450template <class _Key, class _Cp, class _Hash, class _Pred,
427451 bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
428452class __unordered_map_hasher
429453 : private _Hash
......@@ -445,6 +469,12 @@ public:
445469 _LIBCPP_INLINE_VISIBILITY
446470 size_t operator()(const _Key& __x) const
447471 {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
448478 void swap(__unordered_map_hasher&__y)
449479 _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
450480 {
......@@ -453,8 +483,8 @@ public:
453483 }
454484};
455485
456template <class _Key, class _Cp, class _Hash>
457class __unordered_map_hasher<_Key, _Cp, _Hash, false>
486template <class _Key, class _Cp, class _Hash, class _Pred>
487class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false>
458488{
459489 _Hash __hash_;
460490public:
......@@ -474,6 +504,12 @@ public:
474504 _LIBCPP_INLINE_VISIBILITY
475505 size_t operator()(const _Key& __x) const
476506 {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
477513 void swap(__unordered_map_hasher&__y)
478514 _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
479515 {
......@@ -482,17 +518,17 @@ public:
482518 }
483519};
484520
485template <class _Key, class _Cp, class _Hash, bool __b>
521template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
486522inline _LIBCPP_INLINE_VISIBILITY
487523void
488swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
489 __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y)
524swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
525 __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y)
490526 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
491527{
492528 __x.swap(__y);
493529}
494530
495template <class _Key, class _Cp, class _Pred,
531template <class _Key, class _Cp, class _Pred, class _Hash,
496532 bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
497533class __unordered_map_equal
498534 : private _Pred
......@@ -517,6 +553,24 @@ public:
517553 _LIBCPP_INLINE_VISIBILITY
518554 bool operator()(const _Key& __x, const _Cp& __y) const
519555 {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
520574 void swap(__unordered_map_equal&__y)
521575 _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
522576 {
......@@ -525,8 +579,8 @@ public:
525579 }
526580};
527581
528template <class _Key, class _Cp, class _Pred>
529class __unordered_map_equal<_Key, _Cp, _Pred, false>
582template <class _Key, class _Cp, class _Pred, class _Hash>
583class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false>
530584{
531585 _Pred __pred_;
532586public:
......@@ -549,6 +603,24 @@ public:
549603 _LIBCPP_INLINE_VISIBILITY
550604 bool operator()(const _Key& __x, const _Cp& __y) const
551605 {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
552624 void swap(__unordered_map_equal&__y)
553625 _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
554626 {
......@@ -557,11 +629,11 @@ public:
557629 }
558630};
559631
560template <class _Key, class _Cp, class _Pred, bool __b>
632template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
561633inline _LIBCPP_INLINE_VISIBILITY
562634void
563swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x,
564 __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y)
635swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x,
636 __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
565637 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
566638{
567639 __x.swap(__y);
......@@ -858,11 +930,11 @@ public:
858930 "Invalid allocator::value_type");
859931
860932private:
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;
864936 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
865 __value_type>::type __allocator_type;
937 __value_type>::type __allocator_type;
866938
867939 typedef __hash_table<__value_type, __hasher,
868940 __key_equal, __allocator_type> __table;
......@@ -906,7 +978,7 @@ public:
906978 unordered_map()
907979 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
908980 {
909#if _LIBCPP_DEBUG_LEVEL >= 2
981#if _LIBCPP_DEBUG_LEVEL == 2
910982 __get_db()->__insert_c(this);
911983#endif
912984 }
......@@ -1025,7 +1097,7 @@ public:
10251097 {return __table_.__insert_unique(__x);}
10261098
10271099 iterator insert(const_iterator __p, const value_type& __x) {
1028#if _LIBCPP_DEBUG_LEVEL >= 2
1100#if _LIBCPP_DEBUG_LEVEL == 2
10291101 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
10301102 "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
10311103 " referring to this unordered_map");
......@@ -1049,7 +1121,7 @@ public:
10491121 {return __table_.__insert_unique(_VSTD::move(__x));}
10501122
10511123 iterator insert(const_iterator __p, value_type&& __x) {
1052#if _LIBCPP_DEBUG_LEVEL >= 2
1124#if _LIBCPP_DEBUG_LEVEL == 2
10531125 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
10541126 "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
10551127 " referring to this unordered_map");
......@@ -1070,7 +1142,7 @@ public:
10701142 _LIBCPP_INLINE_VISIBILITY
10711143 iterator insert(const_iterator __p, _Pp&& __x)
10721144 {
1073#if _LIBCPP_DEBUG_LEVEL >= 2
1145#if _LIBCPP_DEBUG_LEVEL == 2
10741146 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
10751147 "unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
10761148 " referring to this unordered_map");
......@@ -1089,7 +1161,7 @@ public:
10891161 template <class... _Args>
10901162 _LIBCPP_INLINE_VISIBILITY
10911163 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
1092#if _LIBCPP_DEBUG_LEVEL >= 2
1164#if _LIBCPP_DEBUG_LEVEL == 2
10931165 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
10941166 "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
10951167 " referring to this unordered_map");
......@@ -1106,7 +1178,7 @@ public:
11061178 _LIBCPP_INLINE_VISIBILITY
11071179 pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
11081180 {
1109 return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct,
1181 return __table_.__emplace_unique_key_args(__k, piecewise_construct,
11101182 _VSTD::forward_as_tuple(__k),
11111183 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
11121184 }
......@@ -1115,7 +1187,7 @@ public:
11151187 _LIBCPP_INLINE_VISIBILITY
11161188 pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
11171189 {
1118 return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct,
1190 return __table_.__emplace_unique_key_args(__k, piecewise_construct,
11191191 _VSTD::forward_as_tuple(_VSTD::move(__k)),
11201192 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
11211193 }
......@@ -1124,7 +1196,7 @@ public:
11241196 _LIBCPP_INLINE_VISIBILITY
11251197 iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
11261198 {
1127#if _LIBCPP_DEBUG_LEVEL >= 2
1199#if _LIBCPP_DEBUG_LEVEL == 2
11281200 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
11291201 "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
11301202 " referring to this unordered_map");
......@@ -1138,7 +1210,7 @@ public:
11381210 _LIBCPP_INLINE_VISIBILITY
11391211 iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
11401212 {
1141#if _LIBCPP_DEBUG_LEVEL >= 2
1213#if _LIBCPP_DEBUG_LEVEL == 2
11421214 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
11431215 "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
11441216 " referring to this unordered_map");
......@@ -1280,11 +1352,34 @@ public:
12801352 iterator find(const key_type& __k) {return __table_.find(__k);}
12811353 _LIBCPP_INLINE_VISIBILITY
12821354 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
12831367 _LIBCPP_INLINE_VISIBILITY
12841368 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
12851375 #if _LIBCPP_STD_VER > 17
12861376 _LIBCPP_INLINE_VISIBILITY
12871377 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();}
12881383 #endif // _LIBCPP_STD_VER > 17
12891384 _LIBCPP_INLINE_VISIBILITY
12901385 pair<iterator, iterator> equal_range(const key_type& __k)
......@@ -1292,6 +1387,16 @@ public:
12921387 _LIBCPP_INLINE_VISIBILITY
12931388 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
12941389 {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
12951400
12961401 mapped_type& operator[](const key_type& __k);
12971402#ifndef _LIBCPP_CXX03_LANG
......@@ -1336,7 +1441,7 @@ public:
13361441 _LIBCPP_INLINE_VISIBILITY
13371442 void reserve(size_type __n) {__table_.reserve(__n);}
13381443
1339#if _LIBCPP_DEBUG_LEVEL >= 2
1444#if _LIBCPP_DEBUG_LEVEL == 2
13401445
13411446 bool __dereferenceable(const const_iterator* __i) const
13421447 {return __table_.__dereferenceable(&__i->__i_);}
......@@ -1347,7 +1452,7 @@ public:
13471452 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
13481453 {return __table_.__addable(&__i->__i_, __n);}
13491454
1350#endif // _LIBCPP_DEBUG_LEVEL >= 2
1455#endif // _LIBCPP_DEBUG_LEVEL == 2
13511456
13521457private:
13531458
......@@ -1428,7 +1533,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14281533 size_type __n, const hasher& __hf, const key_equal& __eql)
14291534 : __table_(__hf, __eql)
14301535{
1431#if _LIBCPP_DEBUG_LEVEL >= 2
1536#if _LIBCPP_DEBUG_LEVEL == 2
14321537 __get_db()->__insert_c(this);
14331538#endif
14341539 __table_.rehash(__n);
......@@ -1440,7 +1545,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14401545 const allocator_type& __a)
14411546 : __table_(__hf, __eql, typename __table::allocator_type(__a))
14421547{
1443#if _LIBCPP_DEBUG_LEVEL >= 2
1548#if _LIBCPP_DEBUG_LEVEL == 2
14441549 __get_db()->__insert_c(this);
14451550#endif
14461551 __table_.rehash(__n);
......@@ -1452,7 +1557,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14521557 const allocator_type& __a)
14531558 : __table_(typename __table::allocator_type(__a))
14541559{
1455#if _LIBCPP_DEBUG_LEVEL >= 2
1560#if _LIBCPP_DEBUG_LEVEL == 2
14561561 __get_db()->__insert_c(this);
14571562#endif
14581563}
......@@ -1462,7 +1567,7 @@ template <class _InputIterator>
14621567unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14631568 _InputIterator __first, _InputIterator __last)
14641569{
1465#if _LIBCPP_DEBUG_LEVEL >= 2
1570#if _LIBCPP_DEBUG_LEVEL == 2
14661571 __get_db()->__insert_c(this);
14671572#endif
14681573 insert(__first, __last);
......@@ -1475,7 +1580,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14751580 const hasher& __hf, const key_equal& __eql)
14761581 : __table_(__hf, __eql)
14771582{
1478#if _LIBCPP_DEBUG_LEVEL >= 2
1583#if _LIBCPP_DEBUG_LEVEL == 2
14791584 __get_db()->__insert_c(this);
14801585#endif
14811586 __table_.rehash(__n);
......@@ -1489,7 +1594,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
14891594 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
14901595 : __table_(__hf, __eql, typename __table::allocator_type(__a))
14911596{
1492#if _LIBCPP_DEBUG_LEVEL >= 2
1597#if _LIBCPP_DEBUG_LEVEL == 2
14931598 __get_db()->__insert_c(this);
14941599#endif
14951600 __table_.rehash(__n);
......@@ -1501,7 +1606,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15011606 const unordered_map& __u)
15021607 : __table_(__u.__table_)
15031608{
1504#if _LIBCPP_DEBUG_LEVEL >= 2
1609#if _LIBCPP_DEBUG_LEVEL == 2
15051610 __get_db()->__insert_c(this);
15061611#endif
15071612 __table_.rehash(__u.bucket_count());
......@@ -1513,7 +1618,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15131618 const unordered_map& __u, const allocator_type& __a)
15141619 : __table_(__u.__table_, typename __table::allocator_type(__a))
15151620{
1516#if _LIBCPP_DEBUG_LEVEL >= 2
1621#if _LIBCPP_DEBUG_LEVEL == 2
15171622 __get_db()->__insert_c(this);
15181623#endif
15191624 __table_.rehash(__u.bucket_count());
......@@ -1529,7 +1634,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15291634 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
15301635 : __table_(_VSTD::move(__u.__table_))
15311636{
1532#if _LIBCPP_DEBUG_LEVEL >= 2
1637#if _LIBCPP_DEBUG_LEVEL == 2
15331638 __get_db()->__insert_c(this);
15341639 __get_db()->swap(this, &__u);
15351640#endif
......@@ -1540,7 +1645,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15401645 unordered_map&& __u, const allocator_type& __a)
15411646 : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
15421647{
1543#if _LIBCPP_DEBUG_LEVEL >= 2
1648#if _LIBCPP_DEBUG_LEVEL == 2
15441649 __get_db()->__insert_c(this);
15451650#endif
15461651 if (__a != __u.get_allocator())
......@@ -1551,7 +1656,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15511656 __u.__table_.remove((__i++).__i_)->__value_.__move());
15521657 }
15531658 }
1554#if _LIBCPP_DEBUG_LEVEL >= 2
1659#if _LIBCPP_DEBUG_LEVEL == 2
15551660 else
15561661 __get_db()->swap(this, &__u);
15571662#endif
......@@ -1561,7 +1666,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
15611666unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15621667 initializer_list<value_type> __il)
15631668{
1564#if _LIBCPP_DEBUG_LEVEL >= 2
1669#if _LIBCPP_DEBUG_LEVEL == 2
15651670 __get_db()->__insert_c(this);
15661671#endif
15671672 insert(__il.begin(), __il.end());
......@@ -1573,7 +1678,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15731678 const key_equal& __eql)
15741679 : __table_(__hf, __eql)
15751680{
1576#if _LIBCPP_DEBUG_LEVEL >= 2
1681#if _LIBCPP_DEBUG_LEVEL == 2
15771682 __get_db()->__insert_c(this);
15781683#endif
15791684 __table_.rehash(__n);
......@@ -1586,7 +1691,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
15861691 const key_equal& __eql, const allocator_type& __a)
15871692 : __table_(__hf, __eql, typename __table::allocator_type(__a))
15881693{
1589#if _LIBCPP_DEBUG_LEVEL >= 2
1694#if _LIBCPP_DEBUG_LEVEL == 2
15901695 __get_db()->__insert_c(this);
15911696#endif
15921697 __table_.rehash(__n);
......@@ -1633,8 +1738,8 @@ _Tp&
16331738unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
16341739{
16351740 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;
16381743}
16391744
16401745template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
......@@ -1642,8 +1747,8 @@ _Tp&
16421747unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
16431748{
16441749 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;
16471752}
16481753#else // _LIBCPP_CXX03_LANG
16491754
......@@ -1657,7 +1762,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const
16571762 __h.get_deleter().__first_constructed = true;
16581763 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
16591764 __h.get_deleter().__second_constructed = true;
1660 return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
1765 return __h;
16611766}
16621767
16631768template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
......@@ -1762,11 +1867,11 @@ public:
17621867 "Invalid allocator::value_type");
17631868
17641869private:
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;
17681873 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
1769 __value_type>::type __allocator_type;
1874 __value_type>::type __allocator_type;
17701875
17711876 typedef __hash_table<__value_type, __hasher,
17721877 __key_equal, __allocator_type> __table;
......@@ -1807,7 +1912,7 @@ public:
18071912 unordered_multimap()
18081913 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
18091914 {
1810#if _LIBCPP_DEBUG_LEVEL >= 2
1915#if _LIBCPP_DEBUG_LEVEL == 2
18111916 __get_db()->__insert_c(this);
18121917#endif
18131918 }
......@@ -2059,11 +2164,32 @@ public:
20592164 iterator find(const key_type& __k) {return __table_.find(__k);}
20602165 _LIBCPP_INLINE_VISIBILITY
20612166 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
20622177 _LIBCPP_INLINE_VISIBILITY
20632178 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
20642185 #if _LIBCPP_STD_VER > 17
20652186 _LIBCPP_INLINE_VISIBILITY
20662187 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();}
20672193 #endif // _LIBCPP_STD_VER > 17
20682194 _LIBCPP_INLINE_VISIBILITY
20692195 pair<iterator, iterator> equal_range(const key_type& __k)
......@@ -2071,6 +2197,16 @@ public:
20712197 _LIBCPP_INLINE_VISIBILITY
20722198 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
20732199 {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
20742210
20752211 _LIBCPP_INLINE_VISIBILITY
20762212 size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
......@@ -2108,7 +2244,7 @@ public:
21082244 _LIBCPP_INLINE_VISIBILITY
21092245 void reserve(size_type __n) {__table_.reserve(__n);}
21102246
2111#if _LIBCPP_DEBUG_LEVEL >= 2
2247#if _LIBCPP_DEBUG_LEVEL == 2
21122248
21132249 bool __dereferenceable(const const_iterator* __i) const
21142250 {return __table_.__dereferenceable(&__i->__i_);}
......@@ -2119,7 +2255,7 @@ public:
21192255 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
21202256 {return __table_.__addable(&__i->__i_, __n);}
21212257
2122#endif // _LIBCPP_DEBUG_LEVEL >= 2
2258#endif // _LIBCPP_DEBUG_LEVEL == 2
21232259
21242260
21252261};
......@@ -2196,7 +2332,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
21962332 size_type __n, const hasher& __hf, const key_equal& __eql)
21972333 : __table_(__hf, __eql)
21982334{
2199#if _LIBCPP_DEBUG_LEVEL >= 2
2335#if _LIBCPP_DEBUG_LEVEL == 2
22002336 __get_db()->__insert_c(this);
22012337#endif
22022338 __table_.rehash(__n);
......@@ -2208,7 +2344,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22082344 const allocator_type& __a)
22092345 : __table_(__hf, __eql, typename __table::allocator_type(__a))
22102346{
2211#if _LIBCPP_DEBUG_LEVEL >= 2
2347#if _LIBCPP_DEBUG_LEVEL == 2
22122348 __get_db()->__insert_c(this);
22132349#endif
22142350 __table_.rehash(__n);
......@@ -2219,7 +2355,7 @@ template <class _InputIterator>
22192355unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22202356 _InputIterator __first, _InputIterator __last)
22212357{
2222#if _LIBCPP_DEBUG_LEVEL >= 2
2358#if _LIBCPP_DEBUG_LEVEL == 2
22232359 __get_db()->__insert_c(this);
22242360#endif
22252361 insert(__first, __last);
......@@ -2232,7 +2368,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22322368 const hasher& __hf, const key_equal& __eql)
22332369 : __table_(__hf, __eql)
22342370{
2235#if _LIBCPP_DEBUG_LEVEL >= 2
2371#if _LIBCPP_DEBUG_LEVEL == 2
22362372 __get_db()->__insert_c(this);
22372373#endif
22382374 __table_.rehash(__n);
......@@ -2246,7 +2382,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22462382 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
22472383 : __table_(__hf, __eql, typename __table::allocator_type(__a))
22482384{
2249#if _LIBCPP_DEBUG_LEVEL >= 2
2385#if _LIBCPP_DEBUG_LEVEL == 2
22502386 __get_db()->__insert_c(this);
22512387#endif
22522388 __table_.rehash(__n);
......@@ -2259,7 +2395,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22592395 const allocator_type& __a)
22602396 : __table_(typename __table::allocator_type(__a))
22612397{
2262#if _LIBCPP_DEBUG_LEVEL >= 2
2398#if _LIBCPP_DEBUG_LEVEL == 2
22632399 __get_db()->__insert_c(this);
22642400#endif
22652401}
......@@ -2269,7 +2405,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22692405 const unordered_multimap& __u)
22702406 : __table_(__u.__table_)
22712407{
2272#if _LIBCPP_DEBUG_LEVEL >= 2
2408#if _LIBCPP_DEBUG_LEVEL == 2
22732409 __get_db()->__insert_c(this);
22742410#endif
22752411 __table_.rehash(__u.bucket_count());
......@@ -2281,7 +2417,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22812417 const unordered_multimap& __u, const allocator_type& __a)
22822418 : __table_(__u.__table_, typename __table::allocator_type(__a))
22832419{
2284#if _LIBCPP_DEBUG_LEVEL >= 2
2420#if _LIBCPP_DEBUG_LEVEL == 2
22852421 __get_db()->__insert_c(this);
22862422#endif
22872423 __table_.rehash(__u.bucket_count());
......@@ -2297,7 +2433,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
22972433 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
22982434 : __table_(_VSTD::move(__u.__table_))
22992435{
2300#if _LIBCPP_DEBUG_LEVEL >= 2
2436#if _LIBCPP_DEBUG_LEVEL == 2
23012437 __get_db()->__insert_c(this);
23022438 __get_db()->swap(this, &__u);
23032439#endif
......@@ -2308,7 +2444,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23082444 unordered_multimap&& __u, const allocator_type& __a)
23092445 : __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
23102446{
2311#if _LIBCPP_DEBUG_LEVEL >= 2
2447#if _LIBCPP_DEBUG_LEVEL == 2
23122448 __get_db()->__insert_c(this);
23132449#endif
23142450 if (__a != __u.get_allocator())
......@@ -2320,7 +2456,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23202456 __u.__table_.remove((__i++).__i_)->__value_.__move());
23212457 }
23222458 }
2323#if _LIBCPP_DEBUG_LEVEL >= 2
2459#if _LIBCPP_DEBUG_LEVEL == 2
23242460 else
23252461 __get_db()->swap(this, &__u);
23262462#endif
......@@ -2330,7 +2466,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
23302466unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23312467 initializer_list<value_type> __il)
23322468{
2333#if _LIBCPP_DEBUG_LEVEL >= 2
2469#if _LIBCPP_DEBUG_LEVEL == 2
23342470 __get_db()->__insert_c(this);
23352471#endif
23362472 insert(__il.begin(), __il.end());
......@@ -2342,7 +2478,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23422478 const key_equal& __eql)
23432479 : __table_(__hf, __eql)
23442480{
2345#if _LIBCPP_DEBUG_LEVEL >= 2
2481#if _LIBCPP_DEBUG_LEVEL == 2
23462482 __get_db()->__insert_c(this);
23472483#endif
23482484 __table_.rehash(__n);
......@@ -2355,7 +2491,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
23552491 const key_equal& __eql, const allocator_type& __a)
23562492 : __table_(__hf, __eql, typename __table::allocator_type(__a))
23572493{
2358#if _LIBCPP_DEBUG_LEVEL >= 2
2494#if _LIBCPP_DEBUG_LEVEL == 2
23592495 __get_db()->__insert_c(this);
23602496#endif
23612497 __table_.rehash(__n);
lib/libcxx/include/unordered_set+123-37
......@@ -145,10 +145,22 @@ public:
145145
146146 iterator find(const key_type& k);
147147 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
148152 size_type count(const key_type& k) const;
153 template<typename K>
154 size_type count(const K& k) const; // C++20
149155 bool contains(const key_type& k) const; // C++20
156 template<typename K>
157 bool contains(const K& k) const; // C++20
150158 pair<iterator, iterator> equal_range(const key_type& k);
151159 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
152164
153165 size_type bucket_count() const noexcept;
154166 size_type max_bucket_count() const noexcept;
......@@ -310,10 +322,22 @@ public:
310322
311323 iterator find(const key_type& k);
312324 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
313329 size_type count(const key_type& k) const;
330 template<typename K>
331 size_type count(const K& k) const; // C++20
314332 bool contains(const key_type& k) const; // C++20
333 template<typename K>
334 bool contains(const K& k) const; // C++20
315335 pair<iterator, iterator> equal_range(const key_type& k);
316336 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
317341
318342 size_type bucket_count() const noexcept;
319343 size_type max_bucket_count() const noexcept;
......@@ -425,7 +449,7 @@ public:
425449 unordered_set()
426450 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
427451 {
428#if _LIBCPP_DEBUG_LEVEL >= 2
452#if _LIBCPP_DEBUG_LEVEL == 2
429453 __get_db()->__insert_c(this);
430454#endif
431455 }
......@@ -539,7 +563,7 @@ public:
539563 {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
540564 template <class... _Args>
541565 _LIBCPP_INLINE_VISIBILITY
542#if _LIBCPP_DEBUG_LEVEL >= 2
566#if _LIBCPP_DEBUG_LEVEL == 2
543567 iterator emplace_hint(const_iterator __p, _Args&&... __args)
544568 {
545569 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
......@@ -556,7 +580,7 @@ public:
556580 pair<iterator, bool> insert(value_type&& __x)
557581 {return __table_.__insert_unique(_VSTD::move(__x));}
558582 _LIBCPP_INLINE_VISIBILITY
559#if _LIBCPP_DEBUG_LEVEL >= 2
583#if _LIBCPP_DEBUG_LEVEL == 2
560584 iterator insert(const_iterator __p, value_type&& __x)
561585 {
562586 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
......@@ -577,7 +601,7 @@ public:
577601 {return __table_.__insert_unique(__x);}
578602
579603 _LIBCPP_INLINE_VISIBILITY
580#if _LIBCPP_DEBUG_LEVEL >= 2
604#if _LIBCPP_DEBUG_LEVEL == 2
581605 iterator insert(const_iterator __p, const value_type& __x)
582606 {
583607 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
......@@ -679,11 +703,32 @@ public:
679703 iterator find(const key_type& __k) {return __table_.find(__k);}
680704 _LIBCPP_INLINE_VISIBILITY
681705 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
682716 _LIBCPP_INLINE_VISIBILITY
683717 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
684724 #if _LIBCPP_STD_VER > 17
685725 _LIBCPP_INLINE_VISIBILITY
686726 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();}
687732 #endif // _LIBCPP_STD_VER > 17
688733 _LIBCPP_INLINE_VISIBILITY
689734 pair<iterator, iterator> equal_range(const key_type& __k)
......@@ -691,6 +736,16 @@ public:
691736 _LIBCPP_INLINE_VISIBILITY
692737 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
693738 {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
694749
695750 _LIBCPP_INLINE_VISIBILITY
696751 size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
......@@ -726,7 +781,7 @@ public:
726781 _LIBCPP_INLINE_VISIBILITY
727782 void reserve(size_type __n) {__table_.reserve(__n);}
728783
729#if _LIBCPP_DEBUG_LEVEL >= 2
784#if _LIBCPP_DEBUG_LEVEL == 2
730785
731786 bool __dereferenceable(const const_iterator* __i) const
732787 {return __table_.__dereferenceable(__i);}
......@@ -737,7 +792,7 @@ public:
737792 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
738793 {return __table_.__addable(__i, __n);}
739794
740#endif // _LIBCPP_DEBUG_LEVEL >= 2
795#endif // _LIBCPP_DEBUG_LEVEL == 2
741796
742797};
743798
......@@ -802,7 +857,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
802857 const hasher& __hf, const key_equal& __eql)
803858 : __table_(__hf, __eql)
804859{
805#if _LIBCPP_DEBUG_LEVEL >= 2
860#if _LIBCPP_DEBUG_LEVEL == 2
806861 __get_db()->__insert_c(this);
807862#endif
808863 __table_.rehash(__n);
......@@ -813,7 +868,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
813868 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
814869 : __table_(__hf, __eql, __a)
815870{
816#if _LIBCPP_DEBUG_LEVEL >= 2
871#if _LIBCPP_DEBUG_LEVEL == 2
817872 __get_db()->__insert_c(this);
818873#endif
819874 __table_.rehash(__n);
......@@ -824,7 +879,7 @@ template <class _InputIterator>
824879unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
825880 _InputIterator __first, _InputIterator __last)
826881{
827#if _LIBCPP_DEBUG_LEVEL >= 2
882#if _LIBCPP_DEBUG_LEVEL == 2
828883 __get_db()->__insert_c(this);
829884#endif
830885 insert(__first, __last);
......@@ -837,7 +892,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
837892 const hasher& __hf, const key_equal& __eql)
838893 : __table_(__hf, __eql)
839894{
840#if _LIBCPP_DEBUG_LEVEL >= 2
895#if _LIBCPP_DEBUG_LEVEL == 2
841896 __get_db()->__insert_c(this);
842897#endif
843898 __table_.rehash(__n);
......@@ -851,7 +906,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
851906 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
852907 : __table_(__hf, __eql, __a)
853908{
854#if _LIBCPP_DEBUG_LEVEL >= 2
909#if _LIBCPP_DEBUG_LEVEL == 2
855910 __get_db()->__insert_c(this);
856911#endif
857912 __table_.rehash(__n);
......@@ -864,7 +919,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
864919 const allocator_type& __a)
865920 : __table_(__a)
866921{
867#if _LIBCPP_DEBUG_LEVEL >= 2
922#if _LIBCPP_DEBUG_LEVEL == 2
868923 __get_db()->__insert_c(this);
869924#endif
870925}
......@@ -874,7 +929,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
874929 const unordered_set& __u)
875930 : __table_(__u.__table_)
876931{
877#if _LIBCPP_DEBUG_LEVEL >= 2
932#if _LIBCPP_DEBUG_LEVEL == 2
878933 __get_db()->__insert_c(this);
879934#endif
880935 __table_.rehash(__u.bucket_count());
......@@ -886,7 +941,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
886941 const unordered_set& __u, const allocator_type& __a)
887942 : __table_(__u.__table_, __a)
888943{
889#if _LIBCPP_DEBUG_LEVEL >= 2
944#if _LIBCPP_DEBUG_LEVEL == 2
890945 __get_db()->__insert_c(this);
891946#endif
892947 __table_.rehash(__u.bucket_count());
......@@ -902,7 +957,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
902957 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
903958 : __table_(_VSTD::move(__u.__table_))
904959{
905#if _LIBCPP_DEBUG_LEVEL >= 2
960#if _LIBCPP_DEBUG_LEVEL == 2
906961 __get_db()->__insert_c(this);
907962 __get_db()->swap(this, &__u);
908963#endif
......@@ -913,7 +968,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
913968 unordered_set&& __u, const allocator_type& __a)
914969 : __table_(_VSTD::move(__u.__table_), __a)
915970{
916#if _LIBCPP_DEBUG_LEVEL >= 2
971#if _LIBCPP_DEBUG_LEVEL == 2
917972 __get_db()->__insert_c(this);
918973#endif
919974 if (__a != __u.get_allocator())
......@@ -922,7 +977,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
922977 while (__u.size() != 0)
923978 __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
924979 }
925#if _LIBCPP_DEBUG_LEVEL >= 2
980#if _LIBCPP_DEBUG_LEVEL == 2
926981 else
927982 __get_db()->swap(this, &__u);
928983#endif
......@@ -932,7 +987,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
932987unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
933988 initializer_list<value_type> __il)
934989{
935#if _LIBCPP_DEBUG_LEVEL >= 2
990#if _LIBCPP_DEBUG_LEVEL == 2
936991 __get_db()->__insert_c(this);
937992#endif
938993 insert(__il.begin(), __il.end());
......@@ -944,7 +999,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
944999 const key_equal& __eql)
9451000 : __table_(__hf, __eql)
9461001{
947#if _LIBCPP_DEBUG_LEVEL >= 2
1002#if _LIBCPP_DEBUG_LEVEL == 2
9481003 __get_db()->__insert_c(this);
9491004#endif
9501005 __table_.rehash(__n);
......@@ -957,7 +1012,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
9571012 const key_equal& __eql, const allocator_type& __a)
9581013 : __table_(__hf, __eql, __a)
9591014{
960#if _LIBCPP_DEBUG_LEVEL >= 2
1015#if _LIBCPP_DEBUG_LEVEL == 2
9611016 __get_db()->__insert_c(this);
9621017#endif
9631018 __table_.rehash(__n);
......@@ -1091,7 +1146,7 @@ public:
10911146 unordered_multiset()
10921147 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
10931148 {
1094#if _LIBCPP_DEBUG_LEVEL >= 2
1149#if _LIBCPP_DEBUG_LEVEL == 2
10951150 __get_db()->__insert_c(this);
10961151#endif
10971152 }
......@@ -1314,11 +1369,32 @@ public:
13141369 iterator find(const key_type& __k) {return __table_.find(__k);}
13151370 _LIBCPP_INLINE_VISIBILITY
13161371 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
13171382 _LIBCPP_INLINE_VISIBILITY
13181383 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
13191390 #if _LIBCPP_STD_VER > 17
13201391 _LIBCPP_INLINE_VISIBILITY
13211392 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();}
13221398 #endif // _LIBCPP_STD_VER > 17
13231399 _LIBCPP_INLINE_VISIBILITY
13241400 pair<iterator, iterator> equal_range(const key_type& __k)
......@@ -1326,6 +1402,16 @@ public:
13261402 _LIBCPP_INLINE_VISIBILITY
13271403 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
13281404 {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
13291415
13301416 _LIBCPP_INLINE_VISIBILITY
13311417 size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
......@@ -1361,7 +1447,7 @@ public:
13611447 _LIBCPP_INLINE_VISIBILITY
13621448 void reserve(size_type __n) {__table_.reserve(__n);}
13631449
1364#if _LIBCPP_DEBUG_LEVEL >= 2
1450#if _LIBCPP_DEBUG_LEVEL == 2
13651451
13661452 bool __dereferenceable(const const_iterator* __i) const
13671453 {return __table_.__dereferenceable(__i);}
......@@ -1372,7 +1458,7 @@ public:
13721458 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
13731459 {return __table_.__addable(__i, __n);}
13741460
1375#endif // _LIBCPP_DEBUG_LEVEL >= 2
1461#endif // _LIBCPP_DEBUG_LEVEL == 2
13761462
13771463};
13781464
......@@ -1435,7 +1521,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14351521 size_type __n, const hasher& __hf, const key_equal& __eql)
14361522 : __table_(__hf, __eql)
14371523{
1438#if _LIBCPP_DEBUG_LEVEL >= 2
1524#if _LIBCPP_DEBUG_LEVEL == 2
14391525 __get_db()->__insert_c(this);
14401526#endif
14411527 __table_.rehash(__n);
......@@ -1447,7 +1533,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14471533 const allocator_type& __a)
14481534 : __table_(__hf, __eql, __a)
14491535{
1450#if _LIBCPP_DEBUG_LEVEL >= 2
1536#if _LIBCPP_DEBUG_LEVEL == 2
14511537 __get_db()->__insert_c(this);
14521538#endif
14531539 __table_.rehash(__n);
......@@ -1458,7 +1544,7 @@ template <class _InputIterator>
14581544unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14591545 _InputIterator __first, _InputIterator __last)
14601546{
1461#if _LIBCPP_DEBUG_LEVEL >= 2
1547#if _LIBCPP_DEBUG_LEVEL == 2
14621548 __get_db()->__insert_c(this);
14631549#endif
14641550 insert(__first, __last);
......@@ -1471,7 +1557,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14711557 const hasher& __hf, const key_equal& __eql)
14721558 : __table_(__hf, __eql)
14731559{
1474#if _LIBCPP_DEBUG_LEVEL >= 2
1560#if _LIBCPP_DEBUG_LEVEL == 2
14751561 __get_db()->__insert_c(this);
14761562#endif
14771563 __table_.rehash(__n);
......@@ -1485,7 +1571,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14851571 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
14861572 : __table_(__hf, __eql, __a)
14871573{
1488#if _LIBCPP_DEBUG_LEVEL >= 2
1574#if _LIBCPP_DEBUG_LEVEL == 2
14891575 __get_db()->__insert_c(this);
14901576#endif
14911577 __table_.rehash(__n);
......@@ -1498,7 +1584,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
14981584 const allocator_type& __a)
14991585 : __table_(__a)
15001586{
1501#if _LIBCPP_DEBUG_LEVEL >= 2
1587#if _LIBCPP_DEBUG_LEVEL == 2
15021588 __get_db()->__insert_c(this);
15031589#endif
15041590}
......@@ -1508,7 +1594,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15081594 const unordered_multiset& __u)
15091595 : __table_(__u.__table_)
15101596{
1511#if _LIBCPP_DEBUG_LEVEL >= 2
1597#if _LIBCPP_DEBUG_LEVEL == 2
15121598 __get_db()->__insert_c(this);
15131599#endif
15141600 __table_.rehash(__u.bucket_count());
......@@ -1520,7 +1606,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15201606 const unordered_multiset& __u, const allocator_type& __a)
15211607 : __table_(__u.__table_, __a)
15221608{
1523#if _LIBCPP_DEBUG_LEVEL >= 2
1609#if _LIBCPP_DEBUG_LEVEL == 2
15241610 __get_db()->__insert_c(this);
15251611#endif
15261612 __table_.rehash(__u.bucket_count());
......@@ -1536,7 +1622,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15361622 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
15371623 : __table_(_VSTD::move(__u.__table_))
15381624{
1539#if _LIBCPP_DEBUG_LEVEL >= 2
1625#if _LIBCPP_DEBUG_LEVEL == 2
15401626 __get_db()->__insert_c(this);
15411627 __get_db()->swap(this, &__u);
15421628#endif
......@@ -1547,7 +1633,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15471633 unordered_multiset&& __u, const allocator_type& __a)
15481634 : __table_(_VSTD::move(__u.__table_), __a)
15491635{
1550#if _LIBCPP_DEBUG_LEVEL >= 2
1636#if _LIBCPP_DEBUG_LEVEL == 2
15511637 __get_db()->__insert_c(this);
15521638#endif
15531639 if (__a != __u.get_allocator())
......@@ -1556,7 +1642,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15561642 while (__u.size() != 0)
15571643 __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
15581644 }
1559#if _LIBCPP_DEBUG_LEVEL >= 2
1645#if _LIBCPP_DEBUG_LEVEL == 2
15601646 else
15611647 __get_db()->swap(this, &__u);
15621648#endif
......@@ -1566,7 +1652,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
15661652unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15671653 initializer_list<value_type> __il)
15681654{
1569#if _LIBCPP_DEBUG_LEVEL >= 2
1655#if _LIBCPP_DEBUG_LEVEL == 2
15701656 __get_db()->__insert_c(this);
15711657#endif
15721658 insert(__il.begin(), __il.end());
......@@ -1578,7 +1664,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15781664 const key_equal& __eql)
15791665 : __table_(__hf, __eql)
15801666{
1581#if _LIBCPP_DEBUG_LEVEL >= 2
1667#if _LIBCPP_DEBUG_LEVEL == 2
15821668 __get_db()->__insert_c(this);
15831669#endif
15841670 __table_.rehash(__n);
......@@ -1591,7 +1677,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
15911677 const key_equal& __eql, const allocator_type& __a)
15921678 : __table_(__hf, __eql, __a)
15931679{
1594#if _LIBCPP_DEBUG_LEVEL >= 2
1680#if _LIBCPP_DEBUG_LEVEL == 2
15951681 __get_db()->__insert_c(this);
15961682#endif
15971683 __table_.rehash(__n);
lib/libcxx/include/utility+24-14
......@@ -499,7 +499,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
499499 second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {}
500500
501501 template <class... _Args1, class... _Args2>
502 _LIBCPP_INLINE_VISIBILITY
502 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
503503 pair(piecewise_construct_t __pc,
504504 tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
505505 _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
......@@ -508,7 +508,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
508508 typename __make_tuple_indices<sizeof...(_Args1)>::type(),
509509 typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
510510
511 _LIBCPP_INLINE_VISIBILITY
511 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
512512 pair& operator=(typename conditional<
513513 is_copy_assignable<first_type>::value &&
514514 is_copy_assignable<second_type>::value,
......@@ -521,7 +521,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
521521 return *this;
522522 }
523523
524 _LIBCPP_INLINE_VISIBILITY
524 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
525525 pair& operator=(typename conditional<
526526 is_move_assignable<first_type>::value &&
527527 is_move_assignable<second_type>::value,
......@@ -537,7 +537,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
537537 template <class _Tuple, _EnableB<
538538 _CheckTLC<_Tuple>::template __enable_assign<_Tuple>()
539539 > = false>
540 _LIBCPP_INLINE_VISIBILITY
540 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
541541 pair& operator=(_Tuple&& __p) {
542542 first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p));
543543 second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p));
......@@ -545,7 +545,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
545545 }
546546#endif
547547
548 _LIBCPP_INLINE_VISIBILITY
548 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
549549 void
550550 swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
551551 __is_nothrow_swappable<second_type>::value)
......@@ -558,10 +558,10 @@ private:
558558
559559#ifndef _LIBCPP_CXX03_LANG
560560 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...>);
565565#endif
566566};
567567
......@@ -619,7 +619,7 @@ operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
619619}
620620
621621template <class _T1, class _T2>
622inline _LIBCPP_INLINE_VISIBILITY
622inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
623623typename enable_if
624624<
625625 __is_swappable<_T1>::value &&
......@@ -970,7 +970,7 @@ _Size
970970__loadword(const void* __p)
971971{
972972 _Size __r;
973 std::memcpy(&__r, __p, sizeof(__r));
973 _VSTD::memcpy(&__r, __p, sizeof(__r));
974974 return __r;
975975}
976976
......@@ -1189,7 +1189,7 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
11891189 __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
11901190 __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
11911191 __y + __loadword<_Size>(__s + 16));
1192 std::swap(__z, __x);
1192 _VSTD::swap(__z, __x);
11931193 __s += 64;
11941194 __len -= 64;
11951195 } while (__len != 0);
......@@ -1364,6 +1364,16 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
13641364 size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
13651365};
13661366
1367#ifndef _LIBCPP_NO_HAS_CHAR8_T
1368template <>
1369struct _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
13671377#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
13681378
13691379template <>
......@@ -1506,7 +1516,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
15061516 // -0.0 and 0.0 should return same hash
15071517 if (__v == 0.0L)
15081518 return 0;
1509#if defined(__i386__)
1519#if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
15101520 // Zero out padding bits
15111521 union
15121522 {
......@@ -1593,7 +1603,7 @@ using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
15931603 __invokable_r<size_t, _Hash, _Key const&>::value
15941604>;
15951605
1596template <class _Key, class _Hash = std::hash<_Key> >
1606template <class _Key, class _Hash = hash<_Key> >
15971607using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
15981608 __check_hash_requirements<_Key, _Hash>::value &&
15991609 is_default_constructible<_Hash>::value
lib/libcxx/include/valarray+73-95
......@@ -136,6 +136,7 @@ public:
136136 void operator>>=(const valarray<value_type>& v) const;
137137
138138 void operator=(const value_type& x) const;
139 void operator=(const valarray<T>& val_arr) const;
139140
140141 slice_array() = delete;
141142};
......@@ -802,7 +803,7 @@ private:
802803public:
803804 // construct/destroy:
804805 _LIBCPP_INLINE_VISIBILITY
805 valarray() : __begin_(0), __end_(0) {}
806 valarray() : __begin_(nullptr), __end_(nullptr) {}
806807 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
807808 explicit valarray(size_t __n);
808809 _LIBCPP_INLINE_VISIBILITY
......@@ -1264,6 +1265,9 @@ public:
12641265 _LIBCPP_INLINE_VISIBILITY
12651266 void operator=(const value_type& __x) const;
12661267
1268 _LIBCPP_INLINE_VISIBILITY
1269 void operator=(const valarray<value_type>& __va) const;
1270
12671271private:
12681272 _LIBCPP_INLINE_VISIBILITY
12691273 slice_array(const slice& __sl, const valarray<value_type>& __v)
......@@ -1303,6 +1307,15 @@ slice_array<_Tp>::operator=(const _Expr& __v) const
13031307 *__t = __v[__i];
13041308}
13051309
1310template <class _Tp>
1311inline void
1312slice_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
13061319template <class _Tp>
13071320template <class _Expr>
13081321inline
......@@ -2738,11 +2751,9 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
27382751 if (__n)
27392752 {
27402753 __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);
27442755 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]);
27462757 }
27472758 return __r;
27482759}
......@@ -2752,19 +2763,18 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
27522763template <class _Tp>
27532764inline
27542765valarray<_Tp>::valarray(size_t __n)
2755 : __begin_(0),
2756 __end_(0)
2766 : __begin_(nullptr),
2767 __end_(nullptr)
27572768{
27582769 if (__n)
27592770 {
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);
27622772#ifndef _LIBCPP_NO_EXCEPTIONS
27632773 try
27642774 {
27652775#endif // _LIBCPP_NO_EXCEPTIONS
27662776 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
2767 ::new (__end_) value_type();
2777 ::new ((void*)__end_) value_type();
27682778#ifndef _LIBCPP_NO_EXCEPTIONS
27692779 }
27702780 catch (...)
......@@ -2779,27 +2789,26 @@ valarray<_Tp>::valarray(size_t __n)
27792789template <class _Tp>
27802790inline
27812791valarray<_Tp>::valarray(const value_type& __x, size_t __n)
2782 : __begin_(0),
2783 __end_(0)
2792 : __begin_(nullptr),
2793 __end_(nullptr)
27842794{
27852795 resize(__n, __x);
27862796}
27872797
27882798template <class _Tp>
27892799valarray<_Tp>::valarray(const value_type* __p, size_t __n)
2790 : __begin_(0),
2791 __end_(0)
2800 : __begin_(nullptr),
2801 __end_(nullptr)
27922802{
27932803 if (__n)
27942804 {
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);
27972806#ifndef _LIBCPP_NO_EXCEPTIONS
27982807 try
27992808 {
28002809#endif // _LIBCPP_NO_EXCEPTIONS
28012810 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);
28032812#ifndef _LIBCPP_NO_EXCEPTIONS
28042813 }
28052814 catch (...)
......@@ -2813,19 +2822,18 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n)
28132822
28142823template <class _Tp>
28152824valarray<_Tp>::valarray(const valarray& __v)
2816 : __begin_(0),
2817 __end_(0)
2825 : __begin_(nullptr),
2826 __end_(nullptr)
28182827{
28192828 if (__v.size())
28202829 {
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());
28232831#ifndef _LIBCPP_NO_EXCEPTIONS
28242832 try
28252833 {
28262834#endif // _LIBCPP_NO_EXCEPTIONS
28272835 for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
2828 ::new (__end_) value_type(*__p);
2836 ::new ((void*)__end_) value_type(*__p);
28292837#ifndef _LIBCPP_NO_EXCEPTIONS
28302838 }
28312839 catch (...)
......@@ -2850,21 +2858,20 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
28502858
28512859template <class _Tp>
28522860valarray<_Tp>::valarray(initializer_list<value_type> __il)
2853 : __begin_(0),
2854 __end_(0)
2861 : __begin_(nullptr),
2862 __end_(nullptr)
28552863{
28562864 const size_t __n = __il.size();
28572865 if (__n)
28582866 {
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);
28612868#ifndef _LIBCPP_NO_EXCEPTIONS
28622869 try
28632870 {
28642871#endif // _LIBCPP_NO_EXCEPTIONS
28652872 size_t __n_left = __n;
28662873 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);
28682875#ifndef _LIBCPP_NO_EXCEPTIONS
28692876 }
28702877 catch (...)
......@@ -2880,21 +2887,20 @@ _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)))
28802887
28812888template <class _Tp>
28822889valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
2883 : __begin_(0),
2884 __end_(0)
2890 : __begin_(nullptr),
2891 __end_(nullptr)
28852892{
28862893 const size_t __n = __sa.__size_;
28872894 if (__n)
28882895 {
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);
28912897#ifndef _LIBCPP_NO_EXCEPTIONS
28922898 try
28932899 {
28942900#endif // _LIBCPP_NO_EXCEPTIONS
28952901 size_t __n_left = __n;
28962902 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);
28982904#ifndef _LIBCPP_NO_EXCEPTIONS
28992905 }
29002906 catch (...)
......@@ -2908,14 +2914,13 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
29082914
29092915template <class _Tp>
29102916valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
2911 : __begin_(0),
2912 __end_(0)
2917 : __begin_(nullptr),
2918 __end_(nullptr)
29132919{
29142920 const size_t __n = __ga.__1d_.size();
29152921 if (__n)
29162922 {
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);
29192924#ifndef _LIBCPP_NO_EXCEPTIONS
29202925 try
29212926 {
......@@ -2924,7 +2929,7 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
29242929 const value_type* __s = __ga.__vp_;
29252930 for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
29262931 __i != __e; ++__i, ++__end_)
2927 ::new (__end_) value_type(__s[*__i]);
2932 ::new ((void*)__end_) value_type(__s[*__i]);
29282933#ifndef _LIBCPP_NO_EXCEPTIONS
29292934 }
29302935 catch (...)
......@@ -2938,14 +2943,13 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
29382943
29392944template <class _Tp>
29402945valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
2941 : __begin_(0),
2942 __end_(0)
2946 : __begin_(nullptr),
2947 __end_(nullptr)
29432948{
29442949 const size_t __n = __ma.__1d_.size();
29452950 if (__n)
29462951 {
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);
29492953#ifndef _LIBCPP_NO_EXCEPTIONS
29502954 try
29512955 {
......@@ -2954,7 +2958,7 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
29542958 const value_type* __s = __ma.__vp_;
29552959 for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
29562960 __i != __e; ++__i, ++__end_)
2957 ::new (__end_) value_type(__s[*__i]);
2961 ::new ((void*)__end_) value_type(__s[*__i]);
29582962#ifndef _LIBCPP_NO_EXCEPTIONS
29592963 }
29602964 catch (...)
......@@ -2968,14 +2972,13 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
29682972
29692973template <class _Tp>
29702974valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
2971 : __begin_(0),
2972 __end_(0)
2975 : __begin_(nullptr),
2976 __end_(nullptr)
29732977{
29742978 const size_t __n = __ia.__1d_.size();
29752979 if (__n)
29762980 {
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);
29792982#ifndef _LIBCPP_NO_EXCEPTIONS
29802983 try
29812984 {
......@@ -2984,7 +2987,7 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
29842987 const value_type* __s = __ia.__vp_;
29852988 for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
29862989 __i != __e; ++__i, ++__end_)
2987 ::new (__end_) value_type(__s[*__i]);
2990 ::new ((void*)__end_) value_type(__s[*__i]);
29882991#ifndef _LIBCPP_NO_EXCEPTIONS
29892992 }
29902993 catch (...)
......@@ -3011,8 +3014,7 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
30113014 if (size() != __n)
30123015 {
30133016 __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);
30163018 __end_ = __begin_ + __n;
30173019 _VSTD::uninitialized_copy(__f, __l, __begin_);
30183020 } else {
......@@ -3265,12 +3267,9 @@ valarray<_Tp>::operator+() const
32653267 size_t __n = size();
32663268 if (__n)
32673269 {
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);
32723271 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);
32743273 }
32753274 return __r;
32763275}
......@@ -3283,12 +3282,9 @@ valarray<_Tp>::operator-() const
32833282 size_t __n = size();
32843283 if (__n)
32853284 {
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);
32903286 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);
32923288 }
32933289 return __r;
32943290}
......@@ -3301,12 +3297,9 @@ valarray<_Tp>::operator~() const
33013297 size_t __n = size();
33023298 if (__n)
33033299 {
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);
33083301 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);
33103303 }
33113304 return __r;
33123305}
......@@ -3319,11 +3312,9 @@ valarray<_Tp>::operator!() const
33193312 size_t __n = size();
33203313 if (__n)
33213314 {
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);
33253316 for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
3326 ::new (__r.__end_) bool(!*__p);
3317 ::new ((void*)__r.__end_) bool(!*__p);
33273318 }
33283319 return __r;
33293320}
......@@ -3639,10 +3630,7 @@ valarray<_Tp>::shift(int __i) const
36393630 size_t __n = size();
36403631 if (__n)
36413632 {
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);
36463634 const value_type* __sb;
36473635 value_type* __tb;
36483636 value_type* __te;
......@@ -3661,11 +3649,11 @@ valarray<_Tp>::shift(int __i) const
36613649 __te = __r.__begin_ + __n;
36623650 }
36633651 for (; __r.__end_ != __tb; ++__r.__end_)
3664 ::new (__r.__end_) value_type();
3652 ::new ((void*)__r.__end_) value_type();
36653653 for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
3666 ::new (__r.__end_) value_type(*__sb);
3654 ::new ((void*)__r.__end_) value_type(*__sb);
36673655 for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
3668 ::new (__r.__end_) value_type();
3656 ::new ((void*)__r.__end_) value_type();
36693657 }
36703658 return __r;
36713659}
......@@ -3678,16 +3666,13 @@ valarray<_Tp>::cshift(int __i) const
36783666 size_t __n = size();
36793667 if (__n)
36803668 {
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);
36853670 __i %= static_cast<int>(__n);
36863671 const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
36873672 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);
36893674 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);
36913676 }
36923677 return __r;
36933678}
......@@ -3700,12 +3685,9 @@ valarray<_Tp>::apply(value_type __f(value_type)) const
37003685 size_t __n = size();
37013686 if (__n)
37023687 {
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);
37073689 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));
37093691 }
37103692 return __r;
37113693}
......@@ -3718,12 +3700,9 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const
37183700 size_t __n = size();
37193701 if (__n)
37203702 {
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);
37253704 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));
37273706 }
37283707 return __r;
37293708}
......@@ -3736,7 +3715,7 @@ void valarray<_Tp>::__clear(size_t __capacity)
37363715 {
37373716 while (__end_ != __begin_)
37383717 (--__end_)->~value_type();
3739 _VSTD::__libcpp_deallocate(__begin_, __capacity * sizeof(value_type), _LIBCPP_ALIGNOF(value_type));
3718 allocator<value_type>().deallocate(__begin_, __capacity);
37403719 __begin_ = __end_ = nullptr;
37413720 }
37423721}
......@@ -3748,14 +3727,13 @@ valarray<_Tp>::resize(size_t __n, value_type __x)
37483727 __clear(size());
37493728 if (__n)
37503729 {
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);
37533731#ifndef _LIBCPP_NO_EXCEPTIONS
37543732 try
37553733 {
37563734#endif // _LIBCPP_NO_EXCEPTIONS
37573735 for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
3758 ::new (__end_) value_type(__x);
3736 ::new ((void*)__end_) value_type(__x);
37593737#ifndef _LIBCPP_NO_EXCEPTIONS
37603738 }
37613739 catch (...)
lib/libcxx/include/variant+29-25
......@@ -197,6 +197,7 @@ namespace std {
197197*/
198198
199199#include <__config>
200#include <__availability>
200201#include <__tuple>
201202#include <array>
202203#include <exception>
......@@ -227,7 +228,10 @@ public:
227228
228229_LIBCPP_BEGIN_NAMESPACE_STD
229230
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)
231235
232236_LIBCPP_NORETURN
233237inline _LIBCPP_INLINE_VISIBILITY
......@@ -290,9 +294,9 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
290294_LIBCPP_INLINE_VAR constexpr size_t variant_npos = static_cast<size_t>(-1);
291295
292296constexpr 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())
294298 return 0;
295 if (__num_elem < std::numeric_limits<unsigned short>::max())
299 if (__num_elem < numeric_limits<unsigned short>::max())
296300 return 1;
297301 return 2;
298302}
......@@ -482,12 +486,12 @@ private:
482486 return __result{{_VSTD::forward<_Fs>(__fs)...}};
483487 }
484488
485 template <std::size_t... _Is>
489 template <size_t... _Is>
486490 struct __dispatcher {
487491 template <class _Fp, class... _Vs>
488492 inline _LIBCPP_INLINE_VISIBILITY
489493 static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
490 return __invoke_constexpr(
494 return _VSTD::__invoke_constexpr(
491495 static_cast<_Fp>(__f),
492496 __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
493497 }
......@@ -595,7 +599,7 @@ private:
595599 __std_visit_exhaustive_visitor_check<
596600 _Visitor,
597601 decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
598 return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
602 return _VSTD::__invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
599603 _VSTD::forward<_Alts>(__alts).__value...);
600604 }
601605 _Visitor&& __visitor;
......@@ -720,12 +724,12 @@ protected:
720724};
721725
722726template <class _Traits, _Trait = _Traits::__destructible_trait>
723class _LIBCPP_TEMPLATE_VIS __destructor;
727class _LIBCPP_TEMPLATE_VIS __dtor;
724728
725729#define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
726730 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> \
729733 : public __base<destructible_trait, _Types...> { \
730734 using __base_type = __base<destructible_trait, _Types...>; \
731735 using __index_t = typename __base_type::__index_t; \
......@@ -734,11 +738,11 @@ class _LIBCPP_TEMPLATE_VIS __destructor;
734738 using __base_type::__base_type; \
735739 using __base_type::operator=; \
736740 \
737 __destructor(const __destructor&) = default; \
738 __destructor(__destructor&&) = default; \
741 __dtor(const __dtor&) = default; \
742 __dtor(__dtor&&) = default; \
739743 destructor \
740 __destructor& operator=(const __destructor&) = default; \
741 __destructor& operator=(__destructor&&) = default; \
744 __dtor& operator=(const __dtor&) = default; \
745 __dtor& operator=(__dtor&&) = default; \
742746 \
743747 protected: \
744748 inline _LIBCPP_INLINE_VISIBILITY \
......@@ -747,12 +751,12 @@ class _LIBCPP_TEMPLATE_VIS __destructor;
747751
748752_LIBCPP_VARIANT_DESTRUCTOR(
749753 _Trait::_TriviallyAvailable,
750 ~__destructor() = default;,
754 ~__dtor() = default;,
751755 void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
752756
753757_LIBCPP_VARIANT_DESTRUCTOR(
754758 _Trait::_Available,
755 ~__destructor() { __destroy(); },
759 ~__dtor() { __destroy(); },
756760 void __destroy() noexcept {
757761 if (!this->valueless_by_exception()) {
758762 __visitation::__base::__visit_alt(
......@@ -767,14 +771,14 @@ _LIBCPP_VARIANT_DESTRUCTOR(
767771
768772_LIBCPP_VARIANT_DESTRUCTOR(
769773 _Trait::_Unavailable,
770 ~__destructor() = delete;,
774 ~__dtor() = delete;,
771775 void __destroy() noexcept = delete;);
772776
773777#undef _LIBCPP_VARIANT_DESTRUCTOR
774778
775779template <class _Traits>
776class _LIBCPP_TEMPLATE_VIS __constructor : public __destructor<_Traits> {
777 using __base_type = __destructor<_Traits>;
780class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> {
781 using __base_type = __dtor<_Traits>;
778782
779783public:
780784 using __base_type::__base_type;
......@@ -791,7 +795,7 @@ protected:
791795
792796 template <class _Rhs>
793797 inline _LIBCPP_INLINE_VISIBILITY
794 static void __generic_construct(__constructor& __lhs, _Rhs&& __rhs) {
798 static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
795799 __lhs.__destroy();
796800 if (!__rhs.valueless_by_exception()) {
797801 __visitation::__base::__visit_alt_at(
......@@ -813,10 +817,10 @@ class _LIBCPP_TEMPLATE_VIS __move_constructor;
813817#define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, \
814818 move_constructor) \
815819 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...>>; \
820824 \
821825 public: \
822826 using __base_type::__base_type; \
......@@ -1104,7 +1108,7 @@ struct __narrowing_check {
11041108 template <class _Dest>
11051109 static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>;
11061110 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>()}));
11081112};
11091113
11101114template <class _Dest, class _Source>
......@@ -1510,7 +1514,7 @@ template <class _Operator>
15101514struct __convert_to_bool {
15111515 template <class _T1, class _T2>
15121516 _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,
15141518 "the relational operator does not return a type which is implicitly convertible to bool");
15151519 return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
15161520 }
lib/libcxx/include/vector+48-51
......@@ -454,7 +454,7 @@ inline _LIBCPP_INLINE_VISIBILITY
454454__vector_base<_Tp, _Allocator>::__vector_base(allocator_type&& __a) _NOEXCEPT
455455 : __begin_(nullptr),
456456 __end_(nullptr),
457 __end_cap_(nullptr, std::move(__a)) {}
457 __end_cap_(nullptr, _VSTD::move(__a)) {}
458458#endif
459459
460460template <class _Tp, class _Allocator>
......@@ -496,7 +496,7 @@ public:
496496 _LIBCPP_INLINE_VISIBILITY
497497 vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
498498 {
499#if _LIBCPP_DEBUG_LEVEL >= 2
499#if _LIBCPP_DEBUG_LEVEL == 2
500500 __get_db()->__insert_c(this);
501501#endif
502502 }
......@@ -508,7 +508,7 @@ public:
508508#endif
509509 : __base(__a)
510510 {
511#if _LIBCPP_DEBUG_LEVEL >= 2
511#if _LIBCPP_DEBUG_LEVEL == 2
512512 __get_db()->__insert_c(this);
513513#endif
514514 }
......@@ -551,7 +551,7 @@ public:
551551 ~vector()
552552 {
553553 __annotate_delete();
554#if _LIBCPP_DEBUG_LEVEL >= 2
554#if _LIBCPP_DEBUG_LEVEL == 2
555555 __get_db()->__erase_c(this);
556556#endif
557557 }
......@@ -789,14 +789,14 @@ public:
789789
790790 bool __invariants() const;
791791
792#if _LIBCPP_DEBUG_LEVEL >= 2
792#if _LIBCPP_DEBUG_LEVEL == 2
793793
794794 bool __dereferenceable(const const_iterator* __i) const;
795795 bool __decrementable(const const_iterator* __i) const;
796796 bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
797797 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
798798
799#endif // _LIBCPP_DEBUG_LEVEL >= 2
799#endif // _LIBCPP_DEBUG_LEVEL == 2
800800
801801private:
802802 _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
......@@ -931,7 +931,7 @@ private:
931931
932932#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
933933template<class _InputIterator,
934 class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
934 class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
935935 class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
936936 >
937937vector(_InputIterator, _InputIterator)
......@@ -951,8 +951,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
951951{
952952
953953 __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_);
956955 _VSTD::swap(this->__begin_, __v.__begin_);
957956 _VSTD::swap(this->__end_, __v.__end_);
958957 _VSTD::swap(this->__end_cap(), __v.__end_cap());
......@@ -967,10 +966,8 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
967966{
968967 __annotate_delete();
969968 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_);
974971 _VSTD::swap(this->__begin_, __v.__begin_);
975972 _VSTD::swap(this->__end_, __v.__end_);
976973 _VSTD::swap(this->__end_cap(), __v.__end_cap());
......@@ -1077,7 +1074,7 @@ typename enable_if
10771074vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
10781075{
10791076 _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_);
10811078}
10821079
10831080// Default constructs __n objects starting at __end_
......@@ -1121,7 +1118,7 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
11211118template <class _Tp, class _Allocator>
11221119vector<_Tp, _Allocator>::vector(size_type __n)
11231120{
1124#if _LIBCPP_DEBUG_LEVEL >= 2
1121#if _LIBCPP_DEBUG_LEVEL == 2
11251122 __get_db()->__insert_c(this);
11261123#endif
11271124 if (__n > 0)
......@@ -1136,7 +1133,7 @@ template <class _Tp, class _Allocator>
11361133vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
11371134 : __base(__a)
11381135{
1139#if _LIBCPP_DEBUG_LEVEL >= 2
1136#if _LIBCPP_DEBUG_LEVEL == 2
11401137 __get_db()->__insert_c(this);
11411138#endif
11421139 if (__n > 0)
......@@ -1150,7 +1147,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
11501147template <class _Tp, class _Allocator>
11511148vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
11521149{
1153#if _LIBCPP_DEBUG_LEVEL >= 2
1150#if _LIBCPP_DEBUG_LEVEL == 2
11541151 __get_db()->__insert_c(this);
11551152#endif
11561153 if (__n > 0)
......@@ -1164,7 +1161,7 @@ template <class _Tp, class _Allocator>
11641161vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
11651162 : __base(__a)
11661163{
1167#if _LIBCPP_DEBUG_LEVEL >= 2
1164#if _LIBCPP_DEBUG_LEVEL == 2
11681165 __get_db()->__insert_c(this);
11691166#endif
11701167 if (__n > 0)
......@@ -1184,7 +1181,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,
11841181 typename iterator_traits<_InputIterator>::reference>::value,
11851182 _InputIterator>::type __last)
11861183{
1187#if _LIBCPP_DEBUG_LEVEL >= 2
1184#if _LIBCPP_DEBUG_LEVEL == 2
11881185 __get_db()->__insert_c(this);
11891186#endif
11901187 for (; __first != __last; ++__first)
......@@ -1201,7 +1198,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
12011198 typename iterator_traits<_InputIterator>::reference>::value>::type*)
12021199 : __base(__a)
12031200{
1204#if _LIBCPP_DEBUG_LEVEL >= 2
1201#if _LIBCPP_DEBUG_LEVEL == 2
12051202 __get_db()->__insert_c(this);
12061203#endif
12071204 for (; __first != __last; ++__first)
......@@ -1217,7 +1214,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
12171214 typename iterator_traits<_ForwardIterator>::reference>::value,
12181215 _ForwardIterator>::type __last)
12191216{
1220#if _LIBCPP_DEBUG_LEVEL >= 2
1217#if _LIBCPP_DEBUG_LEVEL == 2
12211218 __get_db()->__insert_c(this);
12221219#endif
12231220 size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
......@@ -1237,7 +1234,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las
12371234 typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
12381235 : __base(__a)
12391236{
1240#if _LIBCPP_DEBUG_LEVEL >= 2
1237#if _LIBCPP_DEBUG_LEVEL == 2
12411238 __get_db()->__insert_c(this);
12421239#endif
12431240 size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
......@@ -1252,7 +1249,7 @@ template <class _Tp, class _Allocator>
12521249vector<_Tp, _Allocator>::vector(const vector& __x)
12531250 : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc()))
12541251{
1255#if _LIBCPP_DEBUG_LEVEL >= 2
1252#if _LIBCPP_DEBUG_LEVEL == 2
12561253 __get_db()->__insert_c(this);
12571254#endif
12581255 size_type __n = __x.size();
......@@ -1267,7 +1264,7 @@ template <class _Tp, class _Allocator>
12671264vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
12681265 : __base(__a)
12691266{
1270#if _LIBCPP_DEBUG_LEVEL >= 2
1267#if _LIBCPP_DEBUG_LEVEL == 2
12711268 __get_db()->__insert_c(this);
12721269#endif
12731270 size_type __n = __x.size();
......@@ -1290,7 +1287,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
12901287#endif
12911288 : __base(_VSTD::move(__x.__alloc()))
12921289{
1293#if _LIBCPP_DEBUG_LEVEL >= 2
1290#if _LIBCPP_DEBUG_LEVEL == 2
12941291 __get_db()->__insert_c(this);
12951292 __get_db()->swap(this, &__x);
12961293#endif
......@@ -1305,7 +1302,7 @@ inline _LIBCPP_INLINE_VISIBILITY
13051302vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
13061303 : __base(__a)
13071304{
1308#if _LIBCPP_DEBUG_LEVEL >= 2
1305#if _LIBCPP_DEBUG_LEVEL == 2
13091306 __get_db()->__insert_c(this);
13101307#endif
13111308 if (__a == __x.__alloc())
......@@ -1314,7 +1311,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
13141311 this->__end_ = __x.__end_;
13151312 this->__end_cap() = __x.__end_cap();
13161313 __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
1317#if _LIBCPP_DEBUG_LEVEL >= 2
1314#if _LIBCPP_DEBUG_LEVEL == 2
13181315 __get_db()->swap(this, &__x);
13191316#endif
13201317 }
......@@ -1329,7 +1326,7 @@ template <class _Tp, class _Allocator>
13291326inline _LIBCPP_INLINE_VISIBILITY
13301327vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
13311328{
1332#if _LIBCPP_DEBUG_LEVEL >= 2
1329#if _LIBCPP_DEBUG_LEVEL == 2
13331330 __get_db()->__insert_c(this);
13341331#endif
13351332 if (__il.size() > 0)
......@@ -1344,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY
13441341vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
13451342 : __base(__a)
13461343{
1347#if _LIBCPP_DEBUG_LEVEL >= 2
1344#if _LIBCPP_DEBUG_LEVEL == 2
13481345 __get_db()->__insert_c(this);
13491346#endif
13501347 if (__il.size() > 0)
......@@ -1390,7 +1387,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
13901387 this->__end_ = __c.__end_;
13911388 this->__end_cap() = __c.__end_cap();
13921389 __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
1393#if _LIBCPP_DEBUG_LEVEL >= 2
1390#if _LIBCPP_DEBUG_LEVEL == 2
13941391 __get_db()->swap(this, &__c);
13951392#endif
13961393}
......@@ -1493,7 +1490,7 @@ inline _LIBCPP_INLINE_VISIBILITY
14931490typename vector<_Tp, _Allocator>::iterator
14941491vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
14951492{
1496#if _LIBCPP_DEBUG_LEVEL >= 2
1493#if _LIBCPP_DEBUG_LEVEL == 2
14971494 return iterator(this, __p);
14981495#else
14991496 return iterator(__p);
......@@ -1505,7 +1502,7 @@ inline _LIBCPP_INLINE_VISIBILITY
15051502typename vector<_Tp, _Allocator>::const_iterator
15061503vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
15071504{
1508#if _LIBCPP_DEBUG_LEVEL >= 2
1505#if _LIBCPP_DEBUG_LEVEL == 2
15091506 return const_iterator(this, __p);
15101507#else
15111508 return const_iterator(__p);
......@@ -1709,7 +1706,7 @@ inline _LIBCPP_INLINE_VISIBILITY
17091706typename vector<_Tp, _Allocator>::iterator
17101707vector<_Tp, _Allocator>::erase(const_iterator __position)
17111708{
1712#if _LIBCPP_DEBUG_LEVEL >= 2
1709#if _LIBCPP_DEBUG_LEVEL == 2
17131710 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
17141711 "vector::erase(iterator) called with an iterator not"
17151712 " referring to this vector");
......@@ -1728,7 +1725,7 @@ template <class _Tp, class _Allocator>
17281725typename vector<_Tp, _Allocator>::iterator
17291726vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
17301727{
1731#if _LIBCPP_DEBUG_LEVEL >= 2
1728#if _LIBCPP_DEBUG_LEVEL == 2
17321729 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
17331730 "vector::erase(iterator, iterator) called with an iterator not"
17341731 " referring to this vector");
......@@ -1769,7 +1766,7 @@ template <class _Tp, class _Allocator>
17691766typename vector<_Tp, _Allocator>::iterator
17701767vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
17711768{
1772#if _LIBCPP_DEBUG_LEVEL >= 2
1769#if _LIBCPP_DEBUG_LEVEL == 2
17731770 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
17741771 "vector::insert(iterator, x) called with an iterator not"
17751772 " referring to this vector");
......@@ -1806,7 +1803,7 @@ template <class _Tp, class _Allocator>
18061803typename vector<_Tp, _Allocator>::iterator
18071804vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
18081805{
1809#if _LIBCPP_DEBUG_LEVEL >= 2
1806#if _LIBCPP_DEBUG_LEVEL == 2
18101807 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
18111808 "vector::insert(iterator, x) called with an iterator not"
18121809 " referring to this vector");
......@@ -1839,7 +1836,7 @@ template <class... _Args>
18391836typename vector<_Tp, _Allocator>::iterator
18401837vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
18411838{
1842#if _LIBCPP_DEBUG_LEVEL >= 2
1839#if _LIBCPP_DEBUG_LEVEL == 2
18431840 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
18441841 "vector::emplace(iterator, x) called with an iterator not"
18451842 " referring to this vector");
......@@ -1874,7 +1871,7 @@ template <class _Tp, class _Allocator>
18741871typename vector<_Tp, _Allocator>::iterator
18751872vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
18761873{
1877#if _LIBCPP_DEBUG_LEVEL >= 2
1874#if _LIBCPP_DEBUG_LEVEL == 2
18781875 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
18791876 "vector::insert(iterator, n, x) called with an iterator not"
18801877 " referring to this vector");
......@@ -1925,7 +1922,7 @@ typename enable_if
19251922>::type
19261923vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
19271924{
1928#if _LIBCPP_DEBUG_LEVEL >= 2
1925#if _LIBCPP_DEBUG_LEVEL == 2
19291926 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
19301927 "vector::insert(iterator, range) called with an iterator not"
19311928 " referring to this vector");
......@@ -1978,7 +1975,7 @@ typename enable_if
19781975>::type
19791976vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
19801977{
1981#if _LIBCPP_DEBUG_LEVEL >= 2
1978#if _LIBCPP_DEBUG_LEVEL == 2
19821979 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
19831980 "vector::insert(iterator, range) called with an iterator not"
19841981 " referring to this vector");
......@@ -2057,11 +2054,11 @@ vector<_Tp, _Allocator>::swap(vector& __x)
20572054 _VSTD::swap(this->__begin_, __x.__begin_);
20582055 _VSTD::swap(this->__end_, __x.__end_);
20592056 _VSTD::swap(this->__end_cap(), __x.__end_cap());
2060 __swap_allocator(this->__alloc(), __x.__alloc(),
2057 _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(),
20612058 integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
2062#if _LIBCPP_DEBUG_LEVEL >= 2
2059#if _LIBCPP_DEBUG_LEVEL == 2
20632060 __get_db()->swap(this, &__x);
2064#endif // _LIBCPP_DEBUG_LEVEL >= 2
2061#endif
20652062}
20662063
20672064template <class _Tp, class _Allocator>
......@@ -2085,7 +2082,7 @@ vector<_Tp, _Allocator>::__invariants() const
20852082 return true;
20862083}
20872084
2088#if _LIBCPP_DEBUG_LEVEL >= 2
2085#if _LIBCPP_DEBUG_LEVEL == 2
20892086
20902087template <class _Tp, class _Allocator>
20912088bool
......@@ -2117,16 +2114,16 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
21172114 return this->__begin_ <= __p && __p < this->__end_;
21182115}
21192116
2120#endif // _LIBCPP_DEBUG_LEVEL >= 2
2117#endif // _LIBCPP_DEBUG_LEVEL == 2
21212118
21222119template <class _Tp, class _Allocator>
21232120inline _LIBCPP_INLINE_VISIBILITY
21242121void
21252122vector<_Tp, _Allocator>::__invalidate_all_iterators()
21262123{
2127#if _LIBCPP_DEBUG_LEVEL >= 2
2124#if _LIBCPP_DEBUG_LEVEL == 2
21282125 __get_db()->__invalidate_all(this);
2129#endif // _LIBCPP_DEBUG_LEVEL >= 2
2126#endif
21302127}
21312128
21322129
......@@ -2134,7 +2131,7 @@ template <class _Tp, class _Allocator>
21342131inline _LIBCPP_INLINE_VISIBILITY
21352132void
21362133vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
2137#if _LIBCPP_DEBUG_LEVEL >= 2
2134#if _LIBCPP_DEBUG_LEVEL == 2
21382135 __c_node* __c = __get_db()->__find_c_and_lock(this);
21392136 for (__i_node** __p = __c->end_; __p != __c->beg_; ) {
21402137 --__p;
......@@ -2142,7 +2139,7 @@ vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
21422139 if (__i->base() > __new_last) {
21432140 (*__p)->__c_ = nullptr;
21442141 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*));
21462143 }
21472144 }
21482145 __get_db()->unlock();
......@@ -2883,7 +2880,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>::vector(vector&& __v)
28832880#endif
28842881 : __begin_(__v.__begin_),
28852882 __size_(__v.__size_),
2886 __cap_alloc_(std::move(__v.__cap_alloc_)) {
2883 __cap_alloc_(_VSTD::move(__v.__cap_alloc_)) {
28872884 __v.__begin_ = nullptr;
28882885 __v.__size_ = 0;
28892886 __v.__cap() = 0;
......@@ -3235,7 +3232,7 @@ vector<bool, _Allocator>::swap(vector& __x)
32353232 _VSTD::swap(this->__begin_, __x.__begin_);
32363233 _VSTD::swap(this->__size_, __x.__size_);
32373234 _VSTD::swap(this->__cap(), __x.__cap());
3238 __swap_allocator(this->__alloc(), __x.__alloc(),
3235 _VSTD::__swap_allocator(this->__alloc(), __x.__alloc(),
32393236 integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
32403237}
32413238
lib/libcxx/include/version+34-2
......@@ -24,8 +24,14 @@ __cpp_lib_apply 201603L <tuple>
2424__cpp_lib_array_constexpr 201811L <iterator> <array>
2525 201603L // C++17
2626__cpp_lib_as_const 201510L <utility>
27__cpp_lib_atomic_flag_test 201907L <atomic>
28__cpp_lib_atomic_float 201711L <atomic>
2729__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
30__cpp_lib_atomic_lock_free_type_aliases 201907L <atomic>
2831__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>
2935__cpp_lib_bind_front 201811L <functional>
3036__cpp_lib_bit_cast 201806L <bit>
3137__cpp_lib_bool_constant 201505L <type_traits>
......@@ -39,9 +45,12 @@ __cpp_lib_chrono_udls 201304L <chrono>
3945__cpp_lib_clamp 201603L <algorithm>
4046__cpp_lib_complex_udls 201309L <complex>
4147__cpp_lib_concepts 201806L <concepts>
48__cpp_lib_constexpr_dynamic_alloc 201907L <memory>
4249__cpp_lib_constexpr_misc 201811L <array> <functional> <iterator>
4350 <string_view> <tuple> <utility>
51__cpp_lib_constexpr_numeric 201911L <numeric>
4452__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
53__cpp_lib_constexpr_utility 201811L <utility>
4554__cpp_lib_destroying_delete 201806L <new>
4655__cpp_lib_enable_shared_from_this 201603L <memory>
4756__cpp_lib_endian 201907L <bit>
......@@ -58,6 +67,7 @@ __cpp_lib_hardware_interference_size 201703L <new>
5867__cpp_lib_has_unique_object_representations 201606L <type_traits>
5968__cpp_lib_hypot 201603L <cmath>
6069__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
70__cpp_lib_int_pow2 202002L <bit>
6171__cpp_lib_integer_sequence 201304L <utility>
6272__cpp_lib_integral_constant_callable 201304L <type_traits>
6373__cpp_lib_interpolate 201902L <numeric>
......@@ -200,7 +210,7 @@ __cpp_lib_void_t 201411L <type_traits>
200210# if !defined(_LIBCPP_HAS_NO_THREADS)
201211# define __cpp_lib_shared_mutex 201505L
202212# endif
203// # define __cpp_lib_shared_ptr_arrays 201611L
213# define __cpp_lib_shared_ptr_arrays 201611L
204214# define __cpp_lib_shared_ptr_weak_type 201606L
205215# define __cpp_lib_string_view 201606L
206216// # define __cpp_lib_to_chars 201611L
......@@ -217,22 +227,44 @@ __cpp_lib_void_t 201411L <type_traits>
217227# undef __cpp_lib_array_constexpr
218228# define __cpp_lib_array_constexpr 201811L
219229# 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)
220239// # define __cpp_lib_atomic_ref 201806L
221240# 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
222250// # define __cpp_lib_bind_front 201811L
223251// # define __cpp_lib_bit_cast 201806L
224252# if !defined(_LIBCPP_NO_HAS_CHAR8_T)
225253# define __cpp_lib_char8_t 201811L
226254# endif
227255// # define __cpp_lib_concepts 201806L
256# define __cpp_lib_constexpr_dynamic_alloc 201907L
228257// # define __cpp_lib_constexpr_misc 201811L
258# define __cpp_lib_constexpr_numeric 201911L
229259// # define __cpp_lib_constexpr_swap_algorithms 201806L
260# define __cpp_lib_constexpr_utility 201811L
230261# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
231262# define __cpp_lib_destroying_delete 201806L
232263# endif
233264# define __cpp_lib_endian 201907L
234265# 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
236268# define __cpp_lib_interpolate 201902L
237269# if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
238270# define __cpp_lib_is_constant_evaluated 201811L
lib/libcxx/include/wctype.h+3-1
......@@ -50,7 +50,9 @@ wctrans_t wctrans(const char* property);
5050#pragma GCC system_header
5151#endif
5252
53#include_next <wctype.h>
53#if __has_include_next(<wctype.h>)
54# include_next <wctype.h>
55#endif
5456
5557#ifdef __cplusplus
5658
lib/libcxx/src/atomic.cpp-2
......@@ -13,8 +13,6 @@
1313#include <atomic>
1414#include <functional>
1515
16#include <iostream>
17
1816#ifdef __linux__
1917
2018#include <unistd.h>
lib/libcxx/src/barrier.cpp+3-9
......@@ -26,21 +26,15 @@ public:
2626 } __tickets[64];
2727 };
2828
29 ptrdiff_t& __expected;
30 unique_ptr<char[]> __state_allocation;
31 __state_t* __state;
29 ptrdiff_t& __expected;
30 unique_ptr<__state_t[]> __state;
3231
3332 _LIBCPP_HIDDEN
3433 __barrier_algorithm_base(ptrdiff_t& __expected)
3534 : __expected(__expected)
3635 {
3736 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]);
4438 }
4539 _LIBCPP_HIDDEN
4640 bool __arrive(__barrier_phase_t __old_phase)
lib/libcxx/src/chrono.cpp+53-44
......@@ -13,11 +13,15 @@
1313#include "include/apple_availability.h"
1414
1515#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
1721#endif
1822
1923#if !defined(__APPLE__) && _POSIX_TIMERS > 0
20#define _LIBCPP_USE_CLOCK_GETTIME
24# define _LIBCPP_USE_CLOCK_GETTIME
2125#endif
2226
2327#if defined(_LIBCPP_WIN32API)
......@@ -27,10 +31,6 @@
2731# if _WIN32_WINNT >= _WIN32_WINNT_WIN8
2832# include <winapifamily.h>
2933# endif
30#else
31# if !defined(CLOCK_REALTIME)
32# include <sys/time.h> // for gettimeofday and timeval
33# endif // !defined(CLOCK_REALTIME)
3434#endif // defined(_LIBCPP_WIN32API)
3535
3636#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
......@@ -42,14 +42,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4242namespace chrono
4343{
4444
45//
4546// system_clock
47//
4648
47const bool system_clock::is_steady;
48
49system_clock::time_point
50system_clock::now() _NOEXCEPT
51{
5249#if defined(_LIBCPP_WIN32API)
50
51static system_clock::time_point __libcpp_system_clock_now() {
5352 // FILETIME is in 100ns units
5453 using filetime_duration =
5554 _VSTD::chrono::duration<__int64,
......@@ -60,31 +59,42 @@ system_clock::now() _NOEXCEPT
6059 static _LIBCPP_CONSTEXPR const seconds nt_to_unix_epoch{11644473600};
6160
6261 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)
6563 GetSystemTimePreciseAsFileTime(&ft);
66#else
67 GetSystemTimeAsFileTime(&ft);
68#endif
6964#else
7065 GetSystemTimeAsFileTime(&ft);
7166#endif
7267
7368 filetime_duration d{(static_cast<__int64>(ft.dwHighDateTime) << 32) |
7469 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
75static system_clock::time_point __libcpp_system_clock_now() {
7876 struct timespec tp;
7977 if (0 != clock_gettime(CLOCK_REALTIME, &tp))
8078 __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
8282#else
83
84static system_clock::time_point __libcpp_system_clock_now() {
8385 timeval tv;
8486 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
8790#endif
91
92const bool system_clock::is_steady;
93
94system_clock::time_point
95system_clock::now() _NOEXCEPT
96{
97 return __libcpp_system_clock_now();
8898}
8999
90100time_t
......@@ -99,33 +109,28 @@ system_clock::from_time_t(time_t t) _NOEXCEPT
99109 return system_clock::time_point(seconds(t));
100110}
101111
102#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
112//
103113// steady_clock
104114//
105115// Warning: If this is not truly steady, then it is non-conforming. It is
106116// better for it to not exist and have the rest of libc++ use system_clock
107117// instead.
118//
108119
109const bool steady_clock::is_steady;
120#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
110121
111122#if defined(__APPLE__)
112123
113#if !defined(CLOCK_MONOTONIC_RAW)
114# error "Building libc++ on Apple platforms requires CLOCK_MONOTONIC_RAW"
115#endif
116
117124// On Apple platforms, only CLOCK_UPTIME_RAW, CLOCK_MONOTONIC_RAW or
118125// mach_absolute_time are able to time functions in the nanosecond range.
119126// Furthermore, only CLOCK_MONOTONIC_RAW is truly monotonic, because it
120127// also counts cycles when the system is asleep. Thus, it is the only
121128// acceptable implementation of steady_clock.
122steady_clock::time_point
123steady_clock::now() _NOEXCEPT
124{
129static steady_clock::time_point __libcpp_steady_clock_now() {
125130 struct timespec tp;
126131 if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp))
127132 __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));
129134}
130135
131136#elif defined(_LIBCPP_WIN32API)
......@@ -138,36 +143,40 @@ steady_clock::now() _NOEXCEPT
138143static LARGE_INTEGER
139144__QueryPerformanceFrequency()
140145{
141 LARGE_INTEGER val;
142 (void) QueryPerformanceFrequency(&val);
143 return val;
146 LARGE_INTEGER val;
147 (void) QueryPerformanceFrequency(&val);
148 return val;
144149}
145150
146steady_clock::time_point
147steady_clock::now() _NOEXCEPT
148{
151static steady_clock::time_point __libcpp_steady_clock_now() {
149152 static const LARGE_INTEGER freq = __QueryPerformanceFrequency();
150153
151154 LARGE_INTEGER counter;
152155 (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));
154157}
155158
156159#elif defined(CLOCK_MONOTONIC)
157160
158steady_clock::time_point
159steady_clock::now() _NOEXCEPT
160{
161static steady_clock::time_point __libcpp_steady_clock_now() {
161162 struct timespec tp;
162163 if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
163164 __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));
165166}
166167
167168#else
168# error "Monotonic clock not implemented"
169# error "Monotonic clock not implemented on this platform"
169170#endif
170171
172const bool steady_clock::is_steady;
173
174steady_clock::time_point
175steady_clock::now() _NOEXCEPT
176{
177 return __libcpp_steady_clock_now();
178}
179
171180#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
172181
173182}
lib/libcxx/src/experimental/memory_resource.cpp-10
......@@ -76,16 +76,6 @@ union ResourceInitHelper {
7676 ~ResourceInitHelper() {}
7777};
7878
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
8979// When compiled in C++14 this initialization should be a constant expression.
9080// Only in C++11 is "init_priority" needed to ensure initialization order.
9181#if _LIBCPP_STD_VER > 11
lib/libcxx/src/filesystem/filesystem_common.h+53-39
......@@ -13,8 +13,9 @@
1313#include "filesystem"
1414#include "array"
1515#include "chrono"
16#include "cstdlib"
1716#include "climits"
17#include "cstdlib"
18#include "ctime"
1819
1920#include <unistd.h>
2021#include <sys/stat.h>
......@@ -47,7 +48,7 @@ static string format_string_imp(const char* msg, ...) {
4748 struct GuardVAList {
4849 va_list& target;
4950 bool active = true;
50 GuardVAList(va_list& target) : target(target), active(true) {}
51 GuardVAList(va_list& tgt) : target(tgt), active(true) {}
5152 void clear() {
5253 if (active)
5354 va_end(target);
......@@ -134,50 +135,50 @@ path error_value<path>() {
134135
135136template <class T>
136137struct 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;
141142
142143 ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr,
143144 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();
147148 }
148149
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;
152153 return error_value<T>();
153154 }
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_)) {
156157 case 0:
157 __throw_filesystem_error(what, m_ec);
158 __throw_filesystem_error(what, ec);
158159 case 1:
159 __throw_filesystem_error(what, *p1, m_ec);
160 __throw_filesystem_error(what, *p1_, ec);
160161 case 2:
161 __throw_filesystem_error(what, *p1, *p2, m_ec);
162 __throw_filesystem_error(what, *p1_, *p2_, ec);
162163 }
163164 _LIBCPP_UNREACHABLE();
164165 }
165166
166167 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;
170171 return error_value<T>();
171172 }
172173 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_)) {
175176 case 0:
176 __throw_filesystem_error(what, m_ec);
177 __throw_filesystem_error(what, ec);
177178 case 1:
178 __throw_filesystem_error(what, *p1, m_ec);
179 __throw_filesystem_error(what, *p1_, ec);
179180 case 2:
180 __throw_filesystem_error(what, *p1, *p2, m_ec);
181 __throw_filesystem_error(what, *p1_, *p2_, ec);
181182 }
182183 _LIBCPP_UNREACHABLE();
183184 }
......@@ -197,8 +198,9 @@ private:
197198using chrono::duration;
198199using chrono::duration_cast;
199200
200using TimeSpec = struct ::timespec;
201using StatT = struct ::stat;
201using TimeSpec = struct timespec;
202using TimeVal = struct timeval;
203using StatT = struct stat;
202204
203205template <class FileTimeT, class TimeT,
204206 bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
......@@ -380,26 +382,38 @@ public:
380382using fs_time = time_util<file_time_type, time_t, TimeSpec>;
381383
382384#if defined(__APPLE__)
383TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
384TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
385inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
386inline TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
387#elif defined(__MVS__)
388inline TimeSpec extract_mtime(StatT const& st) {
389 TimeSpec TS = {st.st_mtime, 0};
390 return TS;
391}
392inline TimeSpec extract_atime(StatT const& st) {
393 TimeSpec TS = {st.st_atime, 0};
394 return TS;
395}
385396#else
386TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
387TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
397inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
398inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
388399#endif
389400
390// allow the utimes implementation to compile even it we're not going
391// to use it.
392
393bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
394 error_code& ec) {
401inline TimeVal make_timeval(TimeSpec const& ts) {
395402 using namespace chrono;
396403 auto Convert = [](long nsec) {
397 using int_type = decltype(std::declval< ::timeval>().tv_usec);
404 using int_type = decltype(std::declval<TimeVal>().tv_usec);
398405 auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
399406 return static_cast<int_type>(dur);
400407 };
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
414inline 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])};
403417 if (::utimes(p.c_str(), ConvertedTS) == -1) {
404418 ec = capture_errno();
405419 return true;
lib/libcxx/src/filesystem/operations.cpp+99-102
......@@ -9,8 +9,6 @@
99#include "filesystem"
1010#include "array"
1111#include "iterator"
12#include "fstream"
13#include "random" /* for unique_path */
1412#include "string_view"
1513#include "type_traits"
1614#include "vector"
......@@ -25,29 +23,23 @@
2523#include <time.h>
2624#include <fcntl.h> /* values for fchmodat */
2725
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
3429#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
3735#endif
3836
3937#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
4539#endif
4640
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")
5143#endif
5244
5345_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
......@@ -542,7 +534,7 @@ path __canonical(path const& orig_p, error_code* ec) {
542534 ErrorHandler<path> err("canonical", ec, &orig_p, &cwd);
543535
544536 path p = __do_absolute(orig_p, &cwd, ec);
545#if _POSIX_VERSION >= 200112
537#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112
546538 std::unique_ptr<char, decltype(&::free)>
547539 hold(::realpath(p.c_str(), nullptr), &::free);
548540 if (hold.get() == nullptr)
......@@ -646,96 +638,83 @@ void __copy(const path& from, const path& to, copy_options options,
646638namespace detail {
647639namespace {
648640
649#ifdef _LIBCPP_USE_SENDFILE
650bool 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);
664652
665 return true;
666}
667#elif defined(_LIBCPP_USE_COPYFILE)
668bool 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();
679654
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;
684656 }
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); }
685663
686 ec.clear();
687 return true;
688}
689#endif
664 private:
665 CopyFileState(CopyFileState const&) = delete;
666 CopyFileState& operator=(CopyFileState const&) = delete;
667 };
690668
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 }
709674
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;
721677 }
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 }
722708
723 ec.clear();
724 return true;
725}
726
727bool 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 }
732712#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
736715
737} // namespace
738} // namespace detail
716} // end anonymous namespace
717} // end namespace detail
739718
740719bool __copy_file(const path& from, const path& to, copy_options options,
741720 error_code* ec) {
......@@ -870,8 +849,17 @@ bool __create_directory(const path& p, error_code* ec) {
870849
871850 if (::mkdir(p.c_str(), static_cast<int>(perms::all)) == 0)
872851 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 {
874861 err.report(capture_errno());
862 }
875863 return false;
876864}
877865
......@@ -889,8 +877,17 @@ bool __create_directory(path const& p, path const& attributes, error_code* ec) {
889877
890878 if (::mkdir(p.c_str(), attr_stat.st_mode) == 0)
891879 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 {
893889 err.report(capture_errno());
890 }
894891 return false;
895892}
896893
lib/libcxx/src/include/config_elast.h+4
......@@ -17,10 +17,14 @@
1717#include <errno.h>
1818#endif
1919
20// Note: _LIBCPP_ELAST needs to be defined only on platforms
21// where strerror/strerror_r can't handle out-of-range errno values.
2022#if defined(ELAST)
2123#define _LIBCPP_ELAST ELAST
2224#elif defined(_NEWLIB_VERSION)
2325#define _LIBCPP_ELAST __ELASTERROR
26#elif defined(__NuttX__)
27// No _LIBCPP_ELAST needed on NuttX
2428#elif defined(__Fuchsia__)
2529// No _LIBCPP_ELAST needed on Fuchsia
2630#elif defined(__wasi__)
lib/libcxx/src/include/refstring.h+19-6
......@@ -13,12 +13,25 @@
1313#include <stdexcept>
1414#include <cstddef>
1515#include <cstring>
16#ifdef __APPLE__
17#include <dlfcn.h>
18#include <mach-o/dyld.h>
19#endif
2016#include "atomic_support.h"
2117
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
2235_LIBCPP_BEGIN_NAMESPACE_STD
2336
2437namespace __refstring_imp { namespace {
......@@ -40,7 +53,7 @@ inline char * data_from_rep(_Rep_base *rep) noexcept {
4053 return data + sizeof(*rep);
4154}
4255
43#if defined(__APPLE__)
56#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
4457inline
4558const char* compute_gcc_empty_string_storage() _NOEXCEPT
4659{
......@@ -115,7 +128,7 @@ __libcpp_refstring::~__libcpp_refstring() {
115128
116129inline
117130bool __libcpp_refstring::__uses_refcount() const {
118#ifdef __APPLE__
131#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
119132 return __imp_ != get_gcc_empty_string_storage();
120133#else
121134 return true;
lib/libcxx/src/ios.cpp-16
......@@ -15,30 +15,14 @@
1515#include "__locale"
1616#include "algorithm"
1717#include "include/config_elast.h"
18#include "istream"
1918#include "limits"
2019#include "memory"
2120#include "new"
22#include "streambuf"
2321#include "string"
2422#include "__undef_macros"
2523
2624_LIBCPP_BEGIN_NAMESPACE_STD
2725
28template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
29template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
30
31template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
32template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
33
34template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
35template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
36
37template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
38template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
39
40template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
41
4226class _LIBCPP_HIDDEN __iostream_category
4327 : public __do_message
4428{
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
21template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
22template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
23template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
24template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
25template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
26template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
27template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
28template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
29template 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.
33template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>;
34template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>;
35template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>;
36template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>;
37template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>;
38template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>;
39template 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
7777#endif
7878;
7979
80_LIBCPP_HIDDEN ios_base::Init __start_std_streams;
80_LIBCPP_HIDDEN ios_base::Init __start_std_streams _LIBCPP_INIT_PRIORITY_MAX;
8181
8282// On Windows the TLS storage for locales needs to be initialized before we create
8383// the standard streams, otherwise it may not be alive during program termination
lib/libcxx/src/locale.cpp+199-9
......@@ -30,7 +30,7 @@
3030#include "__sso_allocator"
3131#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
3232#include "support/win32/locale_win32.h"
33#elif !defined(__BIONIC__)
33#elif !defined(__BIONIC__) && !defined(__NuttX__)
3434#include <langinfo.h>
3535#endif
3636#include <stdlib.h>
......@@ -158,7 +158,7 @@ const locale::category locale::all;
158158class _LIBCPP_HIDDEN locale::__imp
159159 : public facet
160160{
161 enum {N = 28};
161 enum {N = 30};
162162#if defined(_LIBCPP_COMPILER_MSVC)
163163// FIXME: MSVC doesn't support aligned parameters by value.
164164// I can't get the __sso_allocator to work here
......@@ -202,8 +202,14 @@ locale::__imp::__imp(size_t refs)
202202 install(&make<_VSTD::ctype<wchar_t> >(1u));
203203 install(&make<codecvt<char, char, mbstate_t> >(1u));
204204 install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
205_LIBCPP_SUPPRESS_DEPRECATED_PUSH
205206 install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
206207 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
207213 install(&make<numpunct<char> >(1u));
208214 install(&make<numpunct<wchar_t> >(1u));
209215 install(&make<num_get<char> >(1u));
......@@ -245,8 +251,14 @@ locale::__imp::__imp(const string& name, size_t refs)
245251 install(new ctype_byname<wchar_t>(name_));
246252 install(new codecvt_byname<char, char, mbstate_t>(name_));
247253 install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
254_LIBCPP_SUPPRESS_DEPRECATED_PUSH
248255 install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
249256 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
250262 install(new numpunct_byname<char>(name_));
251263 install(new numpunct_byname<wchar_t>(name_));
252264 install(new moneypunct_byname<char, false>(name_));
......@@ -315,8 +327,14 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
315327 install(new ctype_byname<wchar_t>(name));
316328 install(new codecvt_byname<char, char, mbstate_t>(name));
317329 install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
330_LIBCPP_SUPPRESS_DEPRECATED_PUSH
318331 install(new codecvt_byname<char16_t, char, mbstate_t>(name));
319332 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
320338 }
321339 if (c & locale::monetary)
322340 {
......@@ -385,8 +403,14 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
385403 install_from<_VSTD::ctype<char> >(one);
386404 install_from<_VSTD::ctype<wchar_t> >(one);
387405 install_from<_VSTD::codecvt<char, char, mbstate_t> >(one);
406_LIBCPP_SUPPRESS_DEPRECATED_PUSH
388407 install_from<_VSTD::codecvt<char16_t, char, mbstate_t> >(one);
389408 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
390414 install_from<_VSTD::codecvt<wchar_t, char, mbstate_t> >(one);
391415 }
392416 if (c & locale::monetary)
......@@ -1149,7 +1173,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
11491173{
11501174 return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
11511175}
1152#elif __NetBSD__
1176#elif defined(__NetBSD__)
11531177const short*
11541178ctype<char>::__classic_lower_table() _NOEXCEPT
11551179{
......@@ -3171,6 +3195,87 @@ codecvt<char16_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
31713195 return 4;
31723196}
31733197
3198#ifndef _LIBCPP_NO_HAS_CHAR8_T
3199
3200// template <> class codecvt<char16_t, char8_t, mbstate_t>
3201
3202locale::id codecvt<char16_t, char8_t, mbstate_t>::id;
3203
3204codecvt<char16_t, char8_t, mbstate_t>::~codecvt()
3205{
3206}
3207
3208codecvt<char16_t, char8_t, mbstate_t>::result
3209codecvt<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
3225codecvt<char16_t, char8_t, mbstate_t>::result
3226codecvt<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
3242codecvt<char16_t, char8_t, mbstate_t>::result
3243codecvt<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
3250int
3251codecvt<char16_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT
3252{
3253 return 0;
3254}
3255
3256bool
3257codecvt<char16_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT
3258{
3259 return false;
3260}
3261
3262int
3263codecvt<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
3271int
3272codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT
3273{
3274 return 4;
3275}
3276
3277#endif
3278
31743279// template <> class codecvt<char32_t, char, mbstate_t>
31753280
31763281locale::id codecvt<char32_t, char, mbstate_t>::id;
......@@ -3248,6 +3353,87 @@ codecvt<char32_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
32483353 return 4;
32493354}
32503355
3356#ifndef _LIBCPP_NO_HAS_CHAR8_T
3357
3358// template <> class codecvt<char32_t, char8_t, mbstate_t>
3359
3360locale::id codecvt<char32_t, char8_t, mbstate_t>::id;
3361
3362codecvt<char32_t, char8_t, mbstate_t>::~codecvt()
3363{
3364}
3365
3366codecvt<char32_t, char8_t, mbstate_t>::result
3367codecvt<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
3383codecvt<char32_t, char8_t, mbstate_t>::result
3384codecvt<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
3400codecvt<char32_t, char8_t, mbstate_t>::result
3401codecvt<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
3408int
3409codecvt<char32_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT
3410{
3411 return 0;
3412}
3413
3414bool
3415codecvt<char32_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT
3416{
3417 return false;
3418}
3419
3420int
3421codecvt<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
3429int
3430codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT
3431{
3432 return 4;
3433}
3434
3435#endif
3436
32513437// __codecvt_utf8<wchar_t>
32523438
32533439__codecvt_utf8<wchar_t>::result
......@@ -5128,7 +5314,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
51285314 mb = mbstate_t();
51295315 const char* bb = buf;
51305316 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)
51325318 __throw_runtime_error("locale not supported");
51335319 wbe = wbuf + j;
51345320 __weeks_[i].assign(wbuf, wbe);
......@@ -5136,7 +5322,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
51365322 mb = mbstate_t();
51375323 bb = buf;
51385324 j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
5139 if (j == size_t(-1))
5325 if (j == size_t(-1) || j == 0)
51405326 __throw_runtime_error("locale not supported");
51415327 wbe = wbuf + j;
51425328 __weeks_[i+7].assign(wbuf, wbe);
......@@ -5149,7 +5335,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
51495335 mb = mbstate_t();
51505336 const char* bb = buf;
51515337 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)
51535339 __throw_runtime_error("locale not supported");
51545340 wbe = wbuf + j;
51555341 __months_[i].assign(wbuf, wbe);
......@@ -5157,7 +5343,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
51575343 mb = mbstate_t();
51585344 bb = buf;
51595345 j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
5160 if (j == size_t(-1))
5346 if (j == size_t(-1) || j == 0)
51615347 __throw_runtime_error("locale not supported");
51625348 wbe = wbuf + j;
51635349 __months_[i+12].assign(wbuf, wbe);
......@@ -6148,7 +6334,11 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t>
61486334
61496335template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
61506336template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;
6151template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>;
6152template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>;
6337template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char16_t, char, mbstate_t>;
6338template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char32_t, char, mbstate_t>;
6339#ifndef _LIBCPP_NO_HAS_CHAR8_T
6340template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>;
6341template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>;
6342#endif
61536343
61546344_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/memory.cpp-4
......@@ -124,16 +124,12 @@ __shared_weak_count::lock() _NOEXCEPT
124124 return nullptr;
125125}
126126
127#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
128
129127const void*
130128__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
131129{
132130 return nullptr;
133131}
134132
135#endif // _LIBCPP_NO_RTTI
136
137133#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
138134
139135_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
6464 if (size == 0)
6565 size = 1;
6666 void* p;
67 while ((p = ::malloc(size)) == 0)
67 while ((p = ::malloc(size)) == nullptr)
6868 {
6969 // If malloc fails and there is a new_handler,
7070 // call it to try free up memory.
......@@ -85,7 +85,7 @@ _LIBCPP_WEAK
8585void*
8686operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
8787{
88 void* p = 0;
88 void* p = nullptr;
8989#ifndef _LIBCPP_NO_EXCEPTIONS
9090 try
9191 {
......@@ -111,7 +111,7 @@ _LIBCPP_WEAK
111111void*
112112operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
113113{
114 void* p = 0;
114 void* p = nullptr;
115115#ifndef _LIBCPP_NO_EXCEPTIONS
116116 try
117117 {
......@@ -130,7 +130,8 @@ _LIBCPP_WEAK
130130void
131131operator delete(void* ptr) _NOEXCEPT
132132{
133 ::free(ptr);
133 if (ptr)
134 ::free(ptr);
134135}
135136
136137_LIBCPP_WEAK
......@@ -178,15 +179,16 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
178179 size = 1;
179180 if (static_cast<size_t>(alignment) < sizeof(void*))
180181 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).
181189 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)
187191 {
188 // If posix_memalign fails and there is a new_handler,
189 // call it to try free up memory.
190192 std::new_handler nh = std::get_new_handler();
191193 if (nh)
192194 nh();
......@@ -194,7 +196,6 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
194196#ifndef _LIBCPP_NO_EXCEPTIONS
195197 throw std::bad_alloc();
196198#else
197 p = nullptr; // posix_memalign doesn't initialize 'p' on failure
198199 break;
199200#endif
200201 }
......@@ -206,7 +207,7 @@ _LIBCPP_WEAK
206207void*
207208operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
208209{
209 void* p = 0;
210 void* p = nullptr;
210211#ifndef _LIBCPP_NO_EXCEPTIONS
211212 try
212213 {
......@@ -232,7 +233,7 @@ _LIBCPP_WEAK
232233void*
233234operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
234235{
235 void* p = 0;
236 void* p = nullptr;
236237#ifndef _LIBCPP_NO_EXCEPTIONS
237238 try
238239 {
......@@ -251,11 +252,9 @@ _LIBCPP_WEAK
251252void
252253operator delete(void* ptr, std::align_val_t) _NOEXCEPT
253254{
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 }
259258}
260259
261260_LIBCPP_WEAK
lib/libcxx/src/optional.cpp+1
......@@ -7,6 +7,7 @@
77//===----------------------------------------------------------------------===//
88
99#include "optional"
10#include "__availability"
1011
1112namespace std
1213{
lib/libcxx/src/support/runtime/exception_fallback.ipp-4
......@@ -49,7 +49,6 @@ get_terminate() _NOEXCEPT
4949 return __libcpp_atomic_load(&__terminate_handler);
5050}
5151
52#ifndef __EMSCRIPTEN__ // We provide this in JS
5352_LIBCPP_NORETURN
5453void
5554terminate() _NOEXCEPT
......@@ -72,9 +71,7 @@ terminate() _NOEXCEPT
7271 }
7372#endif // _LIBCPP_NO_EXCEPTIONS
7473}
75#endif // !__EMSCRIPTEN__
7674
77#if !defined(__EMSCRIPTEN__)
7875bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
7976
8077int uncaught_exceptions() _NOEXCEPT
......@@ -83,7 +80,6 @@ int uncaught_exceptions() _NOEXCEPT
8380 fprintf(stderr, "uncaught_exceptions not yet implemented\n");
8481 ::abort();
8582}
86#endif // !__EMSCRIPTEN__
8783
8884
8985exception::~exception() _NOEXCEPT
lib/libcxx/src/thread.cpp+2-16
......@@ -14,17 +14,9 @@
1414#include "vector"
1515#include "future"
1616#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__))
2517
2618#if __has_include(<unistd.h>)
27#include <unistd.h>
19# include <unistd.h> // for sysconf
2820#endif
2921
3022#if defined(__NetBSD__)
......@@ -80,13 +72,7 @@ thread::detach()
8072unsigned
8173thread::hardware_concurrency() _NOEXCEPT
8274{
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)
9076 long result = sysconf(_SC_NPROCESSORS_ONLN);
9177 // sysconf returns -1 if the name is invalid, the option does not exist or
9278 // does not have a definite limit.
src/libcxx.zig+1
......@@ -49,6 +49,7 @@ const libcxx_files = [_][]const u8{
4949 "src/future.cpp",
5050 "src/hash.cpp",
5151 "src/ios.cpp",
52 "src/ios.instantiations.cpp",
5253 "src/iostream.cpp",
5354 "src/locale.cpp",
5455 "src/memory.cpp",