authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-14 10:34:21-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-14 10:34:21-05:00
log2289036a40082eb5316e2a46fb2f3a78a8be0c7d
tree9ddbafeeec6b9166667f82f0334e74a7b97fcf2b
parent74619cc04586866013e40228f001e3fa79932d8e
signaturelock-open Commit is signed but in an unrecognized format.

update libcxx to llvm10.0.0rc2


66 files changed, 2284 insertions(+), 1453 deletions(-)

lib/libcxx/include/__bit_reference+18-8
...@@ -47,6 +47,9 @@ class __bit_reference...@@ -47,6 +47,9 @@ class __bit_reference
47 friend class __bit_const_reference<_Cp>;47 friend class __bit_const_reference<_Cp>;
48 friend class __bit_iterator<_Cp, false>;48 friend class __bit_iterator<_Cp, false>;
49public:49public:
50 _LIBCPP_INLINE_VISIBILITY
51 __bit_reference(const __bit_reference&) = default;
52
50 _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT53 _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
51 {return static_cast<bool>(*__seg_ & __mask_);}54 {return static_cast<bool>(*__seg_ & __mask_);}
52 _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT55 _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
...@@ -132,6 +135,9 @@ class __bit_const_reference...@@ -132,6 +135,9 @@ class __bit_const_reference
132 friend typename _Cp::__self;135 friend typename _Cp::__self;
133 friend class __bit_iterator<_Cp, true>;136 friend class __bit_iterator<_Cp, true>;
134public:137public:
138 _LIBCPP_INLINE_VISIBILITY
139 __bit_const_reference(const __bit_const_reference&) = default;
140
135 _LIBCPP_INLINE_VISIBILITY141 _LIBCPP_INLINE_VISIBILITY
136 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT142 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
137 : __seg_(__x.__seg_), __mask_(__x.__mask_) {}143 : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
...@@ -147,7 +153,7 @@ private:...@@ -147,7 +153,7 @@ private:
147 __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT153 __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
148 : __seg_(__s), __mask_(__m) {}154 : __seg_(__s), __mask_(__m) {}
149155
150 __bit_const_reference& operator=(const __bit_const_reference& __x);156 __bit_const_reference& operator=(const __bit_const_reference&) = delete;
151};157};
152158
153// find159// find
...@@ -332,7 +338,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)...@@ -332,7 +338,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
332 }338 }
333 // do middle whole words339 // do middle whole words
334 __storage_type __nw = __n / __bits_per_word;340 __storage_type __nw = __n / __bits_per_word;
335 _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));341 _VSTD::memset(_VSTD::__to_address(__first.__seg_), 0, __nw * sizeof(__storage_type));
336 __n -= __nw * __bits_per_word;342 __n -= __nw * __bits_per_word;
337 // do last partial word343 // do last partial word
338 if (__n > 0)344 if (__n > 0)
...@@ -362,7 +368,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)...@@ -362,7 +368,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
362 }368 }
363 // do middle whole words369 // do middle whole words
364 __storage_type __nw = __n / __bits_per_word;370 __storage_type __nw = __n / __bits_per_word;
365 _VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));371 _VSTD::memset(_VSTD::__to_address(__first.__seg_), -1, __nw * sizeof(__storage_type));
366 __n -= __nw * __bits_per_word;372 __n -= __nw * __bits_per_word;
367 // do last partial word373 // do last partial word
368 if (__n > 0)374 if (__n > 0)
...@@ -429,8 +435,8 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon...@@ -429,8 +435,8 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
429 // __first.__ctz_ == 0;435 // __first.__ctz_ == 0;
430 // do middle words436 // do middle words
431 __storage_type __nw = __n / __bits_per_word;437 __storage_type __nw = __n / __bits_per_word;
432 _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),438 _VSTD::memmove(_VSTD::__to_address(__result.__seg_),
433 _VSTD::__to_raw_pointer(__first.__seg_),439 _VSTD::__to_address(__first.__seg_),
434 __nw * sizeof(__storage_type));440 __nw * sizeof(__storage_type));
435 __n -= __nw * __bits_per_word;441 __n -= __nw * __bits_per_word;
436 __result.__seg_ += __nw;442 __result.__seg_ += __nw;
...@@ -570,8 +576,8 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C...@@ -570,8 +576,8 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
570 __storage_type __nw = __n / __bits_per_word;576 __storage_type __nw = __n / __bits_per_word;
571 __result.__seg_ -= __nw;577 __result.__seg_ -= __nw;
572 __last.__seg_ -= __nw;578 __last.__seg_ -= __nw;
573 _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),579 _VSTD::memmove(_VSTD::__to_address(__result.__seg_),
574 _VSTD::__to_raw_pointer(__last.__seg_),580 _VSTD::__to_address(__last.__seg_),
575 __nw * sizeof(__storage_type));581 __nw * sizeof(__storage_type));
576 __n -= __nw * __bits_per_word;582 __n -= __nw * __bits_per_word;
577 // do last word583 // do last word
...@@ -1108,8 +1114,12 @@ public:...@@ -1108,8 +1114,12 @@ public:
1108#endif1114#endif
1109 {}1115 {}
11101116
1117 // avoid re-declaring a copy constructor for the non-const version.
1118 using __type_for_copy_to_const =
1119 _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>;
1120
1111 _LIBCPP_INLINE_VISIBILITY1121 _LIBCPP_INLINE_VISIBILITY
1112 __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT1122 __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT
1113 : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}1123 : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
11141124
1115 _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT1125 _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
lib/libcxx/include/__config+127-20
...@@ -32,7 +32,7 @@...@@ -32,7 +32,7 @@
32# define _GNUC_VER_NEW 032# define _GNUC_VER_NEW 0
33#endif33#endif
3434
35#define _LIBCPP_VERSION 900035#define _LIBCPP_VERSION 10000
3636
37#ifndef _LIBCPP_ABI_VERSION37#ifndef _LIBCPP_ABI_VERSION
38# define _LIBCPP_ABI_VERSION 138# define _LIBCPP_ABI_VERSION 1
...@@ -183,10 +183,6 @@...@@ -183,10 +183,6 @@
183# define _LIBCPP_COMPILER_IBM183# define _LIBCPP_COMPILER_IBM
184#endif184#endif
185185
186#ifndef _LIBCPP_CLANG_VER
187#define _LIBCPP_CLANG_VER 0
188#endif
189
190#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L186#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
191#error "libc++ does not support using GCC with C++03. Please enable C++11"187#error "libc++ does not support using GCC with C++03. Please enable C++11"
192#endif188#endif
...@@ -246,6 +242,7 @@...@@ -246,6 +242,7 @@
246242
247#ifdef __FreeBSD__243#ifdef __FreeBSD__
248# include <sys/endian.h>244# include <sys/endian.h>
245# include <osreldate.h>
249# if _BYTE_ORDER == _LITTLE_ENDIAN246# if _BYTE_ORDER == _LITTLE_ENDIAN
250# define _LIBCPP_LITTLE_ENDIAN247# define _LIBCPP_LITTLE_ENDIAN
251# else // _BYTE_ORDER == _LITTLE_ENDIAN248# else // _BYTE_ORDER == _LITTLE_ENDIAN
...@@ -263,7 +260,6 @@...@@ -263,7 +260,6 @@
263# else // _BYTE_ORDER == _LITTLE_ENDIAN260# else // _BYTE_ORDER == _LITTLE_ENDIAN
264# define _LIBCPP_BIG_ENDIAN261# define _LIBCPP_BIG_ENDIAN
265# endif // _BYTE_ORDER == _LITTLE_ENDIAN262# endif // _BYTE_ORDER == _LITTLE_ENDIAN
266# define _LIBCPP_HAS_QUICK_EXIT
267#endif // __NetBSD__263#endif // __NetBSD__
268264
269#if defined(_WIN32)265#if defined(_WIN32)
...@@ -343,9 +339,26 @@...@@ -343,9 +339,26 @@
343339
344#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L340#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
345# if defined(__FreeBSD__)341# if defined(__FreeBSD__)
342# define _LIBCPP_HAS_ALIGNED_ALLOC
346# define _LIBCPP_HAS_QUICK_EXIT343# define _LIBCPP_HAS_QUICK_EXIT
347# define _LIBCPP_HAS_C11_FEATURES344# define _LIBCPP_HAS_C11_FEATURES
348# elif defined(__Fuchsia__) || defined(__wasi__)345# if __FreeBSD_version >= 1300064 || \
346 (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000)
347# define _LIBCPP_HAS_TIMESPEC_GET
348# endif
349# elif defined(__BIONIC__)
350# define _LIBCPP_HAS_C11_FEATURES
351# if __ANDROID_API__ >= 21
352# define _LIBCPP_HAS_QUICK_EXIT
353# endif
354# if __ANDROID_API__ >= 28
355# define _LIBCPP_HAS_ALIGNED_ALLOC
356# endif
357# if __ANDROID_API__ >= 29
358# define _LIBCPP_HAS_TIMESPEC_GET
359# endif
360# elif defined(__Fuchsia__) || defined(__wasi__) || defined(__NetBSD__)
361# define _LIBCPP_HAS_ALIGNED_ALLOC
349# define _LIBCPP_HAS_QUICK_EXIT362# define _LIBCPP_HAS_QUICK_EXIT
350# define _LIBCPP_HAS_TIMESPEC_GET363# define _LIBCPP_HAS_TIMESPEC_GET
351# define _LIBCPP_HAS_C11_FEATURES364# define _LIBCPP_HAS_C11_FEATURES
...@@ -355,10 +368,12 @@...@@ -355,10 +368,12 @@
355# define _LIBCPP_HAS_QUICK_EXIT368# define _LIBCPP_HAS_QUICK_EXIT
356# endif369# endif
357# if _LIBCPP_GLIBC_PREREQ(2, 17)370# if _LIBCPP_GLIBC_PREREQ(2, 17)
371# define _LIBCPP_HAS_ALIGNED_ALLOC
358# define _LIBCPP_HAS_C11_FEATURES372# define _LIBCPP_HAS_C11_FEATURES
359# define _LIBCPP_HAS_TIMESPEC_GET373# define _LIBCPP_HAS_TIMESPEC_GET
360# endif374# endif
361# else // defined(_LIBCPP_HAS_MUSL_LIBC)375# else // defined(_LIBCPP_HAS_MUSL_LIBC)
376# define _LIBCPP_HAS_ALIGNED_ALLOC
362# define _LIBCPP_HAS_QUICK_EXIT377# define _LIBCPP_HAS_QUICK_EXIT
363# define _LIBCPP_HAS_TIMESPEC_GET378# define _LIBCPP_HAS_TIMESPEC_GET
364# define _LIBCPP_HAS_C11_FEATURES379# define _LIBCPP_HAS_C11_FEATURES
...@@ -483,11 +498,14 @@ typedef __char32_t char32_t;...@@ -483,11 +498,14 @@ typedef __char32_t char32_t;
483498
484#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))499#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
485500
486// No apple compilers support ""d and ""y at this time.501// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1
487#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)502#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \
488#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS503 (defined(__apple_build_version__) && __apple_build_version__ < 10010000)
504#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
489#endif505#endif
490506
507#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
508
491#elif defined(_LIBCPP_COMPILER_GCC)509#elif defined(_LIBCPP_COMPILER_GCC)
492510
493#define _ALIGNAS(x) __attribute__((__aligned__(x)))511#define _ALIGNAS(x) __attribute__((__aligned__(x)))
...@@ -523,6 +541,8 @@ typedef __char32_t char32_t;...@@ -523,6 +541,8 @@ typedef __char32_t char32_t;
523541
524#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))542#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
525543
544#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
545
526#elif defined(_LIBCPP_COMPILER_MSVC)546#elif defined(_LIBCPP_COMPILER_MSVC)
527547
528#define _LIBCPP_TOSTRING2(x) #x548#define _LIBCPP_TOSTRING2(x) #x
...@@ -548,6 +568,8 @@ typedef __char32_t char32_t;...@@ -548,6 +568,8 @@ typedef __char32_t char32_t;
548568
549#define _LIBCPP_HAS_NO_VECTOR_EXTENSION569#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
550570
571#define _LIBCPP_DISABLE_EXTENSION_WARNING
572
551#elif defined(_LIBCPP_COMPILER_IBM)573#elif defined(_LIBCPP_COMPILER_IBM)
552574
553#define _ALIGNAS(x) __attribute__((__aligned__(x)))575#define _ALIGNAS(x) __attribute__((__aligned__(x)))
...@@ -568,6 +590,8 @@ typedef __char32_t char32_t;...@@ -568,6 +590,8 @@ typedef __char32_t char32_t;
568590
569#define _LIBCPP_HAS_NO_VECTOR_EXTENSION591#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
570592
593#define _LIBCPP_DISABLE_EXTENSION_WARNING
594
571#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]595#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
572596
573#if defined(_LIBCPP_OBJECT_FORMAT_COFF)597#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
...@@ -860,6 +884,10 @@ typedef unsigned int char32_t;...@@ -860,6 +884,10 @@ typedef unsigned int char32_t;
860# endif884# endif
861#endif885#endif
862886
887#ifndef _LIBCPP_DEBUG_LEVEL
888# define _LIBCPP_DEBUG_LEVEL 0
889#endif
890
863#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE891#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
864#define _LIBCPP_EXTERN_TEMPLATE(...)892#define _LIBCPP_EXTERN_TEMPLATE(...)
865#define _LIBCPP_EXTERN_TEMPLATE2(...)893#define _LIBCPP_EXTERN_TEMPLATE2(...)
...@@ -958,6 +986,20 @@ typedef unsigned int char32_t;...@@ -958,6 +986,20 @@ typedef unsigned int char32_t;
958# define _LIBCPP_DEPRECATED_IN_CXX17986# define _LIBCPP_DEPRECATED_IN_CXX17
959#endif987#endif
960988
989// Macros to enter and leave a state where deprecation warnings are suppressed.
990#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
991 (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
992# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
993 _Pragma("GCC diagnostic push") \
994 _Pragma("GCC diagnostic ignored \"-Wdeprecated\"")
995# define _LIBCPP_SUPPRESS_DEPRECATED_POP \
996 _Pragma("GCC diagnostic pop")
997#endif
998#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH)
999# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
1000# define _LIBCPP_SUPPRESS_DEPRECATED_POP
1001#endif
1002
961#if _LIBCPP_STD_VER <= 111003#if _LIBCPP_STD_VER <= 11
962# define _LIBCPP_EXPLICIT_AFTER_CXX111004# define _LIBCPP_EXPLICIT_AFTER_CXX11
963#else1005#else
...@@ -982,6 +1024,14 @@ typedef unsigned int char32_t;...@@ -982,6 +1024,14 @@ typedef unsigned int char32_t;
982# define _LIBCPP_CONSTEXPR_AFTER_CXX171024# define _LIBCPP_CONSTEXPR_AFTER_CXX17
983#endif1025#endif
9841026
1027#if _LIBCPP_STD_VER > 17 && \
1028 !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \
1029 !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
1030# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr
1031#else
1032# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1033#endif
1034
985// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other1035// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
986// NODISCARD macros to the correct attribute.1036// NODISCARD macros to the correct attribute.
987#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)1037#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
...@@ -1065,7 +1115,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1065,7 +1115,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1065 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \1115 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
1066 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)1116 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1067# if defined(__FreeBSD__) || \1117# if defined(__FreeBSD__) || \
1068 defined(__Fuchsia__) || \
1069 defined(__wasi__) || \1118 defined(__wasi__) || \
1070 defined(__NetBSD__) || \1119 defined(__NetBSD__) || \
1071 defined(__linux__) || \1120 defined(__linux__) || \
...@@ -1075,6 +1124,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1075,6 +1124,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1075 defined(__sun__) || \1124 defined(__sun__) || \
1076 (defined(__MINGW32__) && __has_include(<pthread.h>))1125 (defined(__MINGW32__) && __has_include(<pthread.h>))
1077# define _LIBCPP_HAS_THREAD_API_PTHREAD1126# define _LIBCPP_HAS_THREAD_API_PTHREAD
1127# elif defined(__Fuchsia__)
1128# define _LIBCPP_HAS_THREAD_API_C11
1078# elif defined(_LIBCPP_WIN32API)1129# elif defined(_LIBCPP_WIN32API)
1079# define _LIBCPP_HAS_THREAD_API_WIN321130# define _LIBCPP_HAS_THREAD_API_WIN32
1080# else1131# else
...@@ -1082,6 +1133,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1082,6 +1133,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1082# endif // _LIBCPP_HAS_THREAD_API1133# endif // _LIBCPP_HAS_THREAD_API
1083#endif // _LIBCPP_HAS_NO_THREADS1134#endif // _LIBCPP_HAS_NO_THREADS
10841135
1136#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1137#if defined(__ANDROID__) && __ANDROID_API__ >= 30
1138#define _LIBCPP_HAS_COND_CLOCKWAIT
1139#elif defined(_LIBCPP_GLIBC_PREREQ)
1140#if _LIBCPP_GLIBC_PREREQ(2, 30)
1141#define _LIBCPP_HAS_COND_CLOCKWAIT
1142#endif
1143#endif
1144#endif
1145
1085#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)1146#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1086#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \1147#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
1087 _LIBCPP_HAS_NO_THREADS is not defined.1148 _LIBCPP_HAS_NO_THREADS is not defined.
...@@ -1097,20 +1158,40 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1097,20 +1158,40 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1097 _LIBCPP_HAS_NO_THREADS is defined.1158 _LIBCPP_HAS_NO_THREADS is defined.
1098#endif1159#endif
10991160
1100// The Apple, glibc, and Bionic implementation of pthreads implements1161#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
1162#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
1163#endif
1164
1165#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
1166#define __STDCPP_THREADS__ 1
1167#endif
1168
1169// The glibc and Bionic implementation of pthreads implements
1101// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win321170// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
1102// mutexes have no destroy mechanism.1171// mutexes have no destroy mechanism.
1103// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after1172//
1104// speaking to their respective stakeholders.1173// This optimization can't be performed on Apple platforms, where
1174// pthread_mutex_destroy can allow the kernel to release resources.
1175// See https://llvm.org/D64298 for details.
1176//
1177// TODO(EricWF): Enable this optimization on Bionic after speaking to their
1178// respective stakeholders.
1105#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \1179#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
1180 || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \
1106 || defined(_LIBCPP_HAS_THREAD_API_WIN32)1181 || defined(_LIBCPP_HAS_THREAD_API_WIN32)
1107# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION1182# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
1108#endif1183#endif
11091184
1110// Destroying a condvar is a nop on Windows.1185// Destroying a condvar is a nop on Windows.
1186//
1187// This optimization can't be performed on Apple platforms, where
1188// pthread_cond_destroy can allow the kernel to release resources.
1189// See https://llvm.org/D64298 for details.
1190//
1111// TODO(EricWF): This is potentially true for some pthread implementations1191// TODO(EricWF): This is potentially true for some pthread implementations
1112// as well.1192// as well.
1113#if defined(_LIBCPP_HAS_THREAD_API_WIN32)1193#if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \
1194 defined(_LIBCPP_HAS_THREAD_API_WIN32)
1114# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION1195# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
1115#endif1196#endif
11161197
...@@ -1129,6 +1210,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1129,6 +1210,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1129#define _LIBCPP_HAS_NO_STDOUT1210#define _LIBCPP_HAS_NO_STDOUT
1130#endif1211#endif
11311212
1213// Some systems do not provide gets() in their C library, for security reasons.
1214#ifndef _LIBCPP_C_HAS_NO_GETS
1215# if defined(_LIBCPP_MSVCRT) || \
1216 (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)
1217# define _LIBCPP_C_HAS_NO_GETS
1218# endif
1219#endif
1220
1132#if defined(__BIONIC__) || defined(__CloudABI__) || \1221#if defined(__BIONIC__) || defined(__CloudABI__) || \
1133 defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)1222 defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1134#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE1223#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
...@@ -1175,6 +1264,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1175,6 +1264,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1175# endif1264# endif
1176#endif1265#endif
11771266
1267#ifndef _LIBCPP_THREAD_SAFETY_ANNOTATION
1268# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1269# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x))
1270# else
1271# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x)
1272# endif
1273#endif // _LIBCPP_THREAD_SAFETY_ANNOTATION
1274
1178#if __has_attribute(require_constant_initialization)1275#if __has_attribute(require_constant_initialization)
1179# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))1276# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1180#else1277#else
...@@ -1210,7 +1307,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1210,7 +1307,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1210# define _LIBCPP_FALLTHROUGH() [[fallthrough]]1307# define _LIBCPP_FALLTHROUGH() [[fallthrough]]
1211#elif __has_cpp_attribute(clang::fallthrough)1308#elif __has_cpp_attribute(clang::fallthrough)
1212# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]]1309# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]]
1213#elif __has_attribute(fallthough) || _GNUC_VER >= 7001310#elif __has_attribute(fallthrough) || _GNUC_VER >= 700
1214# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))1311# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
1215#else1312#else
1216# define _LIBCPP_FALLTHROUGH() ((void)0)1313# define _LIBCPP_FALLTHROUGH() ((void)0)
...@@ -1224,7 +1321,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1224,7 +1321,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12241321
1225#ifndef _LIBCPP_NODEBUG_TYPE1322#ifndef _LIBCPP_NODEBUG_TYPE
1226#if __has_attribute(__nodebug__) && \1323#if __has_attribute(__nodebug__) && \
1227 (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)1324 (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900)
1228#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))1325#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
1229#else1326#else
1230#define _LIBCPP_NODEBUG_TYPE1327#define _LIBCPP_NODEBUG_TYPE
...@@ -1257,10 +1354,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1257,10 +1354,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1257#define _LIBCPP_HAS_NO_COROUTINES1354#define _LIBCPP_HAS_NO_COROUTINES
1258#endif1355#endif
12591356
1260// FIXME: Correct this macro when either (A) a feature test macro for the1357#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L
1261// spaceship operator is provided, or (B) a compiler provides a complete
1262// implementation.
1263#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR1358#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
1359#endif
12641360
1265// Decide whether to use availability macros.1361// Decide whether to use availability macros.
1266#if !defined(_LIBCPP_BUILDING_LIBRARY) && \1362#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
...@@ -1411,6 +1507,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1411,6 +1507,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
14111507
1412#define _LIBCPP_UNUSED_VAR(x) ((void)(x))1508#define _LIBCPP_UNUSED_VAR(x) ((void)(x))
14131509
1510// Configures the fopen close-on-exec mode character, if any. This string will
1511// be appended to any mode string used by fstream for fopen/fdopen.
1512//
1513// Not all platforms support this, but it helps avoid fd-leaks on platforms that
1514// do.
1515#if defined(__BIONIC__)
1516# define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
1517#else
1518# define _LIBCPP_FOPEN_CLOEXEC_MODE
1519#endif
1520
1414#endif // __cplusplus1521#endif // __cplusplus
14151522
1416#endif // _LIBCPP_CONFIG1523#endif // _LIBCPP_CONFIG
lib/libcxx/include/__config_site.in+1
...@@ -29,6 +29,7 @@...@@ -29,6 +29,7 @@
29#cmakedefine _LIBCPP_NO_VCRUNTIME29#cmakedefine _LIBCPP_NO_VCRUNTIME
30#cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT30#cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
31#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@31#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
32#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
3233
33@_LIBCPP_ABI_DEFINES@34@_LIBCPP_ABI_DEFINES@
3435
lib/libcxx/include/__debug-1
...@@ -276,4 +276,3 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();...@@ -276,4 +276,3 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
276_LIBCPP_END_NAMESPACE_STD276_LIBCPP_END_NAMESPACE_STD
277277
278#endif // _LIBCPP_DEBUG_H278#endif // _LIBCPP_DEBUG_H
279
lib/libcxx/include/__functional_03+4-4
...@@ -104,7 +104,7 @@ class __func<_Fp, _Alloc, _Rp()>...@@ -104,7 +104,7 @@ class __func<_Fp, _Alloc, _Rp()>
104{104{
105 __compressed_pair<_Fp, _Alloc> __f_;105 __compressed_pair<_Fp, _Alloc> __f_;
106public:106public:
107 explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}107 explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
108 explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}108 explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
109 virtual __base<_Rp()>* __clone() const;109 virtual __base<_Rp()>* __clone() const;
110 virtual void __clone(__base<_Rp()>*) const;110 virtual void __clone(__base<_Rp()>*) const;
...@@ -189,7 +189,7 @@ class __func<_Fp, _Alloc, _Rp(_A0)>...@@ -189,7 +189,7 @@ class __func<_Fp, _Alloc, _Rp(_A0)>
189{189{
190 __compressed_pair<_Fp, _Alloc> __f_;190 __compressed_pair<_Fp, _Alloc> __f_;
191public:191public:
192 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}192 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
193 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)193 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
194 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}194 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
195 virtual __base<_Rp(_A0)>* __clone() const;195 virtual __base<_Rp(_A0)>* __clone() const;
...@@ -275,7 +275,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1)>...@@ -275,7 +275,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
275{275{
276 __compressed_pair<_Fp, _Alloc> __f_;276 __compressed_pair<_Fp, _Alloc> __f_;
277public:277public:
278 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}278 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
279 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)279 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
280 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}280 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
281 virtual __base<_Rp(_A0, _A1)>* __clone() const;281 virtual __base<_Rp(_A0, _A1)>* __clone() const;
...@@ -361,7 +361,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>...@@ -361,7 +361,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
361{361{
362 __compressed_pair<_Fp, _Alloc> __f_;362 __compressed_pair<_Fp, _Alloc> __f_;
363public:363public:
364 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}364 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
365 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)365 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
366 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}366 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
367 virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;367 virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
lib/libcxx/include/__functional_base+1-1
...@@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up,...@@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up,
558558
559// allocator_arg_t559// allocator_arg_t
560560
561struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };561struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
562562
563#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)563#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
564extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;564extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;
lib/libcxx/include/__hash_table+14-12
...@@ -776,7 +776,7 @@ public:...@@ -776,7 +776,7 @@ public:
776 _LIBCPP_INLINE_VISIBILITY776 _LIBCPP_INLINE_VISIBILITY
777 __bucket_list_deallocator()777 __bucket_list_deallocator()
778 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)778 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
779 : __data_(0) {}779 : __data_(0, __default_init_tag()) {}
780780
781 _LIBCPP_INLINE_VISIBILITY781 _LIBCPP_INLINE_VISIBILITY
782 __bucket_list_deallocator(const allocator_type& __a, size_type __size)782 __bucket_list_deallocator(const allocator_type& __a, size_type __size)
...@@ -825,11 +825,13 @@ private:...@@ -825,11 +825,13 @@ private:
825825
826 allocator_type& __na_;826 allocator_type& __na_;
827827
828 __hash_node_destructor& operator=(const __hash_node_destructor&);
829
830public:828public:
831 bool __value_constructed;829 bool __value_constructed;
832830
831 __hash_node_destructor(__hash_node_destructor const&) = default;
832 __hash_node_destructor& operator=(const __hash_node_destructor&) = delete;
833
834
833 _LIBCPP_INLINE_VISIBILITY835 _LIBCPP_INLINE_VISIBILITY
834 explicit __hash_node_destructor(allocator_type& __na,836 explicit __hash_node_destructor(allocator_type& __na,
835 bool __constructed = false) _NOEXCEPT837 bool __constructed = false) _NOEXCEPT
...@@ -1416,8 +1418,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()...@@ -1416,8 +1418,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
1416 is_nothrow_default_constructible<__node_allocator>::value &&1418 is_nothrow_default_constructible<__node_allocator>::value &&
1417 is_nothrow_default_constructible<hasher>::value &&1419 is_nothrow_default_constructible<hasher>::value &&
1418 is_nothrow_default_constructible<key_equal>::value)1420 is_nothrow_default_constructible<key_equal>::value)
1419 : __p2_(0),1421 : __p2_(0, __default_init_tag()),
1420 __p3_(1.0f)1422 __p3_(1.0f, __default_init_tag())
1421{1423{
1422}1424}
14231425
...@@ -1437,7 +1439,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,...@@ -1437,7 +1439,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
1437 const key_equal& __eql,1439 const key_equal& __eql,
1438 const allocator_type& __a)1440 const allocator_type& __a)
1439 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),1441 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
1440 __p1_(__second_tag(), __node_allocator(__a)),1442 __p1_(__default_init_tag(), __node_allocator(__a)),
1441 __p2_(0, __hf),1443 __p2_(0, __hf),
1442 __p3_(1.0f, __eql)1444 __p3_(1.0f, __eql)
1443{1445{
...@@ -1446,9 +1448,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,...@@ -1446,9 +1448,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
1446template <class _Tp, class _Hash, class _Equal, class _Alloc>1448template <class _Tp, class _Hash, class _Equal, class _Alloc>
1447__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)1449__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
1448 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),1450 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
1449 __p1_(__second_tag(), __node_allocator(__a)),1451 __p1_(__default_init_tag(), __node_allocator(__a)),
1450 __p2_(0),1452 __p2_(0, __default_init_tag()),
1451 __p3_(1.0f)1453 __p3_(1.0f, __default_init_tag())
1452{1454{
1453}1455}
14541456
...@@ -1458,7 +1460,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)...@@ -1458,7 +1460,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
1458 __bucket_list_deleter(allocator_traits<__pointer_allocator>::1460 __bucket_list_deleter(allocator_traits<__pointer_allocator>::
1459 select_on_container_copy_construction(1461 select_on_container_copy_construction(
1460 __u.__bucket_list_.get_deleter().__alloc()), 0)),1462 __u.__bucket_list_.get_deleter().__alloc()), 0)),
1461 __p1_(__second_tag(), allocator_traits<__node_allocator>::1463 __p1_(__default_init_tag(), allocator_traits<__node_allocator>::
1462 select_on_container_copy_construction(__u.__node_alloc())),1464 select_on_container_copy_construction(__u.__node_alloc())),
1463 __p2_(0, __u.hash_function()),1465 __p2_(0, __u.hash_function()),
1464 __p3_(__u.__p3_)1466 __p3_(__u.__p3_)
...@@ -1469,7 +1471,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>...@@ -1469,7 +1471,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
1469__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,1471__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
1470 const allocator_type& __a)1472 const allocator_type& __a)
1471 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),1473 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
1472 __p1_(__second_tag(), __node_allocator(__a)),1474 __p1_(__default_init_tag(), __node_allocator(__a)),
1473 __p2_(0, __u.hash_function()),1475 __p2_(0, __u.hash_function()),
1474 __p3_(__u.__p3_)1476 __p3_(__u.__p3_)
1475{1477{
...@@ -1503,7 +1505,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>...@@ -1503,7 +1505,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
1503__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,1505__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
1504 const allocator_type& __a)1506 const allocator_type& __a)
1505 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),1507 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
1506 __p1_(__second_tag(), __node_allocator(__a)),1508 __p1_(__default_init_tag(), __node_allocator(__a)),
1507 __p2_(0, _VSTD::move(__u.hash_function())),1509 __p2_(0, _VSTD::move(__u.hash_function())),
1508 __p3_(_VSTD::move(__u.__p3_))1510 __p3_(_VSTD::move(__u.__p3_))
1509{1511{
lib/libcxx/include/__libcpp_version+1-1
...@@ -1 +1 @@...@@ -1 +1 @@
19000110000
lib/libcxx/include/__locale+1-1
...@@ -409,7 +409,7 @@ public:...@@ -409,7 +409,7 @@ public:
409 static const mask xdigit = _ISxdigit;409 static const mask xdigit = _ISxdigit;
410 static const mask blank = _ISblank;410 static const mask blank = _ISblank;
411#if defined(__mips__)411#if defined(__mips__)
412 static const mask __regex_word = static_cast<char_class_type>(_ISbit(15));412 static const mask __regex_word = static_cast<mask>(_ISbit(15));
413#else413#else
414 static const mask __regex_word = 0x80;414 static const mask __regex_word = 0x80;
415#endif415#endif
lib/libcxx/include/__mutex_base+134-31
...@@ -15,6 +15,7 @@...@@ -15,6 +15,7 @@
15#include <system_error>15#include <system_error>
16#include <__threading_support>16#include <__threading_support>
1717
18#include <time.h>
1819
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)20#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20#pragma GCC system_header21#pragma GCC system_header
...@@ -28,15 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD...@@ -28,15 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2829
29#ifndef _LIBCPP_HAS_NO_THREADS30#ifndef _LIBCPP_HAS_NO_THREADS
3031
31#ifndef _LIBCPP_THREAD_SAFETY_ANNOTATION
32# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
33# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x))
34# else
35# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x)
36# endif
37#endif // _LIBCPP_THREAD_SAFETY_ANNOTATION
38
39
40class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex32class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
41{33{
42 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;34 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
...@@ -65,9 +57,9 @@ public:...@@ -65,9 +57,9 @@ public:
65static_assert(is_nothrow_default_constructible<mutex>::value,57static_assert(is_nothrow_default_constructible<mutex>::value,
66 "the default constructor for std::mutex must be nothrow");58 "the default constructor for std::mutex must be nothrow");
6759
68struct _LIBCPP_TYPE_VIS defer_lock_t {};60struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; };
69struct _LIBCPP_TYPE_VIS try_to_lock_t {};61struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; };
70struct _LIBCPP_TYPE_VIS adopt_lock_t {};62struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; };
7163
72#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)64#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
7365
...@@ -94,10 +86,11 @@ private:...@@ -94,10 +86,11 @@ private:
94 mutex_type& __m_;86 mutex_type& __m_;
95public:87public:
9688
97 _LIBCPP_INLINE_VISIBILITY89 _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
98 explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))90 explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
99 : __m_(__m) {__m_.lock();}91 : __m_(__m) {__m_.lock();}
100 _LIBCPP_INLINE_VISIBILITY92
93 _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
101 lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))94 lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
102 : __m_(__m) {}95 : __m_(__m) {}
103 _LIBCPP_INLINE_VISIBILITY96 _LIBCPP_INLINE_VISIBILITY
...@@ -336,23 +329,75 @@ public:...@@ -336,23 +329,75 @@ public:
336private:329private:
337 void __do_timed_wait(unique_lock<mutex>& __lk,330 void __do_timed_wait(unique_lock<mutex>& __lk,
338 chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;331 chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
332#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
333 void __do_timed_wait(unique_lock<mutex>& __lk,
334 chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT;
335#endif
336 template <class _Clock>
337 void __do_timed_wait(unique_lock<mutex>& __lk,
338 chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
339};339};
340#endif // !_LIBCPP_HAS_NO_THREADS340#endif // !_LIBCPP_HAS_NO_THREADS
341341
342template <class _To, class _Rep, class _Period>342template <class _Rep, class _Period>
343inline _LIBCPP_INLINE_VISIBILITY343inline _LIBCPP_INLINE_VISIBILITY
344typename enable_if344typename enable_if
345<345<
346 chrono::__is_duration<_To>::value,346 is_floating_point<_Rep>::value,
347 _To347 chrono::nanoseconds
348>::type348>::type
349__ceil(chrono::duration<_Rep, _Period> __d)349__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
350{350{
351 using namespace chrono;351 using namespace chrono;
352 _To __r = duration_cast<_To>(__d);352 using __ratio = ratio_divide<_Period, nano>;
353 if (__r < __d)353 using __ns_rep = nanoseconds::rep;
354 ++__r;354 _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
355 return __r;355
356 _Rep __result_max = numeric_limits<__ns_rep>::max();
357 if (__result_float >= __result_max) {
358 return nanoseconds::max();
359 }
360
361 _Rep __result_min = numeric_limits<__ns_rep>::min();
362 if (__result_float <= __result_min) {
363 return nanoseconds::min();
364 }
365
366 return nanoseconds(static_cast<__ns_rep>(__result_float));
367}
368
369template <class _Rep, class _Period>
370inline _LIBCPP_INLINE_VISIBILITY
371typename enable_if
372<
373 !is_floating_point<_Rep>::value,
374 chrono::nanoseconds
375>::type
376__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
377{
378 using namespace chrono;
379 if (__d.count() == 0) {
380 return nanoseconds(0);
381 }
382
383 using __ratio = ratio_divide<_Period, nano>;
384 using __ns_rep = nanoseconds::rep;
385 __ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
386 if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
387 return nanoseconds::max();
388 }
389
390 __ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
391 if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
392 return nanoseconds::min();
393 }
394
395 __ns_rep __result = __d.count() * __ratio::num / __ratio::den;
396 if (__result == 0) {
397 return nanoseconds(1);
398 }
399
400 return nanoseconds(__result);
356}401}
357402
358#ifndef _LIBCPP_HAS_NO_THREADS403#ifndef _LIBCPP_HAS_NO_THREADS
...@@ -370,7 +415,15 @@ condition_variable::wait_until(unique_lock<mutex>& __lk,...@@ -370,7 +415,15 @@ condition_variable::wait_until(unique_lock<mutex>& __lk,
370 const chrono::time_point<_Clock, _Duration>& __t)415 const chrono::time_point<_Clock, _Duration>& __t)
371{416{
372 using namespace chrono;417 using namespace chrono;
373 wait_for(__lk, __t - _Clock::now());418 using __clock_tp_ns = time_point<_Clock, nanoseconds>;
419
420 typename _Clock::time_point __now = _Clock::now();
421 if (__t <= __now)
422 return cv_status::timeout;
423
424 __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch()));
425
426 __do_timed_wait(__lk, __t_ns);
374 return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;427 return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
375}428}
376429
...@@ -396,15 +449,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,...@@ -396,15 +449,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
396 using namespace chrono;449 using namespace chrono;
397 if (__d <= __d.zero())450 if (__d <= __d.zero())
398 return cv_status::timeout;451 return cv_status::timeout;
399 typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;452 using __ns_rep = nanoseconds::rep;
400 typedef time_point<system_clock, nanoseconds> __sys_tpi;
401 __sys_tpf _Max = __sys_tpi::max();
402 steady_clock::time_point __c_now = steady_clock::now();453 steady_clock::time_point __c_now = steady_clock::now();
403 system_clock::time_point __s_now = system_clock::now();454
404 if (_Max - __d > __s_now)455#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
405 __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));456 using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
406 else457 __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
407 __do_timed_wait(__lk, __sys_tpi::max());458#else
459 using __clock_tp_ns = time_point<system_clock, nanoseconds>;
460 __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
461#endif
462
463 __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
464
465 if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
466 __do_timed_wait(__lk, __clock_tp_ns::max());
467 } else {
468 __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count)));
469 }
470
408 return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :471 return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
409 cv_status::timeout;472 cv_status::timeout;
410}473}
...@@ -420,6 +483,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,...@@ -420,6 +483,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
420 _VSTD::move(__pred));483 _VSTD::move(__pred));
421}484}
422485
486#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
487inline
488void
489condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
490 chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT
491{
492 using namespace chrono;
493 if (!__lk.owns_lock())
494 __throw_system_error(EPERM,
495 "condition_variable::timed wait: mutex not locked");
496 nanoseconds __d = __tp.time_since_epoch();
497 timespec __ts;
498 seconds __s = duration_cast<seconds>(__d);
499 using __ts_sec = decltype(__ts.tv_sec);
500 const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
501 if (__s.count() < __ts_sec_max)
502 {
503 __ts.tv_sec = static_cast<__ts_sec>(__s.count());
504 __ts.tv_nsec = (__d - __s).count();
505 }
506 else
507 {
508 __ts.tv_sec = __ts_sec_max;
509 __ts.tv_nsec = giga::num - 1;
510 }
511 int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
512 if (__ec != 0 && __ec != ETIMEDOUT)
513 __throw_system_error(__ec, "condition_variable timed_wait failed");
514}
515#endif // _LIBCPP_HAS_COND_CLOCKWAIT
516
517template <class _Clock>
518inline
519void
520condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
521 chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT
522{
523 wait_for(__lk, __tp - _Clock::now());
524}
525
423#endif // !_LIBCPP_HAS_NO_THREADS526#endif // !_LIBCPP_HAS_NO_THREADS
424527
425_LIBCPP_END_NAMESPACE_STD528_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__split_buffer+43-36
...@@ -116,15 +116,15 @@ public:...@@ -116,15 +116,15 @@ public:
116 template <class _InputIter>116 template <class _InputIter>
117 typename enable_if117 typename enable_if
118 <118 <
119 __is_input_iterator<_InputIter>::value &&119 __is_cpp17_input_iterator<_InputIter>::value &&
120 !__is_forward_iterator<_InputIter>::value,120 !__is_cpp17_forward_iterator<_InputIter>::value,
121 void121 void
122 >::type122 >::type
123 __construct_at_end(_InputIter __first, _InputIter __last);123 __construct_at_end(_InputIter __first, _InputIter __last);
124 template <class _ForwardIterator>124 template <class _ForwardIterator>
125 typename enable_if125 typename enable_if
126 <126 <
127 __is_forward_iterator<_ForwardIterator>::value,127 __is_cpp17_forward_iterator<_ForwardIterator>::value,
128 void128 void
129 >::type129 >::type
130 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);130 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
...@@ -161,6 +161,19 @@ private:...@@ -161,6 +161,19 @@ private:
161 _LIBCPP_INLINE_VISIBILITY161 _LIBCPP_INLINE_VISIBILITY
162 void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT162 void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
163 {}163 {}
164
165 struct _ConstructTransaction {
166 explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT
167 : __pos_(*__p), __end_(*__p + __n), __dest_(__p) {
168 }
169 ~_ConstructTransaction() {
170 *__dest_ = __pos_;
171 }
172 pointer __pos_;
173 const pointer __end_;
174 private:
175 pointer *__dest_;
176 };
164};177};
165178
166template <class _Tp, class _Allocator>179template <class _Tp, class _Allocator>
...@@ -197,13 +210,10 @@ template <class _Tp, class _Allocator>...@@ -197,13 +210,10 @@ template <class _Tp, class _Allocator>
197void210void
198__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)211__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
199{212{
200 __alloc_rr& __a = this->__alloc();213 _ConstructTransaction __tx(&this->__end_, __n);
201 do214 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
202 {215 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_));
203 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));216 }
204 ++this->__end_;
205 --__n;
206 } while (__n > 0);
207}217}
208218
209// Copy constructs __n objects starting at __end_ from __x219// Copy constructs __n objects starting at __end_ from __x
...@@ -216,21 +226,19 @@ template <class _Tp, class _Allocator>...@@ -216,21 +226,19 @@ template <class _Tp, class _Allocator>
216void226void
217__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)227__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
218{228{
219 __alloc_rr& __a = this->__alloc();229 _ConstructTransaction __tx(&this->__end_, __n);
220 do230 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
221 {231 __alloc_traits::construct(this->__alloc(),
222 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);232 _VSTD::__to_address(__tx.__pos_), __x);
223 ++this->__end_;233 }
224 --__n;
225 } while (__n > 0);
226}234}
227235
228template <class _Tp, class _Allocator>236template <class _Tp, class _Allocator>
229template <class _InputIter>237template <class _InputIter>
230typename enable_if238typename enable_if
231<239<
232 __is_input_iterator<_InputIter>::value &&240 __is_cpp17_input_iterator<_InputIter>::value &&
233 !__is_forward_iterator<_InputIter>::value,241 !__is_cpp17_forward_iterator<_InputIter>::value,
234 void242 void
235>::type243>::type
236__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)244__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
...@@ -245,10 +253,10 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt...@@ -245,10 +253,10 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
245 __split_buffer __buf(__new_cap, 0, __a);253 __split_buffer __buf(__new_cap, 0, __a);
246 for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)254 for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
247 __alloc_traits::construct(__buf.__alloc(),255 __alloc_traits::construct(__buf.__alloc(),
248 _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));256 _VSTD::__to_address(__buf.__end_), _VSTD::move(*__p));
249 swap(__buf);257 swap(__buf);
250 }258 }
251 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);259 __alloc_traits::construct(__a, _VSTD::__to_address(this->__end_), *__first);
252 ++this->__end_;260 ++this->__end_;
253 }261 }
254}262}
...@@ -257,16 +265,15 @@ template <class _Tp, class _Allocator>...@@ -257,16 +265,15 @@ template <class _Tp, class _Allocator>
257template <class _ForwardIterator>265template <class _ForwardIterator>
258typename enable_if266typename enable_if
259<267<
260 __is_forward_iterator<_ForwardIterator>::value,268 __is_cpp17_forward_iterator<_ForwardIterator>::value,
261 void269 void
262>::type270>::type
263__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)271__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
264{272{
265 __alloc_rr& __a = this->__alloc();273 _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
266 for (; __first != __last; ++__first)274 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
267 {275 __alloc_traits::construct(this->__alloc(),
268 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);276 _VSTD::__to_address(__tx.__pos_), *__first);
269 ++this->__end_;
270 }277 }
271}278}
272279
...@@ -276,7 +283,7 @@ void...@@ -276,7 +283,7 @@ void
276__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)283__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
277{284{
278 while (__begin_ != __new_begin)285 while (__begin_ != __new_begin)
279 __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));286 __alloc_traits::destroy(__alloc(), __to_address(__begin_++));
280}287}
281288
282template <class _Tp, class _Allocator>289template <class _Tp, class _Allocator>
...@@ -293,7 +300,7 @@ void...@@ -293,7 +300,7 @@ void
293__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT300__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
294{301{
295 while (__new_last != __end_)302 while (__new_last != __end_)
296 __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));303 __alloc_traits::destroy(__alloc(), __to_address(--__end_));
297}304}
298305
299template <class _Tp, class _Allocator>306template <class _Tp, class _Allocator>
...@@ -317,7 +324,7 @@ template <class _Tp, class _Allocator>...@@ -317,7 +324,7 @@ template <class _Tp, class _Allocator>
317inline324inline
318__split_buffer<_Tp, _Allocator>::__split_buffer()325__split_buffer<_Tp, _Allocator>::__split_buffer()
319 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)326 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
320 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)327 : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag())
321{328{
322}329}
323330
...@@ -361,7 +368,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)...@@ -361,7 +368,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
361368
362template <class _Tp, class _Allocator>369template <class _Tp, class _Allocator>
363__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)370__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
364 : __end_cap_(__second_tag(), __a)371 : __end_cap_(nullptr, __a)
365{372{
366 if (__a == __c.__alloc())373 if (__a == __c.__alloc())
367 {374 {
...@@ -488,7 +495,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)...@@ -488,7 +495,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
488 _VSTD::swap(__end_cap(), __t.__end_cap());495 _VSTD::swap(__end_cap(), __t.__end_cap());
489 }496 }
490 }497 }
491 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);498 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1), __x);
492 --__begin_;499 --__begin_;
493}500}
494501
...@@ -519,7 +526,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)...@@ -519,7 +526,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
519 _VSTD::swap(__end_cap(), __t.__end_cap());526 _VSTD::swap(__end_cap(), __t.__end_cap());
520 }527 }
521 }528 }
522 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),529 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1),
523 _VSTD::move(__x));530 _VSTD::move(__x));
524 --__begin_;531 --__begin_;
525}532}
...@@ -552,7 +559,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)...@@ -552,7 +559,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
552 _VSTD::swap(__end_cap(), __t.__end_cap());559 _VSTD::swap(__end_cap(), __t.__end_cap());
553 }560 }
554 }561 }
555 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);562 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_), __x);
556 ++__end_;563 ++__end_;
557}564}
558565
...@@ -583,7 +590,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)...@@ -583,7 +590,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
583 _VSTD::swap(__end_cap(), __t.__end_cap());590 _VSTD::swap(__end_cap(), __t.__end_cap());
584 }591 }
585 }592 }
586 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),593 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_),
587 _VSTD::move(__x));594 _VSTD::move(__x));
588 ++__end_;595 ++__end_;
589}596}
...@@ -614,7 +621,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)...@@ -614,7 +621,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
614 _VSTD::swap(__end_cap(), __t.__end_cap());621 _VSTD::swap(__end_cap(), __t.__end_cap());
615 }622 }
616 }623 }
617 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),624 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_),
618 _VSTD::forward<_Args>(__args)...);625 _VSTD::forward<_Args>(__args)...);
619 ++__end_;626 ++__end_;
620}627}
lib/libcxx/include/__string+140-52
...@@ -31,11 +31,12 @@ struct char_traits...@@ -31,11 +31,12 @@ struct char_traits
3131
32 static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);32 static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
33 static constexpr size_t length(const char_type* s);33 static constexpr size_t length(const char_type* s);
34 static constexpr const char_type* 34 static constexpr const char_type*
35 find(const char_type* s, size_t n, const char_type& a);35 find(const char_type* s, size_t n, const char_type& a);
36 static char_type* move(char_type* s1, const char_type* s2, size_t n);36
37 static char_type* copy(char_type* s1, const char_type* s2, size_t n);37 static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20
38 static char_type* assign(char_type* s, size_t n, char_type a);38 static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20
39 static constexpr char_type* assign(char_type* s, size_t n, char_type a); // constexpr in C++20
3940
40 static constexpr int_type not_eof(int_type c) noexcept;41 static constexpr int_type not_eof(int_type c) noexcept;
41 static constexpr char_type to_char_type(int_type c) noexcept;42 static constexpr char_type to_char_type(int_type c) noexcept;
...@@ -93,11 +94,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits...@@ -93,11 +94,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits
93 size_t length(const char_type* __s);94 size_t length(const char_type* __s);
94 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX1495 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
95 const char_type* find(const char_type* __s, size_t __n, const char_type& __a);96 const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
96 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);97 static _LIBCPP_CONSTEXPR_AFTER_CXX17
98 char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
97 _LIBCPP_INLINE_VISIBILITY99 _LIBCPP_INLINE_VISIBILITY
98 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);100 static _LIBCPP_CONSTEXPR_AFTER_CXX17
101 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
99 _LIBCPP_INLINE_VISIBILITY102 _LIBCPP_INLINE_VISIBILITY
100 static char_type* assign(char_type* __s, size_t __n, char_type __a);103 static _LIBCPP_CONSTEXPR_AFTER_CXX17
104 char_type* assign(char_type* __s, size_t __n, char_type __a);
101105
102 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT106 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
103 {return eq_int_type(__c, eof()) ? ~eof() : __c;}107 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
...@@ -151,9 +155,10 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a...@@ -151,9 +155,10 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a
151}155}
152156
153template <class _CharT>157template <class _CharT>
154_CharT*158_LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT*
155char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)159char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
156{160{
161 if (__n == 0) return __s1;
157 char_type* __r = __s1;162 char_type* __r = __s1;
158 if (__s1 < __s2)163 if (__s1 < __s2)
159 {164 {
...@@ -171,7 +176,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)...@@ -171,7 +176,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
171}176}
172177
173template <class _CharT>178template <class _CharT>
174inline179inline _LIBCPP_CONSTEXPR_AFTER_CXX17
175_CharT*180_CharT*
176char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)181char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
177{182{
...@@ -183,7 +188,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)...@@ -183,7 +188,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
183}188}
184189
185template <class _CharT>190template <class _CharT>
186inline191inline _LIBCPP_CONSTEXPR_AFTER_CXX17
187_CharT*192_CharT*
188char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)193char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
189{194{
...@@ -193,6 +198,37 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)...@@ -193,6 +198,37 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
193 return __r;198 return __r;
194}199}
195200
201// constexpr versions of move/copy/assign.
202
203template <class _CharT>
204static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
205_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
206{
207 if (__n == 0) return __s1;
208 if (__s1 < __s2) {
209 _VSTD::copy(__s2, __s2 + __n, __s1);
210 } else if (__s2 < __s1) {
211 _VSTD::copy_backward(__s2, __s2 + __n, __s1 + __n);
212 }
213 return __s1;
214}
215
216template <class _CharT>
217static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
218_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
219{
220 _VSTD::copy_n(__s2, __n, __s1);
221 return __s1;
222}
223
224template <class _CharT>
225static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
226_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
227{
228 _VSTD::fill_n(__s, __n, __a);
229 return __s;
230}
231
196// char_traits<char>232// char_traits<char>
197233
198template <>234template <>
...@@ -217,15 +253,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>...@@ -217,15 +253,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
217 length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}253 length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
218 static _LIBCPP_CONSTEXPR_AFTER_CXX14254 static _LIBCPP_CONSTEXPR_AFTER_CXX14
219 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;255 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
220 static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT256 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
221 {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}257 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
222 static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT258 {
259 return __libcpp_is_constant_evaluated()
260 ? __move_constexpr(__s1, __s2, __n)
261 : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
262 }
263 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
264 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
223 {265 {
224 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");266 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
225 return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);267 return __libcpp_is_constant_evaluated()
268 ? __copy_constexpr(__s1, __s2, __n)
269 : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
270 }
271 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
272 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
273 {
274 return __libcpp_is_constant_evaluated()
275 ? __assign_constexpr(__s, __n, __a)
276 : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
226 }277 }
227 static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
228 {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
229278
230 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT279 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
231 {return eq_int_type(__c, eof()) ? ~eof() : __c;}280 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
...@@ -307,16 +356,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>...@@ -307,16 +356,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
307 size_t length(const char_type* __s) _NOEXCEPT;356 size_t length(const char_type* __s) _NOEXCEPT;
308 static _LIBCPP_CONSTEXPR_AFTER_CXX14357 static _LIBCPP_CONSTEXPR_AFTER_CXX14
309 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;358 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
310 static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT359 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
311 {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}360 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
312 static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT361 {
362 return __libcpp_is_constant_evaluated()
363 ? __move_constexpr(__s1, __s2, __n)
364 : __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
365 }
366 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
367 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
313 {368 {
314 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");369 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
315 return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n);370 return __libcpp_is_constant_evaluated()
371 ? __copy_constexpr(__s1, __s2, __n)
372 : __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n);
373 }
374 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
375 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
376 {
377 return __libcpp_is_constant_evaluated()
378 ? __assign_constexpr(__s, __n, __a)
379 : __n == 0 ? __s : wmemset(__s, __a, __n);
316 }380 }
317 static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
318 {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);}
319
320 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT381 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
321 {return eq_int_type(__c, eof()) ? ~eof() : __c;}382 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
322 static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT383 static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
...@@ -351,6 +412,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size...@@ -351,6 +412,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
351#endif412#endif
352}413}
353414
415
416template <class _Traits>
417_LIBCPP_INLINE_VISIBILITY
418_LIBCPP_CONSTEXPR
419inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
420#if _LIBCPP_DEBUG_LEVEL >= 1
421 return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
422#else
423 return _Traits::length(__s);
424#endif
425}
426
354inline _LIBCPP_CONSTEXPR_AFTER_CXX14427inline _LIBCPP_CONSTEXPR_AFTER_CXX14
355size_t428size_t
356char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT429char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
...@@ -412,21 +485,34 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>...@@ -412,21 +485,34 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
412485
413 static constexpr486 static constexpr
414 size_t length(const char_type* __s) _NOEXCEPT;487 size_t length(const char_type* __s) _NOEXCEPT;
415 488
416 _LIBCPP_INLINE_VISIBILITY static constexpr489 _LIBCPP_INLINE_VISIBILITY static constexpr
417 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;490 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
418 491
419 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT492 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
420 {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}493 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
421 494 {
422 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT495 return __libcpp_is_constant_evaluated()
496 ? __move_constexpr(__s1, __s2, __n)
497 : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
498 }
499
500 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
501 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
423 {502 {
424 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");503 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
425 return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);504 return __libcpp_is_constant_evaluated()
426 }505 ? __copy_constexpr(__s1, __s2, __n)
427 506 : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
428 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT507 }
429 {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}508
509 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
510 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
511 {
512 return __libcpp_is_constant_evaluated()
513 ? __assign_constexpr(__s, __n, __a)
514 : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
515 }
430516
431 static inline constexpr int_type not_eof(int_type __c) noexcept517 static inline constexpr int_type not_eof(int_type __c) noexcept
432 {return eq_int_type(__c, eof()) ? ~eof() : __c;}518 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
...@@ -509,11 +595,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>...@@ -509,11 +595,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
509 size_t length(const char_type* __s) _NOEXCEPT;595 size_t length(const char_type* __s) _NOEXCEPT;
510 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14596 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
511 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;597 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
512 _LIBCPP_INLINE_VISIBILITY598 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
513 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;599 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
514 _LIBCPP_INLINE_VISIBILITY600 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
515 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;601 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
516 _LIBCPP_INLINE_VISIBILITY602 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
517 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;603 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;
518604
519 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT605 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
...@@ -565,10 +651,11 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _...@@ -565,10 +651,11 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
565 return 0;651 return 0;
566}652}
567653
568inline654inline _LIBCPP_CONSTEXPR_AFTER_CXX17
569char16_t*655char16_t*
570char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT656char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
571{657{
658 if (__n == 0) return __s1;
572 char_type* __r = __s1;659 char_type* __r = __s1;
573 if (__s1 < __s2)660 if (__s1 < __s2)
574 {661 {
...@@ -585,7 +672,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)...@@ -585,7 +672,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
585 return __r;672 return __r;
586}673}
587674
588inline675inline _LIBCPP_CONSTEXPR_AFTER_CXX17
589char16_t*676char16_t*
590char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT677char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
591{678{
...@@ -596,7 +683,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)...@@ -596,7 +683,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
596 return __r;683 return __r;
597}684}
598685
599inline686inline _LIBCPP_CONSTEXPR_AFTER_CXX17
600char16_t*687char16_t*
601char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT688char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
602{689{
...@@ -628,11 +715,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t>...@@ -628,11 +715,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t>
628 size_t length(const char_type* __s) _NOEXCEPT;715 size_t length(const char_type* __s) _NOEXCEPT;
629 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14716 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
630 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;717 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
631 _LIBCPP_INLINE_VISIBILITY718 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
632 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;719 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
633 _LIBCPP_INLINE_VISIBILITY720 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
634 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;721 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
635 _LIBCPP_INLINE_VISIBILITY722 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
636 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;723 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;
637724
638 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT725 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
...@@ -684,10 +771,11 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _...@@ -684,10 +771,11 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
684 return 0;771 return 0;
685}772}
686773
687inline774inline _LIBCPP_CONSTEXPR_AFTER_CXX17
688char32_t*775char32_t*
689char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT776char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
690{777{
778 if (__n == 0) return __s1;
691 char_type* __r = __s1;779 char_type* __r = __s1;
692 if (__s1 < __s2)780 if (__s1 < __s2)
693 {781 {
...@@ -704,7 +792,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)...@@ -704,7 +792,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
704 return __r;792 return __r;
705}793}
706794
707inline795inline _LIBCPP_CONSTEXPR_AFTER_CXX17
708char32_t*796char32_t*
709char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT797char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
710{798{
...@@ -715,7 +803,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)...@@ -715,7 +803,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
715 return __r;803 return __r;
716}804}
717805
718inline806inline _LIBCPP_CONSTEXPR_AFTER_CXX17
719char32_t*807char32_t*
720char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT808char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
721{809{
...@@ -732,7 +820,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCE...@@ -732,7 +820,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCE
732// __str_find820// __str_find
733template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>821template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
734inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY822inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
735__str_find(const _CharT *__p, _SizeT __sz, 823__str_find(const _CharT *__p, _SizeT __sz,
736 _CharT __c, _SizeT __pos) _NOEXCEPT824 _CharT __c, _SizeT __pos) _NOEXCEPT
737{825{
738 if (__pos >= __sz)826 if (__pos >= __sz)
...@@ -784,7 +872,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,...@@ -784,7 +872,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
784872
785template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>873template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
786inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY874inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
787__str_find(const _CharT *__p, _SizeT __sz, 875__str_find(const _CharT *__p, _SizeT __sz,
788 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT876 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
789{877{
790 if (__pos > __sz)878 if (__pos > __sz)
...@@ -806,7 +894,7 @@ __str_find(const _CharT *__p, _SizeT __sz,...@@ -806,7 +894,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
806894
807template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>895template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
808inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY896inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
809__str_rfind(const _CharT *__p, _SizeT __sz, 897__str_rfind(const _CharT *__p, _SizeT __sz,
810 _CharT __c, _SizeT __pos) _NOEXCEPT898 _CharT __c, _SizeT __pos) _NOEXCEPT
811{899{
812 if (__sz < 1)900 if (__sz < 1)
...@@ -825,7 +913,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,...@@ -825,7 +913,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
825913
826template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>914template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
827inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY915inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
828__str_rfind(const _CharT *__p, _SizeT __sz, 916__str_rfind(const _CharT *__p, _SizeT __sz,
829 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT917 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
830{918{
831 __pos = _VSTD::min(__pos, __sz);919 __pos = _VSTD::min(__pos, __sz);
...@@ -834,7 +922,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,...@@ -834,7 +922,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
834 else922 else
835 __pos = __sz;923 __pos = __sz;
836 const _CharT* __r = _VSTD::__find_end(924 const _CharT* __r = _VSTD::__find_end(
837 __p, __p + __pos, __s, __s + __n, _Traits::eq, 925 __p, __p + __pos, __s, __s + __n, _Traits::eq,
838 random_access_iterator_tag(), random_access_iterator_tag());926 random_access_iterator_tag(), random_access_iterator_tag());
839 if (__n > 0 && __r == __p + __pos)927 if (__n > 0 && __r == __p + __pos)
840 return __npos;928 return __npos;
...@@ -963,7 +1051,7 @@ struct __quoted_output_proxy...@@ -963,7 +1051,7 @@ struct __quoted_output_proxy
9631051
964 __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)1052 __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
965 : __first(__f), __last(__l), __delim(__d), __escape(__e) {}1053 : __first(__f), __last(__l), __delim(__d), __escape(__e) {}
966 // This would be a nice place for a string_ref 1054 // This would be a nice place for a string_ref
967};1055};
9681056
969_LIBCPP_END_NAMESPACE_STD1057_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__threading_support+236-29
...@@ -23,16 +23,13 @@...@@ -23,16 +23,13 @@
23# include <__external_threading>23# include <__external_threading>
24#elif !defined(_LIBCPP_HAS_NO_THREADS)24#elif !defined(_LIBCPP_HAS_NO_THREADS)
2525
26typedef ::timespec __libcpp_timespec_t;
27
28#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)26#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
29# include <pthread.h>27# include <pthread.h>
30# include <sched.h>28# include <sched.h>
29#elif defined(_LIBCPP_HAS_THREAD_API_C11)
30# include <threads.h>
31#endif31#endif
3232
33_LIBCPP_PUSH_MACROS
34#include <__undef_macros>
35
36#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \33#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
37 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \34 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
38 defined(_LIBCPP_HAS_THREAD_API_WIN32)35 defined(_LIBCPP_HAS_THREAD_API_WIN32)
...@@ -47,8 +44,16 @@ _LIBCPP_PUSH_MACROS...@@ -47,8 +44,16 @@ _LIBCPP_PUSH_MACROS
47#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS44#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
48#endif45#endif
4946
47typedef ::timespec __libcpp_timespec_t;
48#endif // !defined(_LIBCPP_HAS_NO_THREADS)
49
50_LIBCPP_PUSH_MACROS
51#include <__undef_macros>
52
50_LIBCPP_BEGIN_NAMESPACE_STD53_LIBCPP_BEGIN_NAMESPACE_STD
5154
55#if !defined(_LIBCPP_HAS_NO_THREADS)
56
52#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)57#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
53// Mutex58// Mutex
54typedef pthread_mutex_t __libcpp_mutex_t;59typedef pthread_mutex_t __libcpp_mutex_t;
...@@ -76,7 +81,36 @@ typedef pthread_t __libcpp_thread_t;...@@ -76,7 +81,36 @@ typedef pthread_t __libcpp_thread_t;
76typedef pthread_key_t __libcpp_tls_key;81typedef pthread_key_t __libcpp_tls_key;
7782
78#define _LIBCPP_TLS_DESTRUCTOR_CC83#define _LIBCPP_TLS_DESTRUCTOR_CC
79#else84#elif defined(_LIBCPP_HAS_THREAD_API_C11)
85// Mutex
86typedef mtx_t __libcpp_mutex_t;
87// mtx_t is a struct so using {} for initialization is valid.
88#define _LIBCPP_MUTEX_INITIALIZER {}
89
90typedef mtx_t __libcpp_recursive_mutex_t;
91
92// Condition Variable
93typedef cnd_t __libcpp_condvar_t;
94// cnd_t is a struct so using {} for initialization is valid.
95#define _LIBCPP_CONDVAR_INITIALIZER {}
96
97// Execute once
98typedef once_flag __libcpp_exec_once_flag;
99#define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
100
101// Thread id
102typedef thrd_t __libcpp_thread_id;
103
104// Thread
105#define _LIBCPP_NULL_THREAD 0U
106
107typedef thrd_t __libcpp_thread_t;
108
109// Thread Local Storage
110typedef tss_t __libcpp_tls_key;
111
112#define _LIBCPP_TLS_DESTRUCTOR_CC
113#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
80// Mutex114// Mutex
81typedef void* __libcpp_mutex_t;115typedef void* __libcpp_mutex_t;
82#define _LIBCPP_MUTEX_INITIALIZER 0116#define _LIBCPP_MUTEX_INITIALIZER 0
...@@ -109,8 +143,9 @@ typedef void* __libcpp_thread_t;...@@ -109,8 +143,9 @@ typedef void* __libcpp_thread_t;
109typedef long __libcpp_tls_key;143typedef long __libcpp_tls_key;
110144
111#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall145#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
112#endif146#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
113147
148#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
114// Mutex149// Mutex
115_LIBCPP_THREAD_ABI_VISIBILITY150_LIBCPP_THREAD_ABI_VISIBILITY
116int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);151int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
...@@ -205,9 +240,38 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);...@@ -205,9 +240,38 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
205_LIBCPP_THREAD_ABI_VISIBILITY240_LIBCPP_THREAD_ABI_VISIBILITY
206int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);241int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
207242
243#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
244
208#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \245#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
209 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \246 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL))
210 defined(_LIBCPP_HAS_THREAD_API_PTHREAD)247
248namespace __thread_detail {
249
250inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns)
251{
252 using namespace chrono;
253 seconds __s = duration_cast<seconds>(__ns);
254 __libcpp_timespec_t __ts;
255 typedef decltype(__ts.tv_sec) __ts_sec;
256 const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
257
258 if (__s.count() < __ts_sec_max)
259 {
260 __ts.tv_sec = static_cast<__ts_sec>(__s.count());
261 __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
262 }
263 else
264 {
265 __ts.tv_sec = __ts_sec_max;
266 __ts.tv_nsec = 999999999; // (10^9 - 1)
267 }
268
269 return __ts;
270}
271
272}
273
274#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
211275
212int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)276int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
213{277{
...@@ -357,23 +421,7 @@ void __libcpp_thread_yield()...@@ -357,23 +421,7 @@ void __libcpp_thread_yield()
357421
358void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)422void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
359{423{
360 using namespace chrono;424 __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns);
361 seconds __s = duration_cast<seconds>(__ns);
362 __libcpp_timespec_t __ts;
363 typedef decltype(__ts.tv_sec) ts_sec;
364 _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
365
366 if (__s.count() < __ts_sec_max)
367 {
368 __ts.tv_sec = static_cast<ts_sec>(__s.count());
369 __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
370 }
371 else
372 {
373 __ts.tv_sec = __ts_sec_max;
374 __ts.tv_nsec = 999999999; // (10^9 - 1)
375 }
376
377 while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);425 while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
378}426}
379427
...@@ -393,6 +441,165 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)...@@ -393,6 +441,165 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
393 return pthread_setspecific(__key, __p);441 return pthread_setspecific(__key, __p);
394}442}
395443
444#elif defined(_LIBCPP_HAS_THREAD_API_C11)
445
446int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
447{
448 return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL;
449}
450
451int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
452{
453 return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
454}
455
456bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
457{
458 return mtx_trylock(__m) == thrd_success;
459}
460
461int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
462{
463 return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
464}
465
466int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
467{
468 mtx_destroy(__m);
469 return 0;
470}
471
472int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
473{
474 return mtx_lock(__m) == thrd_success ? 0 : EINVAL;
475}
476
477bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
478{
479 return mtx_trylock(__m) == thrd_success;
480}
481
482int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
483{
484 return mtx_unlock(__m) == thrd_success ? 0 : EINVAL;
485}
486
487int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
488{
489 mtx_destroy(__m);
490 return 0;
491}
492
493// Condition Variable
494int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
495{
496 return cnd_signal(__cv) == thrd_success ? 0 : EINVAL;
497}
498
499int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
500{
501 return cnd_broadcast(__cv) == thrd_success ? 0 : EINVAL;
502}
503
504int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
505{
506 return cnd_wait(__cv, __m) == thrd_success ? 0 : EINVAL;
507}
508
509int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
510 timespec *__ts)
511{
512 int __ec = cnd_timedwait(__cv, __m, __ts);
513 return __ec == thrd_timedout ? ETIMEDOUT : __ec;
514}
515
516int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
517{
518 cnd_destroy(__cv);
519 return 0;
520}
521
522// Execute once
523int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
524 void (*init_routine)(void)) {
525 ::call_once(flag, init_routine);
526 return 0;
527}
528
529// Thread id
530// Returns non-zero if the thread ids are equal, otherwise 0
531bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
532{
533 return thrd_equal(t1, t2) != 0;
534}
535
536// Returns non-zero if t1 < t2, otherwise 0
537bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
538{
539 return t1 < t2;
540}
541
542// Thread
543bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
544 return *__t == 0;
545}
546
547int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
548 void *__arg)
549{
550 int __ec = thrd_create(__t, reinterpret_cast<thrd_start_t>(__func), __arg);
551 return __ec == thrd_nomem ? ENOMEM : __ec;
552}
553
554__libcpp_thread_id __libcpp_thread_get_current_id()
555{
556 return thrd_current();
557}
558
559__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
560{
561 return *__t;
562}
563
564int __libcpp_thread_join(__libcpp_thread_t *__t)
565{
566 return thrd_join(*__t, nullptr) == thrd_success ? 0 : EINVAL;
567}
568
569int __libcpp_thread_detach(__libcpp_thread_t *__t)
570{
571 return thrd_detach(*__t) == thrd_success ? 0 : EINVAL;
572}
573
574void __libcpp_thread_yield()
575{
576 thrd_yield();
577}
578
579void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
580{
581 __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns);
582 thrd_sleep(&__ts, nullptr);
583}
584
585// Thread local storage
586int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
587{
588 return tss_create(__key, __at_exit) == thrd_success ? 0 : EINVAL;
589}
590
591void *__libcpp_tls_get(__libcpp_tls_key __key)
592{
593 return tss_get(__key);
594}
595
596int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
597{
598 return tss_set(__key, __p) == thrd_success ? 0 : EINVAL;
599}
600
601#endif
602
396#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL603#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
397604
398class _LIBCPP_TYPE_VIS thread;605class _LIBCPP_TYPE_VIS thread;
...@@ -447,7 +654,7 @@ public:...@@ -447,7 +654,7 @@ public:
447654
448 _LIBCPP_INLINE_VISIBILITY655 _LIBCPP_INLINE_VISIBILITY
449 void __reset() { __id_ = 0; }656 void __reset() { __id_ = 0; }
450 657
451 template<class _CharT, class _Traits>658 template<class _CharT, class _Traits>
452 friend659 friend
453 _LIBCPP_INLINE_VISIBILITY660 _LIBCPP_INLINE_VISIBILITY
...@@ -475,10 +682,10 @@ get_id() _NOEXCEPT...@@ -475,10 +682,10 @@ get_id() _NOEXCEPT
475682
476} // this_thread683} // this_thread
477684
685#endif // !_LIBCPP_HAS_NO_THREADS
686
478_LIBCPP_END_NAMESPACE_STD687_LIBCPP_END_NAMESPACE_STD
479688
480_LIBCPP_POP_MACROS689_LIBCPP_POP_MACROS
481690
482#endif // !_LIBCPP_HAS_NO_THREADS
483
484#endif // _LIBCPP_THREADING_SUPPORT691#endif // _LIBCPP_THREADING_SUPPORT
lib/libcxx/include/__tree+10-7
...@@ -775,11 +775,14 @@ private:...@@ -775,11 +775,14 @@ private:
775 typedef __tree_node_types<pointer> _NodeTypes;775 typedef __tree_node_types<pointer> _NodeTypes;
776 allocator_type& __na_;776 allocator_type& __na_;
777777
778 __tree_node_destructor& operator=(const __tree_node_destructor&);
779778
780public:779public:
781 bool __value_constructed;780 bool __value_constructed;
782781
782
783 __tree_node_destructor(const __tree_node_destructor &) = default;
784 __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
785
783 _LIBCPP_INLINE_VISIBILITY786 _LIBCPP_INLINE_VISIBILITY
784 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT787 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
785 : __na_(__na),788 : __na_(__na),
...@@ -1574,8 +1577,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)...@@ -1574,8 +1577,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
1574template <class _Tp, class _Compare, class _Allocator>1577template <class _Tp, class _Compare, class _Allocator>
1575__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)1578__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
1576 : __begin_node_(__iter_pointer()),1579 : __begin_node_(__iter_pointer()),
1577 __pair1_(__second_tag(), __node_allocator(__a)),1580 __pair1_(__default_init_tag(), __node_allocator(__a)),
1578 __pair3_(0)1581 __pair3_(0, __default_init_tag())
1579{1582{
1580 __begin_node() = __end_node();1583 __begin_node() = __end_node();
1581}1584}
...@@ -1584,7 +1587,7 @@ template <class _Tp, class _Compare, class _Allocator>...@@ -1584,7 +1587,7 @@ template <class _Tp, class _Compare, class _Allocator>
1584__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,1587__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
1585 const allocator_type& __a)1588 const allocator_type& __a)
1586 : __begin_node_(__iter_pointer()),1589 : __begin_node_(__iter_pointer()),
1587 __pair1_(__second_tag(), __node_allocator(__a)),1590 __pair1_(__default_init_tag(), __node_allocator(__a)),
1588 __pair3_(0, __comp)1591 __pair3_(0, __comp)
1589{1592{
1590 __begin_node() = __end_node();1593 __begin_node() = __end_node();
...@@ -1656,7 +1659,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _Fo...@@ -1656,7 +1659,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _Fo
1656 typedef typename _ITraits::value_type _ItValueType;1659 typedef typename _ITraits::value_type _ItValueType;
1657 static_assert((is_same<_ItValueType, __container_value_type>::value),1660 static_assert((is_same<_ItValueType, __container_value_type>::value),
1658 "__assign_unique may only be called with the containers value type");1661 "__assign_unique may only be called with the containers value type");
1659 static_assert(__is_forward_iterator<_ForwardIterator>::value,1662 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
1660 "__assign_unique requires a forward iterator");1663 "__assign_unique requires a forward iterator");
1661 if (size() != 0)1664 if (size() != 0)
1662 {1665 {
...@@ -1697,7 +1700,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input...@@ -1697,7 +1700,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
1697template <class _Tp, class _Compare, class _Allocator>1700template <class _Tp, class _Compare, class _Allocator>
1698__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)1701__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
1699 : __begin_node_(__iter_pointer()),1702 : __begin_node_(__iter_pointer()),
1700 __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),1703 __pair1_(__default_init_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
1701 __pair3_(0, __t.value_comp())1704 __pair3_(0, __t.value_comp())
1702{1705{
1703 __begin_node() = __end_node();1706 __begin_node() = __end_node();
...@@ -1727,7 +1730,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)...@@ -1727,7 +1730,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
17271730
1728template <class _Tp, class _Compare, class _Allocator>1731template <class _Tp, class _Compare, class _Allocator>
1729__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)1732__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
1730 : __pair1_(__second_tag(), __node_allocator(__a)),1733 : __pair1_(__default_init_tag(), __node_allocator(__a)),
1731 __pair3_(0, _VSTD::move(__t.value_comp()))1734 __pair3_(0, _VSTD::move(__t.value_comp()))
1732{1735{
1733 if (__a == __t.__alloc())1736 if (__a == __t.__alloc())
lib/libcxx/include/__tuple+3-2
...@@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp<...@@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp<
477 >;477 >;
478478
479struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {479struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
480 template <class ...>480
481 static constexpr bool __enable_default() { return false; }481 static constexpr bool __enable_explicit_default() { return false; }
482 static constexpr bool __enable_implicit_default() { return false; }
482 template <class ...>483 template <class ...>
483 static constexpr bool __enable_explicit() { return false; }484 static constexpr bool __enable_explicit() { return false; }
484 template <class ...>485 template <class ...>
lib/libcxx/include/algorithm+73-41
...@@ -167,20 +167,20 @@ template <class ForwardIterator, class Size, class T, class BinaryPredicate>...@@ -167,20 +167,20 @@ template <class ForwardIterator, class Size, class T, class BinaryPredicate>
167 Size count, const T& value, BinaryPredicate pred);167 Size count, const T& value, BinaryPredicate pred);
168168
169template <class InputIterator, class OutputIterator>169template <class InputIterator, class OutputIterator>
170 OutputIterator170 constexpr OutputIterator // constexpr in C++20
171 copy(InputIterator first, InputIterator last, OutputIterator result);171 copy(InputIterator first, InputIterator last, OutputIterator result);
172172
173template<class InputIterator, class OutputIterator, class Predicate>173template<class InputIterator, class OutputIterator, class Predicate>
174 OutputIterator174 constexpr OutputIterator // constexpr in C++20
175 copy_if(InputIterator first, InputIterator last,175 copy_if(InputIterator first, InputIterator last,
176 OutputIterator result, Predicate pred);176 OutputIterator result, Predicate pred);
177177
178template<class InputIterator, class Size, class OutputIterator>178template<class InputIterator, class Size, class OutputIterator>
179 OutputIterator179 constexpr OutputIterator // constexpr in C++20
180 copy_n(InputIterator first, Size n, OutputIterator result);180 copy_n(InputIterator first, Size n, OutputIterator result);
181181
182template <class BidirectionalIterator1, class BidirectionalIterator2>182template <class BidirectionalIterator1, class BidirectionalIterator2>
183 BidirectionalIterator2183 constexpr BidirectionalIterator2 // constexpr in C++20
184 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,184 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
185 BidirectionalIterator2 result);185 BidirectionalIterator2 result);
186186
...@@ -1631,7 +1631,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const...@@ -1631,7 +1631,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const
16311631
1632// copy1632// copy
1633template <class _Iter>1633template <class _Iter>
1634inline _LIBCPP_INLINE_VISIBILITY1634inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1635_Iter1635_Iter
1636__unwrap_iter(_Iter __i)1636__unwrap_iter(_Iter __i)
1637{1637{
...@@ -1639,7 +1639,7 @@ __unwrap_iter(_Iter __i)...@@ -1639,7 +1639,7 @@ __unwrap_iter(_Iter __i)
1639}1639}
16401640
1641template <class _Tp>1641template <class _Tp>
1642inline _LIBCPP_INLINE_VISIBILITY1642inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1643typename enable_if1643typename enable_if
1644<1644<
1645 is_trivially_copy_assignable<_Tp>::value,1645 is_trivially_copy_assignable<_Tp>::value,
...@@ -1693,15 +1693,23 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)...@@ -1693,15 +1693,23 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
1693#endif // _LIBCPP_DEBUG_LEVEL < 21693#endif // _LIBCPP_DEBUG_LEVEL < 2
16941694
1695template <class _InputIterator, class _OutputIterator>1695template <class _InputIterator, class _OutputIterator>
1696inline _LIBCPP_INLINE_VISIBILITY1696inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1697_OutputIterator1697_OutputIterator
1698__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)1698__copy_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1699{1699{
1700 for (; __first != __last; ++__first, (void) ++__result)1700 for (; __first != __last; ++__first, (void) ++__result)
1701 *__result = *__first;1701 *__result = *__first;
1702 return __result;1702 return __result;
1703}1703}
17041704
1705template <class _InputIterator, class _OutputIterator>
1706inline _LIBCPP_INLINE_VISIBILITY
1707_OutputIterator
1708__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1709{
1710 return __copy_constexpr(__first, __last, __result);
1711}
1712
1705template <class _Tp, class _Up>1713template <class _Tp, class _Up>
1706inline _LIBCPP_INLINE_VISIBILITY1714inline _LIBCPP_INLINE_VISIBILITY
1707typename enable_if1715typename enable_if
...@@ -1719,25 +1727,39 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)...@@ -1719,25 +1727,39 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)
1719}1727}
17201728
1721template <class _InputIterator, class _OutputIterator>1729template <class _InputIterator, class _OutputIterator>
1722inline _LIBCPP_INLINE_VISIBILITY1730inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1723_OutputIterator1731_OutputIterator
1724copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)1732copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1725{1733{
1726 return _VSTD::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));1734 if (__libcpp_is_constant_evaluated()) {
1735 return _VSTD::__copy_constexpr(
1736 __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
1737 } else {
1738 return _VSTD::__copy(
1739 __unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
1740 }
1727}1741}
17281742
1729// copy_backward1743// copy_backward
17301744
1731template <class _BidirectionalIterator, class _OutputIterator>1745template <class _BidirectionalIterator, class _OutputIterator>
1732inline _LIBCPP_INLINE_VISIBILITY1746inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1733_OutputIterator1747_OutputIterator
1734__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)1748__copy_backward_constexpr(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
1735{1749{
1736 while (__first != __last)1750 while (__first != __last)
1737 *--__result = *--__last;1751 *--__result = *--__last;
1738 return __result;1752 return __result;
1739}1753}
17401754
1755template <class _BidirectionalIterator, class _OutputIterator>
1756inline _LIBCPP_INLINE_VISIBILITY
1757_OutputIterator
1758__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
1759{
1760 return __copy_backward_constexpr(__first, __last, __result);
1761}
1762
1741template <class _Tp, class _Up>1763template <class _Tp, class _Up>
1742inline _LIBCPP_INLINE_VISIBILITY1764inline _LIBCPP_INLINE_VISIBILITY
1743typename enable_if1765typename enable_if
...@@ -1758,20 +1780,26 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)...@@ -1758,20 +1780,26 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
1758}1780}
17591781
1760template <class _BidirectionalIterator1, class _BidirectionalIterator2>1782template <class _BidirectionalIterator1, class _BidirectionalIterator2>
1761inline _LIBCPP_INLINE_VISIBILITY1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1762_BidirectionalIterator21784_BidirectionalIterator2
1763copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,1785copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
1764 _BidirectionalIterator2 __result)1786 _BidirectionalIterator2 __result)
1765{1787{
1766 return _VSTD::__copy_backward(__unwrap_iter(__first),1788 if (__libcpp_is_constant_evaluated()) {
1767 __unwrap_iter(__last),1789 return _VSTD::__copy_backward_constexpr(__unwrap_iter(__first),
1768 __unwrap_iter(__result));1790 __unwrap_iter(__last),
1791 __unwrap_iter(__result));
1792 } else {
1793 return _VSTD::__copy_backward(__unwrap_iter(__first),
1794 __unwrap_iter(__last),
1795 __unwrap_iter(__result));
1796 }
1769}1797}
17701798
1771// copy_if1799// copy_if
17721800
1773template<class _InputIterator, class _OutputIterator, class _Predicate>1801template<class _InputIterator, class _OutputIterator, class _Predicate>
1774inline _LIBCPP_INLINE_VISIBILITY1802inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1775_OutputIterator1803_OutputIterator
1776copy_if(_InputIterator __first, _InputIterator __last,1804copy_if(_InputIterator __first, _InputIterator __last,
1777 _OutputIterator __result, _Predicate __pred)1805 _OutputIterator __result, _Predicate __pred)
...@@ -1790,11 +1818,11 @@ copy_if(_InputIterator __first, _InputIterator __last,...@@ -1790,11 +1818,11 @@ copy_if(_InputIterator __first, _InputIterator __last,
1790// copy_n1818// copy_n
17911819
1792template<class _InputIterator, class _Size, class _OutputIterator>1820template<class _InputIterator, class _Size, class _OutputIterator>
1793inline _LIBCPP_INLINE_VISIBILITY1821inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1794typename enable_if1822typename enable_if
1795<1823<
1796 __is_input_iterator<_InputIterator>::value &&1824 __is_cpp17_input_iterator<_InputIterator>::value &&
1797 !__is_random_access_iterator<_InputIterator>::value,1825 !__is_cpp17_random_access_iterator<_InputIterator>::value,
1798 _OutputIterator1826 _OutputIterator
1799>::type1827>::type
1800copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)1828copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
...@@ -1816,10 +1844,10 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)...@@ -1816,10 +1844,10 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
1816}1844}
18171845
1818template<class _InputIterator, class _Size, class _OutputIterator>1846template<class _InputIterator, class _Size, class _OutputIterator>
1819inline _LIBCPP_INLINE_VISIBILITY1847inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1820typename enable_if1848typename enable_if
1821<1849<
1822 __is_random_access_iterator<_InputIterator>::value,1850 __is_cpp17_random_access_iterator<_InputIterator>::value,
1823 _OutputIterator1851 _OutputIterator
1824>::type1852>::type
1825copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)1853copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
...@@ -2492,7 +2520,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -2492,7 +2520,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2492_ForwardIterator2520_ForwardIterator
2493min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2521min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2494{2522{
2495 static_assert(__is_forward_iterator<_ForwardIterator>::value,2523 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2496 "std::min_element requires a ForwardIterator");2524 "std::min_element requires a ForwardIterator");
2497 if (__first != __last)2525 if (__first != __last)
2498 {2526 {
...@@ -2564,7 +2592,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -2564,7 +2592,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2564_ForwardIterator2592_ForwardIterator
2565max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2593max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2566{2594{
2567 static_assert(__is_forward_iterator<_ForwardIterator>::value,2595 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2568 "std::max_element requires a ForwardIterator");2596 "std::max_element requires a ForwardIterator");
2569 if (__first != __last)2597 if (__first != __last)
2570 {2598 {
...@@ -2659,7 +2687,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -2659,7 +2687,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
2659std::pair<_ForwardIterator, _ForwardIterator>2687std::pair<_ForwardIterator, _ForwardIterator>
2660minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2688minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2661{2689{
2662 static_assert(__is_forward_iterator<_ForwardIterator>::value,2690 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2663 "std::minmax_element requires a ForwardIterator");2691 "std::minmax_element requires a ForwardIterator");
2664 std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);2692 std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
2665 if (__first != __last)2693 if (__first != __last)
...@@ -3117,10 +3145,10 @@ _SampleIterator __sample(_PopulationIterator __first,...@@ -3117,10 +3145,10 @@ _SampleIterator __sample(_PopulationIterator __first,
3117 input_iterator_tag) {3145 input_iterator_tag) {
31183146
3119 _Distance __k = 0;3147 _Distance __k = 0;
3120 for (; __first != __last && __k < __n; ++__first, (void)++__k)3148 for (; __first != __last && __k < __n; ++__first, (void) ++__k)
3121 __output_iter[__k] = *__first;3149 __output_iter[__k] = *__first;
3122 _Distance __sz = __k;3150 _Distance __sz = __k;
3123 for (; __first != __last; ++__first, (void)++__k) {3151 for (; __first != __last; ++__first, (void) ++__k) {
3124 _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);3152 _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
3125 if (__r < __sz)3153 if (__r < __sz)
3126 __output_iter[__r] = *__first;3154 __output_iter[__r] = *__first;
...@@ -3158,8 +3186,8 @@ _SampleIterator __sample(_PopulationIterator __first,...@@ -3158,8 +3186,8 @@ _SampleIterator __sample(_PopulationIterator __first,
3158 _PopCategory;3186 _PopCategory;
3159 typedef typename iterator_traits<_PopulationIterator>::difference_type3187 typedef typename iterator_traits<_PopulationIterator>::difference_type
3160 _Difference;3188 _Difference;
3161 static_assert(__is_forward_iterator<_PopulationIterator>::value ||3189 static_assert(__is_cpp17_forward_iterator<_PopulationIterator>::value ||
3162 __is_random_access_iterator<_SampleIterator>::value,3190 __is_cpp17_random_access_iterator<_SampleIterator>::value,
3163 "SampleIterator must meet the requirements of RandomAccessIterator");3191 "SampleIterator must meet the requirements of RandomAccessIterator");
3164 typedef typename common_type<_Distance, _Difference>::type _CommonType;3192 typedef typename common_type<_Distance, _Difference>::type _CommonType;
3165 _LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");3193 _LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
...@@ -3190,7 +3218,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>...@@ -3190,7 +3218,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
3190 if (__d > 1)3218 if (__d > 1)
3191 {3219 {
3192 _Dp __uid;3220 _Dp __uid;
3193 for (--__last, --__d; __first < __last; ++__first, --__d)3221 for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
3194 {3222 {
3195 difference_type __i = __uid(__g, _Pp(0, __d));3223 difference_type __i = __uid(__g, _Pp(0, __d));
3196 if (__i != difference_type(0))3224 if (__i != difference_type(0))
...@@ -3373,7 +3401,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate...@@ -3373,7 +3401,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
3373 // All trues now at start of range, all falses in buffer3401 // All trues now at start of range, all falses in buffer
3374 // Move falses back into range, but don't mess up __first which points to first false3402 // Move falses back into range, but don't mess up __first which points to first false
3375 __i = __first;3403 __i = __first;
3376 for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)3404 for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
3377 *__i = _VSTD::move(*__t2);3405 *__i = _VSTD::move(*__t2);
3378 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer3406 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
3379 return __first;3407 return __first;
...@@ -3505,7 +3533,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last...@@ -3505,7 +3533,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
3505 __i = ++__first;3533 __i = ++__first;
3506 // All trues now at start of range, all falses in buffer3534 // All trues now at start of range, all falses in buffer
3507 // Move falses back into range, but don't mess up __first which points to first false3535 // Move falses back into range, but don't mess up __first which points to first false
3508 for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)3536 for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
3509 *__i = _VSTD::move(*__t2);3537 *__i = _VSTD::move(*__t2);
3510 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer3538 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
3511 return __first;3539 return __first;
...@@ -4382,7 +4410,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -4382,7 +4410,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,
4382{4410{
4383 typedef typename iterator_traits<_InputIterator1>::value_type __v1;4411 typedef typename iterator_traits<_InputIterator1>::value_type __v1;
4384 typedef typename iterator_traits<_InputIterator2>::value_type __v2;4412 typedef typename iterator_traits<_InputIterator2>::value_type __v2;
4385 return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());4413 return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
4386}4414}
43874415
4388// inplace_merge4416// inplace_merge
...@@ -4428,14 +4456,14 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator...@@ -4428,14 +4456,14 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
4428 if (__len1 <= __len2)4456 if (__len1 <= __len2)
4429 {4457 {
4430 value_type* __p = __buff;4458 value_type* __p = __buff;
4431 for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)4459 for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
4432 ::new(__p) value_type(_VSTD::move(*__i));4460 ::new(__p) value_type(_VSTD::move(*__i));
4433 __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);4461 __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
4434 }4462 }
4435 else4463 else
4436 {4464 {
4437 value_type* __p = __buff;4465 value_type* __p = __buff;
4438 for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)4466 for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
4439 ::new(__p) value_type(_VSTD::move(*__i));4467 ::new(__p) value_type(_VSTD::move(*__i));
4440 typedef reverse_iterator<_BidirectionalIterator> _RBi;4468 typedef reverse_iterator<_BidirectionalIterator> _RBi;
4441 typedef reverse_iterator<value_type*> _Rv;4469 typedef reverse_iterator<value_type*> _Rv;
...@@ -4575,14 +4603,14 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -4575,14 +4603,14 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
4575 {4603 {
4576 if (__first1 == __last1)4604 if (__first1 == __last1)
4577 {4605 {
4578 for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0))4606 for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0))
4579 ::new (__result) value_type(_VSTD::move(*__first2));4607 ::new (__result) value_type(_VSTD::move(*__first2));
4580 __h.release();4608 __h.release();
4581 return;4609 return;
4582 }4610 }
4583 if (__first2 == __last2)4611 if (__first2 == __last2)
4584 {4612 {
4585 for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0))4613 for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0))
4586 ::new (__result) value_type(_VSTD::move(*__first1));4614 ::new (__result) value_type(_VSTD::move(*__first1));
4587 __h.release();4615 __h.release();
4588 return;4616 return;
...@@ -4612,7 +4640,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -4612,7 +4640,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
4612 {4640 {
4613 if (__first2 == __last2)4641 if (__first2 == __last2)
4614 {4642 {
4615 for (; __first1 != __last1; ++__first1, ++__result)4643 for (; __first1 != __last1; ++__first1, (void) ++__result)
4616 *__result = _VSTD::move(*__first1);4644 *__result = _VSTD::move(*__first1);
4617 return;4645 return;
4618 }4646 }
...@@ -4627,7 +4655,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -4627,7 +4655,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
4627 ++__first1;4655 ++__first1;
4628 }4656 }
4629 }4657 }
4630 for (; __first2 != __last2; ++__first2, ++__result)4658 for (; __first2 != __last2; ++__first2, (void) ++__result)
4631 *__result = _VSTD::move(*__first2);4659 *__result = _VSTD::move(*__first2);
4632}4660}
46334661
...@@ -4995,7 +5023,7 @@ void...@@ -4995,7 +5023,7 @@ void
4995__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)5023__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4996{5024{
4997 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;5025 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
4998 for (difference_type __n = __last - __first; __n > 1; --__last, --__n)5026 for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
4999 __pop_heap<_Compare>(__first, __last, __comp, __n);5027 __pop_heap<_Compare>(__first, __last, __comp, __n);
5000}5028}
50015029
...@@ -5065,7 +5093,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,...@@ -5065,7 +5093,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
5065 _RandomAccessIterator __r = __result_first;5093 _RandomAccessIterator __r = __result_first;
5066 if (__r != __result_last)5094 if (__r != __result_last)
5067 {5095 {
5068 for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)5096 for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
5069 *__r = *__first;5097 *__r = *__first;
5070 __make_heap<_Compare>(__result_first, __r, __comp);5098 __make_heap<_Compare>(__result_first, __r, __comp);
5071 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;5099 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
...@@ -5678,4 +5706,8 @@ _LIBCPP_END_NAMESPACE_STD...@@ -5678,4 +5706,8 @@ _LIBCPP_END_NAMESPACE_STD
56785706
5679_LIBCPP_POP_MACROS5707_LIBCPP_POP_MACROS
56805708
5709#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
5710# include <__pstl_algorithm>
5711#endif
5712
5681#endif // _LIBCPP_ALGORITHM5713#endif // _LIBCPP_ALGORITHM
lib/libcxx/include/atomic+1-1
...@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {...@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {
920#endif // _LIBCPP_CXX03_LANG920#endif // _LIBCPP_CXX03_LANG
921 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT921 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
922 : __a_value(value) {}922 : __a_value(value) {}
923 _Atomic(_Tp) __a_value;923 _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
924};924};
925925
926#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)926#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
lib/libcxx/include/bit+22-1
...@@ -42,6 +42,13 @@ namespace std {...@@ -42,6 +42,13 @@ namespace std {
42 template<class T>42 template<class T>
43 constexpr int popcount(T x) noexcept; // C++2043 constexpr int popcount(T x) noexcept; // C++20
4444
45 // 20.15.9, endian
46 enum class endian {
47 little = see below, // C++20
48 big = see below, // C++20
49 native = see below // C++20
50};
51
45} // namespace std52} // namespace std
4653
47*/54*/
...@@ -343,7 +350,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR...@@ -343,7 +350,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
343bool __ispow2(_Tp __t) _NOEXCEPT350bool __ispow2(_Tp __t) _NOEXCEPT
344{351{
345 static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");352 static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
346 return __t != 0 && (((__t & (__t - 1)) == 0)); 353 return __t != 0 && (((__t & (__t - 1)) == 0));
347}354}
348355
349356
...@@ -456,6 +463,20 @@ log2p1(_Tp __t) noexcept...@@ -456,6 +463,20 @@ log2p1(_Tp __t) noexcept
456 return __t == 0 ? 0 : __bit_log2(__t) + 1;463 return __t == 0 ? 0 : __bit_log2(__t) + 1;
457}464}
458465
466
467enum class endian
468{
469 little = 0xDEAD,
470 big = 0xFACE,
471#if defined(_LIBCPP_LITTLE_ENDIAN)
472 native = little
473#elif defined(_LIBCPP_BIG_ENDIAN)
474 native = big
475#else
476 native = 0xCAFE
477#endif
478};
479
459#endif // _LIBCPP_STD_VER > 17480#endif // _LIBCPP_STD_VER > 17
460481
461_LIBCPP_END_NAMESPACE_STD482_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/chrono+131-15
...@@ -612,13 +612,43 @@ constexpr year_month_weekday_last...@@ -612,13 +612,43 @@ constexpr year_month_weekday_last
612constexpr year_month_weekday_last612constexpr year_month_weekday_last
613 operator/(const month_weekday_last& mwdl, int y) noexcept;613 operator/(const month_weekday_last& mwdl, int y) noexcept;
614614
615// 25.9, class template time_of_day // C++20615// 26.9, class template hh_mm_ss
616template<class Duration> class time_of_day;616template <class Duration>
617class hh_mm_ss
618{
619 bool is_neg; // exposition only
620 chrono::hours h; // exposition only
621 chrono::minutes m; // exposition only
622 chrono::seconds s; // exposition only
623 precision ss; // exposition only
624
625public:
626 static unsigned constexpr fractional_width = see below;
627 using precision = see below;
628
629 constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
630 constexpr explicit hh_mm_ss(Duration d) noexcept;
631
632 constexpr bool is_negative() const noexcept;
633 constexpr chrono::hours hours() const noexcept;
634 constexpr chrono::minutes minutes() const noexcept;
635 constexpr chrono::seconds seconds() const noexcept;
636 constexpr precision subseconds() const noexcept;
637
638 constexpr explicit operator precision() const noexcept;
639 constexpr precision to_duration() const noexcept;
640};
641
642template <class charT, class traits, class Duration>
643 basic_ostream<charT, traits>&
644 operator<<(basic_ostream<charT, traits>& os, hh_mm_ss<Duration> const& hms);
645
646// 26.10, 12/24 hour functions
647constexpr bool is_am(hours const& h) noexcept;
648constexpr bool is_pm(hours const& h) noexcept;
649constexpr hours make12(const hours& h) noexcept;
650constexpr hours make24(const hours& h, bool is_pm) noexcept;
617651
618template<> class time_of_day<hours>;
619template<> class time_of_day<minutes>;
620template<> class time_of_day<seconds>;
621template<class Rep, class Period> class time_of_day<duration<Rep, Period>>;
622652
623// 25.10.2, time zone database // C++20653// 25.10.2, time zone database // C++20
624struct tzdb;654struct tzdb;
...@@ -1428,7 +1458,7 @@ typename enable_if...@@ -1428,7 +1458,7 @@ typename enable_if
1428>::type1458>::type
1429abs(duration<_Rep, _Period> __d)1459abs(duration<_Rep, _Period> __d)
1430{1460{
1431 return __d >= __d.zero() ? __d : -__d;1461 return __d >= __d.zero() ? +__d : -__d;
1432}1462}
1433#endif1463#endif
14341464
...@@ -1810,7 +1840,7 @@ private:...@@ -1810,7 +1840,7 @@ private:
1810 unsigned char __wd;1840 unsigned char __wd;
1811public:1841public:
1812 weekday() = default;1842 weekday() = default;
1813 inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val)) {}1843 inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
1814 inline constexpr weekday(const sys_days& __sysd) noexcept1844 inline constexpr weekday(const sys_days& __sysd) noexcept
1815 : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {}1845 : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {}
1816 inline explicit constexpr weekday(const local_days& __locd) noexcept1846 inline explicit constexpr weekday(const local_days& __locd) noexcept
...@@ -1822,11 +1852,13 @@ public:...@@ -1822,11 +1852,13 @@ public:
1822 inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }1852 inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
1823 constexpr weekday& operator+=(const days& __dd) noexcept;1853 constexpr weekday& operator+=(const days& __dd) noexcept;
1824 constexpr weekday& operator-=(const days& __dd) noexcept;1854 constexpr weekday& operator-=(const days& __dd) noexcept;
1825 inline explicit constexpr operator unsigned() const noexcept { return __wd; }1855 inline constexpr unsigned c_encoding() const noexcept { return __wd; }
1856 inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; }
1826 inline constexpr bool ok() const noexcept { return __wd <= 6; }1857 inline constexpr bool ok() const noexcept { return __wd <= 6; }
1827 constexpr weekday_indexed operator[](unsigned __index) const noexcept;1858 constexpr weekday_indexed operator[](unsigned __index) const noexcept;
1828 constexpr weekday_last operator[](last_spec) const noexcept;1859 constexpr weekday_last operator[](last_spec) const noexcept;
18291860
1861 // TODO: Make private?
1830 static constexpr unsigned char __weekday_from_days(int __days) noexcept;1862 static constexpr unsigned char __weekday_from_days(int __days) noexcept;
1831};1863};
18321864
...@@ -1842,7 +1874,7 @@ unsigned char weekday::__weekday_from_days(int __days) noexcept...@@ -1842,7 +1874,7 @@ unsigned char weekday::__weekday_from_days(int __days) noexcept
18421874
1843inline constexpr1875inline constexpr
1844bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept1876bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept
1845{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }1877{ return __lhs.c_encoding() == __rhs.c_encoding(); }
18461878
1847inline constexpr1879inline constexpr
1848bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept1880bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
...@@ -1850,7 +1882,7 @@ bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept...@@ -1850,7 +1882,7 @@ bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
18501882
1851inline constexpr1883inline constexpr
1852bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept1884bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept
1853{ return static_cast<unsigned>(__lhs) < static_cast<unsigned>(__rhs); }1885{ return __lhs.c_encoding() < __rhs.c_encoding(); }
18541886
1855inline constexpr1887inline constexpr
1856bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept1888bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
...@@ -1866,7 +1898,7 @@ bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept...@@ -1866,7 +1898,7 @@ bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept
18661898
1867constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept1899constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
1868{1900{
1869 auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + __rhs.count();1901 auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
1870 auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;1902 auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
1871 return weekday{static_cast<unsigned>(__mu - __yr * 7)};1903 return weekday{static_cast<unsigned>(__mu - __yr * 7)};
1872}1904}
...@@ -1879,7 +1911,7 @@ constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept...@@ -1879,7 +1911,7 @@ constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept
18791911
1880constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept1912constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept
1881{1913{
1882 const int __wdu = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);1914 const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
1883 const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;1915 const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;
1884 return days{__wdu - __wk * 7};1916 return days{__wdu - __wk * 7};
1885}1917}
...@@ -2537,8 +2569,13 @@ public:...@@ -2537,8 +2569,13 @@ public:
2537 inline constexpr bool ok() const noexcept2569 inline constexpr bool ok() const noexcept
2538 {2570 {
2539 if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false;2571 if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false;
2540 // TODO: make sure it's a valid date2572 if (__wdi.index() <= 4) return true;
2541 return true;2573 auto __nth_weekday_day =
2574 __wdi.weekday() -
2575 chrono::weekday{static_cast<sys_days>(__y / __m / 1)} +
2576 days{(__wdi.index() - 1) * 7 + 1};
2577 return static_cast<unsigned>(__nth_weekday_day.count()) <=
2578 static_cast<unsigned>((__y / __m / last).day());
2542 }2579 }
25432580
2544 static constexpr year_month_weekday __from_days(days __d) noexcept;2581 static constexpr year_month_weekday __from_days(days __d) noexcept;
...@@ -2715,6 +2752,84 @@ inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(co...@@ -2715,6 +2752,84 @@ inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(co
2715inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }2752inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
2716inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }2753inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
27172754
2755
2756template <class _Duration>
2757class hh_mm_ss
2758{
2759private:
2760 static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
2761 using __CommonType = common_type_t<_Duration, chrono::seconds>;
2762
2763 static constexpr uint64_t __pow10(unsigned __exp)
2764 {
2765 uint64_t __ret = 1;
2766 for (unsigned __i = 0; __i < __exp; ++__i)
2767 __ret *= 10U;
2768 return __ret;
2769 }
2770
2771 static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0)
2772 {
2773 if (__n >= 2 && __d != 0 && __w < 19)
2774 return 1 + __width(__n, __d % __n * 10, __w+1);
2775 return 0;
2776 }
2777
2778public:
2779 static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?
2780 __width(__CommonType::period::den) : 6u;
2781 using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
2782
2783 constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
2784
2785 constexpr explicit hh_mm_ss(_Duration __d) noexcept :
2786 __is_neg(__d < _Duration(0)),
2787 __h(duration_cast<chrono::hours> (abs(__d))),
2788 __m(duration_cast<chrono::minutes>(abs(__d) - hours())),
2789 __s(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())),
2790 __f(duration_cast<precision> (abs(__d) - hours() - minutes() - seconds()))
2791 {}
2792
2793 constexpr bool is_negative() const noexcept { return __is_neg; }
2794 constexpr chrono::hours hours() const noexcept { return __h; }
2795 constexpr chrono::minutes minutes() const noexcept { return __m; }
2796 constexpr chrono::seconds seconds() const noexcept { return __s; }
2797 constexpr precision subseconds() const noexcept { return __f; }
2798
2799 constexpr precision to_duration() const noexcept
2800 {
2801 auto __dur = __h + __m + __s + __f;
2802 return __is_neg ? -__dur : __dur;
2803 }
2804
2805 constexpr explicit operator precision() const noexcept { return to_duration(); }
2806
2807private:
2808 bool __is_neg;
2809 chrono::hours __h;
2810 chrono::minutes __m;
2811 chrono::seconds __s;
2812 precision __f;
2813};
2814
2815constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); }
2816constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); }
2817
2818constexpr hours make12(const hours& __h) noexcept
2819{
2820 if (__h == hours( 0)) return hours(12);
2821 else if (__h <= hours(12)) return __h;
2822 else return __h - hours(12);
2823}
2824
2825constexpr hours make24(const hours& __h, bool __is_pm) noexcept
2826{
2827 if (__is_pm)
2828 return __h == hours(12) ? __h : __h + hours(12);
2829 else
2830 return __h == hours(12) ? hours(0) : __h;
2831}
2832
2718#endif // _LIBCPP_STD_VER > 172833#endif // _LIBCPP_STD_VER > 17
2719} // chrono2834} // chrono
27202835
...@@ -2825,6 +2940,7 @@ struct _FilesystemClock {...@@ -2825,6 +2940,7 @@ struct _FilesystemClock {
2825 typedef chrono::duration<rep, period> duration;2940 typedef chrono::duration<rep, period> duration;
2826 typedef chrono::time_point<_FilesystemClock> time_point;2941 typedef chrono::time_point<_FilesystemClock> time_point;
28272942
2943 _LIBCPP_EXPORTED_FROM_ABI
2828 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;2944 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
28292945
2830 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;2946 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
lib/libcxx/include/cmath+36
...@@ -303,11 +303,15 @@ long double truncl(long double x);...@@ -303,11 +303,15 @@ long double truncl(long double x);
303#include <__config>303#include <__config>
304#include <math.h>304#include <math.h>
305#include <version>305#include <version>
306#include <type_traits>
306307
307#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
308#pragma GCC system_header309#pragma GCC system_header
309#endif310#endif
310311
312_LIBCPP_PUSH_MACROS
313#include <__undef_macros>
314
311_LIBCPP_BEGIN_NAMESPACE_STD315_LIBCPP_BEGIN_NAMESPACE_STD
312316
313using ::signbit;317using ::signbit;
...@@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __ler...@@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __ler
632636
633#endif // _LIBCPP_STD_VER > 17637#endif // _LIBCPP_STD_VER > 17
634638
639template <class _IntT, class _FloatT,
640 bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
641 int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
642_LIBCPP_INLINE_VISIBILITY
643_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
644 static_assert(is_floating_point<_FloatT>::value, "must be a floating point type");
645 static_assert(is_integral<_IntT>::value, "must be an integral type");
646 static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
647 static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value
648 || _IsSame<_FloatT,long double>::value), "unsupported floating point type");
649 return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
650}
651
652// Convert a floating point number to the specified integral type after
653// clamping to the integral types representable range.
654//
655// The behavior is undefined if `__r` is NaN.
656template <class _IntT, class _RealT>
657_LIBCPP_INLINE_VISIBILITY
658_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
659 using _Lim = std::numeric_limits<_IntT>;
660 const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>();
661 if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
662 return _Lim::max();
663 } else if (__r <= _Lim::lowest()) {
664 return _Lim::min();
665 }
666 return static_cast<_IntT>(__r);
667}
668
635_LIBCPP_END_NAMESPACE_STD669_LIBCPP_END_NAMESPACE_STD
636670
671_LIBCPP_POP_MACROS
672
637#endif // _LIBCPP_CMATH673#endif // _LIBCPP_CMATH
lib/libcxx/include/cstdio+1-1
...@@ -152,7 +152,7 @@ using ::tmpnam;...@@ -152,7 +152,7 @@ using ::tmpnam;
152152
153#ifndef _LIBCPP_HAS_NO_STDIN153#ifndef _LIBCPP_HAS_NO_STDIN
154using ::getchar;154using ::getchar;
155#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)155#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
156using ::gets;156using ::gets;
157#endif157#endif
158using ::scanf;158using ::scanf;
lib/libcxx/include/cstdlib+1-1
...@@ -154,7 +154,7 @@ using ::wcstombs;...@@ -154,7 +154,7 @@ using ::wcstombs;
154using ::at_quick_exit;154using ::at_quick_exit;
155using ::quick_exit;155using ::quick_exit;
156#endif156#endif
157#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)157#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
158using ::aligned_alloc;158using ::aligned_alloc;
159#endif159#endif
160160
lib/libcxx/include/ctime+3-3
...@@ -18,7 +18,7 @@ Macros:...@@ -18,7 +18,7 @@ Macros:
18 NULL18 NULL
19 CLOCKS_PER_SEC19 CLOCKS_PER_SEC
20 TIME_UTC // C++1720 TIME_UTC // C++17
21 21
22namespace std22namespace std
23{23{
2424
...@@ -29,7 +29,7 @@ Types:...@@ -29,7 +29,7 @@ Types:
29 time_t29 time_t
30 tm30 tm
31 timespec // C++1731 timespec // C++17
32 32
33clock_t clock();33clock_t clock();
34double difftime(time_t time1, time_t time0);34double difftime(time_t time1, time_t time0);
35time_t mktime(tm* timeptr);35time_t mktime(tm* timeptr);
...@@ -58,7 +58,7 @@ using ::clock_t;...@@ -58,7 +58,7 @@ using ::clock_t;
58using ::size_t;58using ::size_t;
59using ::time_t;59using ::time_t;
60using ::tm;60using ::tm;
61#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)61#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
62using ::timespec;62using ::timespec;
63#endif63#endif
64using ::clock;64using ::clock;
lib/libcxx/include/deque+182-95
...@@ -190,7 +190,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -190,7 +190,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
190copy(_RAIter __f,190copy(_RAIter __f,
191 _RAIter __l,191 _RAIter __l,
192 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,192 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
193 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);193 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0);
194194
195template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,195template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
196 class _OutputIterator>196 class _OutputIterator>
...@@ -212,7 +212,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -212,7 +212,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
212copy_backward(_RAIter __f,212copy_backward(_RAIter __f,
213 _RAIter __l,213 _RAIter __l,
214 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,214 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
215 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);215 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0);
216216
217template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,217template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
218 class _OutputIterator>218 class _OutputIterator>
...@@ -234,7 +234,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -234,7 +234,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
234move(_RAIter __f,234move(_RAIter __f,
235 _RAIter __l,235 _RAIter __l,
236 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,236 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
237 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);237 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0);
238238
239template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,239template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
240 class _OutputIterator>240 class _OutputIterator>
...@@ -256,7 +256,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -256,7 +256,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
256move_backward(_RAIter __f,256move_backward(_RAIter __f,
257 _RAIter __l,257 _RAIter __l,
258 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,258 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
259 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);259 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0);
260260
261template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,261template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
262 class _OutputIterator>262 class _OutputIterator>
...@@ -450,7 +450,7 @@ private:...@@ -450,7 +450,7 @@ private:
450 copy(_RAIter __f,450 copy(_RAIter __f,
451 _RAIter __l,451 _RAIter __l,
452 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,452 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
453 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);453 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*);
454454
455 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,455 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
456 class _OutputIterator>456 class _OutputIterator>
...@@ -475,7 +475,7 @@ private:...@@ -475,7 +475,7 @@ private:
475 copy_backward(_RAIter __f,475 copy_backward(_RAIter __f,
476 _RAIter __l,476 _RAIter __l,
477 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,477 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
478 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);478 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*);
479479
480 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,480 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
481 class _OutputIterator>481 class _OutputIterator>
...@@ -500,7 +500,7 @@ private:...@@ -500,7 +500,7 @@ private:
500 move(_RAIter __f,500 move(_RAIter __f,
501 _RAIter __l,501 _RAIter __l,
502 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,502 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
503 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);503 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*);
504504
505 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,505 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
506 class _OutputIterator>506 class _OutputIterator>
...@@ -525,7 +525,7 @@ private:...@@ -525,7 +525,7 @@ private:
525 move_backward(_RAIter __f,525 move_backward(_RAIter __f,
526 _RAIter __l,526 _RAIter __l,
527 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,527 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
528 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*);528 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*);
529529
530 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,530 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
531 class _OutputIterator>531 class _OutputIterator>
...@@ -558,7 +558,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -558,7 +558,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
558copy(_RAIter __f,558copy(_RAIter __f,
559 _RAIter __l,559 _RAIter __l,
560 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,560 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
561 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)561 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*)
562{562{
563 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;563 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
564 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;564 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
...@@ -646,7 +646,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -646,7 +646,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
646copy_backward(_RAIter __f,646copy_backward(_RAIter __f,
647 _RAIter __l,647 _RAIter __l,
648 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,648 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
649 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)649 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*)
650{650{
651 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;651 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
652 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;652 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
...@@ -734,7 +734,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -734,7 +734,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
734move(_RAIter __f,734move(_RAIter __f,
735 _RAIter __l,735 _RAIter __l,
736 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,736 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
737 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)737 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*)
738{738{
739 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;739 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
740 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;740 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
...@@ -822,7 +822,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>...@@ -822,7 +822,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
822move_backward(_RAIter __f,822move_backward(_RAIter __f,
823 _RAIter __l,823 _RAIter __l,
824 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,824 __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r,
825 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)825 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*)
826{826{
827 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;827 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
828 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;828 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
...@@ -934,7 +934,7 @@ public:...@@ -934,7 +934,7 @@ public:
934 typedef _Allocator allocator_type;934 typedef _Allocator allocator_type;
935 typedef allocator_traits<allocator_type> __alloc_traits;935 typedef allocator_traits<allocator_type> __alloc_traits;
936 typedef typename __alloc_traits::size_type size_type;936 typedef typename __alloc_traits::size_type size_type;
937protected:937
938 typedef _Tp value_type;938 typedef _Tp value_type;
939 typedef value_type& reference;939 typedef value_type& reference;
940 typedef const value_type& const_reference;940 typedef const value_type& const_reference;
...@@ -956,6 +956,74 @@ protected:...@@ -956,6 +956,74 @@ protected:
956 typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,956 typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
957 difference_type> const_iterator;957 difference_type> const_iterator;
958958
959 struct __deque_block_range {
960 explicit __deque_block_range(pointer __b, pointer __e) _NOEXCEPT : __begin_(__b), __end_(__e) {}
961 const pointer __begin_;
962 const pointer __end_;
963 };
964
965 struct __deque_range {
966 iterator __pos_;
967 const iterator __end_;
968
969 __deque_range(iterator __pos, iterator __e) _NOEXCEPT
970 : __pos_(__pos), __end_(__e) {}
971
972 explicit operator bool() const _NOEXCEPT {
973 return __pos_ != __end_;
974 }
975
976 __deque_range begin() const {
977 return *this;
978 }
979
980 __deque_range end() const {
981 return __deque_range(__end_, __end_);
982 }
983 __deque_block_range operator*() const _NOEXCEPT {
984 if (__pos_.__m_iter_ == __end_.__m_iter_) {
985 return __deque_block_range(__pos_.__ptr_, __end_.__ptr_);
986 }
987 return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size);
988 }
989
990 __deque_range& operator++() _NOEXCEPT {
991 if (__pos_.__m_iter_ == __end_.__m_iter_) {
992 __pos_ = __end_;
993 } else {
994 ++__pos_.__m_iter_;
995 __pos_.__ptr_ = *__pos_.__m_iter_;
996 }
997 return *this;
998 }
999
1000
1001 friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
1002 return __lhs.__pos_ == __rhs.__pos_;
1003 }
1004 friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
1005 return !(__lhs == __rhs);
1006 }
1007 };
1008
1009
1010
1011 struct _ConstructTransaction {
1012 _ConstructTransaction(__deque_base* __db, __deque_block_range& __r)
1013 : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
1014
1015
1016 ~_ConstructTransaction() {
1017 __base_->size() += (__pos_ - __begin_);
1018 }
1019
1020 pointer __pos_;
1021 const pointer __end_;
1022 private:
1023 const pointer __begin_;
1024 __deque_base * const __base_;
1025 };
1026
959protected:1027protected:
960 __map __map_;1028 __map __map_;
961 size_type __start_;1029 size_type __start_;
...@@ -1103,7 +1171,7 @@ template <class _Tp, class _Allocator>...@@ -1103,7 +1171,7 @@ template <class _Tp, class _Allocator>
1103inline1171inline
1104__deque_base<_Tp, _Allocator>::__deque_base()1172__deque_base<_Tp, _Allocator>::__deque_base()
1105 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)1173 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1106 : __start_(0), __size_(0) {}1174 : __start_(0), __size_(0, __default_init_tag()) {}
11071175
1108template <class _Tp, class _Allocator>1176template <class _Tp, class _Allocator>
1109inline1177inline
...@@ -1222,6 +1290,10 @@ public:...@@ -1222,6 +1290,10 @@ public:
1222 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;1290 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
1223 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;1291 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
12241292
1293 using typename __base::__deque_range;
1294 using typename __base::__deque_block_range;
1295 using typename __base::_ConstructTransaction;
1296
1225 // construct/copy/destroy:1297 // construct/copy/destroy:
1226 _LIBCPP_INLINE_VISIBILITY1298 _LIBCPP_INLINE_VISIBILITY
1227 deque()1299 deque()
...@@ -1236,10 +1308,10 @@ public:...@@ -1236,10 +1308,10 @@ public:
1236 deque(size_type __n, const value_type& __v, const allocator_type& __a);1308 deque(size_type __n, const value_type& __v, const allocator_type& __a);
1237 template <class _InputIter>1309 template <class _InputIter>
1238 deque(_InputIter __f, _InputIter __l,1310 deque(_InputIter __f, _InputIter __l,
1239 typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);1311 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0);
1240 template <class _InputIter>1312 template <class _InputIter>
1241 deque(_InputIter __f, _InputIter __l, const allocator_type& __a,1313 deque(_InputIter __f, _InputIter __l, const allocator_type& __a,
1242 typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);1314 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0);
1243 deque(const deque& __c);1315 deque(const deque& __c);
1244 deque(const deque& __c, const allocator_type& __a);1316 deque(const deque& __c, const allocator_type& __a);
12451317
...@@ -1267,11 +1339,11 @@ public:...@@ -1267,11 +1339,11 @@ public:
12671339
1268 template <class _InputIter>1340 template <class _InputIter>
1269 void assign(_InputIter __f, _InputIter __l,1341 void assign(_InputIter __f, _InputIter __l,
1270 typename enable_if<__is_input_iterator<_InputIter>::value &&1342 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value &&
1271 !__is_random_access_iterator<_InputIter>::value>::type* = 0);1343 !__is_cpp17_random_access_iterator<_InputIter>::value>::type* = 0);
1272 template <class _RAIter>1344 template <class _RAIter>
1273 void assign(_RAIter __f, _RAIter __l,1345 void assign(_RAIter __f, _RAIter __l,
1274 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);1346 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type* = 0);
1275 void assign(size_type __n, const value_type& __v);1347 void assign(size_type __n, const value_type& __v);
12761348
1277 _LIBCPP_INLINE_VISIBILITY1349 _LIBCPP_INLINE_VISIBILITY
...@@ -1371,15 +1443,15 @@ public:...@@ -1371,15 +1443,15 @@ public:
1371 iterator insert(const_iterator __p, size_type __n, const value_type& __v);1443 iterator insert(const_iterator __p, size_type __n, const value_type& __v);
1372 template <class _InputIter>1444 template <class _InputIter>
1373 iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,1445 iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
1374 typename enable_if<__is_input_iterator<_InputIter>::value1446 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value
1375 &&!__is_forward_iterator<_InputIter>::value>::type* = 0);1447 &&!__is_cpp17_forward_iterator<_InputIter>::value>::type* = 0);
1376 template <class _ForwardIterator>1448 template <class _ForwardIterator>
1377 iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,1449 iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
1378 typename enable_if<__is_forward_iterator<_ForwardIterator>::value1450 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value
1379 &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);1451 &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
1380 template <class _BiIter>1452 template <class _BiIter>
1381 iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,1453 iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
1382 typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);1454 typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type* = 0);
13831455
1384 void pop_front();1456 void pop_front();
1385 void pop_back();1457 void pop_back();
...@@ -1399,7 +1471,7 @@ public:...@@ -1399,7 +1471,7 @@ public:
13991471
1400 _LIBCPP_INLINE_VISIBILITY1472 _LIBCPP_INLINE_VISIBILITY
1401 bool __invariants() const {return __base::__invariants();}1473 bool __invariants() const {return __base::__invariants();}
1402private:1474
1403 typedef typename __base::__map_const_pointer __map_const_pointer;1475 typedef typename __base::__map_const_pointer __map_const_pointer;
14041476
1405 _LIBCPP_INLINE_VISIBILITY1477 _LIBCPP_INLINE_VISIBILITY
...@@ -1412,24 +1484,62 @@ private:...@@ -1412,24 +1484,62 @@ private:
1412 {1484 {
1413 return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;1485 return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;
1414 }1486 }
1487 _LIBCPP_INLINE_VISIBILITY
1488 size_type __block_count() const
1489 {
1490 return __base::__map_.size();
1491 }
1492
1415 _LIBCPP_INLINE_VISIBILITY1493 _LIBCPP_INLINE_VISIBILITY
1416 size_type __front_spare() const1494 size_type __front_spare() const
1417 {1495 {
1418 return __base::__start_;1496 return __base::__start_;
1419 }1497 }
1420 _LIBCPP_INLINE_VISIBILITY1498 _LIBCPP_INLINE_VISIBILITY
1499 size_type __front_spare_blocks() const {
1500 return __front_spare() / __base::__block_size;
1501 }
1502 _LIBCPP_INLINE_VISIBILITY
1421 size_type __back_spare() const1503 size_type __back_spare() const
1422 {1504 {
1423 return __capacity() - (__base::__start_ + __base::size());1505 return __capacity() - (__base::__start_ + __base::size());
1424 }1506 }
1507 _LIBCPP_INLINE_VISIBILITY
1508 size_type __back_spare_blocks() const {
1509 return __back_spare() / __base::__block_size;
1510 }
1511
1512 private:
1513 _LIBCPP_INLINE_VISIBILITY
1514 bool __maybe_remove_front_spare(bool __keep_one = true) {
1515 if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
1516 __alloc_traits::deallocate(__base::__alloc(), __base::__map_.front(),
1517 __base::__block_size);
1518 __base::__map_.pop_front();
1519 __base::__start_ -= __base::__block_size;
1520 return true;
1521 }
1522 return false;
1523 }
1524
1525 _LIBCPP_INLINE_VISIBILITY
1526 bool __maybe_remove_back_spare(bool __keep_one = true) {
1527 if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
1528 __alloc_traits::deallocate(__base::__alloc(), __base::__map_.back(),
1529 __base::__block_size);
1530 __base::__map_.pop_back();
1531 return true;
1532 }
1533 return false;
1534 }
14251535
1426 template <class _InpIter>1536 template <class _InpIter>
1427 void __append(_InpIter __f, _InpIter __l,1537 void __append(_InpIter __f, _InpIter __l,
1428 typename enable_if<__is_input_iterator<_InpIter>::value &&1538 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value &&
1429 !__is_forward_iterator<_InpIter>::value>::type* = 0);1539 !__is_cpp17_forward_iterator<_InpIter>::value>::type* = 0);
1430 template <class _ForIter>1540 template <class _ForIter>
1431 void __append(_ForIter __f, _ForIter __l,1541 void __append(_ForIter __f, _ForIter __l,
1432 typename enable_if<__is_forward_iterator<_ForIter>::value>::type* = 0);1542 typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type* = 0);
1433 void __append(size_type __n);1543 void __append(size_type __n);
1434 void __append(size_type __n, const value_type& __v);1544 void __append(size_type __n, const value_type& __v);
1435 void __erase_to_end(const_iterator __f);1545 void __erase_to_end(const_iterator __f);
...@@ -1524,7 +1634,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const alloca...@@ -1524,7 +1634,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const alloca
1524template <class _Tp, class _Allocator>1634template <class _Tp, class _Allocator>
1525template <class _InputIter>1635template <class _InputIter>
1526deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,1636deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,
1527 typename enable_if<__is_input_iterator<_InputIter>::value>::type*)1637 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*)
1528{1638{
1529 __append(__f, __l);1639 __append(__f, __l);
1530}1640}
...@@ -1532,7 +1642,7 @@ deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,...@@ -1532,7 +1642,7 @@ deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,
1532template <class _Tp, class _Allocator>1642template <class _Tp, class _Allocator>
1533template <class _InputIter>1643template <class _InputIter>
1534deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a,1644deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a,
1535 typename enable_if<__is_input_iterator<_InputIter>::value>::type*)1645 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*)
1536 : __base(__a)1646 : __base(__a)
1537{1647{
1538 __append(__f, __l);1648 __append(__f, __l);
...@@ -1640,8 +1750,8 @@ template <class _Tp, class _Allocator>...@@ -1640,8 +1750,8 @@ template <class _Tp, class _Allocator>
1640template <class _InputIter>1750template <class _InputIter>
1641void1751void
1642deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,1752deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
1643 typename enable_if<__is_input_iterator<_InputIter>::value &&1753 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value &&
1644 !__is_random_access_iterator<_InputIter>::value>::type*)1754 !__is_cpp17_random_access_iterator<_InputIter>::value>::type*)
1645{1755{
1646 iterator __i = __base::begin();1756 iterator __i = __base::begin();
1647 iterator __e = __base::end();1757 iterator __e = __base::end();
...@@ -1657,7 +1767,7 @@ template <class _Tp, class _Allocator>...@@ -1657,7 +1767,7 @@ template <class _Tp, class _Allocator>
1657template <class _RAIter>1767template <class _RAIter>
1658void1768void
1659deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l,1769deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l,
1660 typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*)1770 typename enable_if<__is_cpp17_random_access_iterator<_RAIter>::value>::type*)
1661{1771{
1662 if (static_cast<size_type>(__l - __f) > __base::size())1772 if (static_cast<size_type>(__l - __f) > __base::size())
1663 {1773 {
...@@ -1727,17 +1837,8 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT...@@ -1727,17 +1837,8 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
1727 }1837 }
1728 else1838 else
1729 {1839 {
1730 if (__front_spare() >= __base::__block_size)1840 __maybe_remove_front_spare(/*__keep_one=*/false);
1731 {1841 __maybe_remove_back_spare(/*__keep_one=*/false);
1732 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
1733 __base::__map_.pop_front();
1734 __base::__start_ -= __base::__block_size;
1735 }
1736 if (__back_spare() >= __base::__block_size)
1737 {
1738 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
1739 __base::__map_.pop_back();
1740 }
1741 }1842 }
1742 __base::__map_.shrink_to_fit();1843 __base::__map_.shrink_to_fit();
1743}1844}
...@@ -2151,8 +2252,8 @@ template <class _Tp, class _Allocator>...@@ -2151,8 +2252,8 @@ template <class _Tp, class _Allocator>
2151template <class _InputIter>2252template <class _InputIter>
2152typename deque<_Tp, _Allocator>::iterator2253typename deque<_Tp, _Allocator>::iterator
2153deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,2254deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
2154 typename enable_if<__is_input_iterator<_InputIter>::value2255 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value
2155 &&!__is_forward_iterator<_InputIter>::value>::type*)2256 &&!__is_cpp17_forward_iterator<_InputIter>::value>::type*)
2156{2257{
2157 __split_buffer<value_type, allocator_type&> __buf(__base::__alloc());2258 __split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
2158 __buf.__construct_at_end(__f, __l);2259 __buf.__construct_at_end(__f, __l);
...@@ -2164,8 +2265,8 @@ template <class _Tp, class _Allocator>...@@ -2164,8 +2265,8 @@ template <class _Tp, class _Allocator>
2164template <class _ForwardIterator>2265template <class _ForwardIterator>
2165typename deque<_Tp, _Allocator>::iterator2266typename deque<_Tp, _Allocator>::iterator
2166deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,2267deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
2167 typename enable_if<__is_forward_iterator<_ForwardIterator>::value2268 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value
2168 &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*)2269 &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type*)
2169{2270{
2170 size_type __n = _VSTD::distance(__f, __l);2271 size_type __n = _VSTD::distance(__f, __l);
2171 __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());2272 __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());
...@@ -2178,7 +2279,7 @@ template <class _Tp, class _Allocator>...@@ -2178,7 +2279,7 @@ template <class _Tp, class _Allocator>
2178template <class _BiIter>2279template <class _BiIter>
2179typename deque<_Tp, _Allocator>::iterator2280typename deque<_Tp, _Allocator>::iterator
2180deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,2281deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
2181 typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type*)2282 typename enable_if<__is_cpp17_bidirectional_iterator<_BiIter>::value>::type*)
2182{2283{
2183 size_type __n = _VSTD::distance(__f, __l);2284 size_type __n = _VSTD::distance(__f, __l);
2184 size_type __pos = __p - __base::begin();2285 size_type __pos = __p - __base::begin();
...@@ -2247,8 +2348,8 @@ template <class _Tp, class _Allocator>...@@ -2247,8 +2348,8 @@ template <class _Tp, class _Allocator>
2247template <class _InpIter>2348template <class _InpIter>
2248void2349void
2249deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,2350deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,
2250 typename enable_if<__is_input_iterator<_InpIter>::value &&2351 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value &&
2251 !__is_forward_iterator<_InpIter>::value>::type*)2352 !__is_cpp17_forward_iterator<_InpIter>::value>::type*)
2252{2353{
2253 for (; __f != __l; ++__f)2354 for (; __f != __l; ++__f)
2254#ifdef _LIBCPP_CXX03_LANG2355#ifdef _LIBCPP_CXX03_LANG
...@@ -2262,7 +2363,7 @@ template <class _Tp, class _Allocator>...@@ -2262,7 +2363,7 @@ template <class _Tp, class _Allocator>
2262template <class _ForIter>2363template <class _ForIter>
2263void2364void
2264deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,2365deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
2265 typename enable_if<__is_forward_iterator<_ForIter>::value>::type*)2366 typename enable_if<__is_cpp17_forward_iterator<_ForIter>::value>::type*)
2266{2367{
2267 size_type __n = _VSTD::distance(__f, __l);2368 size_type __n = _VSTD::distance(__f, __l);
2268 allocator_type& __a = __base::__alloc();2369 allocator_type& __a = __base::__alloc();
...@@ -2270,8 +2371,12 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,...@@ -2270,8 +2371,12 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
2270 if (__n > __back_capacity)2371 if (__n > __back_capacity)
2271 __add_back_capacity(__n - __back_capacity);2372 __add_back_capacity(__n - __back_capacity);
2272 // __n <= __back_capacity2373 // __n <= __back_capacity
2273 for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())2374 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2274 __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);2375 _ConstructTransaction __tx(this, __br);
2376 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
2377 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
2378 }
2379 }
2275}2380}
22762381
2277template <class _Tp, class _Allocator>2382template <class _Tp, class _Allocator>
...@@ -2283,8 +2388,12 @@ deque<_Tp, _Allocator>::__append(size_type __n)...@@ -2283,8 +2388,12 @@ deque<_Tp, _Allocator>::__append(size_type __n)
2283 if (__n > __back_capacity)2388 if (__n > __back_capacity)
2284 __add_back_capacity(__n - __back_capacity);2389 __add_back_capacity(__n - __back_capacity);
2285 // __n <= __back_capacity2390 // __n <= __back_capacity
2286 for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())2391 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2287 __alloc_traits::construct(__a, _VSTD::addressof(*__i));2392 _ConstructTransaction __tx(this, __br);
2393 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
2394 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
2395 }
2396 }
2288}2397}
22892398
2290template <class _Tp, class _Allocator>2399template <class _Tp, class _Allocator>
...@@ -2296,8 +2405,13 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)...@@ -2296,8 +2405,13 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
2296 if (__n > __back_capacity)2405 if (__n > __back_capacity)
2297 __add_back_capacity(__n - __back_capacity);2406 __add_back_capacity(__n - __back_capacity);
2298 // __n <= __back_capacity2407 // __n <= __back_capacity
2299 for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())2408 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2300 __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);2409 _ConstructTransaction __tx(this, __br);
2410 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
2411 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
2412 }
2413 }
2414
2301}2415}
23022416
2303// Create front capacity for one block of elements.2417// Create front capacity for one block of elements.
...@@ -2592,16 +2706,12 @@ void...@@ -2592,16 +2706,12 @@ void
2592deque<_Tp, _Allocator>::pop_front()2706deque<_Tp, _Allocator>::pop_front()
2593{2707{
2594 allocator_type& __a = __base::__alloc();2708 allocator_type& __a = __base::__alloc();
2595 __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +2709 __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
2596 __base::__start_ / __base::__block_size) +2710 __base::__start_ / __base::__block_size) +
2597 __base::__start_ % __base::__block_size));2711 __base::__start_ % __base::__block_size));
2598 --__base::size();2712 --__base::size();
2599 if (++__base::__start_ >= 2 * __base::__block_size)2713 ++__base::__start_;
2600 {2714 __maybe_remove_front_spare();
2601 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2602 __base::__map_.pop_front();
2603 __base::__start_ -= __base::__block_size;
2604 }
2605}2715}
26062716
2607template <class _Tp, class _Allocator>2717template <class _Tp, class _Allocator>
...@@ -2611,15 +2721,11 @@ deque<_Tp, _Allocator>::pop_back()...@@ -2611,15 +2721,11 @@ deque<_Tp, _Allocator>::pop_back()
2611 _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");2721 _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
2612 allocator_type& __a = __base::__alloc();2722 allocator_type& __a = __base::__alloc();
2613 size_type __p = __base::size() + __base::__start_ - 1;2723 size_type __p = __base::size() + __base::__start_ - 1;
2614 __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +2724 __alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
2615 __p / __base::__block_size) +2725 __p / __base::__block_size) +
2616 __p % __base::__block_size));2726 __p % __base::__block_size));
2617 --__base::size();2727 --__base::size();
2618 if (__back_spare() >= 2 * __base::__block_size)2728 __maybe_remove_back_spare();
2619 {
2620 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2621 __base::__map_.pop_back();
2622 }
2623}2729}
26242730
2625// move assign [__f, __l) to [__r, __r + (__l-__f)).2731// move assign [__f, __l) to [__r, __r + (__l-__f)).
...@@ -2768,23 +2874,14 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)...@@ -2768,23 +2874,14 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
2768 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));2874 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
2769 --__base::size();2875 --__base::size();
2770 ++__base::__start_;2876 ++__base::__start_;
2771 if (__front_spare() >= 2 * __base::__block_size)2877 __maybe_remove_front_spare();
2772 {
2773 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2774 __base::__map_.pop_front();
2775 __base::__start_ -= __base::__block_size;
2776 }
2777 }2878 }
2778 else2879 else
2779 { // erase from back2880 { // erase from back
2780 iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p);2881 iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p);
2781 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));2882 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
2782 --__base::size();2883 --__base::size();
2783 if (__back_spare() >= 2 * __base::__block_size)2884 __maybe_remove_back_spare();
2784 {
2785 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2786 __base::__map_.pop_back();
2787 }
2788 }2885 }
2789 return __base::begin() + __pos;2886 return __base::begin() + __pos;
2790}2887}
...@@ -2807,11 +2904,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)...@@ -2807,11 +2904,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
2807 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));2904 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
2808 __base::size() -= __n;2905 __base::size() -= __n;
2809 __base::__start_ += __n;2906 __base::__start_ += __n;
2810 while (__front_spare() >= 2 * __base::__block_size)2907 while (__maybe_remove_front_spare()) {
2811 {
2812 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2813 __base::__map_.pop_front();
2814 __base::__start_ -= __base::__block_size;
2815 }2908 }
2816 }2909 }
2817 else2910 else
...@@ -2820,10 +2913,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)...@@ -2820,10 +2913,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
2820 for (iterator __e = __base::end(); __i != __e; ++__i)2913 for (iterator __e = __base::end(); __i != __e; ++__i)
2821 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));2914 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
2822 __base::size() -= __n;2915 __base::size() -= __n;
2823 while (__back_spare() >= 2 * __base::__block_size)2916 while (__maybe_remove_back_spare()) {
2824 {
2825 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2826 __base::__map_.pop_back();
2827 }2917 }
2828 }2918 }
2829 }2919 }
...@@ -2844,10 +2934,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)...@@ -2844,10 +2934,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
2844 for (iterator __p = __b + __pos; __p != __e; ++__p)2934 for (iterator __p = __b + __pos; __p != __e; ++__p)
2845 __alloc_traits::destroy(__a, _VSTD::addressof(*__p));2935 __alloc_traits::destroy(__a, _VSTD::addressof(*__p));
2846 __base::size() -= __n;2936 __base::size() -= __n;
2847 while (__back_spare() >= 2 * __base::__block_size)2937 while (__maybe_remove_back_spare()) {
2848 {
2849 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2850 __base::__map_.pop_back();
2851 }2938 }
2852 }2939 }
2853}2940}
lib/libcxx/include/execution created+19
...@@ -0,0 +1,19 @@
1// -*- C++ -*-
2//===------------------------- execution ---------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_EXECUTION
11#define _LIBCPP_EXECUTION
12
13#include <__config>
14
15#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
16# include <__pstl_execution>
17#endif
18
19#endif // _LIBCPP_EXECUTION
lib/libcxx/include/experimental/coroutine-1
...@@ -51,7 +51,6 @@ template <class P> struct hash<coroutine_handle<P>>;...@@ -51,7 +51,6 @@ template <class P> struct hash<coroutine_handle<P>>;
51#include <functional>51#include <functional>
52#include <memory> // for hash<T*>52#include <memory> // for hash<T*>
53#include <cstddef>53#include <cstddef>
54#include <cassert>
55#include <__debug>54#include <__debug>
5655
57#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)56#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/experimental/functional+39-39
...@@ -112,7 +112,7 @@ template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>...@@ -112,7 +112,7 @@ template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
112class _LIBCPP_TYPE_VIS default_searcher {112class _LIBCPP_TYPE_VIS default_searcher {
113public:113public:
114 _LIBCPP_INLINE_VISIBILITY114 _LIBCPP_INLINE_VISIBILITY
115 default_searcher(_ForwardIterator __f, _ForwardIterator __l, 115 default_searcher(_ForwardIterator __f, _ForwardIterator __l,
116 _BinaryPredicate __p = _BinaryPredicate())116 _BinaryPredicate __p = _BinaryPredicate())
117 : __first_(__f), __last_(__l), __pred_(__p) {}117 : __first_(__f), __last_(__l), __pred_(__p) {}
118118
...@@ -151,12 +151,12 @@ public: // TODO private:...@@ -151,12 +151,12 @@ public: // TODO private:
151151
152 const _Value __default_value_;152 const _Value __default_value_;
153 std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;153 std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
154 154
155public:155public:
156 _LIBCPP_INLINE_VISIBILITY156 _LIBCPP_INLINE_VISIBILITY
157 _BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)157 _BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
158 : __default_value_(__default), __table(__sz, __hf, __pred) {}158 : __default_value_(__default), __table(__sz, __hf, __pred) {}
159 159
160 _LIBCPP_INLINE_VISIBILITY160 _LIBCPP_INLINE_VISIBILITY
161 void insert(const key_type &__key, value_type __val)161 void insert(const key_type &__key, value_type __val)
162 {162 {
...@@ -170,7 +170,7 @@ public:...@@ -170,7 +170,7 @@ public:
170 return __it == __table.end() ? __default_value_ : __it->second;170 return __it == __table.end() ? __default_value_ : __it->second;
171 }171 }
172};172};
173 173
174174
175// Special case small numeric values; use an array175// Special case small numeric values; use an array
176template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>176template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
...@@ -189,7 +189,7 @@ public:...@@ -189,7 +189,7 @@ public:
189 {189 {
190 std::fill_n(__table.begin(), __table.size(), __default);190 std::fill_n(__table.begin(), __table.size(), __default);
191 }191 }
192 192
193 _LIBCPP_INLINE_VISIBILITY193 _LIBCPP_INLINE_VISIBILITY
194 void insert(key_type __key, value_type __val)194 void insert(key_type __key, value_type __val)
195 {195 {
...@@ -204,8 +204,8 @@ public:...@@ -204,8 +204,8 @@ public:
204};204};
205205
206206
207template <class _RandomAccessIterator1, 207template <class _RandomAccessIterator1,
208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
209 class _BinaryPredicate = equal_to<>>209 class _BinaryPredicate = equal_to<>>
210class _LIBCPP_TYPE_VIS boyer_moore_searcher {210class _LIBCPP_TYPE_VIS boyer_moore_searcher {
211private:211private:
...@@ -217,9 +217,9 @@ private:...@@ -217,9 +217,9 @@ private:
217 is_same<_Hash, hash<value_type>>::value &&217 is_same<_Hash, hash<value_type>>::value &&
218 is_same<_BinaryPredicate, equal_to<>>::value218 is_same<_BinaryPredicate, equal_to<>>::value
219 > skip_table_type;219 > skip_table_type;
220 220
221public:221public:
222 boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, 222 boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
223 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())223 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
224 : __first_(__f), __last_(__l), __pred_(__pred),224 : __first_(__f), __last_(__l), __pred_(__pred),
225 __pattern_length_(_VSTD::distance(__first_, __last_)),225 __pattern_length_(_VSTD::distance(__first_, __last_)),
...@@ -232,13 +232,13 @@ public:...@@ -232,13 +232,13 @@ public:
232232
233 this->__build_suffix_table ( __first_, __last_, __pred_ );233 this->__build_suffix_table ( __first_, __last_, __pred_ );
234 }234 }
235 235
236 template <typename _RandomAccessIterator2>236 template <typename _RandomAccessIterator2>
237 pair<_RandomAccessIterator2, _RandomAccessIterator2>237 pair<_RandomAccessIterator2, _RandomAccessIterator2>
238 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const238 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
239 {239 {
240 static_assert ( std::is_same<240 static_assert ( std::is_same<
241 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, 241 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
242 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type242 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
243 >::value,243 >::value,
244 "Corpus and Pattern iterators must point to the same type" );244 "Corpus and Pattern iterators must point to the same type" );
...@@ -247,13 +247,13 @@ public:...@@ -247,13 +247,13 @@ public:
247 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern247 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
248248
249 // If the pattern is larger than the corpus, we can't find it!249 // If the pattern is larger than the corpus, we can't find it!
250 if ( __pattern_length_ > _VSTD::distance (__f, __l)) 250 if ( __pattern_length_ > _VSTD::distance (__f, __l))
251 return make_pair(__l, __l);251 return make_pair(__l, __l);
252252
253 // Do the search 253 // Do the search
254 return this->__search(__f, __l);254 return this->__search(__f, __l);
255 }255 }
256 256
257public: // TODO private:257public: // TODO private:
258 _RandomAccessIterator1 __first_;258 _RandomAccessIterator1 __first_;
259 _RandomAccessIterator1 __last_;259 _RandomAccessIterator1 __last_;
...@@ -270,7 +270,7 @@ public: // TODO private:...@@ -270,7 +270,7 @@ public: // TODO private:
270 const _RandomAccessIterator2 __last = __l - __pattern_length_;270 const _RandomAccessIterator2 __last = __l - __pattern_length_;
271 const skip_table_type & __skip = *__skip_.get();271 const skip_table_type & __skip = *__skip_.get();
272 const vector<difference_type> & __suffix = *__suffix_.get();272 const vector<difference_type> & __suffix = *__suffix_.get();
273 273
274 while (__cur <= __last)274 while (__cur <= __last)
275 {275 {
276276
...@@ -282,7 +282,7 @@ public: // TODO private:...@@ -282,7 +282,7 @@ public: // TODO private:
282 if ( __j == 0 )282 if ( __j == 0 )
283 return make_pair(__cur, __cur + __pattern_length_);283 return make_pair(__cur, __cur + __pattern_length_);
284 }284 }
285 285
286 // Since we didn't match, figure out how far to skip forward286 // Since we didn't match, figure out how far to skip forward
287 difference_type __k = __skip[__cur [ __j - 1 ]];287 difference_type __k = __skip[__cur [ __j - 1 ]];
288 difference_type __m = __j - __k - 1;288 difference_type __m = __j - __k - 1;
...@@ -291,7 +291,7 @@ public: // TODO private:...@@ -291,7 +291,7 @@ public: // TODO private:
291 else291 else
292 __cur += __suffix[ __j ];292 __cur += __suffix[ __j ];
293 }293 }
294 294
295 return make_pair(__l, __l); // We didn't find anything295 return make_pair(__l, __l); // We didn't find anything
296 }296 }
297297
...@@ -300,21 +300,21 @@ public: // TODO private:...@@ -300,21 +300,21 @@ public: // TODO private:
300 void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )300 void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
301 {301 {
302 const std::size_t __count = _VSTD::distance(__f, __l);302 const std::size_t __count = _VSTD::distance(__f, __l);
303 303
304 __prefix[0] = 0;304 __prefix[0] = 0;
305 std::size_t __k = 0;305 std::size_t __k = 0;
306 for ( std::size_t __i = 1; __i < __count; ++__i )306 for ( std::size_t __i = 1; __i < __count; ++__i )
307 {307 {
308 while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))308 while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
309 __k = __prefix [ __k - 1 ];309 __k = __prefix [ __k - 1 ];
310 310
311 if ( __pred ( __f[__k], __f[__i] ))311 if ( __pred ( __f[__k], __f[__i] ))
312 __k++;312 __k++;
313 __prefix [ __i ] = __k;313 __prefix [ __i ] = __k;
314 }314 }
315 }315 }
316316
317 void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, 317 void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
318 _BinaryPredicate __pred)318 _BinaryPredicate __pred)
319 {319 {
320 const std::size_t __count = _VSTD::distance(__f, __l);320 const std::size_t __count = _VSTD::distance(__f, __l);
...@@ -322,19 +322,19 @@ public: // TODO private:...@@ -322,19 +322,19 @@ public: // TODO private:
322 if (__count > 0)322 if (__count > 0)
323 {323 {
324 _VSTD::vector<value_type> __scratch(__count);324 _VSTD::vector<value_type> __scratch(__count);
325 325
326 __compute_bm_prefix(__f, __l, __pred, __scratch);326 __compute_bm_prefix(__f, __l, __pred, __scratch);
327 for ( std::size_t __i = 0; __i <= __count; __i++ )327 for ( std::size_t __i = 0; __i <= __count; __i++ )
328 __suffix[__i] = __count - __scratch[__count-1];328 __suffix[__i] = __count - __scratch[__count-1];
329 329
330 typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;330 typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
331 __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);331 __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
332 332
333 for ( std::size_t __i = 0; __i < __count; __i++ )333 for ( std::size_t __i = 0; __i < __count; __i++ )
334 {334 {
335 const std::size_t __j = __count - __scratch[__i];335 const std::size_t __j = __count - __scratch[__i];
336 const difference_type __k = __i - __scratch[__i] + 1;336 const difference_type __k = __i - __scratch[__i] + 1;
337 337
338 if (__suffix[__j] > __k)338 if (__suffix[__j] > __k)
339 __suffix[__j] = __k;339 __suffix[__j] = __k;
340 }340 }
...@@ -343,20 +343,20 @@ public: // TODO private:...@@ -343,20 +343,20 @@ public: // TODO private:
343343
344};344};
345345
346template<class _RandomAccessIterator, 346template<class _RandomAccessIterator,
347 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, 347 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
348 class _BinaryPredicate = equal_to<>>348 class _BinaryPredicate = equal_to<>>
349_LIBCPP_INLINE_VISIBILITY349_LIBCPP_INLINE_VISIBILITY
350boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>350boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
351make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, 351make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
352 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())352 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
353{353{
354 return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);354 return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
355}355}
356356
357// boyer-moore-horspool357// boyer-moore-horspool
358template <class _RandomAccessIterator1, 358template <class _RandomAccessIterator1,
359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
360 class _BinaryPredicate = equal_to<>>360 class _BinaryPredicate = equal_to<>>
361class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {361class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {
362private:362private:
...@@ -370,7 +370,7 @@ private:...@@ -370,7 +370,7 @@ private:
370 > skip_table_type;370 > skip_table_type;
371371
372public:372public:
373 boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, 373 boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
374 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())374 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
375 : __first_(__f), __last_(__l), __pred_(__pred),375 : __first_(__f), __last_(__l), __pred_(__pred),
376 __pattern_length_(_VSTD::distance(__first_, __last_)),376 __pattern_length_(_VSTD::distance(__first_, __last_)),
...@@ -384,13 +384,13 @@ public:...@@ -384,13 +384,13 @@ public:
384 __skip_->insert(*__f, __pattern_length_ - 1 - __i);384 __skip_->insert(*__f, __pattern_length_ - 1 - __i);
385 }385 }
386 }386 }
387 387
388 template <typename _RandomAccessIterator2>388 template <typename _RandomAccessIterator2>
389 pair<_RandomAccessIterator2, _RandomAccessIterator2>389 pair<_RandomAccessIterator2, _RandomAccessIterator2>
390 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const390 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
391 {391 {
392 static_assert ( std::is_same<392 static_assert ( std::is_same<
393 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type, 393 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
394 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type394 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
395 >::value,395 >::value,
396 "Corpus and Pattern iterators must point to the same type" );396 "Corpus and Pattern iterators must point to the same type" );
...@@ -399,13 +399,13 @@ public:...@@ -399,13 +399,13 @@ public:
399 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern399 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
400400
401 // If the pattern is larger than the corpus, we can't find it!401 // If the pattern is larger than the corpus, we can't find it!
402 if ( __pattern_length_ > _VSTD::distance (__f, __l)) 402 if ( __pattern_length_ > _VSTD::distance (__f, __l))
403 return make_pair(__l, __l);403 return make_pair(__l, __l);
404404
405 // Do the search 405 // Do the search
406 return this->__search(__f, __l);406 return this->__search(__f, __l);
407 }407 }
408 408
409private:409private:
410 _RandomAccessIterator1 __first_;410 _RandomAccessIterator1 __first_;
411 _RandomAccessIterator1 __last_;411 _RandomAccessIterator1 __last_;
...@@ -433,17 +433,17 @@ private:...@@ -433,17 +433,17 @@ private:
433 }433 }
434 __cur += __skip[__cur[__pattern_length_-1]];434 __cur += __skip[__cur[__pattern_length_-1]];
435 }435 }
436 436
437 return make_pair(__l, __l);437 return make_pair(__l, __l);
438 }438 }
439};439};
440440
441template<class _RandomAccessIterator, 441template<class _RandomAccessIterator,
442 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, 442 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
443 class _BinaryPredicate = equal_to<>>443 class _BinaryPredicate = equal_to<>>
444_LIBCPP_INLINE_VISIBILITY444_LIBCPP_INLINE_VISIBILITY
445boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>445boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
446make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, 446make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
447 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())447 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
448{448{
449 return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);449 return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
lib/libcxx/include/experimental/iterator+6-6
...@@ -26,19 +26,19 @@ namespace std {...@@ -26,19 +26,19 @@ namespace std {
26 typedef void difference_type;26 typedef void difference_type;
27 typedef void pointer;27 typedef void pointer;
28 typedef void reference;28 typedef void reference;
29 29
30 ostream_joiner(ostream_type& s, const DelimT& delimiter);30 ostream_joiner(ostream_type& s, const DelimT& delimiter);
31 ostream_joiner(ostream_type& s, DelimT&& delimiter);31 ostream_joiner(ostream_type& s, DelimT&& delimiter);
3232
33 template<typename T> 33 template<typename T>
34 ostream_joiner& operator=(const T& value);34 ostream_joiner& operator=(const T& value);
3535
36 ostream_joiner& operator*() noexcept;36 ostream_joiner& operator*() noexcept;
37 ostream_joiner& operator++() noexcept;37 ostream_joiner& operator++() noexcept;
38 ostream_joiner& operator++(int) noexcept;38 ostream_joiner& operator++(int) noexcept;
39 private:39 private:
40 ostream_type* out_stream; // exposition only 40 ostream_type* out_stream; // exposition only
41 DelimT delim; // exposition only 41 DelimT delim; // exposition only
42 bool first_element; // exposition only42 bool first_element; // exposition only
43 };43 };
4444
...@@ -75,10 +75,10 @@ public:...@@ -75,10 +75,10 @@ public:
7575
76 ostream_joiner(ostream_type& __os, _Delim&& __d)76 ostream_joiner(ostream_type& __os, _Delim&& __d)
77 : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}77 : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
78 78
79 ostream_joiner(ostream_type& __os, const _Delim& __d)79 ostream_joiner(ostream_type& __os, const _Delim& __d)
80 : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {}80 : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
81 81
8282
83 template<typename _Tp>83 template<typename _Tp>
84 ostream_joiner& operator=(const _Tp& __v)84 ostream_joiner& operator=(const _Tp& __v)
lib/libcxx/include/experimental/propagate_const-1
...@@ -575,4 +575,3 @@ _LIBCPP_END_NAMESPACE_STD...@@ -575,4 +575,3 @@ _LIBCPP_END_NAMESPACE_STD
575575
576#endif // _LIBCPP_STD_VER > 11576#endif // _LIBCPP_STD_VER > 11
577#endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST577#endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
578
lib/libcxx/include/experimental/type_traits+3-3
...@@ -60,7 +60,7 @@ inline namespace fundamentals_v1 {...@@ -60,7 +60,7 @@ inline namespace fundamentals_v1 {
60 using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;60 using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
61 template <class To, template<class...> class Op, class... Args>61 template <class To, template<class...> class Op, class... Args>
62 constexpr bool is_detected_convertible_v62 constexpr bool is_detected_convertible_v
63 = is_detected_convertible<To, Op, Args...>::value; 63 = is_detected_convertible<To, Op, Args...>::value;
6464
65} // namespace fundamentals_v165} // namespace fundamentals_v1
66} // namespace experimental66} // namespace experimental
...@@ -122,7 +122,7 @@ struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {...@@ -122,7 +122,7 @@ struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
122 using value_t = true_type;122 using value_t = true_type;
123 using type = _Op<_Args...>;123 using type = _Op<_Args...>;
124 };124 };
125 125
126126
127template <template<class...> class _Op, class... _Args>127template <template<class...> class _Op, class... _Args>
128 using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;128 using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
...@@ -144,7 +144,7 @@ template <class Expected, template<class...> class _Op, class... _Args>...@@ -144,7 +144,7 @@ template <class Expected, template<class...> class _Op, class... _Args>
144template <class To, template<class...> class _Op, class... _Args>144template <class To, template<class...> class _Op, class... _Args>
145 using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>;145 using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>;
146template <class To, template<class...> class _Op, class... _Args>146template <class To, template<class...> class _Op, class... _Args>
147 _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value; 147 _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value;
148148
149149
150_LIBCPP_END_NAMESPACE_LFTS150_LIBCPP_END_NAMESPACE_LFTS
lib/libcxx/include/ext/hash_map+15-13
...@@ -39,14 +39,17 @@ public:...@@ -39,14 +39,17 @@ public:
39 typedef /unspecified/ iterator;39 typedef /unspecified/ iterator;
40 typedef /unspecified/ const_iterator;40 typedef /unspecified/ const_iterator;
4141
42 explicit hash_map(size_type n = 193, const hasher& hf = hasher(),42 hash_map();
43 explicit hash_map(size_type n, const hasher& hf = hasher(),
43 const key_equal& eql = key_equal(),44 const key_equal& eql = key_equal(),
44 const allocator_type& a = allocator_type());45 const allocator_type& a = allocator_type());
45 template <class InputIterator>46 template <class InputIterator>
46 hash_map(InputIterator f, InputIterator l,47 hash_map(InputIterator f, InputIterator l);
47 size_type n = 193, const hasher& hf = hasher(),48 template <class InputIterator>
48 const key_equal& eql = key_equal(),49 hash_map(InputIterator f, InputIterator l,
49 const allocator_type& a = allocator_type());50 size_type n, const hasher& hf = hasher(),
51 const key_equal& eql = key_equal(),
52 const allocator_type& a = allocator_type());
50 hash_map(const hash_map&);53 hash_map(const hash_map&);
51 ~hash_map();54 ~hash_map();
52 hash_map& operator=(const hash_map&);55 hash_map& operator=(const hash_map&);
...@@ -315,12 +318,13 @@ private:...@@ -315,12 +318,13 @@ private:
315318
316 allocator_type& __na_;319 allocator_type& __na_;
317320
318 __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
319
320public:321public:
321 bool __first_constructed;322 bool __first_constructed;
322 bool __second_constructed;323 bool __second_constructed;
323324
325 __hash_map_node_destructor(__hash_map_node_destructor const&) = default;
326 __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
327
324 _LIBCPP_INLINE_VISIBILITY328 _LIBCPP_INLINE_VISIBILITY
325 explicit __hash_map_node_destructor(allocator_type& __na)329 explicit __hash_map_node_destructor(allocator_type& __na)
326 : __na_(__na),330 : __na_(__na),
...@@ -391,10 +395,10 @@ public:...@@ -391,10 +395,10 @@ public:
391 return __t;395 return __t;
392 }396 }
393397
394 friend _LIBCPP_INLINE_VISIBILITY 398 friend _LIBCPP_INLINE_VISIBILITY
395 bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)399 bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
396 {return __x.__i_ == __y.__i_;}400 {return __x.__i_ == __y.__i_;}
397 friend _LIBCPP_INLINE_VISIBILITY 401 friend _LIBCPP_INLINE_VISIBILITY
398 bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)402 bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
399 {return __x.__i_ != __y.__i_;}403 {return __x.__i_ != __y.__i_;}
400404
...@@ -502,7 +506,7 @@ public:...@@ -502,7 +506,7 @@ public:
502 typedef __hash_map_iterator<typename __table::iterator> iterator;506 typedef __hash_map_iterator<typename __table::iterator> iterator;
503 typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;507 typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
504508
505 _LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}509 _LIBCPP_INLINE_VISIBILITY hash_map() { }
506 explicit hash_map(size_type __n, const hasher& __hf = hasher(),510 explicit hash_map(size_type __n, const hasher& __hf = hasher(),
507 const key_equal& __eql = key_equal());511 const key_equal& __eql = key_equal());
508 hash_map(size_type __n, const hasher& __hf,512 hash_map(size_type __n, const hasher& __hf,
...@@ -623,7 +627,6 @@ template <class _InputIterator>...@@ -623,7 +627,6 @@ template <class _InputIterator>
623hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(627hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
624 _InputIterator __first, _InputIterator __last)628 _InputIterator __first, _InputIterator __last)
625{629{
626 __table_.rehash(193);
627 insert(__first, __last);630 insert(__first, __last);
628}631}
629632
...@@ -775,7 +778,7 @@ public:...@@ -775,7 +778,7 @@ public:
775 typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;778 typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
776779
777 _LIBCPP_INLINE_VISIBILITY780 _LIBCPP_INLINE_VISIBILITY
778 hash_multimap() {__table_.rehash(193);}781 hash_multimap() { }
779 explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),782 explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
780 const key_equal& __eql = key_equal());783 const key_equal& __eql = key_equal());
781 hash_multimap(size_type __n, const hasher& __hf,784 hash_multimap(size_type __n, const hasher& __hf,
...@@ -890,7 +893,6 @@ template <class _InputIterator>...@@ -890,7 +893,6 @@ template <class _InputIterator>
890hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(893hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
891 _InputIterator __first, _InputIterator __last)894 _InputIterator __first, _InputIterator __last)
892{895{
893 __table_.rehash(193);
894 insert(__first, __last);896 insert(__first, __last);
895}897}
896898
lib/libcxx/include/ext/hash_set+2-4
...@@ -237,7 +237,7 @@ public:...@@ -237,7 +237,7 @@ public:
237 typedef typename __table::const_iterator const_iterator;237 typedef typename __table::const_iterator const_iterator;
238238
239 _LIBCPP_INLINE_VISIBILITY239 _LIBCPP_INLINE_VISIBILITY
240 hash_set() {__table_.rehash(193);}240 hash_set() { }
241 explicit hash_set(size_type __n, const hasher& __hf = hasher(),241 explicit hash_set(size_type __n, const hasher& __hf = hasher(),
242 const key_equal& __eql = key_equal());242 const key_equal& __eql = key_equal());
243 hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,243 hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
...@@ -347,7 +347,6 @@ template <class _InputIterator>...@@ -347,7 +347,6 @@ template <class _InputIterator>
347hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(347hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
348 _InputIterator __first, _InputIterator __last)348 _InputIterator __first, _InputIterator __last)
349{349{
350 __table_.rehash(193);
351 insert(__first, __last);350 insert(__first, __last);
352}351}
353352
...@@ -459,7 +458,7 @@ public:...@@ -459,7 +458,7 @@ public:
459 typedef typename __table::const_iterator const_iterator;458 typedef typename __table::const_iterator const_iterator;
460459
461 _LIBCPP_INLINE_VISIBILITY460 _LIBCPP_INLINE_VISIBILITY
462 hash_multiset() {__table_.rehash(193);}461 hash_multiset() { }
463 explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),462 explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
464 const key_equal& __eql = key_equal());463 const key_equal& __eql = key_equal());
465 hash_multiset(size_type __n, const hasher& __hf,464 hash_multiset(size_type __n, const hasher& __hf,
...@@ -569,7 +568,6 @@ template <class _InputIterator>...@@ -569,7 +568,6 @@ template <class _InputIterator>
569hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(568hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
570 _InputIterator __first, _InputIterator __last)569 _InputIterator __first, _InputIterator __last)
571{570{
572 __table_.rehash(193);
573 insert(__first, __last);571 insert(__first, __last);
574}572}
575573
lib/libcxx/include/filesystem+4-3
...@@ -625,7 +625,7 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>...@@ -625,7 +625,7 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
625 static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }625 static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
626};626};
627627
628template <class _Iter, bool _IsIt = __is_input_iterator<_Iter>::value,628template <class _Iter, bool _IsIt = __is_cpp17_input_iterator<_Iter>::value,
629 class = void>629 class = void>
630struct __is_pathable_iter : false_type {};630struct __is_pathable_iter : false_type {};
631631
...@@ -708,14 +708,14 @@ template <>...@@ -708,14 +708,14 @@ template <>
708struct _PathCVT<char> {708struct _PathCVT<char> {
709709
710 template <class _Iter>710 template <class _Iter>
711 static typename enable_if<__is_exactly_input_iterator<_Iter>::value>::type711 static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type
712 __append_range(string& __dest, _Iter __b, _Iter __e) {712 __append_range(string& __dest, _Iter __b, _Iter __e) {
713 for (; __b != __e; ++__b)713 for (; __b != __e; ++__b)
714 __dest.push_back(*__b);714 __dest.push_back(*__b);
715 }715 }
716716
717 template <class _Iter>717 template <class _Iter>
718 static typename enable_if<__is_forward_iterator<_Iter>::value>::type718 static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type
719 __append_range(string& __dest, _Iter __b, _Iter __e) {719 __append_range(string& __dest, _Iter __b, _Iter __e) {
720 __dest.__append_forward_unsafe(__b, __e);720 __dest.__append_forward_unsafe(__b, __e);
721 }721 }
...@@ -2583,6 +2583,7 @@ public:...@@ -2583,6 +2583,7 @@ public:
2583 void disable_recursion_pending() { __rec_ = false; }2583 void disable_recursion_pending() { __rec_ = false; }
25842584
2585private:2585private:
2586 _LIBCPP_FUNC_VIS
2586 recursive_directory_iterator(const path& __p, directory_options __opt,2587 recursive_directory_iterator(const path& __p, directory_options __opt,
2587 error_code* __ec);2588 error_code* __ec);
25882589
lib/libcxx/include/forward_list+12-12
...@@ -490,7 +490,7 @@ protected:...@@ -490,7 +490,7 @@ protected:
490 _LIBCPP_INLINE_VISIBILITY490 _LIBCPP_INLINE_VISIBILITY
491 __forward_list_base()491 __forward_list_base()
492 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)492 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
493 : __before_begin_(__begin_node()) {}493 : __before_begin_(__begin_node(), __default_init_tag()) {}
494 _LIBCPP_INLINE_VISIBILITY494 _LIBCPP_INLINE_VISIBILITY
495 explicit __forward_list_base(const allocator_type& __a)495 explicit __forward_list_base(const allocator_type& __a)
496 : __before_begin_(__begin_node(), __node_allocator(__a)) {}496 : __before_begin_(__begin_node(), __node_allocator(__a)) {}
...@@ -670,13 +670,13 @@ public:...@@ -670,13 +670,13 @@ public:
670 template <class _InputIterator>670 template <class _InputIterator>
671 forward_list(_InputIterator __f, _InputIterator __l,671 forward_list(_InputIterator __f, _InputIterator __l,
672 typename enable_if<672 typename enable_if<
673 __is_input_iterator<_InputIterator>::value673 __is_cpp17_input_iterator<_InputIterator>::value
674 >::type* = nullptr);674 >::type* = nullptr);
675 template <class _InputIterator>675 template <class _InputIterator>
676 forward_list(_InputIterator __f, _InputIterator __l,676 forward_list(_InputIterator __f, _InputIterator __l,
677 const allocator_type& __a,677 const allocator_type& __a,
678 typename enable_if<678 typename enable_if<
679 __is_input_iterator<_InputIterator>::value679 __is_cpp17_input_iterator<_InputIterator>::value
680 >::type* = nullptr);680 >::type* = nullptr);
681 forward_list(const forward_list& __x);681 forward_list(const forward_list& __x);
682 forward_list(const forward_list& __x, const allocator_type& __a);682 forward_list(const forward_list& __x, const allocator_type& __a);
...@@ -711,7 +711,7 @@ public:...@@ -711,7 +711,7 @@ public:
711 template <class _InputIterator>711 template <class _InputIterator>
712 typename enable_if712 typename enable_if
713 <713 <
714 __is_input_iterator<_InputIterator>::value,714 __is_cpp17_input_iterator<_InputIterator>::value,
715 void715 void
716 >::type716 >::type
717 assign(_InputIterator __f, _InputIterator __l);717 assign(_InputIterator __f, _InputIterator __l);
...@@ -792,7 +792,7 @@ public:...@@ -792,7 +792,7 @@ public:
792 _LIBCPP_INLINE_VISIBILITY792 _LIBCPP_INLINE_VISIBILITY
793 typename enable_if793 typename enable_if
794 <794 <
795 __is_input_iterator<_InputIterator>::value,795 __is_cpp17_input_iterator<_InputIterator>::value,
796 iterator796 iterator
797 >::type797 >::type
798 insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);798 insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
...@@ -950,7 +950,7 @@ template <class _Tp, class _Alloc>...@@ -950,7 +950,7 @@ template <class _Tp, class _Alloc>
950template <class _InputIterator>950template <class _InputIterator>
951forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,951forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
952 typename enable_if<952 typename enable_if<
953 __is_input_iterator<_InputIterator>::value953 __is_cpp17_input_iterator<_InputIterator>::value
954 >::type*)954 >::type*)
955{955{
956 insert_after(cbefore_begin(), __f, __l);956 insert_after(cbefore_begin(), __f, __l);
...@@ -961,7 +961,7 @@ template <class _InputIterator>...@@ -961,7 +961,7 @@ template <class _InputIterator>
961forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,961forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
962 const allocator_type& __a,962 const allocator_type& __a,
963 typename enable_if<963 typename enable_if<
964 __is_input_iterator<_InputIterator>::value964 __is_cpp17_input_iterator<_InputIterator>::value
965 >::type*)965 >::type*)
966 : base(__a)966 : base(__a)
967{967{
...@@ -1074,7 +1074,7 @@ template <class _Tp, class _Alloc>...@@ -1074,7 +1074,7 @@ template <class _Tp, class _Alloc>
1074template <class _InputIterator>1074template <class _InputIterator>
1075typename enable_if1075typename enable_if
1076<1076<
1077 __is_input_iterator<_InputIterator>::value,1077 __is_cpp17_input_iterator<_InputIterator>::value,
1078 void1078 void
1079>::type1079>::type
1080forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)1080forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
...@@ -1270,7 +1270,7 @@ template <class _Tp, class _Alloc>...@@ -1270,7 +1270,7 @@ template <class _Tp, class _Alloc>
1270template <class _InputIterator>1270template <class _InputIterator>
1271typename enable_if1271typename enable_if
1272<1272<
1273 __is_input_iterator<_InputIterator>::value,1273 __is_cpp17_input_iterator<_InputIterator>::value,
1274 typename forward_list<_Tp, _Alloc>::iterator1274 typename forward_list<_Tp, _Alloc>::iterator
1275>::type1275>::type
1276forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,1276forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
...@@ -1525,7 +1525,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)...@@ -1525,7 +1525,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
1525 else1525 else
1526 ++__i;1526 ++__i;
1527 }1527 }
1528 1528
1529 return (__remove_return_type) __count_removed;1529 return (__remove_return_type) __count_removed;
1530}1530}
15311531
...@@ -1553,7 +1553,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)...@@ -1553,7 +1553,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
1553 else1553 else
1554 ++__i;1554 ++__i;
1555 }1555 }
1556 1556
1557 return (__remove_return_type) __count_removed;1557 return (__remove_return_type) __count_removed;
1558}1558}
15591559
...@@ -1573,7 +1573,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)...@@ -1573,7 +1573,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
1573 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);1573 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
1574 __i = __j;1574 __i = __j;
1575 }1575 }
1576 1576
1577 return (__remove_return_type) __count_removed;1577 return (__remove_return_type) __count_removed;
1578}1578}
15791579
lib/libcxx/include/fstream+14-15
...@@ -508,34 +508,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(...@@ -508,34 +508,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
508 switch (__mode & ~ios_base::ate) {508 switch (__mode & ~ios_base::ate) {
509 case ios_base::out:509 case ios_base::out:
510 case ios_base::out | ios_base::trunc:510 case ios_base::out | ios_base::trunc:
511 return "w";511 return "w" _LIBCPP_FOPEN_CLOEXEC_MODE;
512 case ios_base::out | ios_base::app:512 case ios_base::out | ios_base::app:
513 case ios_base::app:513 case ios_base::app:
514 return "a";514 return "a" _LIBCPP_FOPEN_CLOEXEC_MODE;
515 case ios_base::in:515 case ios_base::in:
516 return "r";516 return "r" _LIBCPP_FOPEN_CLOEXEC_MODE;
517 case ios_base::in | ios_base::out:517 case ios_base::in | ios_base::out:
518 return "r+";518 return "r+" _LIBCPP_FOPEN_CLOEXEC_MODE;
519 case ios_base::in | ios_base::out | ios_base::trunc:519 case ios_base::in | ios_base::out | ios_base::trunc:
520 return "w+";520 return "w+" _LIBCPP_FOPEN_CLOEXEC_MODE;
521 case ios_base::in | ios_base::out | ios_base::app:521 case ios_base::in | ios_base::out | ios_base::app:
522 case ios_base::in | ios_base::app:522 case ios_base::in | ios_base::app:
523 return "a+";523 return "a+" _LIBCPP_FOPEN_CLOEXEC_MODE;
524 case ios_base::out | ios_base::binary:524 case ios_base::out | ios_base::binary:
525 case ios_base::out | ios_base::trunc | ios_base::binary:525 case ios_base::out | ios_base::trunc | ios_base::binary:
526 return "wb";526 return "wb" _LIBCPP_FOPEN_CLOEXEC_MODE;
527 case ios_base::out | ios_base::app | ios_base::binary:527 case ios_base::out | ios_base::app | ios_base::binary:
528 case ios_base::app | ios_base::binary:528 case ios_base::app | ios_base::binary:
529 return "ab";529 return "ab" _LIBCPP_FOPEN_CLOEXEC_MODE;
530 case ios_base::in | ios_base::binary:530 case ios_base::in | ios_base::binary:
531 return "rb";531 return "rb" _LIBCPP_FOPEN_CLOEXEC_MODE;
532 case ios_base::in | ios_base::out | ios_base::binary:532 case ios_base::in | ios_base::out | ios_base::binary:
533 return "r+b";533 return "r+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
534 case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:534 case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
535 return "w+b";535 return "w+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
536 case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:536 case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
537 case ios_base::in | ios_base::app | ios_base::binary:537 case ios_base::in | ios_base::app | ios_base::binary:
538 return "a+b";538 return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
539 default:539 default:
540 return nullptr;540 return nullptr;
541 }541 }
...@@ -697,10 +697,9 @@ basic_filebuf<_CharT, _Traits>::close()...@@ -697,10 +697,9 @@ basic_filebuf<_CharT, _Traits>::close()
697 unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);697 unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
698 if (sync())698 if (sync())
699 __rt = 0;699 __rt = 0;
700 if (fclose(__h.release()) == 0)700 if (fclose(__h.release()))
701 __file_ = 0;
702 else
703 __rt = 0;701 __rt = 0;
702 __file_ = 0;
704 setbuf(0, 0);703 setbuf(0, 0);
705 }704 }
706 return __rt;705 return __rt;
lib/libcxx/include/functional+54
...@@ -440,6 +440,13 @@ public:...@@ -440,6 +440,13 @@ public:
440 template <typename T> const T* target() const noexcept;440 template <typename T> const T* target() const noexcept;
441};441};
442442
443// Deduction guides
444template<class R, class ...Args>
445function(R(*)(Args...)) -> function<R(Args...)>; // since C++17
446
447template<class F>
448function(F) -> function<see-below>; // since C++17
449
443// Null pointer comparisons:450// Null pointer comparisons:
444template <class R, class ... ArgTypes>451template <class R, class ... ArgTypes>
445 bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;452 bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
...@@ -2335,6 +2342,53 @@ public:...@@ -2335,6 +2342,53 @@ public:
2335#endif // _LIBCPP_NO_RTTI2342#endif // _LIBCPP_NO_RTTI
2336};2343};
23372344
2345#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2346template<class _Rp, class ..._Ap>
2347function(_Rp(*)(_Ap...)) -> function<_Rp(_Ap...)>;
2348
2349template<class _Fp>
2350struct __strip_signature;
2351
2352template<class _Rp, class _Gp, class ..._Ap>
2353struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); };
2354template<class _Rp, class _Gp, class ..._Ap>
2355struct __strip_signature<_Rp (_Gp::*) (_Ap...) const> { using type = _Rp(_Ap...); };
2356template<class _Rp, class _Gp, class ..._Ap>
2357struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile> { using type = _Rp(_Ap...); };
2358template<class _Rp, class _Gp, class ..._Ap>
2359struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile> { using type = _Rp(_Ap...); };
2360
2361template<class _Rp, class _Gp, class ..._Ap>
2362struct __strip_signature<_Rp (_Gp::*) (_Ap...) &> { using type = _Rp(_Ap...); };
2363template<class _Rp, class _Gp, class ..._Ap>
2364struct __strip_signature<_Rp (_Gp::*) (_Ap...) const &> { using type = _Rp(_Ap...); };
2365template<class _Rp, class _Gp, class ..._Ap>
2366struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile &> { using type = _Rp(_Ap...); };
2367template<class _Rp, class _Gp, class ..._Ap>
2368struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile &> { using type = _Rp(_Ap...); };
2369
2370template<class _Rp, class _Gp, class ..._Ap>
2371struct __strip_signature<_Rp (_Gp::*) (_Ap...) noexcept> { using type = _Rp(_Ap...); };
2372template<class _Rp, class _Gp, class ..._Ap>
2373struct __strip_signature<_Rp (_Gp::*) (_Ap...) const noexcept> { using type = _Rp(_Ap...); };
2374template<class _Rp, class _Gp, class ..._Ap>
2375struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile noexcept> { using type = _Rp(_Ap...); };
2376template<class _Rp, class _Gp, class ..._Ap>
2377struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile noexcept> { using type = _Rp(_Ap...); };
2378
2379template<class _Rp, class _Gp, class ..._Ap>
2380struct __strip_signature<_Rp (_Gp::*) (_Ap...) & noexcept> { using type = _Rp(_Ap...); };
2381template<class _Rp, class _Gp, class ..._Ap>
2382struct __strip_signature<_Rp (_Gp::*) (_Ap...) const & noexcept> { using type = _Rp(_Ap...); };
2383template<class _Rp, class _Gp, class ..._Ap>
2384struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile & noexcept> { using type = _Rp(_Ap...); };
2385template<class _Rp, class _Gp, class ..._Ap>
2386struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type = _Rp(_Ap...); };
2387
2388template<class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
2389function(_Fp) -> function<_Stripped>;
2390#endif // !_LIBCPP_HAS_NO_DEDUCTION_GUIDES
2391
2338template<class _Rp, class ..._ArgTypes>2392template<class _Rp, class ..._ArgTypes>
2339function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {}2393function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {}
23402394
lib/libcxx/include/future+8-8
...@@ -611,7 +611,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c...@@ -611,7 +611,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c
611}611}
612612
613template <class _Rp>613template <class _Rp>
614class _LIBCPP_AVAILABILITY_FUTURE __assoc_state614class _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_HIDDEN __assoc_state
615 : public __assoc_sub_state615 : public __assoc_sub_state
616{616{
617 typedef __assoc_sub_state base;617 typedef __assoc_sub_state base;
...@@ -1060,7 +1060,7 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;...@@ -1060,7 +1060,7 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;
1060template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;1060template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
10611061
1062template <class _Rp, class _Fp>1062template <class _Rp, class _Fp>
1063future<_Rp>1063_LIBCPP_INLINE_VISIBILITY future<_Rp>
1064#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES1064#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1065__make_deferred_assoc_state(_Fp&& __f);1065__make_deferred_assoc_state(_Fp&& __f);
1066#else1066#else
...@@ -1068,7 +1068,7 @@ __make_deferred_assoc_state(_Fp __f);...@@ -1068,7 +1068,7 @@ __make_deferred_assoc_state(_Fp __f);
1068#endif1068#endif
10691069
1070template <class _Rp, class _Fp>1070template <class _Rp, class _Fp>
1071future<_Rp>1071_LIBCPP_INLINE_VISIBILITY future<_Rp>
1072#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES1072#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1073__make_async_assoc_state(_Fp&& __f);1073__make_async_assoc_state(_Fp&& __f);
1074#else1074#else
...@@ -1767,9 +1767,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgType...@@ -1767,9 +1767,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgType
1767 __compressed_pair<_Fp, _Alloc> __f_;1767 __compressed_pair<_Fp, _Alloc> __f_;
1768public:1768public:
1769 _LIBCPP_INLINE_VISIBILITY1769 _LIBCPP_INLINE_VISIBILITY
1770 explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {}1770 explicit __packaged_task_func(const _Fp& __f) : __f_(__f, __default_init_tag()) {}
1771 _LIBCPP_INLINE_VISIBILITY1771 _LIBCPP_INLINE_VISIBILITY
1772 explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {}1772 explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
1773 _LIBCPP_INLINE_VISIBILITY1773 _LIBCPP_INLINE_VISIBILITY
1774 __packaged_task_func(const _Fp& __f, const _Alloc& __a)1774 __packaged_task_func(const _Fp& __f, const _Alloc& __a)
1775 : __f_(__f, __a) {}1775 : __f_(__f, __a) {}
...@@ -2266,7 +2266,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>...@@ -2266,7 +2266,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
2266 : public true_type {};2266 : public true_type {};
22672267
2268template <class _Rp, class _Fp>2268template <class _Rp, class _Fp>
2269future<_Rp>2269_LIBCPP_INLINE_VISIBILITY future<_Rp>
2270#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES2270#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2271__make_deferred_assoc_state(_Fp&& __f)2271__make_deferred_assoc_state(_Fp&& __f)
2272#else2272#else
...@@ -2279,7 +2279,7 @@ __make_deferred_assoc_state(_Fp __f)...@@ -2279,7 +2279,7 @@ __make_deferred_assoc_state(_Fp __f)
2279}2279}
22802280
2281template <class _Rp, class _Fp>2281template <class _Rp, class _Fp>
2282future<_Rp>2282_LIBCPP_INLINE_VISIBILITY future<_Rp>
2283#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES2283#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2284__make_async_assoc_state(_Fp&& __f)2284__make_async_assoc_state(_Fp&& __f)
2285#else2285#else
...@@ -2293,7 +2293,7 @@ __make_async_assoc_state(_Fp __f)...@@ -2293,7 +2293,7 @@ __make_async_assoc_state(_Fp __f)
2293}2293}
22942294
2295template <class _Fp, class... _Args>2295template <class _Fp, class... _Args>
2296class __async_func2296class _LIBCPP_HIDDEN __async_func
2297{2297{
2298 tuple<_Fp, _Args...> __f_;2298 tuple<_Fp, _Args...> __f_;
22992299
lib/libcxx/include/istream+1-1
...@@ -1619,7 +1619,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)...@@ -1619,7 +1619,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1619 __is.rdbuf()->sbumpc();1619 __is.rdbuf()->sbumpc();
1620 }1620 }
1621 __x = bitset<_Size>(__str);1621 __x = bitset<_Size>(__str);
1622 if (__c == 0)1622 if (_Size > 0 && __c == 0)
1623 __state |= ios_base::failbit;1623 __state |= ios_base::failbit;
1624#ifndef _LIBCPP_NO_EXCEPTIONS1624#ifndef _LIBCPP_NO_EXCEPTIONS
1625 }1625 }
lib/libcxx/include/iterator+83-15
...@@ -434,12 +434,65 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;...@@ -434,12 +434,65 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
434#endif434#endif
435435
436_LIBCPP_BEGIN_NAMESPACE_STD436_LIBCPP_BEGIN_NAMESPACE_STD
437template <class _Iter>
438struct _LIBCPP_TEMPLATE_VIS iterator_traits;
437439
438struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};440struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};
439struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};441struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};
440struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};442struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
441struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};443struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
442struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};444struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
445#if _LIBCPP_STD_VER > 17
446// TODO(EricWF) contiguous_iterator_tag is provided as an extension prior to
447// C++20 to allow optimizations for users providing wrapped iterator types.
448struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag: public random_access_iterator_tag { };
449#endif
450
451template <class _Iter>
452struct __iter_traits_cache {
453 using type = _If<
454 __is_primary_template<iterator_traits<_Iter> >::value,
455 _Iter,
456 iterator_traits<_Iter>
457 >;
458};
459template <class _Iter>
460using _ITER_TRAITS = typename __iter_traits_cache<_Iter>::type;
461
462struct __iter_concept_concept_test {
463 template <class _Iter>
464 using _Apply = typename _ITER_TRAITS<_Iter>::iterator_concept;
465};
466struct __iter_concept_category_test {
467 template <class _Iter>
468 using _Apply = typename _ITER_TRAITS<_Iter>::iterator_category;
469};
470struct __iter_concept_random_fallback {
471 template <class _Iter>
472 using _Apply = _EnableIf<
473 __is_primary_template<iterator_traits<_Iter> >::value,
474 random_access_iterator_tag
475 >;
476};
477
478template <class _Iter, class _Tester> struct __test_iter_concept
479 : _IsValidExpansion<_Tester::template _Apply, _Iter>,
480 _Tester
481{
482};
483
484template <class _Iter>
485struct __iter_concept_cache {
486 using type = _Or<
487 __test_iter_concept<_Iter, __iter_concept_concept_test>,
488 __test_iter_concept<_Iter, __iter_concept_category_test>,
489 __test_iter_concept<_Iter, __iter_concept_random_fallback>
490 >;
491};
492
493template <class _Iter>
494using _ITER_CONCEPT = typename __iter_concept_cache<_Iter>::type::template _Apply<_Iter>;
495
443496
444template <class _Tp>497template <class _Tp>
445struct __has_iterator_typedefs498struct __has_iterator_typedefs
...@@ -500,7 +553,10 @@ struct __iterator_traits<_Iter, true>...@@ -500,7 +553,10 @@ struct __iterator_traits<_Iter, true>
500553
501template <class _Iter>554template <class _Iter>
502struct _LIBCPP_TEMPLATE_VIS iterator_traits555struct _LIBCPP_TEMPLATE_VIS iterator_traits
503 : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {};556 : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {
557
558 using __primary_template = iterator_traits;
559};
504560
505template<class _Tp>561template<class _Tp>
506struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>562struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
...@@ -510,6 +566,9 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>...@@ -510,6 +566,9 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
510 typedef _Tp* pointer;566 typedef _Tp* pointer;
511 typedef _Tp& reference;567 typedef _Tp& reference;
512 typedef random_access_iterator_tag iterator_category;568 typedef random_access_iterator_tag iterator_category;
569#if _LIBCPP_STD_VER > 17
570 typedef contiguous_iterator_tag iterator_concept;
571#endif
513};572};
514573
515template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>574template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
...@@ -521,19 +580,28 @@ template <class _Tp, class _Up>...@@ -521,19 +580,28 @@ template <class _Tp, class _Up>
521struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {};580struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {};
522581
523template <class _Tp>582template <class _Tp>
524struct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {};583struct __is_cpp17_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {};
525584
526template <class _Tp>585template <class _Tp>
527struct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {};586struct __is_cpp17_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {};
528587
529template <class _Tp>588template <class _Tp>
530struct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {};589struct __is_cpp17_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {};
531590
532template <class _Tp>591template <class _Tp>
533struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {};592struct __is_cpp17_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {};
593
594#if _LIBCPP_STD_VER > 17
595template <class _Tp>
596struct __is_cpp17_contiguous_iterator : public __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag> {};
597#else
598template <class _Tp>
599struct __is_cpp17_contiguous_iterator : public false_type {};
600#endif
601
534602
535template <class _Tp>603template <class _Tp>
536struct __is_exactly_input_iterator604struct __is_exactly_cpp17_input_iterator
537 : public integral_constant<bool,605 : public integral_constant<bool,
538 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&606 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
539 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};607 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
...@@ -600,7 +668,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14...@@ -600,7 +668,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
600void advance(_InputIter& __i,668void advance(_InputIter& __i,
601 typename iterator_traits<_InputIter>::difference_type __n)669 typename iterator_traits<_InputIter>::difference_type __n)
602{670{
603 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,671 _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
604 "Attempt to advance(it, -n) on a non-bidi iterator");672 "Attempt to advance(it, -n) on a non-bidi iterator");
605 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());673 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
606}674}
...@@ -636,13 +704,13 @@ template <class _InputIter>...@@ -636,13 +704,13 @@ template <class _InputIter>
636inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14704inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
637typename enable_if705typename enable_if
638<706<
639 __is_input_iterator<_InputIter>::value,707 __is_cpp17_input_iterator<_InputIter>::value,
640 _InputIter708 _InputIter
641>::type709>::type
642next(_InputIter __x,710next(_InputIter __x,
643 typename iterator_traits<_InputIter>::difference_type __n = 1)711 typename iterator_traits<_InputIter>::difference_type __n = 1)
644{712{
645 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,713 _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
646 "Attempt to next(it, -n) on a non-bidi iterator");714 "Attempt to next(it, -n) on a non-bidi iterator");
647715
648 _VSTD::advance(__x, __n);716 _VSTD::advance(__x, __n);
...@@ -653,13 +721,13 @@ template <class _InputIter>...@@ -653,13 +721,13 @@ template <class _InputIter>
653inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14721inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
654typename enable_if722typename enable_if
655<723<
656 __is_input_iterator<_InputIter>::value,724 __is_cpp17_input_iterator<_InputIter>::value,
657 _InputIter725 _InputIter
658>::type726>::type
659prev(_InputIter __x,727prev(_InputIter __x,
660 typename iterator_traits<_InputIter>::difference_type __n = 1)728 typename iterator_traits<_InputIter>::difference_type __n = 1)
661{729{
662 _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value,730 _LIBCPP_ASSERT(__n <= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
663 "Attempt to prev(it, +n) on a non-bidi iterator");731 "Attempt to prev(it, +n) on a non-bidi iterator");
664 _VSTD::advance(__x, -__n);732 _VSTD::advance(__x, -__n);
665 return __x;733 return __x;
...@@ -1304,8 +1372,8 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG...@@ -1304,8 +1372,8 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1304__wrap_iter<_Iter>1372__wrap_iter<_Iter>
1305operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;1373operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
13061374
1307template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);1375template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op);
1308template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);1376template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2);
1309template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);1377template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
1310template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);1378template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
13111379
...@@ -1515,8 +1583,8 @@ private:...@@ -1515,8 +1583,8 @@ private:
1515 __wrap_iter<_Iter1>1583 __wrap_iter<_Iter1>
1516 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;1584 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
15171585
1518 template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);1586 template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op);
1519 template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);1587 template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 copy_backward(_B1, _B1, _B2);
1520 template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);1588 template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
1521 template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);1589 template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
15221590
lib/libcxx/include/list+10-10
...@@ -715,7 +715,7 @@ template <class _Tp, class _Alloc>...@@ -715,7 +715,7 @@ template <class _Tp, class _Alloc>
715inline715inline
716__list_imp<_Tp, _Alloc>::__list_imp()716__list_imp<_Tp, _Alloc>::__list_imp()
717 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)717 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
718 : __size_alloc_(0)718 : __size_alloc_(0, __default_init_tag())
719{719{
720}720}
721721
...@@ -887,10 +887,10 @@ public:...@@ -887,10 +887,10 @@ public:
887 list(size_type __n, const value_type& __x, const allocator_type& __a);887 list(size_type __n, const value_type& __x, const allocator_type& __a);
888 template <class _InpIter>888 template <class _InpIter>
889 list(_InpIter __f, _InpIter __l,889 list(_InpIter __f, _InpIter __l,
890 typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);890 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
891 template <class _InpIter>891 template <class _InpIter>
892 list(_InpIter __f, _InpIter __l, const allocator_type& __a,892 list(_InpIter __f, _InpIter __l, const allocator_type& __a,
893 typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);893 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
894894
895 list(const list& __c);895 list(const list& __c);
896 list(const list& __c, const allocator_type& __a);896 list(const list& __c, const allocator_type& __a);
...@@ -922,7 +922,7 @@ public:...@@ -922,7 +922,7 @@ public:
922922
923 template <class _InpIter>923 template <class _InpIter>
924 void assign(_InpIter __f, _InpIter __l,924 void assign(_InpIter __f, _InpIter __l,
925 typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);925 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
926 void assign(size_type __n, const value_type& __x);926 void assign(size_type __n, const value_type& __x);
927927
928 _LIBCPP_INLINE_VISIBILITY928 _LIBCPP_INLINE_VISIBILITY
...@@ -1039,7 +1039,7 @@ public:...@@ -1039,7 +1039,7 @@ public:
1039 iterator insert(const_iterator __p, size_type __n, const value_type& __x);1039 iterator insert(const_iterator __p, size_type __n, const value_type& __x);
1040 template <class _InpIter>1040 template <class _InpIter>
1041 iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,1041 iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
1042 typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);1042 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0);
10431043
1044 _LIBCPP_INLINE_VISIBILITY1044 _LIBCPP_INLINE_VISIBILITY
1045 void swap(list& __c)1045 void swap(list& __c)
...@@ -1252,7 +1252,7 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_ty...@@ -1252,7 +1252,7 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_ty
1252template <class _Tp, class _Alloc>1252template <class _Tp, class _Alloc>
1253template <class _InpIter>1253template <class _InpIter>
1254list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,1254list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
1255 typename enable_if<__is_input_iterator<_InpIter>::value>::type*)1255 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
1256{1256{
1257#if _LIBCPP_DEBUG_LEVEL >= 21257#if _LIBCPP_DEBUG_LEVEL >= 2
1258 __get_db()->__insert_c(this);1258 __get_db()->__insert_c(this);
...@@ -1264,7 +1264,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,...@@ -1264,7 +1264,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
1264template <class _Tp, class _Alloc>1264template <class _Tp, class _Alloc>
1265template <class _InpIter>1265template <class _InpIter>
1266list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,1266list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
1267 typename enable_if<__is_input_iterator<_InpIter>::value>::type*)1267 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
1268 : base(__a)1268 : base(__a)
1269{1269{
1270#if _LIBCPP_DEBUG_LEVEL >= 21270#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1403,7 +1403,7 @@ template <class _Tp, class _Alloc>...@@ -1403,7 +1403,7 @@ template <class _Tp, class _Alloc>
1403template <class _InpIter>1403template <class _InpIter>
1404void1404void
1405list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,1405list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
1406 typename enable_if<__is_input_iterator<_InpIter>::value>::type*)1406 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
1407{1407{
1408 iterator __i = begin();1408 iterator __i = begin();
1409 iterator __e = end();1409 iterator __e = end();
...@@ -1532,7 +1532,7 @@ template <class _Tp, class _Alloc>...@@ -1532,7 +1532,7 @@ template <class _Tp, class _Alloc>
1532template <class _InpIter>1532template <class _InpIter>
1533typename list<_Tp, _Alloc>::iterator1533typename list<_Tp, _Alloc>::iterator
1534list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,1534list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
1535 typename enable_if<__is_input_iterator<_InpIter>::value>::type*)1535 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
1536{1536{
1537#if _LIBCPP_DEBUG_LEVEL >= 21537#if _LIBCPP_DEBUG_LEVEL >= 2
1538 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,1538 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
...@@ -2211,7 +2211,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)...@@ -2211,7 +2211,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
2211 __i = __j;2211 __i = __j;
2212 }2212 }
2213 }2213 }
2214 2214
2215 return (__remove_return_type) __deleted_nodes.size();2215 return (__remove_return_type) __deleted_nodes.size();
2216}2216}
22172217
lib/libcxx/include/map+12-12
...@@ -1474,26 +1474,26 @@ private:...@@ -1474,26 +1474,26 @@ private:
1474#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES1474#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1475template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,1475template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
1476 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,1476 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1477 class = enable_if_t<!__is_allocator<_Compare>::value, void>,1477 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
1478 class = enable_if_t<__is_allocator<_Allocator>::value, void>>1478 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1479map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())1479map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1480 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;1480 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
14811481
1482template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,1482template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
1483 class _Allocator = allocator<pair<const _Key, _Tp>>,1483 class _Allocator = allocator<pair<const _Key, _Tp>>,
1484 class = enable_if_t<!__is_allocator<_Compare>::value, void>,1484 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
1485 class = enable_if_t<__is_allocator<_Allocator>::value, void>>1485 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1486map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())1486map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
1487 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;1487 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
14881488
1489template<class _InputIterator, class _Allocator,1489template<class _InputIterator, class _Allocator,
1490 class = enable_if_t<__is_allocator<_Allocator>::value, void>>1490 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1491map(_InputIterator, _InputIterator, _Allocator)1491map(_InputIterator, _InputIterator, _Allocator)
1492 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,1492 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1493 less<__iter_key_type<_InputIterator>>, _Allocator>;1493 less<__iter_key_type<_InputIterator>>, _Allocator>;
14941494
1495template<class _Key, class _Tp, class _Allocator,1495template<class _Key, class _Tp, class _Allocator,
1496 class = enable_if_t<__is_allocator<_Allocator>::value, void>>1496 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1497map(initializer_list<pair<_Key, _Tp>>, _Allocator)1497map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1498 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;1498 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
1499#endif1499#endif
...@@ -2131,26 +2131,26 @@ private:...@@ -2131,26 +2131,26 @@ private:
2131#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES2131#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2132template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,2132template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
2133 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,2133 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2134 class = enable_if_t<!__is_allocator<_Compare>::value, void>,2134 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
2135 class = enable_if_t<__is_allocator<_Allocator>::value, void>>2135 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
2136multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())2136multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
2137 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;2137 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
21382138
2139template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,2139template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
2140 class _Allocator = allocator<pair<const _Key, _Tp>>,2140 class _Allocator = allocator<pair<const _Key, _Tp>>,
2141 class = enable_if_t<!__is_allocator<_Compare>::value, void>,2141 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
2142 class = enable_if_t<__is_allocator<_Allocator>::value, void>>2142 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
2143multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())2143multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
2144 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;2144 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
21452145
2146template<class _InputIterator, class _Allocator,2146template<class _InputIterator, class _Allocator,
2147 class = enable_if_t<__is_allocator<_Allocator>::value, void>>2147 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
2148multimap(_InputIterator, _InputIterator, _Allocator)2148multimap(_InputIterator, _InputIterator, _Allocator)
2149 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,2149 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2150 less<__iter_key_type<_InputIterator>>, _Allocator>;2150 less<__iter_key_type<_InputIterator>>, _Allocator>;
21512151
2152template<class _Key, class _Tp, class _Allocator,2152template<class _Key, class _Tp, class _Allocator,
2153 class = enable_if_t<__is_allocator<_Allocator>::value, void>>2153 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
2154multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)2154multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2155 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;2155 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
2156#endif2156#endif
lib/libcxx/include/math.h+4
...@@ -510,7 +510,11 @@ _LIBCPP_INLINE_VISIBILITY...@@ -510,7 +510,11 @@ _LIBCPP_INLINE_VISIBILITY
510bool510bool
511__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT511__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
512{512{
513#if __has_builtin(__builtin_isnan)
514 return __builtin_isnan(__lcpp_x);
515#else
513 return isnan(__lcpp_x);516 return isnan(__lcpp_x);
517#endif
514}518}
515519
516#undef isnan520#undef isnan
lib/libcxx/include/memory+142-384
...@@ -662,7 +662,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);...@@ -662,7 +662,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
662#include <tuple>662#include <tuple>
663#include <stdexcept>663#include <stdexcept>
664#include <cstring>664#include <cstring>
665#include <cassert>
666#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)665#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
667# include <atomic>666# include <atomic>
668#endif667#endif
...@@ -1099,40 +1098,51 @@ struct __const_void_pointer<_Ptr, _Alloc, false>...@@ -1099,40 +1098,51 @@ struct __const_void_pointer<_Ptr, _Alloc, false>
1099#endif1098#endif
1100};1099};
11011100
1101
1102template <bool _UsePointerTraits> struct __to_address_helper;
1103
1104template <> struct __to_address_helper<true> {
1105 template <class _Pointer>
1106 using __return_type = decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()));
1107
1108 template <class _Pointer>
1109 _LIBCPP_CONSTEXPR
1110 static __return_type<_Pointer>
1111 __do_it(const _Pointer &__p) _NOEXCEPT { return pointer_traits<_Pointer>::to_address(__p); }
1112};
1113
1114template <class _Pointer, bool _Dummy = true>
1115using __choose_to_address = __to_address_helper<_IsValidExpansion<__to_address_helper<_Dummy>::template __return_type, _Pointer>::value>;
1116
1117
1102template <class _Tp>1118template <class _Tp>
1103inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR1119inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1104_Tp*1120_Tp*
1105__to_raw_pointer(_Tp* __p) _NOEXCEPT1121__to_address(_Tp* __p) _NOEXCEPT
1106{1122{
1123 static_assert(!is_function<_Tp>::value, "_Tp is a function type");
1107 return __p;1124 return __p;
1108}1125}
11091126
1110#if _LIBCPP_STD_VER <= 17
1111template <class _Pointer>
1112inline _LIBCPP_INLINE_VISIBILITY
1113typename pointer_traits<_Pointer>::element_type*
1114__to_raw_pointer(_Pointer __p) _NOEXCEPT
1115{
1116 return _VSTD::__to_raw_pointer(__p.operator->());
1117}
1118#else
1119template <class _Pointer>1127template <class _Pointer>
1120inline _LIBCPP_INLINE_VISIBILITY1128inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1121auto1129typename __choose_to_address<_Pointer>::template __return_type<_Pointer>
1122__to_raw_pointer(const _Pointer& __p) _NOEXCEPT1130__to_address(const _Pointer& __p) _NOEXCEPT {
1123-> decltype(pointer_traits<_Pointer>::to_address(__p))1131 return __choose_to_address<_Pointer>::__do_it(__p);
1124{
1125 return pointer_traits<_Pointer>::to_address(__p);
1126}1132}
11271133
1128template <class _Pointer, class... _None>1134template <> struct __to_address_helper<false> {
1129inline _LIBCPP_INLINE_VISIBILITY1135 template <class _Pointer>
1130auto1136 using __return_type = typename pointer_traits<_Pointer>::element_type*;
1131__to_raw_pointer(const _Pointer& __p, _None...) _NOEXCEPT
1132{
1133 return _VSTD::__to_raw_pointer(__p.operator->());
1134}
11351137
1138 template <class _Pointer>
1139 _LIBCPP_CONSTEXPR
1140 static __return_type<_Pointer>
1141 __do_it(const _Pointer &__p) _NOEXCEPT { return std::__to_address(__p.operator->()); }
1142};
1143
1144
1145#if _LIBCPP_STD_VER > 17
1136template <class _Tp>1146template <class _Tp>
1137inline _LIBCPP_INLINE_VISIBILITY constexpr1147inline _LIBCPP_INLINE_VISIBILITY constexpr
1138_Tp*1148_Tp*
...@@ -1147,7 +1157,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -1147,7 +1157,7 @@ inline _LIBCPP_INLINE_VISIBILITY
1147auto1157auto
1148to_address(const _Pointer& __p) _NOEXCEPT1158to_address(const _Pointer& __p) _NOEXCEPT
1149{1159{
1150 return _VSTD::__to_raw_pointer(__p);1160 return _VSTD::__to_address(__p);
1151}1161}
1152#endif1162#endif
11531163
...@@ -1507,6 +1517,31 @@ struct __is_default_allocator : false_type {};...@@ -1507,6 +1517,31 @@ struct __is_default_allocator : false_type {};
1507template <class _Tp>1517template <class _Tp>
1508struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};1518struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
15091519
1520
1521
1522template <class _Alloc,
1523 bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
1524 >
1525struct __is_cpp17_move_insertable;
1526template <class _Alloc>
1527struct __is_cpp17_move_insertable<_Alloc, true> : std::true_type {};
1528template <class _Alloc>
1529struct __is_cpp17_move_insertable<_Alloc, false> : std::is_move_constructible<typename _Alloc::value_type> {};
1530
1531template <class _Alloc,
1532 bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
1533 >
1534struct __is_cpp17_copy_insertable;
1535template <class _Alloc>
1536struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
1537template <class _Alloc>
1538struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool,
1539 std::is_copy_constructible<typename _Alloc::value_type>::value &&
1540 __is_cpp17_move_insertable<_Alloc>::value>
1541 {};
1542
1543
1544
1510template <class _Alloc>1545template <class _Alloc>
1511struct _LIBCPP_TEMPLATE_VIS allocator_traits1546struct _LIBCPP_TEMPLATE_VIS allocator_traits
1512{1547{
...@@ -1609,10 +1644,18 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1609,10 +1644,18 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1609 _LIBCPP_INLINE_VISIBILITY1644 _LIBCPP_INLINE_VISIBILITY
1610 static1645 static
1611 void1646 void
1612 __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)1647 __construct_forward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)
1613 {1648 {
1649 static_assert(__is_cpp17_move_insertable<allocator_type>::value,
1650 "The specified type does not meet the requirements of Cpp17MoveInsertible");
1614 for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)1651 for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
1615 construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1));1652 construct(__a, _VSTD::__to_address(__begin2),
1653#ifdef _LIBCPP_NO_EXCEPTIONS
1654 _VSTD::move(*__begin1)
1655#else
1656 _VSTD::move_if_noexcept(*__begin1)
1657#endif
1658 );
1616 }1659 }
16171660
1618 template <class _Tp>1661 template <class _Tp>
...@@ -1625,7 +1668,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1625,7 +1668,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1625 is_trivially_move_constructible<_Tp>::value,1668 is_trivially_move_constructible<_Tp>::value,
1626 void1669 void
1627 >::type1670 >::type
1628 __construct_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)1671 __construct_forward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
1629 {1672 {
1630 ptrdiff_t _Np = __end1 - __begin1;1673 ptrdiff_t _Np = __end1 - __begin1;
1631 if (_Np > 0)1674 if (_Np > 0)
...@@ -1642,7 +1685,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1642,7 +1685,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1642 __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)1685 __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)
1643 {1686 {
1644 for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)1687 for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
1645 construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1);1688 construct(__a, _VSTD::__to_address(__begin2), *__begin1);
1646 }1689 }
16471690
1648 template <class _SourceTp, class _DestTp,1691 template <class _SourceTp, class _DestTp,
...@@ -1672,12 +1715,20 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1672,12 +1715,20 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1672 _LIBCPP_INLINE_VISIBILITY1715 _LIBCPP_INLINE_VISIBILITY
1673 static1716 static
1674 void1717 void
1675 __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2)1718 __construct_backward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2)
1676 {1719 {
1720 static_assert(__is_cpp17_move_insertable<allocator_type>::value,
1721 "The specified type does not meet the requirements of Cpp17MoveInsertable");
1677 while (__end1 != __begin1)1722 while (__end1 != __begin1)
1678 {1723 {
1679 construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));1724 construct(__a, _VSTD::__to_address(__end2 - 1),
1680 --__end2;1725#ifdef _LIBCPP_NO_EXCEPTIONS
1726 _VSTD::move(*--__end1)
1727#else
1728 _VSTD::move_if_noexcept(*--__end1)
1729#endif
1730 );
1731 --__end2;
1681 }1732 }
1682 }1733 }
16831734
...@@ -1691,7 +1742,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1691,7 +1742,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1691 is_trivially_move_constructible<_Tp>::value,1742 is_trivially_move_constructible<_Tp>::value,
1692 void1743 void
1693 >::type1744 >::type
1694 __construct_backward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)1745 __construct_backward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
1695 {1746 {
1696 ptrdiff_t _Np = __end1 - __begin1;1747 ptrdiff_t _Np = __end1 - __begin1;
1697 __end2 -= _Np;1748 __end2 -= _Np;
...@@ -2127,6 +2178,10 @@ public:...@@ -2127,6 +2178,10 @@ public:
2127};2178};
2128#endif2179#endif
21292180
2181// Tag used to default initialize one or both of the pair's elements.
2182struct __default_init_tag {};
2183struct __value_init_tag {};
2184
2130template <class _Tp, int _Idx,2185template <class _Tp, int _Idx,
2131 bool _CanBeEmptyBase =2186 bool _CanBeEmptyBase =
2132 is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>2187 is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>
...@@ -2135,30 +2190,31 @@ struct __compressed_pair_elem {...@@ -2135,30 +2190,31 @@ struct __compressed_pair_elem {
2135 typedef _Tp& reference;2190 typedef _Tp& reference;
2136 typedef const _Tp& const_reference;2191 typedef const _Tp& const_reference;
21372192
2138#ifndef _LIBCPP_CXX03_LANG2193 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2139 _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {}2194 __compressed_pair_elem(__default_init_tag) {}
2195 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2196 __compressed_pair_elem(__value_init_tag) : __value_() {}
21402197
2141 template <class _Up, class = typename enable_if<2198 template <class _Up, class = typename enable_if<
2142 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value2199 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
2143 >::type>2200 >::type>
2144 _LIBCPP_INLINE_VISIBILITY2201 _LIBCPP_INLINE_VISIBILITY
2145 constexpr explicit2202 _LIBCPP_CONSTEXPR explicit
2146 __compressed_pair_elem(_Up&& __u)2203 __compressed_pair_elem(_Up&& __u)
2147 : __value_(_VSTD::forward<_Up>(__u))2204 : __value_(_VSTD::forward<_Up>(__u))
2148 {2205 {
2149 }2206 }
21502207
2208
2209#ifndef _LIBCPP_CXX03_LANG
2151 template <class... _Args, size_t... _Indexes>2210 template <class... _Args, size_t... _Indexes>
2152 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX142211 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
2153 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,2212 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
2154 __tuple_indices<_Indexes...>)2213 __tuple_indices<_Indexes...>)
2155 : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}2214 : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
2156#else
2157 _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_() {}
2158 _LIBCPP_INLINE_VISIBILITY
2159 __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {}
2160#endif2215#endif
21612216
2217
2162 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; }2218 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; }
2163 _LIBCPP_INLINE_VISIBILITY2219 _LIBCPP_INLINE_VISIBILITY
2164 const_reference __get() const _NOEXCEPT { return __value_; }2220 const_reference __get() const _NOEXCEPT { return __value_; }
...@@ -2174,28 +2230,27 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {...@@ -2174,28 +2230,27 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
2174 typedef const _Tp& const_reference;2230 typedef const _Tp& const_reference;
2175 typedef _Tp __value_type;2231 typedef _Tp __value_type;
21762232
2177#ifndef _LIBCPP_CXX03_LANG2233 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair_elem() = default;
2178 _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default;2234 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2235 __compressed_pair_elem(__default_init_tag) {}
2236 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2237 __compressed_pair_elem(__value_init_tag) : __value_type() {}
21792238
2180 template <class _Up, class = typename enable_if<2239 template <class _Up, class = typename enable_if<
2181 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value2240 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
2182 >::type>2241 >::type>
2183 _LIBCPP_INLINE_VISIBILITY2242 _LIBCPP_INLINE_VISIBILITY
2184 constexpr explicit2243 _LIBCPP_CONSTEXPR explicit
2185 __compressed_pair_elem(_Up&& __u)2244 __compressed_pair_elem(_Up&& __u)
2186 : __value_type(_VSTD::forward<_Up>(__u))2245 : __value_type(_VSTD::forward<_Up>(__u))
2187 {}2246 {}
21882247
2248#ifndef _LIBCPP_CXX03_LANG
2189 template <class... _Args, size_t... _Indexes>2249 template <class... _Args, size_t... _Indexes>
2190 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX142250 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
2191 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,2251 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
2192 __tuple_indices<_Indexes...>)2252 __tuple_indices<_Indexes...>)
2193 : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}2253 : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
2194#else
2195 _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_type() {}
2196 _LIBCPP_INLINE_VISIBILITY
2197 __compressed_pair_elem(_ParamT __p)
2198 : __value_type(std::forward<_ParamT>(__p)) {}
2199#endif2254#endif
22002255
2201 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; }2256 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; }
...@@ -2203,9 +2258,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {...@@ -2203,9 +2258,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
2203 const_reference __get() const _NOEXCEPT { return *this; }2258 const_reference __get() const _NOEXCEPT { return *this; }
2204};2259};
22052260
2206// Tag used to construct the second element of the compressed pair.
2207struct __second_tag {};
2208
2209template <class _T1, class _T2>2261template <class _T1, class _T2>
2210class __compressed_pair : private __compressed_pair_elem<_T1, 0>,2262class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
2211 private __compressed_pair_elem<_T2, 1> {2263 private __compressed_pair_elem<_T2, 1> {
...@@ -2222,33 +2274,21 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,...@@ -2222,33 +2274,21 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
2222 "implementation for this configuration");2274 "implementation for this configuration");
22232275
2224public:2276public:
2225#ifndef _LIBCPP_CXX03_LANG2277 template <bool _Dummy = true,
2226 template <bool _Dummy = true,
2227 class = typename enable_if<2278 class = typename enable_if<
2228 __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&2279 __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
2229 __dependent_type<is_default_constructible<_T2>, _Dummy>::value2280 __dependent_type<is_default_constructible<_T2>, _Dummy>::value
2230 >::type2281 >::type
2231 >2282 >
2232 _LIBCPP_INLINE_VISIBILITY2283 _LIBCPP_INLINE_VISIBILITY
2233 constexpr __compressed_pair() {}2284 _LIBCPP_CONSTEXPR __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
2234
2235 template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type,
2236 __compressed_pair>::value,
2237 bool>::type = true>
2238 _LIBCPP_INLINE_VISIBILITY constexpr explicit
2239 __compressed_pair(_Tp&& __t)
2240 : _Base1(std::forward<_Tp>(__t)), _Base2() {}
2241
2242 template <class _Tp>
2243 _LIBCPP_INLINE_VISIBILITY constexpr
2244 __compressed_pair(__second_tag, _Tp&& __t)
2245 : _Base1(), _Base2(std::forward<_Tp>(__t)) {}
22462285
2247 template <class _U1, class _U2>2286 template <class _U1, class _U2>
2248 _LIBCPP_INLINE_VISIBILITY constexpr2287 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2249 __compressed_pair(_U1&& __t1, _U2&& __t2)2288 __compressed_pair(_U1&& __t1, _U2&& __t2)
2250 : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}2289 : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
22512290
2291#ifndef _LIBCPP_CXX03_LANG
2252 template <class... _Args1, class... _Args2>2292 template <class... _Args1, class... _Args2>
2253 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX142293 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
2254 __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,2294 __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
...@@ -2257,21 +2297,6 @@ public:...@@ -2257,21 +2297,6 @@ public:
2257 typename __make_tuple_indices<sizeof...(_Args1)>::type()),2297 typename __make_tuple_indices<sizeof...(_Args1)>::type()),
2258 _Base2(__pc, _VSTD::move(__second_args),2298 _Base2(__pc, _VSTD::move(__second_args),
2259 typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}2299 typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
2260
2261#else
2262 _LIBCPP_INLINE_VISIBILITY
2263 __compressed_pair() {}
2264
2265 _LIBCPP_INLINE_VISIBILITY explicit
2266 __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {}
2267
2268 _LIBCPP_INLINE_VISIBILITY
2269 __compressed_pair(__second_tag, _T2 __t2)
2270 : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {}
2271
2272 _LIBCPP_INLINE_VISIBILITY
2273 __compressed_pair(_T1 __t1, _T2 __t2)
2274 : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {}
2275#endif2300#endif
22762301
2277 _LIBCPP_INLINE_VISIBILITY2302 _LIBCPP_INLINE_VISIBILITY
...@@ -2452,17 +2477,17 @@ public:...@@ -2452,17 +2477,17 @@ public:
2452 template <bool _Dummy = true,2477 template <bool _Dummy = true,
2453 class = _EnableIfDeleterDefaultConstructible<_Dummy> >2478 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2454 _LIBCPP_INLINE_VISIBILITY2479 _LIBCPP_INLINE_VISIBILITY
2455 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}2480 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
24562481
2457 template <bool _Dummy = true,2482 template <bool _Dummy = true,
2458 class = _EnableIfDeleterDefaultConstructible<_Dummy> >2483 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2459 _LIBCPP_INLINE_VISIBILITY2484 _LIBCPP_INLINE_VISIBILITY
2460 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}2485 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
24612486
2462 template <bool _Dummy = true,2487 template <bool _Dummy = true,
2463 class = _EnableIfDeleterDefaultConstructible<_Dummy> >2488 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2464 _LIBCPP_INLINE_VISIBILITY2489 _LIBCPP_INLINE_VISIBILITY
2465 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {}2490 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __default_init_tag()) {}
24662491
2467 template <bool _Dummy = true,2492 template <bool _Dummy = true,
2468 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >2493 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
...@@ -2504,7 +2529,7 @@ public:...@@ -2504,7 +2529,7 @@ public:
2504 typename enable_if<is_convertible<_Up*, _Tp*>::value &&2529 typename enable_if<is_convertible<_Up*, _Tp*>::value &&
2505 is_same<_Dp, default_delete<_Tp> >::value,2530 is_same<_Dp, default_delete<_Tp> >::value,
2506 __nat>::type = __nat()) _NOEXCEPT2531 __nat>::type = __nat()) _NOEXCEPT
2507 : __ptr_(__p.release()) {}2532 : __ptr_(__p.release(), __default_init_tag()) {}
2508#endif2533#endif
25092534
2510 _LIBCPP_INLINE_VISIBILITY2535 _LIBCPP_INLINE_VISIBILITY
...@@ -2675,19 +2700,19 @@ public:...@@ -2675,19 +2700,19 @@ public:
2675 template <bool _Dummy = true,2700 template <bool _Dummy = true,
2676 class = _EnableIfDeleterDefaultConstructible<_Dummy> >2701 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2677 _LIBCPP_INLINE_VISIBILITY2702 _LIBCPP_INLINE_VISIBILITY
2678 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}2703 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
26792704
2680 template <bool _Dummy = true,2705 template <bool _Dummy = true,
2681 class = _EnableIfDeleterDefaultConstructible<_Dummy> >2706 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2682 _LIBCPP_INLINE_VISIBILITY2707 _LIBCPP_INLINE_VISIBILITY
2683 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}2708 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
26842709
2685 template <class _Pp, bool _Dummy = true,2710 template <class _Pp, bool _Dummy = true,
2686 class = _EnableIfDeleterDefaultConstructible<_Dummy>,2711 class = _EnableIfDeleterDefaultConstructible<_Dummy>,
2687 class = _EnableIfPointerConvertible<_Pp> >2712 class = _EnableIfPointerConvertible<_Pp> >
2688 _LIBCPP_INLINE_VISIBILITY2713 _LIBCPP_INLINE_VISIBILITY
2689 explicit unique_ptr(_Pp __p) _NOEXCEPT2714 explicit unique_ptr(_Pp __p) _NOEXCEPT
2690 : __ptr_(__p) {}2715 : __ptr_(__p, __default_init_tag()) {}
26912716
2692 template <class _Pp, bool _Dummy = true,2717 template <class _Pp, bool _Dummy = true,
2693 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,2718 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
...@@ -3531,24 +3556,20 @@ class __shared_ptr_emplace...@@ -3531,24 +3556,20 @@ class __shared_ptr_emplace
3531{3556{
3532 __compressed_pair<_Alloc, _Tp> __data_;3557 __compressed_pair<_Alloc, _Tp> __data_;
3533public:3558public:
3534#ifndef _LIBCPP_HAS_NO_VARIADICS
35353559
3536 _LIBCPP_INLINE_VISIBILITY3560 _LIBCPP_INLINE_VISIBILITY
3537 __shared_ptr_emplace(_Alloc __a)3561 __shared_ptr_emplace(_Alloc __a)
3538 : __data_(_VSTD::move(__a)) {}3562 : __data_(_VSTD::move(__a), __value_init_tag()) {}
3563
35393564
3565#ifndef _LIBCPP_HAS_NO_VARIADICS
3540 template <class ..._Args>3566 template <class ..._Args>
3541 _LIBCPP_INLINE_VISIBILITY3567 _LIBCPP_INLINE_VISIBILITY
3542 __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)3568 __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
3543 : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),3569 : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
3544 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}3570 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}
3545
3546#else // _LIBCPP_HAS_NO_VARIADICS3571#else // _LIBCPP_HAS_NO_VARIADICS
35473572
3548 _LIBCPP_INLINE_VISIBILITY
3549 __shared_ptr_emplace(_Alloc __a)
3550 : __data_(__a) {}
3551
3552 template <class _A0>3573 template <class _A0>
3553 _LIBCPP_INLINE_VISIBILITY3574 _LIBCPP_INLINE_VISIBILITY
3554 __shared_ptr_emplace(_Alloc __a, _A0& __a0)3575 __shared_ptr_emplace(_Alloc __a, _A0& __a0)
...@@ -3831,49 +3852,22 @@ public:...@@ -3831,49 +3852,22 @@ public:
3831 : nullptr);}3852 : nullptr);}
3832#endif // _LIBCPP_NO_RTTI3853#endif // _LIBCPP_NO_RTTI
38333854
3834#ifndef _LIBCPP_HAS_NO_VARIADICS3855 template<class _Yp, class _CntrlBlk>
38353856 static shared_ptr<_Tp>
3836 template<class ..._Args>3857 __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl)
3837 static3858 {
3838 shared_ptr<_Tp>3859 shared_ptr<_Tp> __r;
3839 make_shared(_Args&& ...__args);3860 __r.__ptr_ = __p;
3861 __r.__cntrl_ = __cntrl;
3862 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
3863 return __r;
3864 }
38403865
3841 template<class _Alloc, class ..._Args>3866 template<class _Alloc, class ..._Args>
3842 static3867 static
3843 shared_ptr<_Tp>3868 shared_ptr<_Tp>
3844 allocate_shared(const _Alloc& __a, _Args&& ...__args);3869 allocate_shared(const _Alloc& __a, _Args&& ...__args);
38453870
3846#else // _LIBCPP_HAS_NO_VARIADICS
3847
3848 static shared_ptr<_Tp> make_shared();
3849
3850 template<class _A0>
3851 static shared_ptr<_Tp> make_shared(_A0&);
3852
3853 template<class _A0, class _A1>
3854 static shared_ptr<_Tp> make_shared(_A0&, _A1&);
3855
3856 template<class _A0, class _A1, class _A2>
3857 static shared_ptr<_Tp> make_shared(_A0&, _A1&, _A2&);
3858
3859 template<class _Alloc>
3860 static shared_ptr<_Tp>
3861 allocate_shared(const _Alloc& __a);
3862
3863 template<class _Alloc, class _A0>
3864 static shared_ptr<_Tp>
3865 allocate_shared(const _Alloc& __a, _A0& __a0);
3866
3867 template<class _Alloc, class _A0, class _A1>
3868 static shared_ptr<_Tp>
3869 allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1);
3870
3871 template<class _Alloc, class _A0, class _A1, class _A2>
3872 static shared_ptr<_Tp>
3873 allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2);
3874
3875#endif // _LIBCPP_HAS_NO_VARIADICS
3876
3877private:3871private:
3878 template <class _Yp, bool = is_function<_Yp>::value>3872 template <class _Yp, bool = is_function<_Yp>::value>
3879 struct __shared_ptr_default_allocator3873 struct __shared_ptr_default_allocator
...@@ -4186,27 +4180,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,...@@ -4186,27 +4180,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
4186 __r.release();4180 __r.release();
4187}4181}
41884182
4189#ifndef _LIBCPP_HAS_NO_VARIADICS
4190
4191template<class _Tp>
4192template<class ..._Args>
4193shared_ptr<_Tp>
4194shared_ptr<_Tp>::make_shared(_Args&& ...__args)
4195{
4196 static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared" );
4197 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4198 typedef allocator<_CntrlBlk> _A2;
4199 typedef __allocator_destructor<_A2> _D2;
4200 _A2 __a2;
4201 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
4202 ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
4203 shared_ptr<_Tp> __r;
4204 __r.__ptr_ = __hold2.get()->get();
4205 __r.__cntrl_ = __hold2.release();
4206 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4207 return __r;
4208}
4209
4210template<class _Tp>4183template<class _Tp>
4211template<class _Alloc, class ..._Args>4184template<class _Alloc, class ..._Args>
4212shared_ptr<_Tp>4185shared_ptr<_Tp>
...@@ -4227,165 +4200,6 @@ shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)...@@ -4227,165 +4200,6 @@ shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
4227 return __r;4200 return __r;
4228}4201}
42294202
4230#else // _LIBCPP_HAS_NO_VARIADICS
4231
4232template<class _Tp>
4233shared_ptr<_Tp>
4234shared_ptr<_Tp>::make_shared()
4235{
4236 static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" );
4237 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4238 typedef allocator<_CntrlBlk> _Alloc2;
4239 typedef __allocator_destructor<_Alloc2> _D2;
4240 _Alloc2 __alloc2;
4241 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4242 ::new(__hold2.get()) _CntrlBlk(__alloc2);
4243 shared_ptr<_Tp> __r;
4244 __r.__ptr_ = __hold2.get()->get();
4245 __r.__cntrl_ = __hold2.release();
4246 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4247 return __r;
4248}
4249
4250template<class _Tp>
4251template<class _A0>
4252shared_ptr<_Tp>
4253shared_ptr<_Tp>::make_shared(_A0& __a0)
4254{
4255 static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in make_shared" );
4256 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4257 typedef allocator<_CntrlBlk> _Alloc2;
4258 typedef __allocator_destructor<_Alloc2> _D2;
4259 _Alloc2 __alloc2;
4260 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4261 ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0);
4262 shared_ptr<_Tp> __r;
4263 __r.__ptr_ = __hold2.get()->get();
4264 __r.__cntrl_ = __hold2.release();
4265 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4266 return __r;
4267}
4268
4269template<class _Tp>
4270template<class _A0, class _A1>
4271shared_ptr<_Tp>
4272shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1)
4273{
4274 static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in make_shared" );
4275 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4276 typedef allocator<_CntrlBlk> _Alloc2;
4277 typedef __allocator_destructor<_Alloc2> _D2;
4278 _Alloc2 __alloc2;
4279 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4280 ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1);
4281 shared_ptr<_Tp> __r;
4282 __r.__ptr_ = __hold2.get()->get();
4283 __r.__cntrl_ = __hold2.release();
4284 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4285 return __r;
4286}
4287
4288template<class _Tp>
4289template<class _A0, class _A1, class _A2>
4290shared_ptr<_Tp>
4291shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
4292{
4293 static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
4294 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4295 typedef allocator<_CntrlBlk> _Alloc2;
4296 typedef __allocator_destructor<_Alloc2> _D2;
4297 _Alloc2 __alloc2;
4298 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4299 ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2);
4300 shared_ptr<_Tp> __r;
4301 __r.__ptr_ = __hold2.get()->get();
4302 __r.__cntrl_ = __hold2.release();
4303 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4304 return __r;
4305}
4306
4307template<class _Tp>
4308template<class _Alloc>
4309shared_ptr<_Tp>
4310shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)
4311{
4312 static_assert((is_constructible<_Tp>::value), "Can't construct object in allocate_shared" );
4313 typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
4314 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
4315 typedef __allocator_destructor<_Alloc2> _D2;
4316 _Alloc2 __alloc2(__a);
4317 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4318 ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
4319 _CntrlBlk(__a);
4320 shared_ptr<_Tp> __r;
4321 __r.__ptr_ = __hold2.get()->get();
4322 __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
4323 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4324 return __r;
4325}
4326
4327template<class _Tp>
4328template<class _Alloc, class _A0>
4329shared_ptr<_Tp>
4330shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)
4331{
4332 static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in allocate_shared" );
4333 typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
4334 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
4335 typedef __allocator_destructor<_Alloc2> _D2;
4336 _Alloc2 __alloc2(__a);
4337 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4338 ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
4339 _CntrlBlk(__a, __a0);
4340 shared_ptr<_Tp> __r;
4341 __r.__ptr_ = __hold2.get()->get();
4342 __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
4343 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4344 return __r;
4345}
4346
4347template<class _Tp>
4348template<class _Alloc, class _A0, class _A1>
4349shared_ptr<_Tp>
4350shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
4351{
4352 static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in allocate_shared" );
4353 typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
4354 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
4355 typedef __allocator_destructor<_Alloc2> _D2;
4356 _Alloc2 __alloc2(__a);
4357 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4358 ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
4359 _CntrlBlk(__a, __a0, __a1);
4360 shared_ptr<_Tp> __r;
4361 __r.__ptr_ = __hold2.get()->get();
4362 __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
4363 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4364 return __r;
4365}
4366
4367template<class _Tp>
4368template<class _Alloc, class _A0, class _A1, class _A2>
4369shared_ptr<_Tp>
4370shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
4371{
4372 static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
4373 typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
4374 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
4375 typedef __allocator_destructor<_Alloc2> _D2;
4376 _Alloc2 __alloc2(__a);
4377 unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
4378 ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
4379 _CntrlBlk(__a, __a0, __a1, __a2);
4380 shared_ptr<_Tp> __r;
4381 __r.__ptr_ = __hold2.get()->get();
4382 __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
4383 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
4384 return __r;
4385}
4386
4387#endif // _LIBCPP_HAS_NO_VARIADICS
4388
4389template<class _Tp>4203template<class _Tp>
4390shared_ptr<_Tp>::~shared_ptr()4204shared_ptr<_Tp>::~shared_ptr()
4391{4205{
...@@ -4567,8 +4381,6 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)...@@ -4567,8 +4381,6 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
4567 shared_ptr(__p, __d, __a).swap(*this);4381 shared_ptr(__p, __d, __a).swap(*this);
4568}4382}
45694383
4570#ifndef _LIBCPP_HAS_NO_VARIADICS
4571
4572template<class _Tp, class ..._Args>4384template<class _Tp, class ..._Args>
4573inline _LIBCPP_INLINE_VISIBILITY4385inline _LIBCPP_INLINE_VISIBILITY
4574typename enable_if4386typename enable_if
...@@ -4578,7 +4390,17 @@ typename enable_if...@@ -4578,7 +4390,17 @@ typename enable_if
4578>::type4390>::type
4579make_shared(_Args&& ...__args)4391make_shared(_Args&& ...__args)
4580{4392{
4581 return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);4393 static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared");
4394 typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
4395 typedef allocator<_CntrlBlk> _A2;
4396 typedef __allocator_destructor<_A2> _D2;
4397
4398 _A2 __a2;
4399 unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
4400 ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
4401
4402 _Tp *__ptr = __hold2.get()->get();
4403 return shared_ptr<_Tp>::__create_with_control_block(__ptr, __hold2.release());
4582}4404}
45834405
4584template<class _Tp, class _Alloc, class ..._Args>4406template<class _Tp, class _Alloc, class ..._Args>
...@@ -4593,74 +4415,6 @@ allocate_shared(const _Alloc& __a, _Args&& ...__args)...@@ -4593,74 +4415,6 @@ allocate_shared(const _Alloc& __a, _Args&& ...__args)
4593 return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);4415 return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);
4594}4416}
45954417
4596#else // _LIBCPP_HAS_NO_VARIADICS
4597
4598template<class _Tp>
4599inline _LIBCPP_INLINE_VISIBILITY
4600shared_ptr<_Tp>
4601make_shared()
4602{
4603 return shared_ptr<_Tp>::make_shared();
4604}
4605
4606template<class _Tp, class _A0>
4607inline _LIBCPP_INLINE_VISIBILITY
4608shared_ptr<_Tp>
4609make_shared(_A0& __a0)
4610{
4611 return shared_ptr<_Tp>::make_shared(__a0);
4612}
4613
4614template<class _Tp, class _A0, class _A1>
4615inline _LIBCPP_INLINE_VISIBILITY
4616shared_ptr<_Tp>
4617make_shared(_A0& __a0, _A1& __a1)
4618{
4619 return shared_ptr<_Tp>::make_shared(__a0, __a1);
4620}
4621
4622template<class _Tp, class _A0, class _A1, class _A2>
4623inline _LIBCPP_INLINE_VISIBILITY
4624shared_ptr<_Tp>
4625make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
4626{
4627 return shared_ptr<_Tp>::make_shared(__a0, __a1, __a2);
4628}
4629
4630template<class _Tp, class _Alloc>
4631inline _LIBCPP_INLINE_VISIBILITY
4632shared_ptr<_Tp>
4633allocate_shared(const _Alloc& __a)
4634{
4635 return shared_ptr<_Tp>::allocate_shared(__a);
4636}
4637
4638template<class _Tp, class _Alloc, class _A0>
4639inline _LIBCPP_INLINE_VISIBILITY
4640shared_ptr<_Tp>
4641allocate_shared(const _Alloc& __a, _A0& __a0)
4642{
4643 return shared_ptr<_Tp>::allocate_shared(__a, __a0);
4644}
4645
4646template<class _Tp, class _Alloc, class _A0, class _A1>
4647inline _LIBCPP_INLINE_VISIBILITY
4648shared_ptr<_Tp>
4649allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
4650{
4651 return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1);
4652}
4653
4654template<class _Tp, class _Alloc, class _A0, class _A1, class _A2>
4655inline _LIBCPP_INLINE_VISIBILITY
4656shared_ptr<_Tp>
4657allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
4658{
4659 return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1, __a2);
4660}
4661
4662#endif // _LIBCPP_HAS_NO_VARIADICS
4663
4664template<class _Tp, class _Up>4418template<class _Tp, class _Up>
4665inline _LIBCPP_INLINE_VISIBILITY4419inline _LIBCPP_INLINE_VISIBILITY
4666bool4420bool
...@@ -5590,4 +5344,8 @@ _LIBCPP_END_NAMESPACE_STD...@@ -5590,4 +5344,8 @@ _LIBCPP_END_NAMESPACE_STD
55905344
5591_LIBCPP_POP_MACROS5345_LIBCPP_POP_MACROS
55925346
5347#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
5348# include <__pstl_memory>
5349#endif
5350
5593#endif // _LIBCPP_MEMORY5351#endif // _LIBCPP_MEMORY
lib/libcxx/include/module.modulemap+4
...@@ -275,6 +275,10 @@ module std [system] {...@@ -275,6 +275,10 @@ module std [system] {
275 header "exception"275 header "exception"
276 export *276 export *
277 }277 }
278 module execution {
279 header "execution"
280 export *
281 }
278 module filesystem {282 module filesystem {
279 header "filesystem"283 header "filesystem"
280 export *284 export *
lib/libcxx/include/mutex+4-4
...@@ -86,9 +86,9 @@ public:...@@ -86,9 +86,9 @@ public:
86 void unlock();86 void unlock();
87};87};
8888
89struct defer_lock_t {};89struct defer_lock_t { explicit defer_lock_t() = default; };
90struct try_to_lock_t {};90struct try_to_lock_t { explicit try_to_lock_t() = default; };
91struct adopt_lock_t {};91struct adopt_lock_t { explicit adopt_lock_t() = default; };
9292
93inline constexpr defer_lock_t defer_lock{};93inline constexpr defer_lock_t defer_lock{};
94inline constexpr try_to_lock_t try_to_lock{};94inline constexpr try_to_lock_t try_to_lock{};
...@@ -650,7 +650,7 @@ public:...@@ -650,7 +650,7 @@ public:
650#endif650#endif
651651
652template <class _Fp>652template <class _Fp>
653void653void _LIBCPP_INLINE_VISIBILITY
654__call_once_proxy(void* __vp)654__call_once_proxy(void* __vp)
655{655{
656 __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);656 __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
lib/libcxx/include/new+2-2
...@@ -39,7 +39,7 @@ struct destroying_delete_t { // C++20...@@ -39,7 +39,7 @@ struct destroying_delete_t { // C++20
39};39};
40inline constexpr destroying_delete_t destroying_delete{}; // C++2040inline constexpr destroying_delete_t destroying_delete{}; // C++20
4141
42struct nothrow_t {};42struct nothrow_t { explicit nothrow_t() = default; };
43extern const nothrow_t nothrow;43extern const nothrow_t nothrow;
44typedef void (*new_handler)();44typedef void (*new_handler)();
45new_handler set_new_handler(new_handler new_p) noexcept;45new_handler set_new_handler(new_handler new_p) noexcept;
...@@ -126,7 +126,7 @@ namespace std // purposefully not using versioning namespace...@@ -126,7 +126,7 @@ namespace std // purposefully not using versioning namespace
126{126{
127127
128#if !defined(_LIBCPP_ABI_VCRUNTIME)128#if !defined(_LIBCPP_ABI_VCRUNTIME)
129struct _LIBCPP_TYPE_VIS nothrow_t {};129struct _LIBCPP_TYPE_VIS nothrow_t { explicit nothrow_t() = default; };
130extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;130extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
131131
132class _LIBCPP_EXCEPTION_ABI bad_alloc132class _LIBCPP_EXCEPTION_ABI bad_alloc
lib/libcxx/include/numeric+12-11
...@@ -532,17 +532,14 @@ midpoint(_Tp __a, _Tp __b) noexcept...@@ -532,17 +532,14 @@ midpoint(_Tp __a, _Tp __b) noexcept
532_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK532_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
533{533{
534 using _Up = std::make_unsigned_t<_Tp>;534 using _Up = std::make_unsigned_t<_Tp>;
535 constexpr _Up __bitshift = std::numeric_limits<_Up>::digits - 1;
535536
536 int __sign = 1;537 _Up __diff = _Up(__b) - _Up(__a);
537 _Up __m = __a;538 _Up __sign_bit = __b < __a;
538 _Up __M = __b;539
539 if (__a > __b)540 _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
540 {541
541 __sign = -1;542 return __a + __half_diff;
542 __m = __b;
543 __M = __a;
544 }
545 return __a + __sign * _Tp(_Up(__M-__m) >> 1);
546}543}
547544
548545
...@@ -576,7 +573,7 @@ midpoint(_Fp __a, _Fp __b) noexcept...@@ -576,7 +573,7 @@ midpoint(_Fp __a, _Fp __b) noexcept
576 return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible573 return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible
577 (__a + __b)/2 : // always correctly rounded574 (__a + __b)/2 : // always correctly rounded
578 __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a575 __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
579 __fp_abs(__a) < __lo ? __a/2 + __b : // not safe to halve b576 __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
580 __a/2 + __b/2; // otherwise correctly rounded577 __a/2 + __b/2; // otherwise correctly rounded
581}578}
582579
...@@ -586,4 +583,8 @@ _LIBCPP_END_NAMESPACE_STD...@@ -586,4 +583,8 @@ _LIBCPP_END_NAMESPACE_STD
586583
587_LIBCPP_POP_MACROS584_LIBCPP_POP_MACROS
588585
586#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
587# include <__pstl_numeric>
588#endif
589
589#endif // _LIBCPP_NUMERIC590#endif // _LIBCPP_NUMERIC
lib/libcxx/include/ostream+1-1
...@@ -1055,7 +1055,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,...@@ -1055,7 +1055,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
1055template<class _CharT, class _Traits>1055template<class _CharT, class _Traits>
1056basic_ostream<_CharT, _Traits>&1056basic_ostream<_CharT, _Traits>&
1057operator<<(basic_ostream<_CharT, _Traits>& __os,1057operator<<(basic_ostream<_CharT, _Traits>& __os,
1058 const basic_string_view<_CharT, _Traits> __sv)1058 basic_string_view<_CharT, _Traits> __sv)
1059{1059{
1060 return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());1060 return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
1061}1061}
lib/libcxx/include/queue+1-1
...@@ -562,7 +562,7 @@ priority_queue(_Compare, _Container)...@@ -562,7 +562,7 @@ priority_queue(_Compare, _Container)
562template<class _InputIterator,562template<class _InputIterator,
563 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,563 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
564 class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,564 class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
565 class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,565 class = typename enable_if< __is_cpp17_input_iterator<_InputIterator>::value, nullptr_t>::type,
566 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,566 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
567 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type567 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
568>568>
lib/libcxx/include/random+27-22
...@@ -3645,7 +3645,7 @@ generate_canonical(_URNG& __g)...@@ -3645,7 +3645,7 @@ generate_canonical(_URNG& __g)
3645 const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;3645 const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
3646#endif3646#endif
3647 const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);3647 const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);
3648 const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1);3648 const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1);
3649 _RealType __base = _Rp;3649 _RealType __base = _Rp;
3650 _RealType _Sp = __g() - _URNG::min();3650 _RealType _Sp = __g() - _URNG::min();
3651 for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)3651 for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)
...@@ -4592,7 +4592,10 @@ public:...@@ -4592,7 +4592,10 @@ public:
45924592
4593template<class _IntType>4593template<class _IntType>
4594poisson_distribution<_IntType>::param_type::param_type(double __mean)4594poisson_distribution<_IntType>::param_type::param_type(double __mean)
4595 : __mean_(__mean)4595 // According to the standard `inf` is a valid input, but it causes the
4596 // distribution to hang, so we replace it with the maximum representable
4597 // mean.
4598 : __mean_(isinf(__mean) ? numeric_limits<double>::max() : __mean)
4596{4599{
4597 if (__mean_ < 10)4600 if (__mean_ < 10)
4598 {4601 {
...@@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)...@@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
4610 {4613 {
4611 __s_ = _VSTD::sqrt(__mean_);4614 __s_ = _VSTD::sqrt(__mean_);
4612 __d_ = 6 * __mean_ * __mean_;4615 __d_ = 6 * __mean_ * __mean_;
4613 __l_ = static_cast<result_type>(__mean_ - 1.1484);4616 __l_ = std::trunc(__mean_ - 1.1484);
4614 __omega_ = .3989423 / __s_;4617 __omega_ = .3989423 / __s_;
4615 double __b1_ = .4166667E-1 / __mean_;4618 double __b1_ = .4166667E-1 / __mean_;
4616 double __b2_ = .3 * __b1_ * __b1_;4619 double __b2_ = .3 * __b1_ * __b1_;
...@@ -4627,12 +4630,12 @@ template<class _URNG>...@@ -4627,12 +4630,12 @@ template<class _URNG>
4627_IntType4630_IntType
4628poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)4631poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
4629{4632{
4630 result_type __x;4633 double __tx;
4631 uniform_real_distribution<double> __urd;4634 uniform_real_distribution<double> __urd;
4632 if (__pr.__mean_ < 10)4635 if (__pr.__mean_ < 10)
4633 {4636 {
4634 __x = 0;4637 __tx = 0;
4635 for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)4638 for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
4636 __p *= __urd(__urng);4639 __p *= __urd(__urng);
4637 }4640 }
4638 else4641 else
...@@ -4642,19 +4645,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr...@@ -4642,19 +4645,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
4642 double __u;4645 double __u;
4643 if (__g > 0)4646 if (__g > 0)
4644 {4647 {
4645 __x = static_cast<result_type>(__g);4648 __tx = std::trunc(__g);
4646 if (__x >= __pr.__l_)4649 if (__tx >= __pr.__l_)
4647 return __x;4650 return std::__clamp_to_integral<result_type>(__tx);
4648 __difmuk = __pr.__mean_ - __x;4651 __difmuk = __pr.__mean_ - __tx;
4649 __u = __urd(__urng);4652 __u = __urd(__urng);
4650 if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)4653 if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
4651 return __x;4654 return std::__clamp_to_integral<result_type>(__tx);
4652 }4655 }
4653 exponential_distribution<double> __edist;4656 exponential_distribution<double> __edist;
4654 for (bool __using_exp_dist = false; true; __using_exp_dist = true)4657 for (bool __using_exp_dist = false; true; __using_exp_dist = true)
4655 {4658 {
4656 double __e;4659 double __e;
4657 if (__using_exp_dist || __g < 0)4660 if (__using_exp_dist || __g <= 0)
4658 {4661 {
4659 double __t;4662 double __t;
4660 do4663 do
...@@ -4664,31 +4667,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr...@@ -4664,31 +4667,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
4664 __u += __u - 1;4667 __u += __u - 1;
4665 __t = 1.8 + (__u < 0 ? -__e : __e);4668 __t = 1.8 + (__u < 0 ? -__e : __e);
4666 } while (__t <= -.6744);4669 } while (__t <= -.6744);
4667 __x = __pr.__mean_ + __pr.__s_ * __t;4670 __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
4668 __difmuk = __pr.__mean_ - __x;4671 __difmuk = __pr.__mean_ - __tx;
4669 __using_exp_dist = true;4672 __using_exp_dist = true;
4670 }4673 }
4671 double __px;4674 double __px;
4672 double __py;4675 double __py;
4673 if (__x < 10)4676 if (__tx < 10 && __tx >= 0)
4674 {4677 {
4675 const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,4678 const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
4676 40320, 362880};4679 40320, 362880};
4677 __px = -__pr.__mean_;4680 __px = -__pr.__mean_;
4678 __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x];4681 __py = _VSTD::pow(__pr.__mean_, (double)__tx) / __fac[static_cast<int>(__tx)];
4679 }4682 }
4680 else4683 else
4681 {4684 {
4682 double __del = .8333333E-1 / __x;4685 double __del = .8333333E-1 / __tx;
4683 __del -= 4.8 * __del * __del * __del;4686 __del -= 4.8 * __del * __del * __del;
4684 double __v = __difmuk / __x;4687 double __v = __difmuk / __tx;
4685 if (_VSTD::abs(__v) > 0.25)4688 if (_VSTD::abs(__v) > 0.25)
4686 __px = __x * _VSTD::log(1 + __v) - __difmuk - __del;4689 __px = __tx * _VSTD::log(1 + __v) - __difmuk - __del;
4687 else4690 else
4688 __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) *4691 __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) *
4689 __v + .1421878) * __v + -.1661269) * __v + .2000118) *4692 __v + .1421878) * __v + -.1661269) * __v + .2000118) *
4690 __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;4693 __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
4691 __py = .3989423 / _VSTD::sqrt(__x);4694 __py = .3989423 / _VSTD::sqrt(__tx);
4692 }4695 }
4693 double __r = (0.5 - __difmuk) / __pr.__s_;4696 double __r = (0.5 - __difmuk) / __pr.__s_;
4694 double __r2 = __r * __r;4697 double __r2 = __r * __r;
...@@ -4708,7 +4711,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr...@@ -4708,7 +4711,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
4708 }4711 }
4709 }4712 }
4710 }4713 }
4711 return __x;4714 return std::__clamp_to_integral<result_type>(__tx);
4712}4715}
47134716
4714template <class _CharT, class _Traits, class _IntType>4717template <class _CharT, class _Traits, class _IntType>
...@@ -6102,6 +6105,7 @@ public:...@@ -6102,6 +6105,7 @@ public:
6102 template<class _UnaryOperation>6105 template<class _UnaryOperation>
6103 param_type(size_t __nw, result_type __xmin, result_type __xmax,6106 param_type(size_t __nw, result_type __xmin, result_type __xmax,
6104 _UnaryOperation __fw);6107 _UnaryOperation __fw);
6108 param_type(param_type const&) = default;
6105 param_type & operator=(const param_type& __rhs);6109 param_type & operator=(const param_type& __rhs);
61066110
6107 _LIBCPP_INLINE_VISIBILITY6111 _LIBCPP_INLINE_VISIBILITY
...@@ -6425,6 +6429,7 @@ public:...@@ -6425,6 +6429,7 @@ public:
6425 template<class _UnaryOperation>6429 template<class _UnaryOperation>
6426 param_type(size_t __nw, result_type __xmin, result_type __xmax,6430 param_type(size_t __nw, result_type __xmin, result_type __xmax,
6427 _UnaryOperation __fw);6431 _UnaryOperation __fw);
6432 param_type(param_type const&) = default;
6428 param_type & operator=(const param_type& __rhs);6433 param_type & operator=(const param_type& __rhs);
64296434
6430 _LIBCPP_INLINE_VISIBILITY6435 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/regex+31-21
...@@ -169,15 +169,15 @@ public:...@@ -169,15 +169,15 @@ public:
169 // assign:169 // assign:
170 basic_regex& assign(const basic_regex& that);170 basic_regex& assign(const basic_regex& that);
171 basic_regex& assign(basic_regex&& that) noexcept;171 basic_regex& assign(basic_regex&& that) noexcept;
172 basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);172 basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
173 basic_regex& assign(const charT* p, size_t len, flag_type f);173 basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
174 template <class string_traits, class A>174 template <class string_traits, class A>
175 basic_regex& assign(const basic_string<charT, string_traits, A>& s,175 basic_regex& assign(const basic_string<charT, string_traits, A>& s,
176 flag_type f = regex_constants::ECMAScript);176 flag_type f = regex_constants::ECMAScript);
177 template <class InputIterator>177 template <class InputIterator>
178 basic_regex& assign(InputIterator first, InputIterator last,178 basic_regex& assign(InputIterator first, InputIterator last,
179 flag_type f = regex_constants::ECMAScript);179 flag_type f = regex_constants::ECMAScript);
180 basic_regex& assign(initializer_list<charT>, flag_type = regex_constants::ECMAScript);180 basic_regex& assign(initializer_list<charT>, flag_type f = regex_constants::ECMAScript);
181181
182 // const operations:182 // const operations:
183 unsigned mark_count() const;183 unsigned mark_count() const;
...@@ -965,7 +965,8 @@ enum error_type...@@ -965,7 +965,8 @@ enum error_type
965 error_stack,965 error_stack,
966 __re_err_grammar,966 __re_err_grammar,
967 __re_err_empty,967 __re_err_empty,
968 __re_err_unknown968 __re_err_unknown,
969 __re_err_parse
969};970};
970971
971} // regex_constants972} // regex_constants
...@@ -2539,8 +2540,7 @@ public:...@@ -2539,8 +2540,7 @@ public:
2539 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2540 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2540 __end_(0)2541 __end_(0)
2541 {2542 {
2542 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;2543 __init(__p, __p + __traits_.length(__p));
2543 __parse(__p, __p + __traits_.length(__p));
2544 }2544 }
25452545
2546 _LIBCPP_INLINE_VISIBILITY2546 _LIBCPP_INLINE_VISIBILITY
...@@ -2548,8 +2548,7 @@ public:...@@ -2548,8 +2548,7 @@ public:
2548 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2548 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2549 __end_(0)2549 __end_(0)
2550 {2550 {
2551 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;2551 __init(__p, __p + __len);
2552 __parse(__p, __p + __len);
2553 }2552 }
25542553
2555// basic_regex(const basic_regex&) = default;2554// basic_regex(const basic_regex&) = default;
...@@ -2561,8 +2560,7 @@ public:...@@ -2561,8 +2560,7 @@ public:
2561 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2560 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2562 __end_(0)2561 __end_(0)
2563 {2562 {
2564 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;2563 __init(__p.begin(), __p.end());
2565 __parse(__p.begin(), __p.end());
2566 }2564 }
25672565
2568 template <class _ForwardIterator>2566 template <class _ForwardIterator>
...@@ -2572,8 +2570,7 @@ public:...@@ -2572,8 +2570,7 @@ public:
2572 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2570 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2573 __end_(0)2571 __end_(0)
2574 {2572 {
2575 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;2573 __init(__first, __last);
2576 __parse(__first, __last);
2577 }2574 }
2578#ifndef _LIBCPP_CXX03_LANG2575#ifndef _LIBCPP_CXX03_LANG
2579 _LIBCPP_INLINE_VISIBILITY2576 _LIBCPP_INLINE_VISIBILITY
...@@ -2582,8 +2579,7 @@ public:...@@ -2582,8 +2579,7 @@ public:
2582 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2579 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2583 __end_(0)2580 __end_(0)
2584 {2581 {
2585 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;2582 __init(__il.begin(), __il.end());
2586 __parse(__il.begin(), __il.end());
2587 }2583 }
2588#endif // _LIBCPP_CXX03_LANG2584#endif // _LIBCPP_CXX03_LANG
25892585
...@@ -2617,7 +2613,7 @@ public:...@@ -2617,7 +2613,7 @@ public:
2617 basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)2613 basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
2618 {return assign(__p, __p + __traits_.length(__p), __f);}2614 {return assign(__p, __p + __traits_.length(__p), __f);}
2619 _LIBCPP_INLINE_VISIBILITY2615 _LIBCPP_INLINE_VISIBILITY
2620 basic_regex& assign(const value_type* __p, size_t __len, flag_type __f)2616 basic_regex& assign(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
2621 {return assign(__p, __p + __len, __f);}2617 {return assign(__p, __p + __len, __f);}
2622 template <class _ST, class _SA>2618 template <class _ST, class _SA>
2623 _LIBCPP_INLINE_VISIBILITY2619 _LIBCPP_INLINE_VISIBILITY
...@@ -2629,8 +2625,8 @@ public:...@@ -2629,8 +2625,8 @@ public:
2629 _LIBCPP_INLINE_VISIBILITY2625 _LIBCPP_INLINE_VISIBILITY
2630 typename enable_if2626 typename enable_if
2631 <2627 <
2632 __is_input_iterator <_InputIterator>::value &&2628 __is_cpp17_input_iterator <_InputIterator>::value &&
2633 !__is_forward_iterator<_InputIterator>::value,2629 !__is_cpp17_forward_iterator<_InputIterator>::value,
2634 basic_regex&2630 basic_regex&
2635 >::type2631 >::type
2636 assign(_InputIterator __first, _InputIterator __last,2632 assign(_InputIterator __first, _InputIterator __last,
...@@ -2656,7 +2652,7 @@ public:...@@ -2656,7 +2652,7 @@ public:
2656 _LIBCPP_INLINE_VISIBILITY2652 _LIBCPP_INLINE_VISIBILITY
2657 typename enable_if2653 typename enable_if
2658 <2654 <
2659 __is_forward_iterator<_ForwardIterator>::value,2655 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2660 basic_regex&2656 basic_regex&
2661 >::type2657 >::type
2662 assign(_ForwardIterator __first, _ForwardIterator __last,2658 assign(_ForwardIterator __first, _ForwardIterator __last,
...@@ -2698,6 +2694,9 @@ private:...@@ -2698,6 +2694,9 @@ private:
2698 _LIBCPP_INLINE_VISIBILITY2694 _LIBCPP_INLINE_VISIBILITY
2699 unsigned __loop_count() const {return __loop_count_;}2695 unsigned __loop_count() const {return __loop_count_;}
27002696
2697 template <class _ForwardIterator>
2698 void
2699 __init(_ForwardIterator __first, _ForwardIterator __last);
2701 template <class _ForwardIterator>2700 template <class _ForwardIterator>
2702 _ForwardIterator2701 _ForwardIterator
2703 __parse(_ForwardIterator __first, _ForwardIterator __last);2702 __parse(_ForwardIterator __first, _ForwardIterator __last);
...@@ -2953,7 +2952,7 @@ private:...@@ -2953,7 +2952,7 @@ private:
29532952
2954#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES2953#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2955template <class _ForwardIterator,2954template <class _ForwardIterator,
2956 class = typename enable_if<__is_forward_iterator<_ForwardIterator>::value, nullptr_t>::type2955 class = typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value, nullptr_t>::type
2957>2956>
2958basic_regex(_ForwardIterator, _ForwardIterator,2957basic_regex(_ForwardIterator, _ForwardIterator,
2959 regex_constants::syntax_option_type = regex_constants::ECMAScript)2958 regex_constants::syntax_option_type = regex_constants::ECMAScript)
...@@ -3054,6 +3053,17 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const...@@ -3054,6 +3053,17 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
3054 }3053 }
3055}3054}
30563055
3056template <class _CharT, class _Traits>
3057template <class _ForwardIterator>
3058void
3059basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIterator __last)
3060{
3061 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
3062 _ForwardIterator __temp = __parse(__first, __last);
3063 if ( __temp != __last)
3064 __throw_regex_error<regex_constants::__re_err_parse>();
3065}
3066
3057template <class _CharT, class _Traits>3067template <class _CharT, class _Traits>
3058template <class _ForwardIterator>3068template <class _ForwardIterator>
3059_ForwardIterator3069_ForwardIterator
lib/libcxx/include/set+12-12
...@@ -852,26 +852,26 @@ public:...@@ -852,26 +852,26 @@ public:
852template<class _InputIterator,852template<class _InputIterator,
853 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,853 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
854 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,854 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
855 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,855 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
856 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>856 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
857set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())857set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
858 -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;858 -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
859859
860template<class _Key, class _Compare = less<_Key>,860template<class _Key, class _Compare = less<_Key>,
861 class _Allocator = allocator<_Key>,861 class _Allocator = allocator<_Key>,
862 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,862 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
863 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>863 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
864set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())864set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
865 -> set<_Key, _Compare, _Allocator>;865 -> set<_Key, _Compare, _Allocator>;
866866
867template<class _InputIterator, class _Allocator,867template<class _InputIterator, class _Allocator,
868 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>868 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
869set(_InputIterator, _InputIterator, _Allocator)869set(_InputIterator, _InputIterator, _Allocator)
870 -> set<typename iterator_traits<_InputIterator>::value_type,870 -> set<typename iterator_traits<_InputIterator>::value_type,
871 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;871 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
872872
873template<class _Key, class _Allocator,873template<class _Key, class _Allocator,
874 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>874 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
875set(initializer_list<_Key>, _Allocator)875set(initializer_list<_Key>, _Allocator)
876 -> set<_Key, less<_Key>, _Allocator>;876 -> set<_Key, less<_Key>, _Allocator>;
877#endif877#endif
...@@ -1377,26 +1377,26 @@ public:...@@ -1377,26 +1377,26 @@ public:
1377template<class _InputIterator,1377template<class _InputIterator,
1378 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,1378 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
1379 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,1379 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
1380 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,1380 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
1381 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>1381 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
1382multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())1382multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1383 -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;1383 -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
13841384
1385template<class _Key, class _Compare = less<_Key>,1385template<class _Key, class _Compare = less<_Key>,
1386 class _Allocator = allocator<_Key>,1386 class _Allocator = allocator<_Key>,
1387 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,1387 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
1388 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>1388 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
1389multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())1389multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
1390 -> multiset<_Key, _Compare, _Allocator>;1390 -> multiset<_Key, _Compare, _Allocator>;
13911391
1392template<class _InputIterator, class _Allocator,1392template<class _InputIterator, class _Allocator,
1393 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>1393 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1394multiset(_InputIterator, _InputIterator, _Allocator)1394multiset(_InputIterator, _InputIterator, _Allocator)
1395 -> multiset<typename iterator_traits<_InputIterator>::value_type,1395 -> multiset<typename iterator_traits<_InputIterator>::value_type,
1396 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;1396 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
13971397
1398template<class _Key, class _Allocator,1398template<class _Key, class _Allocator,
1399 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>1399 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
1400multiset(initializer_list<_Key>, _Allocator)1400multiset(initializer_list<_Key>, _Allocator)
1401 -> multiset<_Key, less<_Key>, _Allocator>;1401 -> multiset<_Key, less<_Key>, _Allocator>;
1402#endif1402#endif
lib/libcxx/include/span+36-36
...@@ -39,7 +39,7 @@ public:...@@ -39,7 +39,7 @@ public:
39 // constants and types39 // constants and types
40 using element_type = ElementType;40 using element_type = ElementType;
41 using value_type = remove_cv_t<ElementType>;41 using value_type = remove_cv_t<ElementType>;
42 using index_type = size_t;42 using size_type = size_t;
43 using difference_type = ptrdiff_t;43 using difference_type = ptrdiff_t;
44 using pointer = element_type*;44 using pointer = element_type*;
45 using const_pointer = const element_type*;45 using const_pointer = const element_type*;
...@@ -49,11 +49,11 @@ public:...@@ -49,11 +49,11 @@ public:
49 using const_iterator = implementation-defined;49 using const_iterator = implementation-defined;
50 using reverse_iterator = std::reverse_iterator<iterator>;50 using reverse_iterator = std::reverse_iterator<iterator>;
51 using const_reverse_iterator = std::reverse_iterator<const_iterator>;51 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
52 static constexpr index_type extent = Extent;52 static constexpr size_type extent = Extent;
5353
54 // [span.cons], span constructors, copy, assignment, and destructor54 // [span.cons], span constructors, copy, assignment, and destructor
55 constexpr span() noexcept;55 constexpr span() noexcept;
56 constexpr span(pointer ptr, index_type count);56 constexpr span(pointer ptr, size_type count);
57 constexpr span(pointer firstElem, pointer lastElem);57 constexpr span(pointer firstElem, pointer lastElem);
58 template <size_t N>58 template <size_t N>
59 constexpr span(element_type (&arr)[N]) noexcept;59 constexpr span(element_type (&arr)[N]) noexcept;
...@@ -79,17 +79,17 @@ public:...@@ -79,17 +79,17 @@ public:
79 template <size_t Offset, size_t Count = dynamic_extent>79 template <size_t Offset, size_t Count = dynamic_extent>
80 constexpr span<element_type, see below> subspan() const;80 constexpr span<element_type, see below> subspan() const;
8181
82 constexpr span<element_type, dynamic_extent> first(index_type count) const;82 constexpr span<element_type, dynamic_extent> first(size_type count) const;
83 constexpr span<element_type, dynamic_extent> last(index_type count) const;83 constexpr span<element_type, dynamic_extent> last(size_type count) const;
84 constexpr span<element_type, dynamic_extent> subspan(index_type offset, index_type count = dynamic_extent) const;84 constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const;
8585
86 // [span.obs], span observers86 // [span.obs], span observers
87 constexpr index_type size() const noexcept;87 constexpr size_type size() const noexcept;
88 constexpr index_type size_bytes() const noexcept;88 constexpr size_type size_bytes() const noexcept;
89 constexpr bool empty() const noexcept;89 constexpr bool empty() const noexcept;
9090
91 // [span.elem], span element access91 // [span.elem], span element access
92 constexpr reference operator[](index_type idx) const;92 constexpr reference operator[](size_type idx) const;
93 constexpr reference front() const;93 constexpr reference front() const;
94 constexpr reference back() const;94 constexpr reference back() const;
95 constexpr pointer data() const noexcept;95 constexpr pointer data() const noexcept;
...@@ -105,8 +105,8 @@ public:...@@ -105,8 +105,8 @@ public:
105 constexpr const_reverse_iterator crend() const noexcept;105 constexpr const_reverse_iterator crend() const noexcept;
106106
107private:107private:
108 pointer data_; // exposition only108 pointer data_; // exposition only
109 index_type size_; // exposition only109 size_type size_; // exposition only
110};110};
111111
112template<class T, size_t N>112template<class T, size_t N>
...@@ -195,7 +195,7 @@ public:...@@ -195,7 +195,7 @@ public:
195// constants and types195// constants and types
196 using element_type = _Tp;196 using element_type = _Tp;
197 using value_type = remove_cv_t<_Tp>;197 using value_type = remove_cv_t<_Tp>;
198 using index_type = size_t;198 using size_type = size_t;
199 using difference_type = ptrdiff_t;199 using difference_type = ptrdiff_t;
200 using pointer = _Tp *;200 using pointer = _Tp *;
201 using const_pointer = const _Tp *;201 using const_pointer = const _Tp *;
...@@ -206,7 +206,7 @@ public:...@@ -206,7 +206,7 @@ public:
206 using reverse_iterator = _VSTD::reverse_iterator<iterator>;206 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
207 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;207 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
208208
209 static constexpr index_type extent = _Extent;209 static constexpr size_type extent = _Extent;
210210
211// [span.cons], span constructors, copy, assignment, and destructor211// [span.cons], span constructors, copy, assignment, and destructor
212 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}212 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
...@@ -215,7 +215,7 @@ public:...@@ -215,7 +215,7 @@ public:
215 constexpr span (const span&) noexcept = default;215 constexpr span (const span&) noexcept = default;
216 constexpr span& operator=(const span&) noexcept = default;216 constexpr span& operator=(const span&) noexcept = default;
217217
218 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}218 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}
219 { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); }219 { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); }
220 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}220 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}
221 { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); }221 { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); }
...@@ -260,14 +260,14 @@ public:...@@ -260,14 +260,14 @@ public:
260 }260 }
261261
262 _LIBCPP_INLINE_VISIBILITY262 _LIBCPP_INLINE_VISIBILITY
263 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept263 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
264 {264 {
265 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");265 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
266 return {data(), __count};266 return {data(), __count};
267 }267 }
268268
269 _LIBCPP_INLINE_VISIBILITY269 _LIBCPP_INLINE_VISIBILITY
270 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept270 constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
271 {271 {
272 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");272 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
273 return {data() + size() - __count, __count};273 return {data() + size() - __count, __count};
...@@ -285,7 +285,7 @@ public:...@@ -285,7 +285,7 @@ public:
285285
286 _LIBCPP_INLINE_VISIBILITY286 _LIBCPP_INLINE_VISIBILITY
287 constexpr span<element_type, dynamic_extent>287 constexpr span<element_type, dynamic_extent>
288 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept288 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
289 {289 {
290 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");290 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
291 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");291 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
...@@ -295,11 +295,11 @@ public:...@@ -295,11 +295,11 @@ public:
295 return {data() + __offset, __count};295 return {data() + __offset, __count};
296 }296 }
297297
298 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return _Extent; }298 _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; }
299 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }299 _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
300 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }300 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
301301
302 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept302 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
303 {303 {
304 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");304 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");
305 return __data[__idx];305 return __data[__idx];
...@@ -356,7 +356,7 @@ public:...@@ -356,7 +356,7 @@ public:
356// constants and types356// constants and types
357 using element_type = _Tp;357 using element_type = _Tp;
358 using value_type = remove_cv_t<_Tp>;358 using value_type = remove_cv_t<_Tp>;
359 using index_type = size_t;359 using size_type = size_t;
360 using difference_type = ptrdiff_t;360 using difference_type = ptrdiff_t;
361 using pointer = _Tp *;361 using pointer = _Tp *;
362 using const_pointer = const _Tp *;362 using const_pointer = const _Tp *;
...@@ -367,7 +367,7 @@ public:...@@ -367,7 +367,7 @@ public:
367 using reverse_iterator = _VSTD::reverse_iterator<iterator>;367 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
368 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;368 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
369369
370 static constexpr index_type extent = dynamic_extent;370 static constexpr size_type extent = dynamic_extent;
371371
372// [span.cons], span constructors, copy, assignment, and destructor372// [span.cons], span constructors, copy, assignment, and destructor
373 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}373 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}
...@@ -375,7 +375,7 @@ public:...@@ -375,7 +375,7 @@ public:
375 constexpr span (const span&) noexcept = default;375 constexpr span (const span&) noexcept = default;
376 constexpr span& operator=(const span&) noexcept = default;376 constexpr span& operator=(const span&) noexcept = default;
377377
378 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {}378 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count) : __data{__ptr}, __size{__count} {}
379 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}379 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
380380
381 template <size_t _Sz>381 template <size_t _Sz>
...@@ -394,13 +394,13 @@ public:...@@ -394,13 +394,13 @@ public:
394 _LIBCPP_INLINE_VISIBILITY394 _LIBCPP_INLINE_VISIBILITY
395 constexpr span( _Container& __c,395 constexpr span( _Container& __c,
396 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)396 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
397 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}397 : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {}
398398
399 template <class _Container>399 template <class _Container>
400 _LIBCPP_INLINE_VISIBILITY400 _LIBCPP_INLINE_VISIBILITY
401 constexpr span(const _Container& __c,401 constexpr span(const _Container& __c,
402 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)402 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
403 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}403 : __data{_VSTD::data(__c)}, __size{(size_type) _VSTD::size(__c)} {}
404404
405405
406 template <class _OtherElementType, size_t _OtherExtent>406 template <class _OtherElementType, size_t _OtherExtent>
...@@ -430,14 +430,14 @@ public:...@@ -430,14 +430,14 @@ public:
430 }430 }
431431
432 _LIBCPP_INLINE_VISIBILITY432 _LIBCPP_INLINE_VISIBILITY
433 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept433 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
434 {434 {
435 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");435 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
436 return {data(), __count};436 return {data(), __count};
437 }437 }
438438
439 _LIBCPP_INLINE_VISIBILITY439 _LIBCPP_INLINE_VISIBILITY
440 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept440 constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
441 {441 {
442 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");442 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
443 return {data() + size() - __count, __count};443 return {data() + size() - __count, __count};
...@@ -454,7 +454,7 @@ public:...@@ -454,7 +454,7 @@ public:
454454
455 constexpr span<element_type, dynamic_extent>455 constexpr span<element_type, dynamic_extent>
456 _LIBCPP_INLINE_VISIBILITY456 _LIBCPP_INLINE_VISIBILITY
457 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept457 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
458 {458 {
459 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");459 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
460 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");460 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
...@@ -464,11 +464,11 @@ public:...@@ -464,11 +464,11 @@ public:
464 return {data() + __offset, __count};464 return {data() + __offset, __count};
465 }465 }
466466
467 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return __size; }467 _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; }
468 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return __size * sizeof(element_type); }468 _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); }
469 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }469 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }
470470
471 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept471 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
472 {472 {
473 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");473 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");
474 return __data[__idx];474 return __data[__idx];
...@@ -505,7 +505,7 @@ public:...@@ -505,7 +505,7 @@ public:
505 __data = __other.__data;505 __data = __other.__data;
506 __other.__data = __p;506 __other.__data = __p;
507507
508 index_type __sz = __size;508 size_type __sz = __size;
509 __size = __other.__size;509 __size = __other.__size;
510 __other.__size = __sz;510 __other.__size = __sz;
511 }511 }
...@@ -517,8 +517,8 @@ public:...@@ -517,8 +517,8 @@ public:
517 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }517 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
518518
519private:519private:
520 pointer __data;520 pointer __data;
521 index_type __size;521 size_type __size;
522};522};
523523
524// tuple interface524// tuple interface
lib/libcxx/include/string+96-90
...@@ -625,7 +625,7 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {};...@@ -625,7 +625,7 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {};
625template <class _Iter>625template <class _Iter>
626struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};626struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
627#else627#else
628template <class _Iter, bool = __is_forward_iterator<_Iter>::value>628template <class _Iter, bool = __is_cpp17_forward_iterator<_Iter>::value>
629struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((629struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
630 noexcept(++(declval<_Iter&>())) &&630 noexcept(++(declval<_Iter&>())) &&
631 is_nothrow_assignable<_Iter&, _Iter>::value &&631 is_nothrow_assignable<_Iter&, _Iter>::value &&
...@@ -812,11 +812,9 @@ public:...@@ -812,11 +812,9 @@ public:
812 basic_string(basic_string&& __str, const allocator_type& __a);812 basic_string(basic_string&& __str, const allocator_type& __a);
813#endif // _LIBCPP_CXX03_LANG813#endif // _LIBCPP_CXX03_LANG
814814
815#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
816 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>815 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
817#endif
818 _LIBCPP_INLINE_VISIBILITY816 _LIBCPP_INLINE_VISIBILITY
819 basic_string(const _CharT* __s) {817 basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
820 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");818 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
821 __init(__s, traits_type::length(__s));819 __init(__s, traits_type::length(__s));
822# if _LIBCPP_DEBUG_LEVEL >= 2820# if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -824,9 +822,7 @@ public:...@@ -824,9 +822,7 @@ public:
824# endif822# endif
825 }823 }
826824
827#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
828 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>825 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
829#endif
830 _LIBCPP_INLINE_VISIBILITY826 _LIBCPP_INLINE_VISIBILITY
831 basic_string(const _CharT* __s, const _Allocator& __a);827 basic_string(const _CharT* __s, const _Allocator& __a);
832828
...@@ -837,9 +833,7 @@ public:...@@ -837,9 +833,7 @@ public:
837 _LIBCPP_INLINE_VISIBILITY833 _LIBCPP_INLINE_VISIBILITY
838 basic_string(size_type __n, _CharT __c);834 basic_string(size_type __n, _CharT __c);
839835
840#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
841 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>836 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
842#endif
843 _LIBCPP_INLINE_VISIBILITY837 _LIBCPP_INLINE_VISIBILITY
844 basic_string(size_type __n, _CharT __c, const _Allocator& __a);838 basic_string(size_type __n, _CharT __c, const _Allocator& __a);
845839
...@@ -862,10 +856,10 @@ public:...@@ -862,10 +856,10 @@ public:
862 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS856 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
863 explicit basic_string(const _Tp& __t, const allocator_type& __a);857 explicit basic_string(const _Tp& __t, const allocator_type& __a);
864858
865 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>859 template<class _InputIterator, class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value>::type>
866 _LIBCPP_INLINE_VISIBILITY860 _LIBCPP_INLINE_VISIBILITY
867 basic_string(_InputIterator __first, _InputIterator __last);861 basic_string(_InputIterator __first, _InputIterator __last);
868 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>862 template<class _InputIterator, class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value>::type>
869 _LIBCPP_INLINE_VISIBILITY863 _LIBCPP_INLINE_VISIBILITY
870 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);864 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
871#ifndef _LIBCPP_CXX03_LANG865#ifndef _LIBCPP_CXX03_LANG
...@@ -1029,7 +1023,7 @@ public:...@@ -1029,7 +1023,7 @@ public:
1029 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1023 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1030 typename enable_if1024 typename enable_if
1031 <1025 <
1032 __is_exactly_input_iterator<_InputIterator>::value1026 __is_exactly_cpp17_input_iterator<_InputIterator>::value
1033 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,1027 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1034 basic_string&1028 basic_string&
1035 >::type1029 >::type
...@@ -1043,7 +1037,7 @@ public:...@@ -1043,7 +1037,7 @@ public:
1043 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1037 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1044 typename enable_if1038 typename enable_if
1045 <1039 <
1046 __is_forward_iterator<_ForwardIterator>::value1040 __is_cpp17_forward_iterator<_ForwardIterator>::value
1047 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,1041 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1048 basic_string&1042 basic_string&
1049 >::type1043 >::type
...@@ -1097,7 +1091,7 @@ public:...@@ -1097,7 +1091,7 @@ public:
1097 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1091 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1098 typename enable_if1092 typename enable_if
1099 <1093 <
1100 __is_exactly_input_iterator<_InputIterator>::value1094 __is_exactly_cpp17_input_iterator<_InputIterator>::value
1101 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,1095 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1102 basic_string&1096 basic_string&
1103 >::type1097 >::type
...@@ -1106,7 +1100,7 @@ public:...@@ -1106,7 +1100,7 @@ public:
1106 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1100 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1107 typename enable_if1101 typename enable_if
1108 <1102 <
1109 __is_forward_iterator<_ForwardIterator>::value1103 __is_cpp17_forward_iterator<_ForwardIterator>::value
1110 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,1104 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1111 basic_string&1105 basic_string&
1112 >::type1106 >::type
...@@ -1148,7 +1142,7 @@ public:...@@ -1148,7 +1142,7 @@ public:
1148 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1142 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1149 typename enable_if1143 typename enable_if
1150 <1144 <
1151 __is_exactly_input_iterator<_InputIterator>::value1145 __is_exactly_cpp17_input_iterator<_InputIterator>::value
1152 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,1146 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1153 iterator1147 iterator
1154 >::type1148 >::type
...@@ -1157,7 +1151,7 @@ public:...@@ -1157,7 +1151,7 @@ public:
1157 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1151 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1158 typename enable_if1152 typename enable_if
1159 <1153 <
1160 __is_forward_iterator<_ForwardIterator>::value1154 __is_cpp17_forward_iterator<_ForwardIterator>::value
1161 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,1155 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1162 iterator1156 iterator
1163 >::type1157 >::type
...@@ -1219,7 +1213,7 @@ public:...@@ -1219,7 +1213,7 @@ public:
1219 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1213 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1220 typename enable_if1214 typename enable_if
1221 <1215 <
1222 __is_input_iterator<_InputIterator>::value,1216 __is_cpp17_input_iterator<_InputIterator>::value,
1223 basic_string&1217 basic_string&
1224 >::type1218 >::type
1225 replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);1219 replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
...@@ -1245,10 +1239,10 @@ public:...@@ -1245,10 +1239,10 @@ public:
1245 _LIBCPP_INLINE_VISIBILITY1239 _LIBCPP_INLINE_VISIBILITY
1246 const value_type* c_str() const _NOEXCEPT {return data();}1240 const value_type* c_str() const _NOEXCEPT {return data();}
1247 _LIBCPP_INLINE_VISIBILITY1241 _LIBCPP_INLINE_VISIBILITY
1248 const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}1242 const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(__get_pointer());}
1249#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY)1243#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY)
1250 _LIBCPP_INLINE_VISIBILITY1244 _LIBCPP_INLINE_VISIBILITY
1251 value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}1245 value_type* data() _NOEXCEPT {return _VSTD::__to_address(__get_pointer());}
1252#endif1246#endif
12531247
1254 _LIBCPP_INLINE_VISIBILITY1248 _LIBCPP_INLINE_VISIBILITY
...@@ -1553,7 +1547,7 @@ private:...@@ -1553,7 +1547,7 @@ private:
1553 inline1547 inline
1554 typename enable_if1548 typename enable_if
1555 <1549 <
1556 __is_exactly_input_iterator<_InputIterator>::value,1550 __is_exactly_cpp17_input_iterator<_InputIterator>::value,
1557 void1551 void
1558 >::type1552 >::type
1559 __init(_InputIterator __first, _InputIterator __last);1553 __init(_InputIterator __first, _InputIterator __last);
...@@ -1562,7 +1556,7 @@ private:...@@ -1562,7 +1556,7 @@ private:
1562 inline1556 inline
1563 typename enable_if1557 typename enable_if
1564 <1558 <
1565 __is_forward_iterator<_ForwardIterator>::value,1559 __is_cpp17_forward_iterator<_ForwardIterator>::value,
1566 void1560 void
1567 >::type1561 >::type
1568 __init(_ForwardIterator __first, _ForwardIterator __last);1562 __init(_ForwardIterator __first, _ForwardIterator __last);
...@@ -1658,7 +1652,7 @@ private:...@@ -1658,7 +1652,7 @@ private:
1658template<class _InputIterator,1652template<class _InputIterator,
1659 class _CharT = typename iterator_traits<_InputIterator>::value_type,1653 class _CharT = typename iterator_traits<_InputIterator>::value_type,
1660 class _Allocator = allocator<_CharT>,1654 class _Allocator = allocator<_CharT>,
1661 class = typename enable_if<__is_input_iterator<_InputIterator>::value, void>::type,1655 class = typename enable_if<__is_cpp17_input_iterator<_InputIterator>::value, void>::type,
1662 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type1656 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type
1663 >1657 >
1664basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())1658basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
...@@ -1727,6 +1721,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -1727,6 +1721,7 @@ template <class _CharT, class _Traits, class _Allocator>
1727inline1721inline
1728basic_string<_CharT, _Traits, _Allocator>::basic_string()1722basic_string<_CharT, _Traits, _Allocator>::basic_string()
1729 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)1723 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1724 : __r_(__default_init_tag(), __default_init_tag())
1730{1725{
1731#if _LIBCPP_DEBUG_LEVEL >= 21726#if _LIBCPP_DEBUG_LEVEL >= 2
1732 __get_db()->__insert_c(this);1727 __get_db()->__insert_c(this);
...@@ -1742,7 +1737,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __...@@ -1742,7 +1737,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
1742#else1737#else
1743 _NOEXCEPT1738 _NOEXCEPT
1744#endif1739#endif
1745: __r_(__second_tag(), __a)1740: __r_(__default_init_tag(), __a)
1746{1741{
1747#if _LIBCPP_DEBUG_LEVEL >= 21742#if _LIBCPP_DEBUG_LEVEL >= 2
1748 __get_db()->__insert_c(this);1743 __get_db()->__insert_c(this);
...@@ -1771,7 +1766,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,...@@ -1771,7 +1766,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
1771 __set_long_cap(__cap+1);1766 __set_long_cap(__cap+1);
1772 __set_long_size(__sz);1767 __set_long_size(__sz);
1773 }1768 }
1774 traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);1769 traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1775 traits_type::assign(__p[__sz], value_type());1770 traits_type::assign(__p[__sz], value_type());
1776}1771}
17771772
...@@ -1795,16 +1790,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty...@@ -1795,16 +1790,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
1795 __set_long_cap(__cap+1);1790 __set_long_cap(__cap+1);
1796 __set_long_size(__sz);1791 __set_long_size(__sz);
1797 }1792 }
1798 traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);1793 traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1799 traits_type::assign(__p[__sz], value_type());1794 traits_type::assign(__p[__sz], value_type());
1800}1795}
18011796
1802template <class _CharT, class _Traits, class _Allocator>1797template <class _CharT, class _Traits, class _Allocator>
1803#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1804template <class>1798template <class>
1805#endif
1806basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)1799basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
1807 : __r_(__second_tag(), __a)1800 : __r_(__default_init_tag(), __a)
1808{1801{
1809 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");1802 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
1810 __init(__s, traits_type::length(__s));1803 __init(__s, traits_type::length(__s));
...@@ -1816,6 +1809,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const...@@ -1816,6 +1809,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const
1816template <class _CharT, class _Traits, class _Allocator>1809template <class _CharT, class _Traits, class _Allocator>
1817inline1810inline
1818basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)1811basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
1812 : __r_(__default_init_tag(), __default_init_tag())
1819{1813{
1820 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");1814 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
1821 __init(__s, __n);1815 __init(__s, __n);
...@@ -1827,7 +1821,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_...@@ -1827,7 +1821,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
1827template <class _CharT, class _Traits, class _Allocator>1821template <class _CharT, class _Traits, class _Allocator>
1828inline1822inline
1829basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)1823basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
1830 : __r_(__second_tag(), __a)1824 : __r_(__default_init_tag(), __a)
1831{1825{
1832 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");1826 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
1833 __init(__s, __n);1827 __init(__s, __n);
...@@ -1838,12 +1832,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_...@@ -1838,12 +1832,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
18381832
1839template <class _CharT, class _Traits, class _Allocator>1833template <class _CharT, class _Traits, class _Allocator>
1840basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)1834basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
1841 : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))1835 : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
1842{1836{
1843 if (!__str.__is_long())1837 if (!__str.__is_long())
1844 __r_.first().__r = __str.__r_.first().__r;1838 __r_.first().__r = __str.__r_.first().__r;
1845 else1839 else
1846 __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());1840 __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1847#if _LIBCPP_DEBUG_LEVEL >= 21841#if _LIBCPP_DEBUG_LEVEL >= 2
1848 __get_db()->__insert_c(this);1842 __get_db()->__insert_c(this);
1849#endif1843#endif
...@@ -1852,12 +1846,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st...@@ -1852,12 +1846,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
1852template <class _CharT, class _Traits, class _Allocator>1846template <class _CharT, class _Traits, class _Allocator>
1853basic_string<_CharT, _Traits, _Allocator>::basic_string(1847basic_string<_CharT, _Traits, _Allocator>::basic_string(
1854 const basic_string& __str, const allocator_type& __a)1848 const basic_string& __str, const allocator_type& __a)
1855 : __r_(__second_tag(), __a)1849 : __r_(__default_init_tag(), __a)
1856{1850{
1857 if (!__str.__is_long())1851 if (!__str.__is_long())
1858 __r_.first().__r = __str.__r_.first().__r;1852 __r_.first().__r = __str.__r_.first().__r;
1859 else1853 else
1860 __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());1854 __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1861#if _LIBCPP_DEBUG_LEVEL >= 21855#if _LIBCPP_DEBUG_LEVEL >= 2
1862 __get_db()->__insert_c(this);1856 __get_db()->__insert_c(this);
1863#endif1857#endif
...@@ -1886,10 +1880,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)...@@ -1886,10 +1880,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
1886template <class _CharT, class _Traits, class _Allocator>1880template <class _CharT, class _Traits, class _Allocator>
1887inline1881inline
1888basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)1882basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
1889 : __r_(__second_tag(), __a)1883 : __r_(__default_init_tag(), __a)
1890{1884{
1891 if (__str.__is_long() && __a != __str.__alloc()) // copy, not move1885 if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
1892 __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());1886 __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1893 else1887 else
1894 {1888 {
1895 __r_.first().__r = __str.__r_.first().__r;1889 __r_.first().__r = __str.__r_.first().__r;
...@@ -1924,13 +1918,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)...@@ -1924,13 +1918,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
1924 __set_long_cap(__cap+1);1918 __set_long_cap(__cap+1);
1925 __set_long_size(__n);1919 __set_long_size(__n);
1926 }1920 }
1927 traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c);1921 traits_type::assign(_VSTD::__to_address(__p), __n, __c);
1928 traits_type::assign(__p[__n], value_type());1922 traits_type::assign(__p[__n], value_type());
1929}1923}
19301924
1931template <class _CharT, class _Traits, class _Allocator>1925template <class _CharT, class _Traits, class _Allocator>
1932inline1926inline
1933basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)1927basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
1928 : __r_(__default_init_tag(), __default_init_tag())
1934{1929{
1935 __init(__n, __c);1930 __init(__n, __c);
1936#if _LIBCPP_DEBUG_LEVEL >= 21931#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1939,11 +1934,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __...@@ -1939,11 +1934,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
1939}1934}
19401935
1941template <class _CharT, class _Traits, class _Allocator>1936template <class _CharT, class _Traits, class _Allocator>
1942#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1943template <class>1937template <class>
1944#endif
1945basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)1938basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
1946 : __r_(__second_tag(), __a)1939 : __r_(__default_init_tag(), __a)
1947{1940{
1948 __init(__n, __c);1941 __init(__n, __c);
1949#if _LIBCPP_DEBUG_LEVEL >= 21942#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1955,7 +1948,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -1955,7 +1948,7 @@ template <class _CharT, class _Traits, class _Allocator>
1955basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,1948basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
1956 size_type __pos, size_type __n,1949 size_type __pos, size_type __n,
1957 const _Allocator& __a)1950 const _Allocator& __a)
1958 : __r_(__second_tag(), __a)1951 : __r_(__default_init_tag(), __a)
1959{1952{
1960 size_type __str_sz = __str.size();1953 size_type __str_sz = __str.size();
1961 if (__pos > __str_sz)1954 if (__pos > __str_sz)
...@@ -1970,7 +1963,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -1970,7 +1963,7 @@ template <class _CharT, class _Traits, class _Allocator>
1970inline1963inline
1971basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,1964basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
1972 const _Allocator& __a)1965 const _Allocator& __a)
1973 : __r_(__second_tag(), __a)1966 : __r_(__default_init_tag(), __a)
1974{1967{
1975 size_type __str_sz = __str.size();1968 size_type __str_sz = __str.size();
1976 if (__pos > __str_sz)1969 if (__pos > __str_sz)
...@@ -1985,7 +1978,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -1985,7 +1978,7 @@ template <class _CharT, class _Traits, class _Allocator>
1985template <class _Tp, class>1978template <class _Tp, class>
1986basic_string<_CharT, _Traits, _Allocator>::basic_string(1979basic_string<_CharT, _Traits, _Allocator>::basic_string(
1987 const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)1980 const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
1988 : __r_(__second_tag(), __a)1981 : __r_(__default_init_tag(), __a)
1989{1982{
1990 __self_view __sv0 = __t;1983 __self_view __sv0 = __t;
1991 __self_view __sv = __sv0.substr(__pos, __n);1984 __self_view __sv = __sv0.substr(__pos, __n);
...@@ -1998,6 +1991,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(...@@ -1998,6 +1991,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
1998template <class _CharT, class _Traits, class _Allocator>1991template <class _CharT, class _Traits, class _Allocator>
1999template <class _Tp, class>1992template <class _Tp, class>
2000basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)1993basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
1994 : __r_(__default_init_tag(), __default_init_tag())
2001{1995{
2002 __self_view __sv = __t;1996 __self_view __sv = __t;
2003 __init(__sv.data(), __sv.size());1997 __init(__sv.data(), __sv.size());
...@@ -2009,7 +2003,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)...@@ -2009,7 +2003,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
2009template <class _CharT, class _Traits, class _Allocator>2003template <class _CharT, class _Traits, class _Allocator>
2010template <class _Tp, class>2004template <class _Tp, class>
2011basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)2005basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
2012 : __r_(__second_tag(), __a)2006 : __r_(__default_init_tag(), __a)
2013{2007{
2014 __self_view __sv = __t;2008 __self_view __sv = __t;
2015 __init(__sv.data(), __sv.size());2009 __init(__sv.data(), __sv.size());
...@@ -2022,7 +2016,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2022,7 +2016,7 @@ template <class _CharT, class _Traits, class _Allocator>
2022template <class _InputIterator>2016template <class _InputIterator>
2023typename enable_if2017typename enable_if
2024<2018<
2025 __is_exactly_input_iterator<_InputIterator>::value,2019 __is_exactly_cpp17_input_iterator<_InputIterator>::value,
2026 void2020 void
2027>::type2021>::type
2028basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)2022basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
...@@ -2049,7 +2043,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2049,7 +2043,7 @@ template <class _CharT, class _Traits, class _Allocator>
2049template <class _ForwardIterator>2043template <class _ForwardIterator>
2050typename enable_if2044typename enable_if
2051<2045<
2052 __is_forward_iterator<_ForwardIterator>::value,2046 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2053 void2047 void
2054>::type2048>::type
2055basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)2049basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
...@@ -2080,6 +2074,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2080,6 +2074,7 @@ template <class _CharT, class _Traits, class _Allocator>
2080template<class _InputIterator, class>2074template<class _InputIterator, class>
2081inline2075inline
2082basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)2076basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
2077 : __r_(__default_init_tag(), __default_init_tag())
2083{2078{
2084 __init(__first, __last);2079 __init(__first, __last);
2085#if _LIBCPP_DEBUG_LEVEL >= 22080#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -2092,7 +2087,7 @@ template<class _InputIterator, class>...@@ -2092,7 +2087,7 @@ template<class _InputIterator, class>
2092inline2087inline
2093basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,2088basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
2094 const allocator_type& __a)2089 const allocator_type& __a)
2095 : __r_(__second_tag(), __a)2090 : __r_(__default_init_tag(), __a)
2096{2091{
2097 __init(__first, __last);2092 __init(__first, __last);
2098#if _LIBCPP_DEBUG_LEVEL >= 22093#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -2106,6 +2101,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2106,6 +2101,7 @@ template <class _CharT, class _Traits, class _Allocator>
2106inline2101inline
2107basic_string<_CharT, _Traits, _Allocator>::basic_string(2102basic_string<_CharT, _Traits, _Allocator>::basic_string(
2108 initializer_list<_CharT> __il)2103 initializer_list<_CharT> __il)
2104 : __r_(__default_init_tag(), __default_init_tag())
2109{2105{
2110 __init(__il.begin(), __il.end());2106 __init(__il.begin(), __il.end());
2111#if _LIBCPP_DEBUG_LEVEL >= 22107#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -2118,7 +2114,7 @@ inline...@@ -2118,7 +2114,7 @@ inline
21182114
2119basic_string<_CharT, _Traits, _Allocator>::basic_string(2115basic_string<_CharT, _Traits, _Allocator>::basic_string(
2120 initializer_list<_CharT> __il, const _Allocator& __a)2116 initializer_list<_CharT> __il, const _Allocator& __a)
2121 : __r_(__second_tag(), __a)2117 : __r_(__default_init_tag(), __a)
2122{2118{
2123 __init(__il.begin(), __il.end());2119 __init(__il.begin(), __il.end());
2124#if _LIBCPP_DEBUG_LEVEL >= 22120#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -2154,14 +2150,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace...@@ -2154,14 +2150,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
2154 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);2150 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2155 __invalidate_all_iterators();2151 __invalidate_all_iterators();
2156 if (__n_copy != 0)2152 if (__n_copy != 0)
2157 traits_type::copy(_VSTD::__to_raw_pointer(__p),2153 traits_type::copy(_VSTD::__to_address(__p),
2158 _VSTD::__to_raw_pointer(__old_p), __n_copy);2154 _VSTD::__to_address(__old_p), __n_copy);
2159 if (__n_add != 0)2155 if (__n_add != 0)
2160 traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add);2156 traits_type::copy(_VSTD::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
2161 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;2157 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2162 if (__sec_cp_sz != 0)2158 if (__sec_cp_sz != 0)
2163 traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,2159 traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2164 _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz);2160 _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2165 if (__old_cap+1 != __min_cap)2161 if (__old_cap+1 != __min_cap)
2166 __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);2162 __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2167 __set_long_pointer(__p);2163 __set_long_pointer(__p);
...@@ -2186,12 +2182,12 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t...@@ -2186,12 +2182,12 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
2186 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);2182 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2187 __invalidate_all_iterators();2183 __invalidate_all_iterators();
2188 if (__n_copy != 0)2184 if (__n_copy != 0)
2189 traits_type::copy(_VSTD::__to_raw_pointer(__p),2185 traits_type::copy(_VSTD::__to_address(__p),
2190 _VSTD::__to_raw_pointer(__old_p), __n_copy);2186 _VSTD::__to_address(__old_p), __n_copy);
2191 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;2187 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2192 if (__sec_cp_sz != 0)2188 if (__sec_cp_sz != 0)
2193 traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,2189 traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2194 _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del,2190 _VSTD::__to_address(__old_p) + __n_copy + __n_del,
2195 __sec_cp_sz);2191 __sec_cp_sz);
2196 if (__old_cap+1 != __min_cap)2192 if (__old_cap+1 != __min_cap)
2197 __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);2193 __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
...@@ -2209,7 +2205,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty...@@ -2209,7 +2205,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty
2209 size_type __cap = capacity();2205 size_type __cap = capacity();
2210 if (__cap >= __n)2206 if (__cap >= __n)
2211 {2207 {
2212 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());2208 value_type* __p = _VSTD::__to_address(__get_pointer());
2213 traits_type::move(__p, __s, __n);2209 traits_type::move(__p, __s, __n);
2214 traits_type::assign(__p[__n], value_type());2210 traits_type::assign(__p[__n], value_type());
2215 __set_size(__n);2211 __set_size(__n);
...@@ -2235,7 +2231,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)...@@ -2235,7 +2231,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
2235 }2231 }
2236 else2232 else
2237 __invalidate_iterators_past(__n);2233 __invalidate_iterators_past(__n);
2238 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());2234 value_type* __p = _VSTD::__to_address(__get_pointer());
2239 traits_type::assign(__p, __n, __c);2235 traits_type::assign(__p, __n, __c);
2240 traits_type::assign(__p[__n], value_type());2236 traits_type::assign(__p[__n], value_type());
2241 __set_size(__n);2237 __set_size(__n);
...@@ -2270,7 +2266,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)...@@ -2270,7 +2266,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
2270 if (this != &__str)2266 if (this != &__str)
2271 {2267 {
2272 __copy_assign_alloc(__str);2268 __copy_assign_alloc(__str);
2273 assign(__str.data(), __str.size());2269 return assign(__str.data(), __str.size());
2274 }2270 }
2275 return *this;2271 return *this;
2276}2272}
...@@ -2299,10 +2295,20 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr...@@ -2299,10 +2295,20 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
2299 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)2295 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
2300#endif2296#endif
2301{2297{
2302 __clear_and_shrink();2298 if (__is_long()) {
2303 __r_.first() = __str.__r_.first();2299 __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
2304 __move_assign_alloc(__str);2300 __get_long_cap());
2305 __str.__zero();2301#if _LIBCPP_STD_VER <= 14
2302 if (!is_nothrow_move_assignable<allocator_type>::value) {
2303 __set_short_size(0);
2304 traits_type::assign(__get_short_pointer()[0], value_type());
2305 }
2306#endif
2307 }
2308 __move_assign_alloc(__str);
2309 __r_.first() = __str.__r_.first();
2310 __str.__set_short_size(0);
2311 traits_type::assign(__str.__get_short_pointer()[0], value_type());
2306}2312}
23072313
2308template <class _CharT, class _Traits, class _Allocator>2314template <class _CharT, class _Traits, class _Allocator>
...@@ -2322,7 +2328,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2322,7 +2328,7 @@ template <class _CharT, class _Traits, class _Allocator>
2322template<class _InputIterator>2328template<class _InputIterator>
2323typename enable_if2329typename enable_if
2324<2330<
2325 __is_exactly_input_iterator <_InputIterator>::value2331 __is_exactly_cpp17_input_iterator <_InputIterator>::value
2326 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,2332 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
2327 basic_string<_CharT, _Traits, _Allocator>&2333 basic_string<_CharT, _Traits, _Allocator>&
2328>::type2334>::type
...@@ -2337,7 +2343,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2337,7 +2343,7 @@ template <class _CharT, class _Traits, class _Allocator>
2337template<class _ForwardIterator>2343template<class _ForwardIterator>
2338typename enable_if2344typename enable_if
2339<2345<
2340 __is_forward_iterator<_ForwardIterator>::value2346 __is_cpp17_forward_iterator<_ForwardIterator>::value
2341 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,2347 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
2342 basic_string<_CharT, _Traits, _Allocator>&2348 basic_string<_CharT, _Traits, _Allocator>&
2343>::type2349>::type
...@@ -2408,7 +2414,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty...@@ -2408,7 +2414,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
2408 {2414 {
2409 if (__n)2415 if (__n)
2410 {2416 {
2411 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());2417 value_type* __p = _VSTD::__to_address(__get_pointer());
2412 traits_type::copy(__p + __sz, __s, __n);2418 traits_type::copy(__p + __sz, __s, __n);
2413 __sz += __n;2419 __sz += __n;
2414 __set_size(__sz);2420 __set_size(__sz);
...@@ -2431,7 +2437,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)...@@ -2431,7 +2437,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
2431 if (__cap - __sz < __n)2437 if (__cap - __sz < __n)
2432 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);2438 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2433 pointer __p = __get_pointer();2439 pointer __p = __get_pointer();
2434 traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c);2440 traits_type::assign(_VSTD::__to_address(__p) + __sz, __n, __c);
2435 __sz += __n;2441 __sz += __n;
2436 __set_size(__sz);2442 __set_size(__sz);
2437 traits_type::assign(__p[__sz], value_type());2443 traits_type::assign(__p[__sz], value_type());
...@@ -2511,7 +2517,7 @@ basic_string<_CharT, _Traits, _Allocator>&...@@ -2511,7 +2517,7 @@ basic_string<_CharT, _Traits, _Allocator>&
2511basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(2517basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
2512 _ForwardIterator __first, _ForwardIterator __last)2518 _ForwardIterator __first, _ForwardIterator __last)
2513{2519{
2514 static_assert(__is_forward_iterator<_ForwardIterator>::value,2520 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2515 "function requires a ForwardIterator");2521 "function requires a ForwardIterator");
2516 size_type __sz = size();2522 size_type __sz = size();
2517 size_type __cap = capacity();2523 size_type __cap = capacity();
...@@ -2596,7 +2602,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t...@@ -2596,7 +2602,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
2596 {2602 {
2597 if (__n)2603 if (__n)
2598 {2604 {
2599 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());2605 value_type* __p = _VSTD::__to_address(__get_pointer());
2600 size_type __n_move = __sz - __pos;2606 size_type __n_move = __sz - __pos;
2601 if (__n_move != 0)2607 if (__n_move != 0)
2602 {2608 {
...@@ -2628,7 +2634,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n...@@ -2628,7 +2634,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
2628 value_type* __p;2634 value_type* __p;
2629 if (__cap - __sz >= __n)2635 if (__cap - __sz >= __n)
2630 {2636 {
2631 __p = _VSTD::__to_raw_pointer(__get_pointer());2637 __p = _VSTD::__to_address(__get_pointer());
2632 size_type __n_move = __sz - __pos;2638 size_type __n_move = __sz - __pos;
2633 if (__n_move != 0)2639 if (__n_move != 0)
2634 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);2640 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
...@@ -2636,7 +2642,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n...@@ -2636,7 +2642,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
2636 else2642 else
2637 {2643 {
2638 __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);2644 __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
2639 __p = _VSTD::__to_raw_pointer(__get_long_pointer());2645 __p = _VSTD::__to_address(__get_long_pointer());
2640 }2646 }
2641 traits_type::assign(__p + __pos, __n, __c);2647 traits_type::assign(__p + __pos, __n, __c);
2642 __sz += __n;2648 __sz += __n;
...@@ -2650,7 +2656,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2650,7 +2656,7 @@ template <class _CharT, class _Traits, class _Allocator>
2650template<class _InputIterator>2656template<class _InputIterator>
2651typename enable_if2657typename enable_if
2652<2658<
2653 __is_exactly_input_iterator<_InputIterator>::value2659 __is_exactly_cpp17_input_iterator<_InputIterator>::value
2654 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,2660 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
2655 typename basic_string<_CharT, _Traits, _Allocator>::iterator2661 typename basic_string<_CharT, _Traits, _Allocator>::iterator
2656>::type2662>::type
...@@ -2669,7 +2675,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2669,7 +2675,7 @@ template <class _CharT, class _Traits, class _Allocator>
2669template<class _ForwardIterator>2675template<class _ForwardIterator>
2670typename enable_if2676typename enable_if
2671<2677<
2672 __is_forward_iterator<_ForwardIterator>::value2678 __is_cpp17_forward_iterator<_ForwardIterator>::value
2673 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,2679 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
2674 typename basic_string<_CharT, _Traits, _Allocator>::iterator2680 typename basic_string<_CharT, _Traits, _Allocator>::iterator
2675>::type2681>::type
...@@ -2697,7 +2703,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward...@@ -2697,7 +2703,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
2697 value_type* __p;2703 value_type* __p;
2698 if (__cap - __sz >= __n)2704 if (__cap - __sz >= __n)
2699 {2705 {
2700 __p = _VSTD::__to_raw_pointer(__get_pointer());2706 __p = _VSTD::__to_address(__get_pointer());
2701 size_type __n_move = __sz - __ip;2707 size_type __n_move = __sz - __ip;
2702 if (__n_move != 0)2708 if (__n_move != 0)
2703 traits_type::move(__p + __ip + __n, __p + __ip, __n_move);2709 traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
...@@ -2705,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward...@@ -2705,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
2705 else2711 else
2706 {2712 {
2707 __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);2713 __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
2708 __p = _VSTD::__to_raw_pointer(__get_long_pointer());2714 __p = _VSTD::__to_address(__get_long_pointer());
2709 }2715 }
2710 __sz += __n;2716 __sz += __n;
2711 __set_size(__sz);2717 __set_size(__sz);
...@@ -2771,11 +2777,11 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty...@@ -2771,11 +2777,11 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
2771 if (__cap == __sz)2777 if (__cap == __sz)
2772 {2778 {
2773 __grow_by(__cap, 1, __sz, __ip, 0, 1);2779 __grow_by(__cap, 1, __sz, __ip, 0, 1);
2774 __p = _VSTD::__to_raw_pointer(__get_long_pointer());2780 __p = _VSTD::__to_address(__get_long_pointer());
2775 }2781 }
2776 else2782 else
2777 {2783 {
2778 __p = _VSTD::__to_raw_pointer(__get_pointer());2784 __p = _VSTD::__to_address(__get_pointer());
2779 size_type __n_move = __sz - __ip;2785 size_type __n_move = __sz - __ip;
2780 if (__n_move != 0)2786 if (__n_move != 0)
2781 traits_type::move(__p + __ip + 1, __p + __ip, __n_move);2787 traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
...@@ -2816,7 +2822,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __...@@ -2816,7 +2822,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
2816 size_type __cap = capacity();2822 size_type __cap = capacity();
2817 if (__cap - __sz + __n1 >= __n2)2823 if (__cap - __sz + __n1 >= __n2)
2818 {2824 {
2819 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());2825 value_type* __p = _VSTD::__to_address(__get_pointer());
2820 if (__n1 != __n2)2826 if (__n1 != __n2)
2821 {2827 {
2822 size_type __n_move = __sz - __pos - __n1;2828 size_type __n_move = __sz - __pos - __n1;
...@@ -2871,7 +2877,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __...@@ -2871,7 +2877,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
2871 value_type* __p;2877 value_type* __p;
2872 if (__cap - __sz + __n1 >= __n2)2878 if (__cap - __sz + __n1 >= __n2)
2873 {2879 {
2874 __p = _VSTD::__to_raw_pointer(__get_pointer());2880 __p = _VSTD::__to_address(__get_pointer());
2875 if (__n1 != __n2)2881 if (__n1 != __n2)
2876 {2882 {
2877 size_type __n_move = __sz - __pos - __n1;2883 size_type __n_move = __sz - __pos - __n1;
...@@ -2882,7 +2888,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __...@@ -2882,7 +2888,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
2882 else2888 else
2883 {2889 {
2884 __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);2890 __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
2885 __p = _VSTD::__to_raw_pointer(__get_long_pointer());2891 __p = _VSTD::__to_address(__get_long_pointer());
2886 }2892 }
2887 traits_type::assign(__p + __pos, __n2, __c);2893 traits_type::assign(__p + __pos, __n2, __c);
2888 __sz += __n2 - __n1;2894 __sz += __n2 - __n1;
...@@ -2896,7 +2902,7 @@ template <class _CharT, class _Traits, class _Allocator>...@@ -2896,7 +2902,7 @@ template <class _CharT, class _Traits, class _Allocator>
2896template<class _InputIterator>2902template<class _InputIterator>
2897typename enable_if2903typename enable_if
2898<2904<
2899 __is_input_iterator<_InputIterator>::value,2905 __is_cpp17_input_iterator<_InputIterator>::value,
2900 basic_string<_CharT, _Traits, _Allocator>&2906 basic_string<_CharT, _Traits, _Allocator>&
2901>::type2907>::type
2902basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,2908basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
...@@ -2994,7 +3000,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)...@@ -2994,7 +3000,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
2994 this->__throw_out_of_range();3000 this->__throw_out_of_range();
2995 if (__n)3001 if (__n)
2996 {3002 {
2997 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());3003 value_type* __p = _VSTD::__to_address(__get_pointer());
2998 __n = _VSTD::min(__n, __sz - __pos);3004 __n = _VSTD::min(__n, __sz - __pos);
2999 size_type __n_move = __sz - __pos - __n;3005 size_type __n_move = __sz - __pos - __n;
3000 if (__n_move != 0)3006 if (__n_move != 0)
...@@ -3182,8 +3188,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)...@@ -3182,8 +3188,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
3182 __was_long = __is_long();3188 __was_long = __is_long();
3183 __p = __get_pointer();3189 __p = __get_pointer();
3184 }3190 }
3185 traits_type::copy(_VSTD::__to_raw_pointer(__new_data),3191 traits_type::copy(_VSTD::__to_address(__new_data),
3186 _VSTD::__to_raw_pointer(__p), size()+1);3192 _VSTD::__to_address(__p), size()+1);
3187 if (__was_long)3193 if (__was_long)
3188 __alloc_traits::deallocate(__alloc(), __p, __cap+1);3194 __alloc_traits::deallocate(__alloc(), __p, __cap+1);
3189 if (__now_long)3195 if (__now_long)
...@@ -4294,23 +4300,23 @@ template<class _CharT, class _Traits, class _Allocator>...@@ -4294,23 +4300,23 @@ template<class _CharT, class _Traits, class _Allocator>
4294bool4300bool
4295basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const4301basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const
4296{4302{
4297 return this->data() <= _VSTD::__to_raw_pointer(__i->base()) &&4303 return this->data() <= _VSTD::__to_address(__i->base()) &&
4298 _VSTD::__to_raw_pointer(__i->base()) < this->data() + this->size();4304 _VSTD::__to_address(__i->base()) < this->data() + this->size();
4299}4305}
43004306
4301template<class _CharT, class _Traits, class _Allocator>4307template<class _CharT, class _Traits, class _Allocator>
4302bool4308bool
4303basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const4309basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const
4304{4310{
4305 return this->data() < _VSTD::__to_raw_pointer(__i->base()) &&4311 return this->data() < _VSTD::__to_address(__i->base()) &&
4306 _VSTD::__to_raw_pointer(__i->base()) <= this->data() + this->size();4312 _VSTD::__to_address(__i->base()) <= this->data() + this->size();
4307}4313}
43084314
4309template<class _CharT, class _Traits, class _Allocator>4315template<class _CharT, class _Traits, class _Allocator>
4310bool4316bool
4311basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const4317basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
4312{4318{
4313 const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;4319 const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
4314 return this->data() <= __p && __p <= this->data() + this->size();4320 return this->data() <= __p && __p <= this->data() + this->size();
4315}4321}
43164322
...@@ -4318,7 +4324,7 @@ template<class _CharT, class _Traits, class _Allocator>...@@ -4318,7 +4324,7 @@ template<class _CharT, class _Traits, class _Allocator>
4318bool4324bool
4319basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const4325basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
4320{4326{
4321 const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;4327 const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
4322 return this->data() <= __p && __p < this->data() + this->size();4328 return this->data() <= __p && __p < this->data() + this->size();
4323}4329}
43244330
lib/libcxx/include/string_view+8-1
...@@ -173,6 +173,7 @@ namespace std {...@@ -173,6 +173,7 @@ namespace std {
173173
174#include <__config>174#include <__config>
175#include <__string>175#include <__string>
176#include <iosfwd>
176#include <algorithm>177#include <algorithm>
177#include <iterator>178#include <iterator>
178#include <limits>179#include <limits>
...@@ -235,7 +236,7 @@ public:...@@ -235,7 +236,7 @@ public:
235236
236 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY237 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
237 basic_string_view(const _CharT* __s)238 basic_string_view(const _CharT* __s)
238 : __data(__s), __size(_Traits::length(__s)) {}239 : __data(__s), __size(std::__char_traits_length_checked<_Traits>(__s)) {}
239240
240 // [string.view.iterators], iterators241 // [string.view.iterators], iterators
241 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY242 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
...@@ -767,6 +768,12 @@ bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type...@@ -767,6 +768,12 @@ bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type
767 return __lhs.compare(__rhs) >= 0;768 return __lhs.compare(__rhs) >= 0;
768}769}
769770
771
772template<class _CharT, class _Traits>
773basic_ostream<_CharT, _Traits>&
774operator<<(basic_ostream<_CharT, _Traits>& __os,
775 basic_string_view<_CharT, _Traits> __str);
776
770typedef basic_string_view<char> string_view;777typedef basic_string_view<char> string_view;
771#ifndef _LIBCPP_NO_HAS_CHAR8_T778#ifndef _LIBCPP_NO_HAS_CHAR8_T
772typedef basic_string_view<char8_t> u8string_view;779typedef basic_string_view<char8_t> u8string_view;
lib/libcxx/include/support/android/locale_bionic.h+2
...@@ -27,7 +27,9 @@ extern "C" {...@@ -27,7 +27,9 @@ extern "C" {
2727
28#include <android/api-level.h>28#include <android/api-level.h>
29#include <android/ndk-version.h>29#include <android/ndk-version.h>
30#if __ANDROID_API__ < 21
30#include <support/xlocale/__posix_l_fallback.h>31#include <support/xlocale/__posix_l_fallback.h>
32#endif
31// In NDK versions later than 16, locale-aware functions are provided by33// In NDK versions later than 16, locale-aware functions are provided by
32// legacy_stdlib_inlines.h34// legacy_stdlib_inlines.h
33#if __NDK_MAJOR__ <= 1635#if __NDK_MAJOR__ <= 16
lib/libcxx/include/support/ibm/xlocale.h+3-3
...@@ -87,7 +87,7 @@ int isxdigit_l(int c, locale_t locale)...@@ -87,7 +87,7 @@ int isxdigit_l(int c, locale_t locale)
87static inline87static inline
88int iswalnum_l(wchar_t wc, locale_t locale)88int iswalnum_l(wchar_t wc, locale_t locale)
89{89{
90 return __xiswalnum(locale, wc); 90 return __xiswalnum(locale, wc);
91}91}
9292
93static inline93static inline
...@@ -159,7 +159,7 @@ int iswxdigit_l(wchar_t wc, locale_t locale)...@@ -159,7 +159,7 @@ int iswxdigit_l(wchar_t wc, locale_t locale)
159static inline159static inline
160int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)160int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
161{161{
162 return __xiswctype(locale, wc, desc); 162 return __xiswctype(locale, wc, desc);
163}163}
164164
165static inline165static inline
...@@ -261,7 +261,7 @@ int vasprintf(char **strp, const char *fmt, va_list ap)...@@ -261,7 +261,7 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
261 str_size = vsnprintf(*strp, str_size + 1, fmt, ap);261 str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
262 }262 }
263 return str_size;263 return str_size;
264} 264}
265265
266#ifdef __cplusplus266#ifdef __cplusplus
267}267}
lib/libcxx/include/support/solaris/wchar.h+1-1
...@@ -26,7 +26,7 @@...@@ -26,7 +26,7 @@
26#define wctype sun_wctype26#define wctype sun_wctype
27#define _WCHAR_T 127#define _WCHAR_T 1
28#include_next "wchar.h"28#include_next "wchar.h"
29#undef iswalpha 29#undef iswalpha
30#undef iswupper30#undef iswupper
31#undef iswlower31#undef iswlower
32#undef iswdigit32#undef iswdigit
lib/libcxx/include/support/win32/locale_win32.h+71-5
...@@ -28,14 +28,72 @@...@@ -28,14 +28,72 @@
28 | LC_NUMERIC_MASK \28 | LC_NUMERIC_MASK \
29 | LC_TIME_MASK )29 | LC_TIME_MASK )
3030
31class __lconv_storage {
32public:
33 __lconv_storage(const lconv *__lc_input) {
34 __lc = *__lc_input;
35
36 __decimal_point = __lc_input->decimal_point;
37 __thousands_sep = __lc_input->thousands_sep;
38 __grouping = __lc_input->grouping;
39 __int_curr_symbol = __lc_input->int_curr_symbol;
40 __currency_symbol = __lc_input->currency_symbol;
41 __mon_decimal_point = __lc_input->mon_decimal_point;
42 __mon_thousands_sep = __lc_input->mon_thousands_sep;
43 __mon_grouping = __lc_input->mon_grouping;
44 __positive_sign = __lc_input->positive_sign;
45 __negative_sign = __lc_input->negative_sign;
46
47 __lc.decimal_point = const_cast<char *>(__decimal_point.c_str());
48 __lc.thousands_sep = const_cast<char *>(__thousands_sep.c_str());
49 __lc.grouping = const_cast<char *>(__grouping.c_str());
50 __lc.int_curr_symbol = const_cast<char *>(__int_curr_symbol.c_str());
51 __lc.currency_symbol = const_cast<char *>(__currency_symbol.c_str());
52 __lc.mon_decimal_point = const_cast<char *>(__mon_decimal_point.c_str());
53 __lc.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep.c_str());
54 __lc.mon_grouping = const_cast<char *>(__mon_grouping.c_str());
55 __lc.positive_sign = const_cast<char *>(__positive_sign.c_str());
56 __lc.negative_sign = const_cast<char *>(__negative_sign.c_str());
57 }
58
59 lconv *__get() {
60 return &__lc;
61 }
62private:
63 lconv __lc;
64 std::string __decimal_point;
65 std::string __thousands_sep;
66 std::string __grouping;
67 std::string __int_curr_symbol;
68 std::string __currency_symbol;
69 std::string __mon_decimal_point;
70 std::string __mon_thousands_sep;
71 std::string __mon_grouping;
72 std::string __positive_sign;
73 std::string __negative_sign;
74};
75
31class locale_t {76class locale_t {
32public:77public:
33 locale_t()78 locale_t()
34 : __locale(nullptr), __locale_str(nullptr) {}79 : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {}
35 locale_t(std::nullptr_t)80 locale_t(std::nullptr_t)
36 : __locale(nullptr), __locale_str(nullptr) {}81 : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {}
37 locale_t(_locale_t __xlocale, const char* __xlocale_str)82 locale_t(_locale_t __xlocale, const char* __xlocale_str)
38 : __locale(__xlocale), __locale_str(__xlocale_str) {}83 : __locale(__xlocale), __locale_str(__xlocale_str), __lc(nullptr) {}
84 locale_t(const locale_t &__l)
85 : __locale(__l.__locale), __locale_str(__l.__locale_str), __lc(nullptr) {}
86
87 ~locale_t() {
88 delete __lc;
89 }
90
91 locale_t &operator =(const locale_t &__l) {
92 __locale = __l.__locale;
93 __locale_str = __l.__locale_str;
94 // __lc not copied
95 return *this;
96 }
3997
40 friend bool operator==(const locale_t& __left, const locale_t& __right) {98 friend bool operator==(const locale_t& __left, const locale_t& __right) {
41 return __left.__locale == __right.__locale;99 return __left.__locale == __right.__locale;
...@@ -94,9 +152,16 @@ public:...@@ -94,9 +152,16 @@ public:
94 operator _locale_t() const {152 operator _locale_t() const {
95 return __locale;153 return __locale;
96 }154 }
155
156 lconv *__store_lconv(const lconv *__input_lc) {
157 delete __lc;
158 __lc = new __lconv_storage(__input_lc);
159 return __lc->__get();
160 }
97private:161private:
98 _locale_t __locale;162 _locale_t __locale;
99 const char* __locale_str;163 const char* __locale_str;
164 __lconv_storage *__lc = nullptr;
100};165};
101166
102// Locale management functions167// Locale management functions
...@@ -109,7 +174,7 @@ locale_t newlocale( int mask, const char * locale, locale_t base );...@@ -109,7 +174,7 @@ locale_t newlocale( int mask, const char * locale, locale_t base );
109// We can still implement raii even without uselocale though.174// We can still implement raii even without uselocale though.
110175
111176
112lconv *localeconv_l( locale_t loc );177lconv *localeconv_l( locale_t &loc );
113size_t mbrlen_l( const char *__restrict s, size_t n,178size_t mbrlen_l( const char *__restrict s, size_t n,
114 mbstate_t *__restrict ps, locale_t loc);179 mbstate_t *__restrict ps, locale_t loc);
115size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,180size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
...@@ -173,7 +238,8 @@ isupper_l(int c, _locale_t loc)...@@ -173,7 +238,8 @@ isupper_l(int c, _locale_t loc)
173#define towupper_l _towupper_l238#define towupper_l _towupper_l
174#define towlower_l _towlower_l239#define towlower_l _towlower_l
175#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800240#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
176#define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm )241_LIBCPP_FUNC_VIS size_t strftime_l(char *ret, size_t n, const char *format,
242 const struct tm *tm, locale_t loc);
177#else243#else
178#define strftime_l _strftime_l244#define strftime_l _strftime_l
179#endif245#endif
lib/libcxx/include/thread+1-4
...@@ -14,8 +14,6 @@...@@ -14,8 +14,6 @@
1414
15 thread synopsis15 thread synopsis
1616
17#define __STDCPP_THREADS__ __cplusplus
18
19namespace std17namespace std
20{18{
2119
...@@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);...@@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
107_LIBCPP_PUSH_MACROS105_LIBCPP_PUSH_MACROS
108#include <__undef_macros>106#include <__undef_macros>
109107
110#define __STDCPP_THREADS__ __cplusplus
111
112#ifdef _LIBCPP_HAS_NO_THREADS108#ifdef _LIBCPP_HAS_NO_THREADS
113#error <thread> is not supported on this single threaded system109#error <thread> is not supported on this single threaded system
114#else // !_LIBCPP_HAS_NO_THREADS110#else // !_LIBCPP_HAS_NO_THREADS
...@@ -278,6 +274,7 @@ __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)...@@ -278,6 +274,7 @@ __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
278}274}
279275
280template <class _Fp>276template <class _Fp>
277_LIBCPP_INLINE_VISIBILITY
281void* __thread_proxy(void* __vp)278void* __thread_proxy(void* __vp)
282{279{
283 // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...>280 // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...>
lib/libcxx/include/tuple+84-45
...@@ -19,40 +19,40 @@ namespace std...@@ -19,40 +19,40 @@ namespace std
19template <class... T>19template <class... T>
20class tuple {20class tuple {
21public:21public:
22 constexpr tuple();22 explicit(see-below) constexpr tuple();
23 explicit tuple(const T&...); // constexpr in C++1423 explicit(see-below) tuple(const T&...); // constexpr in C++14
24 template <class... U>24 template <class... U>
25 explicit tuple(U&&...); // constexpr in C++1425 explicit(see-below) tuple(U&&...); // constexpr in C++14
26 tuple(const tuple&) = default;26 tuple(const tuple&) = default;
27 tuple(tuple&&) = default;27 tuple(tuple&&) = default;
28 template <class... U>28 template <class... U>
29 tuple(const tuple<U...>&); // constexpr in C++1429 explicit(see-below) tuple(const tuple<U...>&); // constexpr in C++14
30 template <class... U>30 template <class... U>
31 tuple(tuple<U...>&&); // constexpr in C++1431 explicit(see-below) tuple(tuple<U...>&&); // constexpr in C++14
32 template <class U1, class U2>32 template <class U1, class U2>
33 tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++1433 explicit(see-below) tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
34 template <class U1, class U2>34 template <class U1, class U2>
35 tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++1435 explicit(see-below) tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
3636
37 // allocator-extended constructors37 // allocator-extended constructors
38 template <class Alloc>38 template <class Alloc>
39 tuple(allocator_arg_t, const Alloc& a);39 tuple(allocator_arg_t, const Alloc& a);
40 template <class Alloc>40 template <class Alloc>
41 tuple(allocator_arg_t, const Alloc& a, const T&...);41 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...);
42 template <class Alloc, class... U>42 template <class Alloc, class... U>
43 tuple(allocator_arg_t, const Alloc& a, U&&...);43 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...);
44 template <class Alloc>44 template <class Alloc>
45 tuple(allocator_arg_t, const Alloc& a, const tuple&);45 tuple(allocator_arg_t, const Alloc& a, const tuple&);
46 template <class Alloc>46 template <class Alloc>
47 tuple(allocator_arg_t, const Alloc& a, tuple&&);47 tuple(allocator_arg_t, const Alloc& a, tuple&&);
48 template <class Alloc, class... U>48 template <class Alloc, class... U>
49 tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&);49 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&);
50 template <class Alloc, class... U>50 template <class Alloc, class... U>
51 tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&);51 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&);
52 template <class Alloc, class U1, class U2>52 template <class Alloc, class U1, class U2>
53 tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);53 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
54 template <class Alloc, class U1, class U2>54 template <class Alloc, class U1, class U2>
55 tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);55 explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
5656
57 tuple& operator=(const tuple&);57 tuple& operator=(const tuple&);
58 tuple&58 tuple&
...@@ -69,6 +69,17 @@ public:...@@ -69,6 +69,17 @@ public:
69 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));69 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
70};70};
7171
72template <class ...T>
73tuple(T...) -> tuple<T...>; // since C++17
74template <class T1, class T2>
75tuple(pair<T1, T2>) -> tuple<T1, T2>; // since C++17
76template <class Alloc, class ...T>
77tuple(allocator_arg_t, Alloc, T...) -> tuple<T...>; // since C++17
78template <class Alloc, class T1, class T2>
79tuple(allocator_arg_t, Alloc, pair<T1, T2>) -> tuple<T1, T2>; // since C++17
80template <class Alloc, class ...T>
81tuple(allocator_arg_t, Alloc, tuple<T...>) -> tuple<T...>; // since C++17
82
72inline constexpr unspecified ignore;83inline constexpr unspecified ignore;
7384
74template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++1485template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
...@@ -488,11 +499,19 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -488,11 +499,19 @@ class _LIBCPP_TEMPLATE_VIS tuple
488 template <class _Dummy>499 template <class _Dummy>
489 struct _CheckArgsConstructor<true, _Dummy>500 struct _CheckArgsConstructor<true, _Dummy>
490 {501 {
491 template <class ..._Args>502 template <int&...>
492 static constexpr bool __enable_default() {503 static constexpr bool __enable_implicit_default() {
493 return __all<is_default_constructible<_Args>::value...>::value;504 return __all<__is_implicitly_default_constructible<_Tp>::value... >::value;
505 }
506
507 template <int&...>
508 static constexpr bool __enable_explicit_default() {
509 return
510 __all<is_default_constructible<_Tp>::value...>::value &&
511 !__enable_implicit_default< >();
494 }512 }
495513
514
496 template <class ..._Args>515 template <class ..._Args>
497 static constexpr bool __enable_explicit() {516 static constexpr bool __enable_explicit() {
498 return517 return
...@@ -630,22 +649,26 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -630,22 +649,26 @@ class _LIBCPP_TEMPLATE_VIS tuple
630 const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;649 const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
631public:650public:
632651
633 template <bool _Dummy = true, class = typename enable_if<652 template <bool _Dummy = true, _EnableIf<
634 _CheckArgsConstructor<_Dummy>::template __enable_default<_Tp...>()653 _CheckArgsConstructor<_Dummy>::__enable_implicit_default()
635 >::type>654 , void*> = nullptr>
636 _LIBCPP_INLINE_VISIBILITY655 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
637 _LIBCPP_CONSTEXPR tuple()656 tuple()
657 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
658
659 template <bool _Dummy = true, _EnableIf<
660 _CheckArgsConstructor<_Dummy>::__enable_explicit_default()
661 , void*> = nullptr>
662 explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
663 tuple()
638 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}664 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
639665
640 tuple(tuple const&) = default;666 tuple(tuple const&) = default;
641 tuple(tuple&&) = default;667 tuple(tuple&&) = default;
642668
643 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf<669 template <class _AllocArgT, class _Alloc, _EnableIf<
644 _And<670 _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value >::__enable_implicit_default()
645 _IsSame<allocator_arg_t, _AllocArgT>,671 , void*> = nullptr
646 __dependent_type<is_default_constructible<_Tp>, _Dummy>...
647 >::value
648 >
649 >672 >
650 _LIBCPP_INLINE_VISIBILITY673 _LIBCPP_INLINE_VISIBILITY
651 tuple(_AllocArgT, _Alloc const& __a)674 tuple(_AllocArgT, _Alloc const& __a)
...@@ -654,6 +677,17 @@ public:...@@ -654,6 +677,17 @@ public:
654 typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),677 typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
655 __tuple_types<_Tp...>()) {}678 __tuple_types<_Tp...>()) {}
656679
680 template <class _AllocArgT, class _Alloc, _EnableIf<
681 _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value>::__enable_explicit_default()
682 , void*> = nullptr
683 >
684 explicit _LIBCPP_INLINE_VISIBILITY
685 tuple(_AllocArgT, _Alloc const& __a)
686 : __base_(allocator_arg_t(), __a,
687 __tuple_indices<>(), __tuple_types<>(),
688 typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
689 __tuple_types<_Tp...>()) {}
690
657 template <bool _Dummy = true,691 template <bool _Dummy = true,
658 typename enable_if692 typename enable_if
659 <693 <
...@@ -943,13 +977,16 @@ public:...@@ -943,13 +977,16 @@ public:
943};977};
944978
945#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES979#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
946// NOTE: These are not yet standardized, but are required to simulate the980template <class ..._Tp>
947// implicit deduction guide that should be generated had libc++ declared the981tuple(_Tp...) -> tuple<_Tp...>;
948// tuple-like constructors "correctly"982template <class _Tp1, class _Tp2>
949template <class _Alloc, class ..._Args>983tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
950tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>;984template <class _Alloc, class ..._Tp>
951template <class _Alloc, class ..._Args>985tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>;
952tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;986template <class _Alloc, class _Tp1, class _Tp2>
987tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
988template <class _Alloc, class ..._Tp>
989tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
953#endif990#endif
954991
955template <class ..._Tp>992template <class ..._Tp>
...@@ -1312,8 +1349,9 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J...@@ -1312,8 +1349,9 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
1312 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type1349 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
1313 operator()(tuple<_Types...> __t, _Tuple0&& __t0)1350 operator()(tuple<_Types...> __t, _Tuple0&& __t0)
1314 {1351 {
1315 return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,1352 return _VSTD::forward_as_tuple(
1316 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);1353 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1354 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
1317 }1355 }
13181356
1319 template <class _Tuple0, class _Tuple1, class ..._Tuples>1357 template <class _Tuple0, class _Tuple1, class ..._Tuples>
...@@ -1324,15 +1362,16 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J...@@ -1324,15 +1362,16 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
1324 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;1362 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
1325 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;1363 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;
1326 return __tuple_cat<1364 return __tuple_cat<
1327 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,1365 tuple<_Types...,
1328 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,1366 typename __apply_cv<_Tuple0, typename tuple_element<
1329 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()1367 _J0, _T0>::type>::type&&...>,
1330 (forward_as_tuple(1368 typename __make_tuple_indices<sizeof...(_Types) +
1331 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,1369 tuple_size<_T0>::value>::type,
1332 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...1370 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
1333 ),1371 _VSTD::forward_as_tuple(
1334 _VSTD::forward<_Tuple1>(__t1),1372 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1335 _VSTD::forward<_Tuples>(__tpls)...);1373 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...),
1374 _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...);
1336 }1375 }
1337};1376};
13381377
lib/libcxx/include/type_traits+105-89
...@@ -427,7 +427,6 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;...@@ -427,7 +427,6 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
427template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;427template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
428template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;428template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
429429
430
431template <class _Tp, _Tp __v>430template <class _Tp, _Tp __v>
432struct _LIBCPP_TEMPLATE_VIS integral_constant431struct _LIBCPP_TEMPLATE_VIS integral_constant
433{432{
...@@ -509,8 +508,8 @@ struct _Lazy : _Func<_Args...> {};...@@ -509,8 +508,8 @@ struct _Lazy : _Func<_Args...> {};
509508
510// Member detector base509// Member detector base
511510
512template <template <class...> class _Templ, class ..._Args>511template <template <class...> class _Templ, class ..._Args, class = _Templ<_Args...> >
513true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >);512true_type __sfinae_test_impl(int);
514template <template <class...> class, class ...>513template <template <class...> class, class ...>
515false_type __sfinae_test_impl(...);514false_type __sfinae_test_impl(...);
516515
...@@ -526,6 +525,7 @@ struct __identity { typedef _Tp type; };...@@ -526,6 +525,7 @@ struct __identity { typedef _Tp type; };
526template <class _Tp, bool>525template <class _Tp, bool>
527struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};526struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};
528527
528
529template <bool _Bp, class _If, class _Then>529template <bool _Bp, class _If, class _Then>
530 struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};530 struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
531template <class _If, class _Then>531template <class _If, class _Then>
...@@ -570,6 +570,17 @@ using _IsNotSame = _BoolConstant<...@@ -570,6 +570,17 @@ using _IsNotSame = _BoolConstant<
570 !_VSTD::is_same<_Tp, _Up>::value570 !_VSTD::is_same<_Tp, _Up>::value
571#endif571#endif
572>;572>;
573
574
575template <class _Tp>
576using __test_for_primary_template = _EnableIf<
577 _IsSame<_Tp, typename _Tp::__primary_template>::value
578 >;
579template <class _Tp>
580using __is_primary_template = _IsValidExpansion<
581 __test_for_primary_template, _Tp
582 >;
583
573// addressof584// addressof
574#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF585#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
575586
...@@ -720,7 +731,7 @@ template <class _Tp>...@@ -720,7 +731,7 @@ template <class _Tp>
720_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_null_pointer_v731_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_null_pointer_v
721 = is_null_pointer<_Tp>::value;732 = is_null_pointer<_Tp>::value;
722#endif733#endif
723#endif734#endif // _LIBCPP_STD_VER > 11
724735
725// is_integral736// is_integral
726737
...@@ -886,28 +897,15 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v...@@ -886,28 +897,15 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v
886897
887// is_function898// is_function
888899
889namespace __libcpp_is_function_imp
890{
891struct __dummy_type {};
892template <class _Tp> char __test(_Tp*);
893template <class _Tp> char __test(__dummy_type);
894template <class _Tp> __two __test(...);
895template <class _Tp> _Tp& __source(int);
896template <class _Tp> __dummy_type __source(...);
897}
898
899template <class _Tp, bool = is_class<_Tp>::value ||
900 is_union<_Tp>::value ||
901 is_void<_Tp>::value ||
902 is_reference<_Tp>::value ||
903 __is_nullptr_t<_Tp>::value >
904struct __libcpp_is_function
905 : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1>
906 {};
907template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
908
909template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function900template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function
910 : public __libcpp_is_function<_Tp> {};901 : public _BoolConstant<
902#ifdef __clang__
903 __is_function(_Tp)
904#else
905 !(is_reference<_Tp>::value || is_const<const _Tp>::value)
906#endif
907 > {};
908
911909
912#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)910#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
913template <class _Tp>911template <class _Tp>
...@@ -915,27 +913,24 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_function_v...@@ -915,27 +913,24 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_function_v
915 = is_function<_Tp>::value;913 = is_function<_Tp>::value;
916#endif914#endif
917915
918// is_member_function_pointer916template <class _Tp> struct __libcpp_is_member_pointer {
919917 enum {
920// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};918 __is_member = false,
921// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};919 __is_func = false,
922//920 __is_obj = false
923921 };
924template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>922};
925struct __member_pointer_traits_imp923template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> {
926{ // forward declaration; specializations later924 enum {
925 __is_member = true,
926 __is_func = is_function<_Tp>::value,
927 __is_obj = !__is_func,
928 };
927};929};
928930
929931
930template <class _Tp> struct __libcpp_is_member_function_pointer
931 : public false_type {};
932
933template <class _Ret, class _Class>
934struct __libcpp_is_member_function_pointer<_Ret _Class::*>
935 : public is_function<_Ret> {};
936
937template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer932template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
938 : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};933 : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {};
939934
940#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)935#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
941template <class _Tp>936template <class _Tp>
...@@ -945,11 +940,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v...@@ -945,11 +940,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
945940
946// is_member_pointer941// is_member_pointer
947942
948template <class _Tp> struct __libcpp_is_member_pointer : public false_type {};
949template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {};
950
951template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer943template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer
952 : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};944 : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {};
953945
954#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)946#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
955template <class _Tp>947template <class _Tp>
...@@ -960,8 +952,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v...@@ -960,8 +952,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v
960// is_member_object_pointer952// is_member_object_pointer
961953
962template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer954template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
963 : public integral_constant<bool, is_member_pointer<_Tp>::value &&955 : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {};
964 !is_member_function_pointer<_Tp>::value> {};
965956
966#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)957#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
967template <class _Tp>958template <class _Tp>
...@@ -1080,16 +1071,9 @@ struct __is_referenceable : integral_constant<bool,...@@ -1080,16 +1071,9 @@ struct __is_referenceable : integral_constant<bool,
10801071
1081// add_const1072// add_const
10821073
1083template <class _Tp, bool = is_reference<_Tp>::value ||1074template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const {
1084 is_function<_Tp>::value ||1075 typedef _LIBCPP_NODEBUG_TYPE const _Tp type;
1085 is_const<_Tp>::value >1076};
1086struct __add_const {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1087
1088template <class _Tp>
1089struct __add_const<_Tp, false> {typedef _LIBCPP_NODEBUG_TYPE const _Tp type;};
1090
1091template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
1092 {typedef _LIBCPP_NODEBUG_TYPE typename __add_const<_Tp>::type type;};
10931077
1094#if _LIBCPP_STD_VER > 111078#if _LIBCPP_STD_VER > 11
1095template <class _Tp> using add_const_t = typename add_const<_Tp>::type;1079template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
...@@ -1097,25 +1081,18 @@ template <class _Tp> using add_const_t = typename add_const<_Tp>::type;...@@ -1097,25 +1081,18 @@ template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
10971081
1098// add_volatile1082// add_volatile
10991083
1100template <class _Tp, bool = is_reference<_Tp>::value ||1084template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile {
1101 is_function<_Tp>::value ||1085 typedef _LIBCPP_NODEBUG_TYPE volatile _Tp type;
1102 is_volatile<_Tp>::value >1086};
1103struct __add_volatile {typedef _Tp type;};
1104
1105template <class _Tp>
1106struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
1107
1108template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile
1109 {typedef _LIBCPP_NODEBUG_TYPE typename __add_volatile<_Tp>::type type;};
11101087
1111#if _LIBCPP_STD_VER > 111088#if _LIBCPP_STD_VER > 11
1112template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;1089template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
1113#endif1090#endif
11141091
1115// add_cv1092// add_cv
11161093template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv {
1117template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv1094 typedef _LIBCPP_NODEBUG_TYPE const volatile _Tp type;
1118 {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;};1095};
11191096
1120#if _LIBCPP_STD_VER > 111097#if _LIBCPP_STD_VER > 11
1121template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;1098template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
...@@ -1153,8 +1130,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference...@@ -1153,8 +1130,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
1153template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;1130template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
1154#endif1131#endif
11551132
1133// Suppress deprecation notice for volatile-qualified return type resulting
1134// from volatile-qualified types _Tp.
1135_LIBCPP_SUPPRESS_DEPRECATED_PUSH
1156template <class _Tp> _Tp&& __declval(int);1136template <class _Tp> _Tp&& __declval(int);
1157template <class _Tp> _Tp __declval(long);1137template <class _Tp> _Tp __declval(long);
1138_LIBCPP_SUPPRESS_DEPRECATED_POP
11581139
1159template <class _Tp>1140template <class _Tp>
1160decltype(_VSTD::__declval<_Tp>(0))1141decltype(_VSTD::__declval<_Tp>(0))
...@@ -1448,8 +1429,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v...@@ -1448,8 +1429,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v
1448#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)1429#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
14491430
1450template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible1431template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
1451 : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&1432 : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
1452 !is_abstract<_T2>::value> {};
14531433
1454#else // __has_feature(is_convertible_to)1434#else // __has_feature(is_convertible_to)
14551435
...@@ -2307,6 +2287,11 @@ __decay_copy(_Tp&& __t)...@@ -2307,6 +2287,11 @@ __decay_copy(_Tp&& __t)
2307 return _VSTD::forward<_Tp>(__t);2287 return _VSTD::forward<_Tp>(__t);
2308}2288}
23092289
2290template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
2291struct __member_pointer_traits_imp
2292{
2293};
2294
2310template <class _Rp, class _Class, class ..._Param>2295template <class _Rp, class _Class, class ..._Param>
2311struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>2296struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
2312{2297{
...@@ -2836,6 +2821,30 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v...@@ -2836,6 +2821,30 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v
2836 = is_default_constructible<_Tp>::value;2821 = is_default_constructible<_Tp>::value;
2837#endif2822#endif
28382823
2824#ifndef _LIBCPP_CXX03_LANG
2825// First of all, we can't implement this check in C++03 mode because the {}
2826// default initialization syntax isn't valid.
2827// Second, we implement the trait in a funny manner with two defaulted template
2828// arguments to workaround Clang's PR43454.
2829template <class _Tp>
2830void __test_implicit_default_constructible(_Tp);
2831
2832template <class _Tp, class = void, bool = is_default_constructible<_Tp>::value>
2833struct __is_implicitly_default_constructible
2834 : false_type
2835{ };
2836
2837template <class _Tp>
2838struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true>
2839 : true_type
2840{ };
2841
2842template <class _Tp>
2843struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false>
2844 : false_type
2845{ };
2846#endif // !C++03
2847
2839// is_copy_constructible2848// is_copy_constructible
28402849
2841template <class _Tp>2850template <class _Tp>
...@@ -3681,6 +3690,13 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v...@@ -3681,6 +3690,13 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v
3681template <class _Tp> struct __is_swappable;3690template <class _Tp> struct __is_swappable;
3682template <class _Tp> struct __is_nothrow_swappable;3691template <class _Tp> struct __is_nothrow_swappable;
36833692
3693// swap, swap_ranges
3694
3695template <class _ForwardIterator1, class _ForwardIterator2>
3696inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3697_ForwardIterator2
3698swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
3699
3684template <class _Tp>3700template <class _Tp>
3685inline _LIBCPP_INLINE_VISIBILITY3701inline _LIBCPP_INLINE_VISIBILITY
3686#ifndef _LIBCPP_CXX03_LANG3702#ifndef _LIBCPP_CXX03_LANG
...@@ -3706,7 +3722,22 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17...@@ -3706,7 +3722,22 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3706typename enable_if<3722typename enable_if<
3707 __is_swappable<_Tp>::value3723 __is_swappable<_Tp>::value
3708>::type3724>::type
3709swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);3725swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
3726{
3727 _VSTD::swap_ranges(__a, __a + _Np, __b);
3728}
3729
3730template <class _ForwardIterator1, class _ForwardIterator2>
3731inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3732_ForwardIterator2
3733swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
3734{
3735 for(; __first1 != __last1; ++__first1, (void) ++__first2)
3736 swap(*__first1, *__first2);
3737 return __first2;
3738}
3739
3740// iter_swap
37103741
3711template <class _ForwardIterator1, class _ForwardIterator2>3742template <class _ForwardIterator1, class _ForwardIterator2>
3712inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX173743inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
...@@ -3985,21 +4016,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>...@@ -3985,21 +4016,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
39854016
3986#endif4017#endif
39874018
3988#if _LIBCPP_STD_VER > 17
3989enum class endian
3990{
3991 little = 0xDEAD,
3992 big = 0xFACE,
3993#if defined(_LIBCPP_LITTLE_ENDIAN)
3994 native = little
3995#elif defined(_LIBCPP_BIG_ENDIAN)
3996 native = big
3997#else
3998 native = 0xCAFE
3999#endif
4000};
4001#endif
4002
4003#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED4019#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
4004#if _LIBCPP_STD_VER > 174020#if _LIBCPP_STD_VER > 17
4005_LIBCPP_INLINE_VISIBILITY4021_LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/utility+30-33
...@@ -69,11 +69,11 @@ struct pair...@@ -69,11 +69,11 @@ struct pair
6969
70 pair(const pair&) = default;70 pair(const pair&) = default;
71 pair(pair&&) = default;71 pair(pair&&) = default;
72 constexpr pair();72 explicit(see-below) constexpr pair();
73 pair(const T1& x, const T2& y); // constexpr in C++1473 explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14
74 template <class U, class V> pair(U&& x, V&& y); // constexpr in C++1474 template <class U, class V> explicit(see-below) pair(U&& x, V&& y); // constexpr in C++14
75 template <class U, class V> pair(const pair<U, V>& p); // constexpr in C++1475 template <class U, class V> explicit(see-below) pair(const pair<U, V>& p); // constexpr in C++14
76 template <class U, class V> pair(pair<U, V>&& p); // constexpr in C++1476 template <class U, class V> explicit(see-below) pair(pair<U, V>&& p); // constexpr in C++14
77 template <class... Args1, class... Args2>77 template <class... Args1, class... Args2>
78 pair(piecewise_construct_t, tuple<Args1...> first_args,78 pair(piecewise_construct_t, tuple<Args1...> first_args,
79 tuple<Args2...> second_args);79 tuple<Args2...> second_args);
...@@ -99,7 +99,7 @@ template <class T1, class T2>...@@ -99,7 +99,7 @@ template <class T1, class T2>
99void99void
100swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));100swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
101101
102struct piecewise_construct_t { };102struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
103inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();103inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
104104
105template <class T> struct tuple_size;105template <class T> struct tuple_size;
...@@ -248,29 +248,11 @@ operator>=(const _Tp& __x, const _Tp& __y)...@@ -248,29 +248,11 @@ operator>=(const _Tp& __x, const _Tp& __y)
248248
249} // rel_ops249} // rel_ops
250250
251// swap_ranges251// swap_ranges is defined in <type_traits>`
252252
253// swap is defined in <type_traits>
253254
254template <class _ForwardIterator1, class _ForwardIterator2>255// move_if_noexcept
255inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
256_ForwardIterator2
257swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
258{
259 for(; __first1 != __last1; ++__first1, (void) ++__first2)
260 swap(*__first1, *__first2);
261 return __first2;
262}
263
264// forward declared in <type_traits>
265template<class _Tp, size_t _Np>
266inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
267typename enable_if<
268 __is_swappable<_Tp>::value
269>::type
270swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
271{
272 _VSTD::swap_ranges(__a, __a + _Np, __b);
273}
274256
275template <class _Tp>257template <class _Tp>
276inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11258inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
...@@ -294,7 +276,7 @@ template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { r...@@ -294,7 +276,7 @@ template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { r
294template <class _Tp> void as_const(const _Tp&&) = delete;276template <class _Tp> void as_const(const _Tp&&) = delete;
295#endif277#endif
296278
297struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { };279struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
298#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)280#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
299extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();281extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
300#else282#else
...@@ -352,10 +334,17 @@ struct _LIBCPP_TEMPLATE_VIS pair...@@ -352,10 +334,17 @@ struct _LIBCPP_TEMPLATE_VIS pair
352 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;334 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
353335
354 struct _CheckArgs {336 struct _CheckArgs {
355 template <class _U1, class _U2>337 template <int&...>
356 static constexpr bool __enable_default() {338 static constexpr bool __enable_explicit_default() {
357 return is_default_constructible<_U1>::value339 return is_default_constructible<_T1>::value
358 && is_default_constructible<_U2>::value;340 && is_default_constructible<_T2>::value
341 && !__enable_implicit_default<>();
342 }
343
344 template <int&...>
345 static constexpr bool __enable_implicit_default() {
346 return __is_implicitly_default_constructible<_T1>::value
347 && __is_implicitly_default_constructible<_T2>::value;
359 }348 }
360349
361 template <class _U1, class _U2>350 template <class _U1, class _U2>
...@@ -406,7 +395,15 @@ struct _LIBCPP_TEMPLATE_VIS pair...@@ -406,7 +395,15 @@ struct _LIBCPP_TEMPLATE_VIS pair
406 >::type;395 >::type;
407396
408 template<bool _Dummy = true, _EnableB<397 template<bool _Dummy = true, _EnableB<
409 _CheckArgsDep<_Dummy>::template __enable_default<_T1, _T2>()398 _CheckArgsDep<_Dummy>::__enable_explicit_default()
399 > = false>
400 explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
401 pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
402 is_nothrow_default_constructible<second_type>::value)
403 : first(), second() {}
404
405 template<bool _Dummy = true, _EnableB<
406 _CheckArgsDep<_Dummy>::__enable_implicit_default()
410 > = false>407 > = false>
411 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR408 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
412 pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&409 pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
lib/libcxx/include/valarray+7-19
...@@ -1256,6 +1256,8 @@ public:...@@ -1256,6 +1256,8 @@ public:
1256 _LIBCPP_INLINE_VISIBILITY1256 _LIBCPP_INLINE_VISIBILITY
1257 operator>>=(const _Expr& __v) const;1257 operator>>=(const _Expr& __v) const;
12581258
1259 slice_array(slice_array const&) = default;
1260
1259 _LIBCPP_INLINE_VISIBILITY1261 _LIBCPP_INLINE_VISIBILITY
1260 const slice_array& operator=(const slice_array& __sa) const;1262 const slice_array& operator=(const slice_array& __sa) const;
12611263
...@@ -1505,11 +1507,6 @@ public:...@@ -1505,11 +1507,6 @@ public:
15051507
1506#endif // _LIBCPP_CXX03_LANG1508#endif // _LIBCPP_CXX03_LANG
15071509
1508// gslice(const gslice&) = default;
1509// gslice(gslice&&) = default;
1510// gslice& operator=(const gslice&) = default;
1511// gslice& operator=(gslice&&) = default;
1512
1513 _LIBCPP_INLINE_VISIBILITY1510 _LIBCPP_INLINE_VISIBILITY
1514 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}1511 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
15151512
...@@ -1645,10 +1642,7 @@ public:...@@ -1645,10 +1642,7 @@ public:
1645 _LIBCPP_INLINE_VISIBILITY1642 _LIBCPP_INLINE_VISIBILITY
1646 void operator=(const value_type& __x) const;1643 void operator=(const value_type& __x) const;
16471644
1648// gslice_array(const gslice_array&) = default;1645 gslice_array(const gslice_array&) = default;
1649// gslice_array(gslice_array&&) = default;
1650// gslice_array& operator=(const gslice_array&) = default;
1651// gslice_array& operator=(gslice_array&&) = default;
16521646
1653private:1647private:
1654 gslice_array(const gslice& __gs, const valarray<value_type>& __v)1648 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
...@@ -1977,17 +1971,14 @@ public:...@@ -1977,17 +1971,14 @@ public:
1977 _LIBCPP_INLINE_VISIBILITY1971 _LIBCPP_INLINE_VISIBILITY
1978 operator>>=(const _Expr& __v) const;1972 operator>>=(const _Expr& __v) const;
19791973
1974 mask_array(const mask_array&) = default;
1975
1980 _LIBCPP_INLINE_VISIBILITY1976 _LIBCPP_INLINE_VISIBILITY
1981 const mask_array& operator=(const mask_array& __ma) const;1977 const mask_array& operator=(const mask_array& __ma) const;
19821978
1983 _LIBCPP_INLINE_VISIBILITY1979 _LIBCPP_INLINE_VISIBILITY
1984 void operator=(const value_type& __x) const;1980 void operator=(const value_type& __x) const;
19851981
1986// mask_array(const mask_array&) = default;
1987// mask_array(mask_array&&) = default;
1988// mask_array& operator=(const mask_array&) = default;
1989// mask_array& operator=(mask_array&&) = default;
1990
1991private:1982private:
1992 _LIBCPP_INLINE_VISIBILITY1983 _LIBCPP_INLINE_VISIBILITY
1993 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)1984 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
...@@ -2336,17 +2327,14 @@ public:...@@ -2336,17 +2327,14 @@ public:
2336 _LIBCPP_INLINE_VISIBILITY2327 _LIBCPP_INLINE_VISIBILITY
2337 operator>>=(const _Expr& __v) const;2328 operator>>=(const _Expr& __v) const;
23382329
2330 indirect_array(const indirect_array&) = default;
2331
2339 _LIBCPP_INLINE_VISIBILITY2332 _LIBCPP_INLINE_VISIBILITY
2340 const indirect_array& operator=(const indirect_array& __ia) const;2333 const indirect_array& operator=(const indirect_array& __ia) const;
23412334
2342 _LIBCPP_INLINE_VISIBILITY2335 _LIBCPP_INLINE_VISIBILITY
2343 void operator=(const value_type& __x) const;2336 void operator=(const value_type& __x) const;
23442337
2345// indirect_array(const indirect_array&) = default;
2346// indirect_array(indirect_array&&) = default;
2347// indirect_array& operator=(const indirect_array&) = default;
2348// indirect_array& operator=(indirect_array&&) = default;
2349
2350private:2338private:
2351 _LIBCPP_INLINE_VISIBILITY2339 _LIBCPP_INLINE_VISIBILITY
2352 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)2340 indirect_array(const valarray<size_t>& __ia, const valarray<value_type>& __v)
lib/libcxx/include/vector+133-163
...@@ -297,7 +297,7 @@ _LIBCPP_PUSH_MACROS...@@ -297,7 +297,7 @@ _LIBCPP_PUSH_MACROS
297_LIBCPP_BEGIN_NAMESPACE_STD297_LIBCPP_BEGIN_NAMESPACE_STD
298298
299template <bool>299template <bool>
300class __vector_base_common300class _LIBCPP_TEMPLATE_VIS __vector_base_common
301{301{
302protected:302protected:
303 _LIBCPP_INLINE_VISIBILITY __vector_base_common() {}303 _LIBCPP_INLINE_VISIBILITY __vector_base_common() {}
...@@ -423,7 +423,7 @@ __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT...@@ -423,7 +423,7 @@ __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
423{423{
424 pointer __soon_to_be_end = __end_;424 pointer __soon_to_be_end = __end_;
425 while (__new_last != __soon_to_be_end)425 while (__new_last != __soon_to_be_end)
426 __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end));426 __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__soon_to_be_end));
427 __end_ = __new_last;427 __end_ = __new_last;
428}428}
429429
...@@ -433,7 +433,7 @@ __vector_base<_Tp, _Allocator>::__vector_base()...@@ -433,7 +433,7 @@ __vector_base<_Tp, _Allocator>::__vector_base()
433 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)433 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
434 : __begin_(nullptr),434 : __begin_(nullptr),
435 __end_(nullptr),435 __end_(nullptr),
436 __end_cap_(nullptr)436 __end_cap_(nullptr, __default_init_tag())
437{437{
438}438}
439439
...@@ -518,29 +518,29 @@ public:...@@ -518,29 +518,29 @@ public:
518 vector(size_type __n, const value_type& __x, const allocator_type& __a);518 vector(size_type __n, const value_type& __x, const allocator_type& __a);
519 template <class _InputIterator>519 template <class _InputIterator>
520 vector(_InputIterator __first,520 vector(_InputIterator __first,
521 typename enable_if<__is_input_iterator <_InputIterator>::value &&521 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
522 !__is_forward_iterator<_InputIterator>::value &&522 !__is_cpp17_forward_iterator<_InputIterator>::value &&
523 is_constructible<523 is_constructible<
524 value_type,524 value_type,
525 typename iterator_traits<_InputIterator>::reference>::value,525 typename iterator_traits<_InputIterator>::reference>::value,
526 _InputIterator>::type __last);526 _InputIterator>::type __last);
527 template <class _InputIterator>527 template <class _InputIterator>
528 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,528 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
529 typename enable_if<__is_input_iterator <_InputIterator>::value &&529 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
530 !__is_forward_iterator<_InputIterator>::value &&530 !__is_cpp17_forward_iterator<_InputIterator>::value &&
531 is_constructible<531 is_constructible<
532 value_type,532 value_type,
533 typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);533 typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
534 template <class _ForwardIterator>534 template <class _ForwardIterator>
535 vector(_ForwardIterator __first,535 vector(_ForwardIterator __first,
536 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&536 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
537 is_constructible<537 is_constructible<
538 value_type,538 value_type,
539 typename iterator_traits<_ForwardIterator>::reference>::value,539 typename iterator_traits<_ForwardIterator>::reference>::value,
540 _ForwardIterator>::type __last);540 _ForwardIterator>::type __last);
541 template <class _ForwardIterator>541 template <class _ForwardIterator>
542 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,542 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
543 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&543 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
544 is_constructible<544 is_constructible<
545 value_type,545 value_type,
546 typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);546 typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
...@@ -589,8 +589,8 @@ public:...@@ -589,8 +589,8 @@ public:
589 template <class _InputIterator>589 template <class _InputIterator>
590 typename enable_if590 typename enable_if
591 <591 <
592 __is_input_iterator <_InputIterator>::value &&592 __is_cpp17_input_iterator <_InputIterator>::value &&
593 !__is_forward_iterator<_InputIterator>::value &&593 !__is_cpp17_forward_iterator<_InputIterator>::value &&
594 is_constructible<594 is_constructible<
595 value_type,595 value_type,
596 typename iterator_traits<_InputIterator>::reference>::value,596 typename iterator_traits<_InputIterator>::reference>::value,
...@@ -600,7 +600,7 @@ public:...@@ -600,7 +600,7 @@ public:
600 template <class _ForwardIterator>600 template <class _ForwardIterator>
601 typename enable_if601 typename enable_if
602 <602 <
603 __is_forward_iterator<_ForwardIterator>::value &&603 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
604 is_constructible<604 is_constructible<
605 value_type,605 value_type,
606 typename iterator_traits<_ForwardIterator>::reference>::value,606 typename iterator_traits<_ForwardIterator>::reference>::value,
...@@ -692,10 +692,10 @@ public:...@@ -692,10 +692,10 @@ public:
692692
693 _LIBCPP_INLINE_VISIBILITY693 _LIBCPP_INLINE_VISIBILITY
694 value_type* data() _NOEXCEPT694 value_type* data() _NOEXCEPT
695 {return _VSTD::__to_raw_pointer(this->__begin_);}695 {return _VSTD::__to_address(this->__begin_);}
696 _LIBCPP_INLINE_VISIBILITY696 _LIBCPP_INLINE_VISIBILITY
697 const value_type* data() const _NOEXCEPT697 const value_type* data() const _NOEXCEPT
698 {return _VSTD::__to_raw_pointer(this->__begin_);}698 {return _VSTD::__to_address(this->__begin_);}
699699
700#ifdef _LIBCPP_CXX03_LANG700#ifdef _LIBCPP_CXX03_LANG
701 _LIBCPP_INLINE_VISIBILITY701 _LIBCPP_INLINE_VISIBILITY
...@@ -737,8 +737,8 @@ public:...@@ -737,8 +737,8 @@ public:
737 template <class _InputIterator>737 template <class _InputIterator>
738 typename enable_if738 typename enable_if
739 <739 <
740 __is_input_iterator <_InputIterator>::value &&740 __is_cpp17_input_iterator <_InputIterator>::value &&
741 !__is_forward_iterator<_InputIterator>::value &&741 !__is_cpp17_forward_iterator<_InputIterator>::value &&
742 is_constructible<742 is_constructible<
743 value_type,743 value_type,
744 typename iterator_traits<_InputIterator>::reference>::value,744 typename iterator_traits<_InputIterator>::reference>::value,
...@@ -748,7 +748,7 @@ public:...@@ -748,7 +748,7 @@ public:
748 template <class _ForwardIterator>748 template <class _ForwardIterator>
749 typename enable_if749 typename enable_if
750 <750 <
751 __is_forward_iterator<_ForwardIterator>::value &&751 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
752 is_constructible<752 is_constructible<
753 value_type,753 value_type,
754 typename iterator_traits<_ForwardIterator>::reference>::value,754 typename iterator_traits<_ForwardIterator>::reference>::value,
...@@ -808,7 +808,7 @@ private:...@@ -808,7 +808,7 @@ private:
808 template <class _ForwardIterator>808 template <class _ForwardIterator>
809 typename enable_if809 typename enable_if
810 <810 <
811 __is_forward_iterator<_ForwardIterator>::value,811 __is_cpp17_forward_iterator<_ForwardIterator>::value,
812 void812 void
813 >::type813 >::type
814 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n);814 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n);
...@@ -864,58 +864,67 @@ private:...@@ -864,58 +864,67 @@ private:
864#else864#else
865 _LIBCPP_INLINE_VISIBILITY865 _LIBCPP_INLINE_VISIBILITY
866 void __annotate_contiguous_container(const void*, const void*, const void*,866 void __annotate_contiguous_container(const void*, const void*, const void*,
867 const void*) const {}867 const void*) const _NOEXCEPT {}
868#endif868#endif
869 _LIBCPP_INLINE_VISIBILITY869 _LIBCPP_INLINE_VISIBILITY
870 void __annotate_new(size_type __current_size) const {870 void __annotate_new(size_type __current_size) const _NOEXCEPT {
871 __annotate_contiguous_container(data(), data() + capacity(),871 __annotate_contiguous_container(data(), data() + capacity(),
872 data() + capacity(), data() + __current_size);872 data() + capacity(), data() + __current_size);
873 }873 }
874874
875 _LIBCPP_INLINE_VISIBILITY875 _LIBCPP_INLINE_VISIBILITY
876 void __annotate_delete() const {876 void __annotate_delete() const _NOEXCEPT {
877 __annotate_contiguous_container(data(), data() + capacity(),877 __annotate_contiguous_container(data(), data() + capacity(),
878 data() + size(), data() + capacity());878 data() + size(), data() + capacity());
879 }879 }
880880
881 _LIBCPP_INLINE_VISIBILITY881 _LIBCPP_INLINE_VISIBILITY
882 void __annotate_increase(size_type __n) const882 void __annotate_increase(size_type __n) const _NOEXCEPT
883 {883 {
884 __annotate_contiguous_container(data(), data() + capacity(),884 __annotate_contiguous_container(data(), data() + capacity(),
885 data() + size(), data() + size() + __n);885 data() + size(), data() + size() + __n);
886 }886 }
887887
888 _LIBCPP_INLINE_VISIBILITY888 _LIBCPP_INLINE_VISIBILITY
889 void __annotate_shrink(size_type __old_size) const889 void __annotate_shrink(size_type __old_size) const _NOEXCEPT
890 {890 {
891 __annotate_contiguous_container(data(), data() + capacity(),891 __annotate_contiguous_container(data(), data() + capacity(),
892 data() + __old_size, data() + size());892 data() + __old_size, data() + size());
893 }893 }
894
895 struct _ConstructTransaction {
896 explicit _ConstructTransaction(vector &__v, size_type __n)
897 : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
894#ifndef _LIBCPP_HAS_NO_ASAN898#ifndef _LIBCPP_HAS_NO_ASAN
895 // The annotation for size increase should happen before the actual increase,899 __v_.__annotate_increase(__n);
896 // but if an exception is thrown after that the annotation has to be undone.900#endif
897 struct __RAII_IncreaseAnnotator {901 }
898 __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1)902 ~_ConstructTransaction() {
899 : __commit(false), __v(__v), __old_size(__v.size() + __n) {903 __v_.__end_ = __pos_;
900 __v.__annotate_increase(__n);904#ifndef _LIBCPP_HAS_NO_ASAN
901 }905 if (__pos_ != __new_end_) {
902 void __done() { __commit = true; }906 __v_.__annotate_shrink(__new_end_ - __v_.__begin_);
903 ~__RAII_IncreaseAnnotator() {
904 if (__commit) return;
905 __v.__annotate_shrink(__old_size);
906 }907 }
907 bool __commit;
908 const vector &__v;
909 size_type __old_size;
910 };
911#else
912 struct __RAII_IncreaseAnnotator {
913 _LIBCPP_INLINE_VISIBILITY
914 __RAII_IncreaseAnnotator(const vector &, size_type = 1) {}
915 _LIBCPP_INLINE_VISIBILITY void __done() {}
916 };
917#endif908#endif
909 }
918910
911 vector &__v_;
912 pointer __pos_;
913 const_pointer const __new_end_;
914
915 private:
916 _ConstructTransaction(_ConstructTransaction const&) = delete;
917 _ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
918 };
919
920 template <class ..._Args>
921 _LIBCPP_INLINE_VISIBILITY
922 void __construct_one_at_end(_Args&& ...__args) {
923 _ConstructTransaction __tx(*this, 1);
924 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_),
925 _VSTD::forward<_Args>(__args)...);
926 ++__tx.__pos_;
927 }
919};928};
920929
921#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES930#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
...@@ -938,8 +947,10 @@ template <class _Tp, class _Allocator>...@@ -938,8 +947,10 @@ template <class _Tp, class _Allocator>
938void947void
939vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)948vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
940{949{
950
941 __annotate_delete();951 __annotate_delete();
942 __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);952 __alloc_traits::__construct_backward_with_exception_guarantees(
953 this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
943 _VSTD::swap(this->__begin_, __v.__begin_);954 _VSTD::swap(this->__begin_, __v.__begin_);
944 _VSTD::swap(this->__end_, __v.__end_);955 _VSTD::swap(this->__end_, __v.__end_);
945 _VSTD::swap(this->__end_cap(), __v.__end_cap());956 _VSTD::swap(this->__end_cap(), __v.__end_cap());
...@@ -954,8 +965,10 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a...@@ -954,8 +965,10 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
954{965{
955 __annotate_delete();966 __annotate_delete();
956 pointer __r = __v.__begin_;967 pointer __r = __v.__begin_;
957 __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_);968 __alloc_traits::__construct_backward_with_exception_guarantees(
958 __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_);969 this->__alloc(), this->__begin_, __p, __v.__begin_);
970 __alloc_traits::__construct_forward_with_exception_guarantees(
971 this->__alloc(), __p, this->__end_, __v.__end_);
959 _VSTD::swap(this->__begin_, __v.__begin_);972 _VSTD::swap(this->__begin_, __v.__begin_);
960 _VSTD::swap(this->__end_, __v.__end_);973 _VSTD::swap(this->__end_, __v.__end_);
961 _VSTD::swap(this->__end_cap(), __v.__end_cap());974 _VSTD::swap(this->__end_cap(), __v.__end_cap());
...@@ -1027,15 +1040,10 @@ template <class _Tp, class _Allocator>...@@ -1027,15 +1040,10 @@ template <class _Tp, class _Allocator>
1027void1040void
1028vector<_Tp, _Allocator>::__construct_at_end(size_type __n)1041vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
1029{1042{
1030 allocator_type& __a = this->__alloc();1043 _ConstructTransaction __tx(*this, __n);
1031 do1044 for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) {
1032 {1045 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_));
1033 __RAII_IncreaseAnnotator __annotator(*this);1046 }
1034 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
1035 ++this->__end_;
1036 --__n;
1037 __annotator.__done();
1038 } while (__n > 0);
1039}1047}
10401048
1041// Copy constructs __n objects starting at __end_ from __x1049// Copy constructs __n objects starting at __end_ from __x
...@@ -1049,30 +1057,23 @@ inline...@@ -1049,30 +1057,23 @@ inline
1049void1057void
1050vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)1058vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
1051{1059{
1052 allocator_type& __a = this->__alloc();1060 _ConstructTransaction __tx(*this, __n);
1053 do1061 for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) {
1054 {1062 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), __x);
1055 __RAII_IncreaseAnnotator __annotator(*this);1063 }
1056 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
1057 ++this->__end_;
1058 --__n;
1059 __annotator.__done();
1060 } while (__n > 0);
1061}1064}
10621065
1063template <class _Tp, class _Allocator>1066template <class _Tp, class _Allocator>
1064template <class _ForwardIterator>1067template <class _ForwardIterator>
1065typename enable_if1068typename enable_if
1066<1069<
1067 __is_forward_iterator<_ForwardIterator>::value,1070 __is_cpp17_forward_iterator<_ForwardIterator>::value,
1068 void1071 void
1069>::type1072>::type
1070vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)1073vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
1071{1074{
1072 allocator_type& __a = this->__alloc();1075 _ConstructTransaction __tx(*this, __n);
1073 __RAII_IncreaseAnnotator __annotator(*this, __n);1076 __alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_);
1074 __alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_);
1075 __annotator.__done();
1076}1077}
10771078
1078// Default constructs __n objects starting at __end_1079// Default constructs __n objects starting at __end_
...@@ -1172,8 +1173,8 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allo...@@ -1172,8 +1173,8 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allo
1172template <class _Tp, class _Allocator>1173template <class _Tp, class _Allocator>
1173template <class _InputIterator>1174template <class _InputIterator>
1174vector<_Tp, _Allocator>::vector(_InputIterator __first,1175vector<_Tp, _Allocator>::vector(_InputIterator __first,
1175 typename enable_if<__is_input_iterator <_InputIterator>::value &&1176 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
1176 !__is_forward_iterator<_InputIterator>::value &&1177 !__is_cpp17_forward_iterator<_InputIterator>::value &&
1177 is_constructible<1178 is_constructible<
1178 value_type,1179 value_type,
1179 typename iterator_traits<_InputIterator>::reference>::value,1180 typename iterator_traits<_InputIterator>::reference>::value,
...@@ -1189,8 +1190,8 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,...@@ -1189,8 +1190,8 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,
1189template <class _Tp, class _Allocator>1190template <class _Tp, class _Allocator>
1190template <class _InputIterator>1191template <class _InputIterator>
1191vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,1192vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
1192 typename enable_if<__is_input_iterator <_InputIterator>::value &&1193 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
1193 !__is_forward_iterator<_InputIterator>::value &&1194 !__is_cpp17_forward_iterator<_InputIterator>::value &&
1194 is_constructible<1195 is_constructible<
1195 value_type,1196 value_type,
1196 typename iterator_traits<_InputIterator>::reference>::value>::type*)1197 typename iterator_traits<_InputIterator>::reference>::value>::type*)
...@@ -1206,7 +1207,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c...@@ -1206,7 +1207,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
1206template <class _Tp, class _Allocator>1207template <class _Tp, class _Allocator>
1207template <class _ForwardIterator>1208template <class _ForwardIterator>
1208vector<_Tp, _Allocator>::vector(_ForwardIterator __first,1209vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
1209 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&1210 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
1210 is_constructible<1211 is_constructible<
1211 value_type,1212 value_type,
1212 typename iterator_traits<_ForwardIterator>::reference>::value,1213 typename iterator_traits<_ForwardIterator>::reference>::value,
...@@ -1226,7 +1227,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,...@@ -1226,7 +1227,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
1226template <class _Tp, class _Allocator>1227template <class _Tp, class _Allocator>
1227template <class _ForwardIterator>1228template <class _ForwardIterator>
1228vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,1229vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
1229 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&1230 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
1230 is_constructible<1231 is_constructible<
1231 value_type,1232 value_type,
1232 typename iterator_traits<_ForwardIterator>::reference>::value>::type*)1233 typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
...@@ -1409,8 +1410,8 @@ template <class _Tp, class _Allocator>...@@ -1409,8 +1410,8 @@ template <class _Tp, class _Allocator>
1409template <class _InputIterator>1410template <class _InputIterator>
1410typename enable_if1411typename enable_if
1411<1412<
1412 __is_input_iterator <_InputIterator>::value &&1413 __is_cpp17_input_iterator <_InputIterator>::value &&
1413 !__is_forward_iterator<_InputIterator>::value &&1414 !__is_cpp17_forward_iterator<_InputIterator>::value &&
1414 is_constructible<1415 is_constructible<
1415 _Tp,1416 _Tp,
1416 typename iterator_traits<_InputIterator>::reference>::value,1417 typename iterator_traits<_InputIterator>::reference>::value,
...@@ -1427,7 +1428,7 @@ template <class _Tp, class _Allocator>...@@ -1427,7 +1428,7 @@ template <class _Tp, class _Allocator>
1427template <class _ForwardIterator>1428template <class _ForwardIterator>
1428typename enable_if1429typename enable_if
1429<1430<
1430 __is_forward_iterator<_ForwardIterator>::value &&1431 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
1431 is_constructible<1432 is_constructible<
1432 _Tp,1433 _Tp,
1433 typename iterator_traits<_ForwardIterator>::reference>::value,1434 typename iterator_traits<_ForwardIterator>::reference>::value,
...@@ -1621,7 +1622,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)...@@ -1621,7 +1622,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
1621 allocator_type& __a = this->__alloc();1622 allocator_type& __a = this->__alloc();
1622 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);1623 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
1623 // __v.push_back(_VSTD::forward<_Up>(__x));1624 // __v.push_back(_VSTD::forward<_Up>(__x));
1624 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x));1625 __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Up>(__x));
1625 __v.__end_++;1626 __v.__end_++;
1626 __swap_out_circular_buffer(__v);1627 __swap_out_circular_buffer(__v);
1627}1628}
...@@ -1633,11 +1634,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)...@@ -1633,11 +1634,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
1633{1634{
1634 if (this->__end_ != this->__end_cap())1635 if (this->__end_ != this->__end_cap())
1635 {1636 {
1636 __RAII_IncreaseAnnotator __annotator(*this);1637 __construct_one_at_end(__x);
1637 __alloc_traits::construct(this->__alloc(),
1638 _VSTD::__to_raw_pointer(this->__end_), __x);
1639 __annotator.__done();
1640 ++this->__end_;
1641 }1638 }
1642 else1639 else
1643 __push_back_slow_path(__x);1640 __push_back_slow_path(__x);
...@@ -1652,12 +1649,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)...@@ -1652,12 +1649,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
1652{1649{
1653 if (this->__end_ < this->__end_cap())1650 if (this->__end_ < this->__end_cap())
1654 {1651 {
1655 __RAII_IncreaseAnnotator __annotator(*this);1652 __construct_one_at_end(_VSTD::move(__x));
1656 __alloc_traits::construct(this->__alloc(),
1657 _VSTD::__to_raw_pointer(this->__end_),
1658 _VSTD::move(__x));
1659 __annotator.__done();
1660 ++this->__end_;
1661 }1653 }
1662 else1654 else
1663 __push_back_slow_path(_VSTD::move(__x));1655 __push_back_slow_path(_VSTD::move(__x));
...@@ -1671,7 +1663,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)...@@ -1671,7 +1663,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
1671 allocator_type& __a = this->__alloc();1663 allocator_type& __a = this->__alloc();
1672 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);1664 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
1673// __v.emplace_back(_VSTD::forward<_Args>(__args)...);1665// __v.emplace_back(_VSTD::forward<_Args>(__args)...);
1674 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...);1666 __alloc_traits::construct(__a, _VSTD::__to_address(__v.__end_), _VSTD::forward<_Args>(__args)...);
1675 __v.__end_++;1667 __v.__end_++;
1676 __swap_out_circular_buffer(__v);1668 __swap_out_circular_buffer(__v);
1677}1669}
...@@ -1688,12 +1680,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)...@@ -1688,12 +1680,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
1688{1680{
1689 if (this->__end_ < this->__end_cap())1681 if (this->__end_ < this->__end_cap())
1690 {1682 {
1691 __RAII_IncreaseAnnotator __annotator(*this);1683 __construct_one_at_end(_VSTD::forward<_Args>(__args)...);
1692 __alloc_traits::construct(this->__alloc(),
1693 _VSTD::__to_raw_pointer(this->__end_),
1694 _VSTD::forward<_Args>(__args)...);
1695 __annotator.__done();
1696 ++this->__end_;
1697 }1684 }
1698 else1685 else
1699 __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);1686 __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
...@@ -1761,10 +1748,15 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe...@@ -1761,10 +1748,15 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe
1761{1748{
1762 pointer __old_last = this->__end_;1749 pointer __old_last = this->__end_;
1763 difference_type __n = __old_last - __to;1750 difference_type __n = __old_last - __to;
1764 for (pointer __i = __from_s + __n; __i < __from_e; ++__i, ++this->__end_)1751 {
1765 __alloc_traits::construct(this->__alloc(),1752 pointer __i = __from_s + __n;
1766 _VSTD::__to_raw_pointer(this->__end_),1753 _ConstructTransaction __tx(*this, __from_e - __i);
1767 _VSTD::move(*__i));1754 for (; __i < __from_e; ++__i, ++__tx.__pos_) {
1755 __alloc_traits::construct(this->__alloc(),
1756 _VSTD::__to_address(__tx.__pos_),
1757 _VSTD::move(*__i));
1758 }
1759 }
1768 _VSTD::move_backward(__from_s, __from_s + __n, __old_last);1760 _VSTD::move_backward(__from_s, __from_s + __n, __old_last);
1769}1761}
17701762
...@@ -1780,12 +1772,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)...@@ -1780,12 +1772,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
1780 pointer __p = this->__begin_ + (__position - begin());1772 pointer __p = this->__begin_ + (__position - begin());
1781 if (this->__end_ < this->__end_cap())1773 if (this->__end_ < this->__end_cap())
1782 {1774 {
1783 __RAII_IncreaseAnnotator __annotator(*this);
1784 if (__p == this->__end_)1775 if (__p == this->__end_)
1785 {1776 {
1786 __alloc_traits::construct(this->__alloc(),1777 __construct_one_at_end(__x);
1787 _VSTD::__to_raw_pointer(this->__end_), __x);
1788 ++this->__end_;
1789 }1778 }
1790 else1779 else
1791 {1780 {
...@@ -1795,7 +1784,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)...@@ -1795,7 +1784,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
1795 ++__xr;1784 ++__xr;
1796 *__p = *__xr;1785 *__p = *__xr;
1797 }1786 }
1798 __annotator.__done();
1799 }1787 }
1800 else1788 else
1801 {1789 {
...@@ -1821,20 +1809,15 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)...@@ -1821,20 +1809,15 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
1821 pointer __p = this->__begin_ + (__position - begin());1809 pointer __p = this->__begin_ + (__position - begin());
1822 if (this->__end_ < this->__end_cap())1810 if (this->__end_ < this->__end_cap())
1823 {1811 {
1824 __RAII_IncreaseAnnotator __annotator(*this);
1825 if (__p == this->__end_)1812 if (__p == this->__end_)
1826 {1813 {
1827 __alloc_traits::construct(this->__alloc(),1814 __construct_one_at_end(_VSTD::move(__x));
1828 _VSTD::__to_raw_pointer(this->__end_),
1829 _VSTD::move(__x));
1830 ++this->__end_;
1831 }1815 }
1832 else1816 else
1833 {1817 {
1834 __move_range(__p, this->__end_, __p + 1);1818 __move_range(__p, this->__end_, __p + 1);
1835 *__p = _VSTD::move(__x);1819 *__p = _VSTD::move(__x);
1836 }1820 }
1837 __annotator.__done();
1838 }1821 }
1839 else1822 else
1840 {1823 {
...@@ -1859,13 +1842,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)...@@ -1859,13 +1842,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
1859 pointer __p = this->__begin_ + (__position - begin());1842 pointer __p = this->__begin_ + (__position - begin());
1860 if (this->__end_ < this->__end_cap())1843 if (this->__end_ < this->__end_cap())
1861 {1844 {
1862 __RAII_IncreaseAnnotator __annotator(*this);
1863 if (__p == this->__end_)1845 if (__p == this->__end_)
1864 {1846 {
1865 __alloc_traits::construct(this->__alloc(),1847 __construct_one_at_end(_VSTD::forward<_Args>(__args)...);
1866 _VSTD::__to_raw_pointer(this->__end_),
1867 _VSTD::forward<_Args>(__args)...);
1868 ++this->__end_;
1869 }1848 }
1870 else1849 else
1871 {1850 {
...@@ -1873,7 +1852,6 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)...@@ -1873,7 +1852,6 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
1873 __move_range(__p, this->__end_, __p + 1);1852 __move_range(__p, this->__end_, __p + 1);
1874 *__p = _VSTD::move(__tmp.get());1853 *__p = _VSTD::move(__tmp.get());
1875 }1854 }
1876 __annotator.__done();
1877 }1855 }
1878 else1856 else
1879 {1857 {
...@@ -1911,9 +1889,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_...@@ -1911,9 +1889,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_
1911 }1889 }
1912 if (__n > 0)1890 if (__n > 0)
1913 {1891 {
1914 __RAII_IncreaseAnnotator __annotator(*this, __n);
1915 __move_range(__p, __old_last, __p + __old_n);1892 __move_range(__p, __old_last, __p + __old_n);
1916 __annotator.__done();
1917 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);1893 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
1918 if (__p <= __xr && __xr < this->__end_)1894 if (__p <= __xr && __xr < this->__end_)
1919 __xr += __old_n;1895 __xr += __old_n;
...@@ -1935,8 +1911,8 @@ template <class _Tp, class _Allocator>...@@ -1935,8 +1911,8 @@ template <class _Tp, class _Allocator>
1935template <class _InputIterator>1911template <class _InputIterator>
1936typename enable_if1912typename enable_if
1937<1913<
1938 __is_input_iterator <_InputIterator>::value &&1914 __is_cpp17_input_iterator <_InputIterator>::value &&
1939 !__is_forward_iterator<_InputIterator>::value &&1915 !__is_cpp17_forward_iterator<_InputIterator>::value &&
1940 is_constructible<1916 is_constructible<
1941 _Tp,1917 _Tp,
1942 typename iterator_traits<_InputIterator>::reference>::value,1918 typename iterator_traits<_InputIterator>::reference>::value,
...@@ -1955,11 +1931,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs...@@ -1955,11 +1931,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
1955 pointer __old_last = this->__end_;1931 pointer __old_last = this->__end_;
1956 for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)1932 for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
1957 {1933 {
1958 __RAII_IncreaseAnnotator __annotator(*this);1934 __construct_one_at_end(*__first);
1959 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
1960 *__first);
1961 ++this->__end_;
1962 __annotator.__done();
1963 }1935 }
1964 __split_buffer<value_type, allocator_type&> __v(__a);1936 __split_buffer<value_type, allocator_type&> __v(__a);
1965 if (__first != __last)1937 if (__first != __last)
...@@ -1993,7 +1965,7 @@ template <class _Tp, class _Allocator>...@@ -1993,7 +1965,7 @@ template <class _Tp, class _Allocator>
1993template <class _ForwardIterator>1965template <class _ForwardIterator>
1994typename enable_if1966typename enable_if
1995<1967<
1996 __is_forward_iterator<_ForwardIterator>::value &&1968 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
1997 is_constructible<1969 is_constructible<
1998 _Tp,1970 _Tp,
1999 typename iterator_traits<_ForwardIterator>::reference>::value,1971 typename iterator_traits<_ForwardIterator>::reference>::value,
...@@ -2026,9 +1998,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi...@@ -2026,9 +1998,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi
2026 }1998 }
2027 if (__n > 0)1999 if (__n > 0)
2028 {2000 {
2029 __RAII_IncreaseAnnotator __annotator(*this, __n);
2030 __move_range(__p, __old_last, __p + __old_n);2001 __move_range(__p, __old_last, __p + __old_n);
2031 __annotator.__done();
2032 _VSTD::copy(__first, __m, __p);2002 _VSTD::copy(__first, __m, __p);
2033 }2003 }
2034 }2004 }
...@@ -2261,18 +2231,18 @@ public:...@@ -2261,18 +2231,18 @@ public:
2261 vector(size_type __n, const value_type& __v, const allocator_type& __a);2231 vector(size_type __n, const value_type& __v, const allocator_type& __a);
2262 template <class _InputIterator>2232 template <class _InputIterator>
2263 vector(_InputIterator __first, _InputIterator __last,2233 vector(_InputIterator __first, _InputIterator __last,
2264 typename enable_if<__is_input_iterator <_InputIterator>::value &&2234 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2265 !__is_forward_iterator<_InputIterator>::value>::type* = 0);2235 !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0);
2266 template <class _InputIterator>2236 template <class _InputIterator>
2267 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,2237 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
2268 typename enable_if<__is_input_iterator <_InputIterator>::value &&2238 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2269 !__is_forward_iterator<_InputIterator>::value>::type* = 0);2239 !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0);
2270 template <class _ForwardIterator>2240 template <class _ForwardIterator>
2271 vector(_ForwardIterator __first, _ForwardIterator __last,2241 vector(_ForwardIterator __first, _ForwardIterator __last,
2272 typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);2242 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0);
2273 template <class _ForwardIterator>2243 template <class _ForwardIterator>
2274 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,2244 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
2275 typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);2245 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type* = 0);
22762246
2277 vector(const vector& __v);2247 vector(const vector& __v);
2278 vector(const vector& __v, const allocator_type& __a);2248 vector(const vector& __v, const allocator_type& __a);
...@@ -2303,15 +2273,15 @@ public:...@@ -2303,15 +2273,15 @@ public:
2303 template <class _InputIterator>2273 template <class _InputIterator>
2304 typename enable_if2274 typename enable_if
2305 <2275 <
2306 __is_input_iterator<_InputIterator>::value &&2276 __is_cpp17_input_iterator<_InputIterator>::value &&
2307 !__is_forward_iterator<_InputIterator>::value,2277 !__is_cpp17_forward_iterator<_InputIterator>::value,
2308 void2278 void
2309 >::type2279 >::type
2310 assign(_InputIterator __first, _InputIterator __last);2280 assign(_InputIterator __first, _InputIterator __last);
2311 template <class _ForwardIterator>2281 template <class _ForwardIterator>
2312 typename enable_if2282 typename enable_if
2313 <2283 <
2314 __is_forward_iterator<_ForwardIterator>::value,2284 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2315 void2285 void
2316 >::type2286 >::type
2317 assign(_ForwardIterator __first, _ForwardIterator __last);2287 assign(_ForwardIterator __first, _ForwardIterator __last);
...@@ -2419,15 +2389,15 @@ public:...@@ -2419,15 +2389,15 @@ public:
2419 template <class _InputIterator>2389 template <class _InputIterator>
2420 typename enable_if2390 typename enable_if
2421 <2391 <
2422 __is_input_iterator <_InputIterator>::value &&2392 __is_cpp17_input_iterator <_InputIterator>::value &&
2423 !__is_forward_iterator<_InputIterator>::value,2393 !__is_cpp17_forward_iterator<_InputIterator>::value,
2424 iterator2394 iterator
2425 >::type2395 >::type
2426 insert(const_iterator __position, _InputIterator __first, _InputIterator __last);2396 insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
2427 template <class _ForwardIterator>2397 template <class _ForwardIterator>
2428 typename enable_if2398 typename enable_if
2429 <2399 <
2430 __is_forward_iterator<_ForwardIterator>::value,2400 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2431 iterator2401 iterator
2432 >::type2402 >::type
2433 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);2403 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
...@@ -2470,7 +2440,7 @@ private:...@@ -2470,7 +2440,7 @@ private:
2470 template <class _ForwardIterator>2440 template <class _ForwardIterator>
2471 typename enable_if2441 typename enable_if
2472 <2442 <
2473 __is_forward_iterator<_ForwardIterator>::value,2443 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2474 void2444 void
2475 >::type2445 >::type
2476 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);2446 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
...@@ -2629,7 +2599,7 @@ template <class _Allocator>...@@ -2629,7 +2599,7 @@ template <class _Allocator>
2629template <class _ForwardIterator>2599template <class _ForwardIterator>
2630typename enable_if2600typename enable_if
2631<2601<
2632 __is_forward_iterator<_ForwardIterator>::value,2602 __is_cpp17_forward_iterator<_ForwardIterator>::value,
2633 void2603 void
2634>::type2604>::type
2635vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)2605vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
...@@ -2652,7 +2622,7 @@ vector<bool, _Allocator>::vector()...@@ -2652,7 +2622,7 @@ vector<bool, _Allocator>::vector()
2652 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)2622 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
2653 : __begin_(nullptr),2623 : __begin_(nullptr),
2654 __size_(0),2624 __size_(0),
2655 __cap_alloc_(0)2625 __cap_alloc_(0, __default_init_tag())
2656{2626{
2657}2627}
26582628
...@@ -2674,7 +2644,7 @@ template <class _Allocator>...@@ -2674,7 +2644,7 @@ template <class _Allocator>
2674vector<bool, _Allocator>::vector(size_type __n)2644vector<bool, _Allocator>::vector(size_type __n)
2675 : __begin_(nullptr),2645 : __begin_(nullptr),
2676 __size_(0),2646 __size_(0),
2677 __cap_alloc_(0)2647 __cap_alloc_(0, __default_init_tag())
2678{2648{
2679 if (__n > 0)2649 if (__n > 0)
2680 {2650 {
...@@ -2702,7 +2672,7 @@ template <class _Allocator>...@@ -2702,7 +2672,7 @@ template <class _Allocator>
2702vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)2672vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
2703 : __begin_(nullptr),2673 : __begin_(nullptr),
2704 __size_(0),2674 __size_(0),
2705 __cap_alloc_(0)2675 __cap_alloc_(0, __default_init_tag())
2706{2676{
2707 if (__n > 0)2677 if (__n > 0)
2708 {2678 {
...@@ -2727,11 +2697,11 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all...@@ -2727,11 +2697,11 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all
2727template <class _Allocator>2697template <class _Allocator>
2728template <class _InputIterator>2698template <class _InputIterator>
2729vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,2699vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
2730 typename enable_if<__is_input_iterator <_InputIterator>::value &&2700 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2731 !__is_forward_iterator<_InputIterator>::value>::type*)2701 !__is_cpp17_forward_iterator<_InputIterator>::value>::type*)
2732 : __begin_(nullptr),2702 : __begin_(nullptr),
2733 __size_(0),2703 __size_(0),
2734 __cap_alloc_(0)2704 __cap_alloc_(0, __default_init_tag())
2735{2705{
2736#ifndef _LIBCPP_NO_EXCEPTIONS2706#ifndef _LIBCPP_NO_EXCEPTIONS
2737 try2707 try
...@@ -2754,8 +2724,8 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,...@@ -2754,8 +2724,8 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
2754template <class _Allocator>2724template <class _Allocator>
2755template <class _InputIterator>2725template <class _InputIterator>
2756vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,2726vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
2757 typename enable_if<__is_input_iterator <_InputIterator>::value &&2727 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2758 !__is_forward_iterator<_InputIterator>::value>::type*)2728 !__is_cpp17_forward_iterator<_InputIterator>::value>::type*)
2759 : __begin_(nullptr),2729 : __begin_(nullptr),
2760 __size_(0),2730 __size_(0),
2761 __cap_alloc_(0, static_cast<__storage_allocator>(__a))2731 __cap_alloc_(0, static_cast<__storage_allocator>(__a))
...@@ -2781,10 +2751,10 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,...@@ -2781,10 +2751,10 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
2781template <class _Allocator>2751template <class _Allocator>
2782template <class _ForwardIterator>2752template <class _ForwardIterator>
2783vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,2753vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
2784 typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)2754 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*)
2785 : __begin_(nullptr),2755 : __begin_(nullptr),
2786 __size_(0),2756 __size_(0),
2787 __cap_alloc_(0)2757 __cap_alloc_(0, __default_init_tag())
2788{2758{
2789 size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));2759 size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2790 if (__n > 0)2760 if (__n > 0)
...@@ -2797,7 +2767,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la...@@ -2797,7 +2767,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
2797template <class _Allocator>2767template <class _Allocator>
2798template <class _ForwardIterator>2768template <class _ForwardIterator>
2799vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,2769vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
2800 typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)2770 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value>::type*)
2801 : __begin_(nullptr),2771 : __begin_(nullptr),
2802 __size_(0),2772 __size_(0),
2803 __cap_alloc_(0, static_cast<__storage_allocator>(__a))2773 __cap_alloc_(0, static_cast<__storage_allocator>(__a))
...@@ -2816,7 +2786,7 @@ template <class _Allocator>...@@ -2816,7 +2786,7 @@ template <class _Allocator>
2816vector<bool, _Allocator>::vector(initializer_list<value_type> __il)2786vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
2817 : __begin_(nullptr),2787 : __begin_(nullptr),
2818 __size_(0),2788 __size_(0),
2819 __cap_alloc_(0)2789 __cap_alloc_(0, __default_init_tag())
2820{2790{
2821 size_type __n = static_cast<size_type>(__il.size());2791 size_type __n = static_cast<size_type>(__il.size());
2822 if (__n > 0)2792 if (__n > 0)
...@@ -2998,8 +2968,8 @@ template <class _Allocator>...@@ -2998,8 +2968,8 @@ template <class _Allocator>
2998template <class _InputIterator>2968template <class _InputIterator>
2999typename enable_if2969typename enable_if
3000<2970<
3001 __is_input_iterator<_InputIterator>::value &&2971 __is_cpp17_input_iterator<_InputIterator>::value &&
3002 !__is_forward_iterator<_InputIterator>::value,2972 !__is_cpp17_forward_iterator<_InputIterator>::value,
3003 void2973 void
3004>::type2974>::type
3005vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)2975vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
...@@ -3013,7 +2983,7 @@ template <class _Allocator>...@@ -3013,7 +2983,7 @@ template <class _Allocator>
3013template <class _ForwardIterator>2983template <class _ForwardIterator>
3014typename enable_if2984typename enable_if
3015<2985<
3016 __is_forward_iterator<_ForwardIterator>::value,2986 __is_cpp17_forward_iterator<_ForwardIterator>::value,
3017 void2987 void
3018>::type2988>::type
3019vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)2989vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
...@@ -3150,8 +3120,8 @@ template <class _Allocator>...@@ -3150,8 +3120,8 @@ template <class _Allocator>
3150template <class _InputIterator>3120template <class _InputIterator>
3151typename enable_if3121typename enable_if
3152<3122<
3153 __is_input_iterator <_InputIterator>::value &&3123 __is_cpp17_input_iterator <_InputIterator>::value &&
3154 !__is_forward_iterator<_InputIterator>::value,3124 !__is_cpp17_forward_iterator<_InputIterator>::value,
3155 typename vector<bool, _Allocator>::iterator3125 typename vector<bool, _Allocator>::iterator
3156>::type3126>::type
3157vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)3127vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
...@@ -3195,7 +3165,7 @@ template <class _Allocator>...@@ -3195,7 +3165,7 @@ template <class _Allocator>
3195template <class _ForwardIterator>3165template <class _ForwardIterator>
3196typename enable_if3166typename enable_if
3197<3167<
3198 __is_forward_iterator<_ForwardIterator>::value,3168 __is_cpp17_forward_iterator<_ForwardIterator>::value,
3199 typename vector<bool, _Allocator>::iterator3169 typename vector<bool, _Allocator>::iterator
3200>::type3170>::type
3201vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)3171vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
lib/libcxx/include/version+2
...@@ -43,6 +43,7 @@ __cpp_lib_constexpr_misc 201811L <array> <functio...@@ -43,6 +43,7 @@ __cpp_lib_constexpr_misc 201811L <array> <functio
43__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>43__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
44__cpp_lib_destroying_delete 201806L <new>44__cpp_lib_destroying_delete 201806L <new>
45__cpp_lib_enable_shared_from_this 201603L <memory>45__cpp_lib_enable_shared_from_this 201603L <memory>
46__cpp_lib_endian 201907L <bit>
46__cpp_lib_erase_if 201811L <string> <deque> <forward_list>47__cpp_lib_erase_if 201811L <string> <deque> <forward_list>
47 <list> <vector> <map>48 <list> <vector> <map>
48 <set> <unordered_map> <unordered_set>49 <set> <unordered_map> <unordered_set>
...@@ -223,6 +224,7 @@ __cpp_lib_void_t 201411L <type_traits>...@@ -223,6 +224,7 @@ __cpp_lib_void_t 201411L <type_traits>
223# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L224# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
224# define __cpp_lib_destroying_delete 201806L225# define __cpp_lib_destroying_delete 201806L
225# endif226# endif
227# define __cpp_lib_endian 201907L
226# define __cpp_lib_erase_if 201811L228# define __cpp_lib_erase_if 201811L
227// # define __cpp_lib_generic_unordered_lookup 201811L229// # define __cpp_lib_generic_unordered_lookup 201811L
228# define __cpp_lib_interpolate 201902L230# define __cpp_lib_interpolate 201902L