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
4747 friend class __bit_const_reference<_Cp>;
4848 friend class __bit_iterator<_Cp, false>;
4949public:
50 _LIBCPP_INLINE_VISIBILITY
51 __bit_reference(const __bit_reference&) = default;
52
5053 _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
5154 {return static_cast<bool>(*__seg_ & __mask_);}
5255 _LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
......@@ -132,6 +135,9 @@ class __bit_const_reference
132135 friend typename _Cp::__self;
133136 friend class __bit_iterator<_Cp, true>;
134137public:
138 _LIBCPP_INLINE_VISIBILITY
139 __bit_const_reference(const __bit_const_reference&) = default;
140
135141 _LIBCPP_INLINE_VISIBILITY
136142 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
137143 : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
......@@ -147,7 +153,7 @@ private:
147153 __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
148154 : __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;
151157};
152158
153159// find
......@@ -332,7 +338,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
332338 }
333339 // do middle whole words
334340 __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));
336342 __n -= __nw * __bits_per_word;
337343 // do last partial word
338344 if (__n > 0)
......@@ -362,7 +368,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
362368 }
363369 // do middle whole words
364370 __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));
366372 __n -= __nw * __bits_per_word;
367373 // do last partial word
368374 if (__n > 0)
......@@ -429,8 +435,8 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
429435 // __first.__ctz_ == 0;
430436 // do middle words
431437 __storage_type __nw = __n / __bits_per_word;
432 _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
433 _VSTD::__to_raw_pointer(__first.__seg_),
438 _VSTD::memmove(_VSTD::__to_address(__result.__seg_),
439 _VSTD::__to_address(__first.__seg_),
434440 __nw * sizeof(__storage_type));
435441 __n -= __nw * __bits_per_word;
436442 __result.__seg_ += __nw;
......@@ -570,8 +576,8 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
570576 __storage_type __nw = __n / __bits_per_word;
571577 __result.__seg_ -= __nw;
572578 __last.__seg_ -= __nw;
573 _VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
574 _VSTD::__to_raw_pointer(__last.__seg_),
579 _VSTD::memmove(_VSTD::__to_address(__result.__seg_),
580 _VSTD::__to_address(__last.__seg_),
575581 __nw * sizeof(__storage_type));
576582 __n -= __nw * __bits_per_word;
577583 // do last word
......@@ -1108,8 +1114,12 @@ public:
11081114#endif
11091115 {}
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
11111121 _LIBCPP_INLINE_VISIBILITY
1112 __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
1122 __bit_iterator(const __type_for_copy_to_const& __it) _NOEXCEPT
11131123 : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
11141124
11151125 _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
lib/libcxx/include/__config+127-20
......@@ -32,7 +32,7 @@
3232# define _GNUC_VER_NEW 0
3333#endif
3434
35#define _LIBCPP_VERSION 9000
35#define _LIBCPP_VERSION 10000
3636
3737#ifndef _LIBCPP_ABI_VERSION
3838# define _LIBCPP_ABI_VERSION 1
......@@ -183,10 +183,6 @@
183183# define _LIBCPP_COMPILER_IBM
184184#endif
185185
186#ifndef _LIBCPP_CLANG_VER
187#define _LIBCPP_CLANG_VER 0
188#endif
189
190186#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
191187#error "libc++ does not support using GCC with C++03. Please enable C++11"
192188#endif
......@@ -246,6 +242,7 @@
246242
247243#ifdef __FreeBSD__
248244# include <sys/endian.h>
245# include <osreldate.h>
249246# if _BYTE_ORDER == _LITTLE_ENDIAN
250247# define _LIBCPP_LITTLE_ENDIAN
251248# else // _BYTE_ORDER == _LITTLE_ENDIAN
......@@ -263,7 +260,6 @@
263260# else // _BYTE_ORDER == _LITTLE_ENDIAN
264261# define _LIBCPP_BIG_ENDIAN
265262# endif // _BYTE_ORDER == _LITTLE_ENDIAN
266# define _LIBCPP_HAS_QUICK_EXIT
267263#endif // __NetBSD__
268264
269265#if defined(_WIN32)
......@@ -343,9 +339,26 @@
343339
344340#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
345341# if defined(__FreeBSD__)
342# define _LIBCPP_HAS_ALIGNED_ALLOC
346343# define _LIBCPP_HAS_QUICK_EXIT
347344# 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
349362# define _LIBCPP_HAS_QUICK_EXIT
350363# define _LIBCPP_HAS_TIMESPEC_GET
351364# define _LIBCPP_HAS_C11_FEATURES
......@@ -355,10 +368,12 @@
355368# define _LIBCPP_HAS_QUICK_EXIT
356369# endif
357370# if _LIBCPP_GLIBC_PREREQ(2, 17)
371# define _LIBCPP_HAS_ALIGNED_ALLOC
358372# define _LIBCPP_HAS_C11_FEATURES
359373# define _LIBCPP_HAS_TIMESPEC_GET
360374# endif
361375# else // defined(_LIBCPP_HAS_MUSL_LIBC)
376# define _LIBCPP_HAS_ALIGNED_ALLOC
362377# define _LIBCPP_HAS_QUICK_EXIT
363378# define _LIBCPP_HAS_TIMESPEC_GET
364379# define _LIBCPP_HAS_C11_FEATURES
......@@ -483,11 +498,14 @@ typedef __char32_t char32_t;
483498
484499#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
485500
486// No apple compilers support ""d and ""y at this time.
487#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)
488#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
501// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1
502#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \
503 (defined(__apple_build_version__) && __apple_build_version__ < 10010000)
504#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
489505#endif
490506
507#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
508
491509#elif defined(_LIBCPP_COMPILER_GCC)
492510
493511#define _ALIGNAS(x) __attribute__((__aligned__(x)))
......@@ -523,6 +541,8 @@ typedef __char32_t char32_t;
523541
524542#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
525543
544#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
545
526546#elif defined(_LIBCPP_COMPILER_MSVC)
527547
528548#define _LIBCPP_TOSTRING2(x) #x
......@@ -548,6 +568,8 @@ typedef __char32_t char32_t;
548568
549569#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
550570
571#define _LIBCPP_DISABLE_EXTENSION_WARNING
572
551573#elif defined(_LIBCPP_COMPILER_IBM)
552574
553575#define _ALIGNAS(x) __attribute__((__aligned__(x)))
......@@ -568,6 +590,8 @@ typedef __char32_t char32_t;
568590
569591#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
570592
593#define _LIBCPP_DISABLE_EXTENSION_WARNING
594
571595#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
572596
573597#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
......@@ -860,6 +884,10 @@ typedef unsigned int char32_t;
860884# endif
861885#endif
862886
887#ifndef _LIBCPP_DEBUG_LEVEL
888# define _LIBCPP_DEBUG_LEVEL 0
889#endif
890
863891#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
864892#define _LIBCPP_EXTERN_TEMPLATE(...)
865893#define _LIBCPP_EXTERN_TEMPLATE2(...)
......@@ -958,6 +986,20 @@ typedef unsigned int char32_t;
958986# define _LIBCPP_DEPRECATED_IN_CXX17
959987#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
9611003#if _LIBCPP_STD_VER <= 11
9621004# define _LIBCPP_EXPLICIT_AFTER_CXX11
9631005#else
......@@ -982,6 +1024,14 @@ typedef unsigned int char32_t;
9821024# define _LIBCPP_CONSTEXPR_AFTER_CXX17
9831025#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
9851035// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
9861036// NODISCARD macros to the correct attribute.
9871037#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
......@@ -1065,7 +1115,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
10651115 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
10661116 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
10671117# if defined(__FreeBSD__) || \
1068 defined(__Fuchsia__) || \
10691118 defined(__wasi__) || \
10701119 defined(__NetBSD__) || \
10711120 defined(__linux__) || \
......@@ -1075,6 +1124,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
10751124 defined(__sun__) || \
10761125 (defined(__MINGW32__) && __has_include(<pthread.h>))
10771126# define _LIBCPP_HAS_THREAD_API_PTHREAD
1127# elif defined(__Fuchsia__)
1128# define _LIBCPP_HAS_THREAD_API_C11
10781129# elif defined(_LIBCPP_WIN32API)
10791130# define _LIBCPP_HAS_THREAD_API_WIN32
10801131# else
......@@ -1082,6 +1133,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
10821133# endif // _LIBCPP_HAS_THREAD_API
10831134#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
10851146#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
10861147#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
10871148 _LIBCPP_HAS_NO_THREADS is not defined.
......@@ -1097,20 +1158,40 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
10971158 _LIBCPP_HAS_NO_THREADS is defined.
10981159#endif
10991160
1100// The Apple, glibc, and Bionic implementation of pthreads implements
1161#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
1162#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
1163#endif
1164
1165#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
1166#define __STDCPP_THREADS__ 1
1167#endif
1168
1169// The glibc and Bionic implementation of pthreads implements
11011170// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
11021171// mutexes have no destroy mechanism.
1103// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
1104// speaking to their respective stakeholders.
1172//
1173// This optimization can't be performed on Apple platforms, where
1174// pthread_mutex_destroy can allow the kernel to release resources.
1175// See https://llvm.org/D64298 for details.
1176//
1177// TODO(EricWF): Enable this optimization on Bionic after speaking to their
1178// respective stakeholders.
11051179#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
1180 || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \
11061181 || defined(_LIBCPP_HAS_THREAD_API_WIN32)
11071182# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
11081183#endif
11091184
11101185// 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//
11111191// TODO(EricWF): This is potentially true for some pthread implementations
11121192// 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)
11141195# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
11151196#endif
11161197
......@@ -1129,6 +1210,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11291210#define _LIBCPP_HAS_NO_STDOUT
11301211#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
11321221#if defined(__BIONIC__) || defined(__CloudABI__) || \
11331222 defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
11341223#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
......@@ -1175,6 +1264,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11751264# endif
11761265#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
11781275#if __has_attribute(require_constant_initialization)
11791276# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
11801277#else
......@@ -1210,7 +1307,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12101307# define _LIBCPP_FALLTHROUGH() [[fallthrough]]
12111308#elif __has_cpp_attribute(clang::fallthrough)
12121309# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]]
1213#elif __has_attribute(fallthough) || _GNUC_VER >= 700
1310#elif __has_attribute(fallthrough) || _GNUC_VER >= 700
12141311# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
12151312#else
12161313# define _LIBCPP_FALLTHROUGH() ((void)0)
......@@ -1224,7 +1321,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12241321
12251322#ifndef _LIBCPP_NODEBUG_TYPE
12261323#if __has_attribute(__nodebug__) && \
1227 (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
1324 (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900)
12281325#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
12291326#else
12301327#define _LIBCPP_NODEBUG_TYPE
......@@ -1257,10 +1354,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12571354#define _LIBCPP_HAS_NO_COROUTINES
12581355#endif
12591356
1260// FIXME: Correct this macro when either (A) a feature test macro for the
1261// spaceship operator is provided, or (B) a compiler provides a complete
1262// implementation.
1357#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L
12631358#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
1359#endif
12641360
12651361// Decide whether to use availability macros.
12661362#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
......@@ -1411,6 +1507,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
14111507
14121508#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
14141521#endif // __cplusplus
14151522
14161523#endif // _LIBCPP_CONFIG
lib/libcxx/include/__config_site.in+1
......@@ -29,6 +29,7 @@
2929#cmakedefine _LIBCPP_NO_VCRUNTIME
3030#cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
3131#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
32#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
3233
3334@_LIBCPP_ABI_DEFINES@
3435
lib/libcxx/include/__debug-1
......@@ -276,4 +276,3 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
276276_LIBCPP_END_NAMESPACE_STD
277277
278278#endif // _LIBCPP_DEBUG_H
279
lib/libcxx/include/__functional_03+4-4
......@@ -104,7 +104,7 @@ class __func<_Fp, _Alloc, _Rp()>
104104{
105105 __compressed_pair<_Fp, _Alloc> __f_;
106106public:
107 explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
107 explicit __func(_Fp __f) : __f_(_VSTD::move(__f), __default_init_tag()) {}
108108 explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
109109 virtual __base<_Rp()>* __clone() const;
110110 virtual void __clone(__base<_Rp()>*) const;
......@@ -189,7 +189,7 @@ class __func<_Fp, _Alloc, _Rp(_A0)>
189189{
190190 __compressed_pair<_Fp, _Alloc> __f_;
191191public:
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()) {}
193193 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
194194 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
195195 virtual __base<_Rp(_A0)>* __clone() const;
......@@ -275,7 +275,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
275275{
276276 __compressed_pair<_Fp, _Alloc> __f_;
277277public:
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()) {}
279279 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
280280 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
281281 virtual __base<_Rp(_A0, _A1)>* __clone() const;
......@@ -361,7 +361,7 @@ class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
361361{
362362 __compressed_pair<_Fp, _Alloc> __f_;
363363public:
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()) {}
365365 _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
366366 : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
367367 virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
lib/libcxx/include/__functional_base+1-1
......@@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up,
558558
559559// allocator_arg_t
560560
561struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
561struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
562562
563563#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
564564extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;
lib/libcxx/include/__hash_table+14-12
......@@ -776,7 +776,7 @@ public:
776776 _LIBCPP_INLINE_VISIBILITY
777777 __bucket_list_deallocator()
778778 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
779 : __data_(0) {}
779 : __data_(0, __default_init_tag()) {}
780780
781781 _LIBCPP_INLINE_VISIBILITY
782782 __bucket_list_deallocator(const allocator_type& __a, size_type __size)
......@@ -825,11 +825,13 @@ private:
825825
826826 allocator_type& __na_;
827827
828 __hash_node_destructor& operator=(const __hash_node_destructor&);
829
830828public:
831829 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
833835 _LIBCPP_INLINE_VISIBILITY
834836 explicit __hash_node_destructor(allocator_type& __na,
835837 bool __constructed = false) _NOEXCEPT
......@@ -1416,8 +1418,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
14161418 is_nothrow_default_constructible<__node_allocator>::value &&
14171419 is_nothrow_default_constructible<hasher>::value &&
14181420 is_nothrow_default_constructible<key_equal>::value)
1419 : __p2_(0),
1420 __p3_(1.0f)
1421 : __p2_(0, __default_init_tag()),
1422 __p3_(1.0f, __default_init_tag())
14211423{
14221424}
14231425
......@@ -1437,7 +1439,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
14371439 const key_equal& __eql,
14381440 const allocator_type& __a)
14391441 : __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)),
14411443 __p2_(0, __hf),
14421444 __p3_(1.0f, __eql)
14431445{
......@@ -1446,9 +1448,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
14461448template <class _Tp, class _Hash, class _Equal, class _Alloc>
14471449__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
14481450 : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
1449 __p1_(__second_tag(), __node_allocator(__a)),
1450 __p2_(0),
1451 __p3_(1.0f)
1451 __p1_(__default_init_tag(), __node_allocator(__a)),
1452 __p2_(0, __default_init_tag()),
1453 __p3_(1.0f, __default_init_tag())
14521454{
14531455}
14541456
......@@ -1458,7 +1460,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
14581460 __bucket_list_deleter(allocator_traits<__pointer_allocator>::
14591461 select_on_container_copy_construction(
14601462 __u.__bucket_list_.get_deleter().__alloc()), 0)),
1461 __p1_(__second_tag(), allocator_traits<__node_allocator>::
1463 __p1_(__default_init_tag(), allocator_traits<__node_allocator>::
14621464 select_on_container_copy_construction(__u.__node_alloc())),
14631465 __p2_(0, __u.hash_function()),
14641466 __p3_(__u.__p3_)
......@@ -1469,7 +1471,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
14691471__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
14701472 const allocator_type& __a)
14711473 : __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)),
14731475 __p2_(0, __u.hash_function()),
14741476 __p3_(__u.__p3_)
14751477{
......@@ -1503,7 +1505,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
15031505__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
15041506 const allocator_type& __a)
15051507 : __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)),
15071509 __p2_(0, _VSTD::move(__u.hash_function())),
15081510 __p3_(_VSTD::move(__u.__p3_))
15091511{
lib/libcxx/include/__libcpp_version+1-1
......@@ -1 +1 @@
19000
110000
lib/libcxx/include/__locale+1-1
......@@ -409,7 +409,7 @@ public:
409409 static const mask xdigit = _ISxdigit;
410410 static const mask blank = _ISblank;
411411#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));
413413#else
414414 static const mask __regex_word = 0x80;
415415#endif
lib/libcxx/include/__mutex_base+134-31
......@@ -15,6 +15,7 @@
1515#include <system_error>
1616#include <__threading_support>
1717
18#include <time.h>
1819
1920#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2021#pragma GCC system_header
......@@ -28,15 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2829
2930#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
4032class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
4133{
4234 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
......@@ -65,9 +57,9 @@ public:
6557static_assert(is_nothrow_default_constructible<mutex>::value,
6658 "the default constructor for std::mutex must be nothrow");
6759
68struct _LIBCPP_TYPE_VIS defer_lock_t {};
69struct _LIBCPP_TYPE_VIS try_to_lock_t {};
70struct _LIBCPP_TYPE_VIS adopt_lock_t {};
60struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; };
61struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; };
62struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; };
7163
7264#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
7365
......@@ -94,10 +86,11 @@ private:
9486 mutex_type& __m_;
9587public:
9688
97 _LIBCPP_INLINE_VISIBILITY
89 _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
9890 explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
9991 : __m_(__m) {__m_.lock();}
100 _LIBCPP_INLINE_VISIBILITY
92
93 _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
10194 lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
10295 : __m_(__m) {}
10396 _LIBCPP_INLINE_VISIBILITY
......@@ -336,23 +329,75 @@ public:
336329private:
337330 void __do_timed_wait(unique_lock<mutex>& __lk,
338331 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;
339339};
340340#endif // !_LIBCPP_HAS_NO_THREADS
341341
342template <class _To, class _Rep, class _Period>
342template <class _Rep, class _Period>
343343inline _LIBCPP_INLINE_VISIBILITY
344344typename enable_if
345345<
346 chrono::__is_duration<_To>::value,
347 _To
346 is_floating_point<_Rep>::value,
347 chrono::nanoseconds
348348>::type
349__ceil(chrono::duration<_Rep, _Period> __d)
349__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
350350{
351351 using namespace chrono;
352 _To __r = duration_cast<_To>(__d);
353 if (__r < __d)
354 ++__r;
355 return __r;
352 using __ratio = ratio_divide<_Period, nano>;
353 using __ns_rep = nanoseconds::rep;
354 _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
355
356 _Rep __result_max = numeric_limits<__ns_rep>::max();
357 if (__result_float >= __result_max) {
358 return nanoseconds::max();
359 }
360
361 _Rep __result_min = numeric_limits<__ns_rep>::min();
362 if (__result_float <= __result_min) {
363 return nanoseconds::min();
364 }
365
366 return nanoseconds(static_cast<__ns_rep>(__result_float));
367}
368
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);
356401}
357402
358403#ifndef _LIBCPP_HAS_NO_THREADS
......@@ -370,7 +415,15 @@ condition_variable::wait_until(unique_lock<mutex>& __lk,
370415 const chrono::time_point<_Clock, _Duration>& __t)
371416{
372417 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);
374427 return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
375428}
376429
......@@ -396,15 +449,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
396449 using namespace chrono;
397450 if (__d <= __d.zero())
398451 return cv_status::timeout;
399 typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
400 typedef time_point<system_clock, nanoseconds> __sys_tpi;
401 __sys_tpf _Max = __sys_tpi::max();
452 using __ns_rep = nanoseconds::rep;
402453 steady_clock::time_point __c_now = steady_clock::now();
403 system_clock::time_point __s_now = system_clock::now();
404 if (_Max - __d > __s_now)
405 __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
406 else
407 __do_timed_wait(__lk, __sys_tpi::max());
454
455#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
456 using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
457 __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
458#else
459 using __clock_tp_ns = time_point<system_clock, nanoseconds>;
460 __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
461#endif
462
463 __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
464
465 if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
466 __do_timed_wait(__lk, __clock_tp_ns::max());
467 } else {
468 __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count)));
469 }
470
408471 return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
409472 cv_status::timeout;
410473}
......@@ -420,6 +483,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
420483 _VSTD::move(__pred));
421484}
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
423526#endif // !_LIBCPP_HAS_NO_THREADS
424527
425528_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__split_buffer+43-36
......@@ -116,15 +116,15 @@ public:
116116 template <class _InputIter>
117117 typename enable_if
118118 <
119 __is_input_iterator<_InputIter>::value &&
120 !__is_forward_iterator<_InputIter>::value,
119 __is_cpp17_input_iterator<_InputIter>::value &&
120 !__is_cpp17_forward_iterator<_InputIter>::value,
121121 void
122122 >::type
123123 __construct_at_end(_InputIter __first, _InputIter __last);
124124 template <class _ForwardIterator>
125125 typename enable_if
126126 <
127 __is_forward_iterator<_ForwardIterator>::value,
127 __is_cpp17_forward_iterator<_ForwardIterator>::value,
128128 void
129129 >::type
130130 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
......@@ -161,6 +161,19 @@ private:
161161 _LIBCPP_INLINE_VISIBILITY
162162 void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
163163 {}
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 };
164177};
165178
166179template <class _Tp, class _Allocator>
......@@ -197,13 +210,10 @@ template <class _Tp, class _Allocator>
197210void
198211__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
199212{
200 __alloc_rr& __a = this->__alloc();
201 do
202 {
203 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
204 ++this->__end_;
205 --__n;
206 } while (__n > 0);
213 _ConstructTransaction __tx(&this->__end_, __n);
214 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
215 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_));
216 }
207217}
208218
209219// Copy constructs __n objects starting at __end_ from __x
......@@ -216,21 +226,19 @@ template <class _Tp, class _Allocator>
216226void
217227__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
218228{
219 __alloc_rr& __a = this->__alloc();
220 do
221 {
222 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
223 ++this->__end_;
224 --__n;
225 } while (__n > 0);
229 _ConstructTransaction __tx(&this->__end_, __n);
230 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
231 __alloc_traits::construct(this->__alloc(),
232 _VSTD::__to_address(__tx.__pos_), __x);
233 }
226234}
227235
228236template <class _Tp, class _Allocator>
229237template <class _InputIter>
230238typename enable_if
231239<
232 __is_input_iterator<_InputIter>::value &&
233 !__is_forward_iterator<_InputIter>::value,
240 __is_cpp17_input_iterator<_InputIter>::value &&
241 !__is_cpp17_forward_iterator<_InputIter>::value,
234242 void
235243>::type
236244__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
245253 __split_buffer __buf(__new_cap, 0, __a);
246254 for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
247255 __alloc_traits::construct(__buf.__alloc(),
248 _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
256 _VSTD::__to_address(__buf.__end_), _VSTD::move(*__p));
249257 swap(__buf);
250258 }
251 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
259 __alloc_traits::construct(__a, _VSTD::__to_address(this->__end_), *__first);
252260 ++this->__end_;
253261 }
254262}
......@@ -257,16 +265,15 @@ template <class _Tp, class _Allocator>
257265template <class _ForwardIterator>
258266typename enable_if
259267<
260 __is_forward_iterator<_ForwardIterator>::value,
268 __is_cpp17_forward_iterator<_ForwardIterator>::value,
261269 void
262270>::type
263271__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
264272{
265 __alloc_rr& __a = this->__alloc();
266 for (; __first != __last; ++__first)
267 {
268 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
269 ++this->__end_;
273 _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
274 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
275 __alloc_traits::construct(this->__alloc(),
276 _VSTD::__to_address(__tx.__pos_), *__first);
270277 }
271278}
272279
......@@ -276,7 +283,7 @@ void
276283__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
277284{
278285 while (__begin_ != __new_begin)
279 __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
286 __alloc_traits::destroy(__alloc(), __to_address(__begin_++));
280287}
281288
282289template <class _Tp, class _Allocator>
......@@ -293,7 +300,7 @@ void
293300__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
294301{
295302 while (__new_last != __end_)
296 __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
303 __alloc_traits::destroy(__alloc(), __to_address(--__end_));
297304}
298305
299306template <class _Tp, class _Allocator>
......@@ -317,7 +324,7 @@ template <class _Tp, class _Allocator>
317324inline
318325__split_buffer<_Tp, _Allocator>::__split_buffer()
319326 _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())
321328{
322329}
323330
......@@ -361,7 +368,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
361368
362369template <class _Tp, class _Allocator>
363370__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
364 : __end_cap_(__second_tag(), __a)
371 : __end_cap_(nullptr, __a)
365372{
366373 if (__a == __c.__alloc())
367374 {
......@@ -488,7 +495,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
488495 _VSTD::swap(__end_cap(), __t.__end_cap());
489496 }
490497 }
491 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
498 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1), __x);
492499 --__begin_;
493500}
494501
......@@ -519,7 +526,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
519526 _VSTD::swap(__end_cap(), __t.__end_cap());
520527 }
521528 }
522 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
529 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__begin_-1),
523530 _VSTD::move(__x));
524531 --__begin_;
525532}
......@@ -552,7 +559,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
552559 _VSTD::swap(__end_cap(), __t.__end_cap());
553560 }
554561 }
555 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
562 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_), __x);
556563 ++__end_;
557564}
558565
......@@ -583,7 +590,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
583590 _VSTD::swap(__end_cap(), __t.__end_cap());
584591 }
585592 }
586 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
593 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_),
587594 _VSTD::move(__x));
588595 ++__end_;
589596}
......@@ -614,7 +621,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
614621 _VSTD::swap(__end_cap(), __t.__end_cap());
615622 }
616623 }
617 __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
624 __alloc_traits::construct(__alloc(), _VSTD::__to_address(__end_),
618625 _VSTD::forward<_Args>(__args)...);
619626 ++__end_;
620627}
lib/libcxx/include/__string+140-52
......@@ -31,11 +31,12 @@ struct char_traits
3131
3232 static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
3333 static constexpr size_t length(const char_type* s);
34 static constexpr const char_type*
34 static constexpr const char_type*
3535 find(const char_type* s, size_t n, const char_type& a);
36 static char_type* move(char_type* s1, const char_type* s2, size_t n);
37 static char_type* copy(char_type* s1, const char_type* s2, size_t n);
38 static char_type* assign(char_type* s, size_t n, char_type a);
36
37 static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20
38 static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20
39 static constexpr char_type* assign(char_type* s, size_t n, char_type a); // constexpr in C++20
3940
4041 static constexpr int_type not_eof(int_type c) noexcept;
4142 static constexpr char_type to_char_type(int_type c) noexcept;
......@@ -93,11 +94,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits
9394 size_t length(const char_type* __s);
9495 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
9596 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);
9799 _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);
99102 _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
102106 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
103107 {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
151155}
152156
153157template <class _CharT>
154_CharT*
158_LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT*
155159char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
156160{
161 if (__n == 0) return __s1;
157162 char_type* __r = __s1;
158163 if (__s1 < __s2)
159164 {
......@@ -171,7 +176,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
171176}
172177
173178template <class _CharT>
174inline
179inline _LIBCPP_CONSTEXPR_AFTER_CXX17
175180_CharT*
176181char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
177182{
......@@ -183,7 +188,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
183188}
184189
185190template <class _CharT>
186inline
191inline _LIBCPP_CONSTEXPR_AFTER_CXX17
187192_CharT*
188193char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
189194{
......@@ -193,6 +198,37 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
193198 return __r;
194199}
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
196232// char_traits<char>
197233
198234template <>
......@@ -217,15 +253,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
217253 length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
218254 static _LIBCPP_CONSTEXPR_AFTER_CXX14
219255 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
220 static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
221 {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
222 static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
256 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
257 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
258 {
259 return __libcpp_is_constant_evaluated()
260 ? __move_constexpr(__s1, __s2, __n)
261 : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
262 }
263 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
264 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
223265 {
224266 _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);
226277 }
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
230279 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
231280 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
......@@ -307,16 +356,28 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
307356 size_t length(const char_type* __s) _NOEXCEPT;
308357 static _LIBCPP_CONSTEXPR_AFTER_CXX14
309358 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
310 static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
311 {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}
312 static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
359 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
360 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
361 {
362 return __libcpp_is_constant_evaluated()
363 ? __move_constexpr(__s1, __s2, __n)
364 : __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
365 }
366 static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
367 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
313368 {
314369 _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);
316380 }
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
320381 static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
321382 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
322383 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
351412#endif
352413}
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
354427inline _LIBCPP_CONSTEXPR_AFTER_CXX14
355428size_t
356429char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
......@@ -412,21 +485,34 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
412485
413486 static constexpr
414487 size_t length(const char_type* __s) _NOEXCEPT;
415
488
416489 _LIBCPP_INLINE_VISIBILITY static constexpr
417490 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
418
419 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
420 {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
421
422 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
491
492 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
493 char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
494 {
495 return __libcpp_is_constant_evaluated()
496 ? __move_constexpr(__s1, __s2, __n)
497 : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
498 }
499
500 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
501 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
423502 {
424503 _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
425 return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
426 }
427
428 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
429 {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
504 return __libcpp_is_constant_evaluated()
505 ? __copy_constexpr(__s1, __s2, __n)
506 : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
507 }
508
509 static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
510 char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
511 {
512 return __libcpp_is_constant_evaluated()
513 ? __assign_constexpr(__s, __n, __a)
514 : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
515 }
430516
431517 static inline constexpr int_type not_eof(int_type __c) noexcept
432518 {return eq_int_type(__c, eof()) ? ~eof() : __c;}
......@@ -509,11 +595,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
509595 size_t length(const char_type* __s) _NOEXCEPT;
510596 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
511597 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
512 _LIBCPP_INLINE_VISIBILITY
598 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
513599 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
514 _LIBCPP_INLINE_VISIBILITY
600 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
515601 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
516 _LIBCPP_INLINE_VISIBILITY
602 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
517603 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;
518604
519605 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& _
565651 return 0;
566652}
567653
568inline
654inline _LIBCPP_CONSTEXPR_AFTER_CXX17
569655char16_t*
570656char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
571657{
658 if (__n == 0) return __s1;
572659 char_type* __r = __s1;
573660 if (__s1 < __s2)
574661 {
......@@ -585,7 +672,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
585672 return __r;
586673}
587674
588inline
675inline _LIBCPP_CONSTEXPR_AFTER_CXX17
589676char16_t*
590677char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
591678{
......@@ -596,7 +683,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
596683 return __r;
597684}
598685
599inline
686inline _LIBCPP_CONSTEXPR_AFTER_CXX17
600687char16_t*
601688char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
602689{
......@@ -628,11 +715,11 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t>
628715 size_t length(const char_type* __s) _NOEXCEPT;
629716 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14
630717 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
631 _LIBCPP_INLINE_VISIBILITY
718 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
632719 static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
633 _LIBCPP_INLINE_VISIBILITY
720 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
634721 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT;
635 _LIBCPP_INLINE_VISIBILITY
722 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
636723 static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT;
637724
638725 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& _
684771 return 0;
685772}
686773
687inline
774inline _LIBCPP_CONSTEXPR_AFTER_CXX17
688775char32_t*
689776char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
690777{
778 if (__n == 0) return __s1;
691779 char_type* __r = __s1;
692780 if (__s1 < __s2)
693781 {
......@@ -704,7 +792,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
704792 return __r;
705793}
706794
707inline
795inline _LIBCPP_CONSTEXPR_AFTER_CXX17
708796char32_t*
709797char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
710798{
......@@ -715,7 +803,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
715803 return __r;
716804}
717805
718inline
806inline _LIBCPP_CONSTEXPR_AFTER_CXX17
719807char32_t*
720808char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
721809{
......@@ -732,7 +820,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCE
732820// __str_find
733821template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
734822inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
735__str_find(const _CharT *__p, _SizeT __sz,
823__str_find(const _CharT *__p, _SizeT __sz,
736824 _CharT __c, _SizeT __pos) _NOEXCEPT
737825{
738826 if (__pos >= __sz)
......@@ -784,7 +872,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
784872
785873template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
786874inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
787__str_find(const _CharT *__p, _SizeT __sz,
875__str_find(const _CharT *__p, _SizeT __sz,
788876 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
789877{
790878 if (__pos > __sz)
......@@ -806,7 +894,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
806894
807895template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
808896inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
809__str_rfind(const _CharT *__p, _SizeT __sz,
897__str_rfind(const _CharT *__p, _SizeT __sz,
810898 _CharT __c, _SizeT __pos) _NOEXCEPT
811899{
812900 if (__sz < 1)
......@@ -825,7 +913,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
825913
826914template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
827915inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
828__str_rfind(const _CharT *__p, _SizeT __sz,
916__str_rfind(const _CharT *__p, _SizeT __sz,
829917 const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
830918{
831919 __pos = _VSTD::min(__pos, __sz);
......@@ -834,7 +922,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
834922 else
835923 __pos = __sz;
836924 const _CharT* __r = _VSTD::__find_end(
837 __p, __p + __pos, __s, __s + __n, _Traits::eq,
925 __p, __p + __pos, __s, __s + __n, _Traits::eq,
838926 random_access_iterator_tag(), random_access_iterator_tag());
839927 if (__n > 0 && __r == __p + __pos)
840928 return __npos;
......@@ -963,7 +1051,7 @@ struct __quoted_output_proxy
9631051
9641052 __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
9651053 : __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
9671055};
9681056
9691057_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__threading_support+236-29
......@@ -23,16 +23,13 @@
2323# include <__external_threading>
2424#elif !defined(_LIBCPP_HAS_NO_THREADS)
2525
26typedef ::timespec __libcpp_timespec_t;
27
2826#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
2927# include <pthread.h>
3028# include <sched.h>
29#elif defined(_LIBCPP_HAS_THREAD_API_C11)
30# include <threads.h>
3131#endif
3232
33_LIBCPP_PUSH_MACROS
34#include <__undef_macros>
35
3633#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
3734 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
3835 defined(_LIBCPP_HAS_THREAD_API_WIN32)
......@@ -47,8 +44,16 @@ _LIBCPP_PUSH_MACROS
4744#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
4845#endif
4946
47typedef ::timespec __libcpp_timespec_t;
48#endif // !defined(_LIBCPP_HAS_NO_THREADS)
49
50_LIBCPP_PUSH_MACROS
51#include <__undef_macros>
52
5053_LIBCPP_BEGIN_NAMESPACE_STD
5154
55#if !defined(_LIBCPP_HAS_NO_THREADS)
56
5257#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
5358// Mutex
5459typedef pthread_mutex_t __libcpp_mutex_t;
......@@ -76,7 +81,36 @@ typedef pthread_t __libcpp_thread_t;
7681typedef pthread_key_t __libcpp_tls_key;
7782
7883#define _LIBCPP_TLS_DESTRUCTOR_CC
79#else
84#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)
80114// Mutex
81115typedef void* __libcpp_mutex_t;
82116#define _LIBCPP_MUTEX_INITIALIZER 0
......@@ -109,8 +143,9 @@ typedef void* __libcpp_thread_t;
109143typedef long __libcpp_tls_key;
110144
111145#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
112#endif
146#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
113147
148#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
114149// Mutex
115150_LIBCPP_THREAD_ABI_VISIBILITY
116151int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
......@@ -205,9 +240,38 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
205240_LIBCPP_THREAD_ABI_VISIBILITY
206241int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
207242
243#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
244
208245#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
209 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \
210 defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
246 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL))
247
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
212276int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
213277{
......@@ -357,23 +421,7 @@ void __libcpp_thread_yield()
357421
358422void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
359423{
360 using namespace chrono;
361 seconds __s = duration_cast<seconds>(__ns);
362 __libcpp_timespec_t __ts;
363 typedef decltype(__ts.tv_sec) ts_sec;
364 _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
365
366 if (__s.count() < __ts_sec_max)
367 {
368 __ts.tv_sec = static_cast<ts_sec>(__s.count());
369 __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
370 }
371 else
372 {
373 __ts.tv_sec = __ts_sec_max;
374 __ts.tv_nsec = 999999999; // (10^9 - 1)
375 }
376
424 __libcpp_timespec_t __ts = __thread_detail::__convert_to_timespec(__ns);
377425 while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
378426}
379427
......@@ -393,6 +441,165 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
393441 return pthread_setspecific(__key, __p);
394442}
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
396603#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
397604
398605class _LIBCPP_TYPE_VIS thread;
......@@ -447,7 +654,7 @@ public:
447654
448655 _LIBCPP_INLINE_VISIBILITY
449656 void __reset() { __id_ = 0; }
450
657
451658 template<class _CharT, class _Traits>
452659 friend
453660 _LIBCPP_INLINE_VISIBILITY
......@@ -475,10 +682,10 @@ get_id() _NOEXCEPT
475682
476683} // this_thread
477684
685#endif // !_LIBCPP_HAS_NO_THREADS
686
478687_LIBCPP_END_NAMESPACE_STD
479688
480689_LIBCPP_POP_MACROS
481690
482#endif // !_LIBCPP_HAS_NO_THREADS
483
484691#endif // _LIBCPP_THREADING_SUPPORT
lib/libcxx/include/__tree+10-7
......@@ -775,11 +775,14 @@ private:
775775 typedef __tree_node_types<pointer> _NodeTypes;
776776 allocator_type& __na_;
777777
778 __tree_node_destructor& operator=(const __tree_node_destructor&);
779778
780779public:
781780 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
783786 _LIBCPP_INLINE_VISIBILITY
784787 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
785788 : __na_(__na),
......@@ -1574,8 +1577,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
15741577template <class _Tp, class _Compare, class _Allocator>
15751578__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
15761579 : __begin_node_(__iter_pointer()),
1577 __pair1_(__second_tag(), __node_allocator(__a)),
1578 __pair3_(0)
1580 __pair1_(__default_init_tag(), __node_allocator(__a)),
1581 __pair3_(0, __default_init_tag())
15791582{
15801583 __begin_node() = __end_node();
15811584}
......@@ -1584,7 +1587,7 @@ template <class _Tp, class _Compare, class _Allocator>
15841587__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
15851588 const allocator_type& __a)
15861589 : __begin_node_(__iter_pointer()),
1587 __pair1_(__second_tag(), __node_allocator(__a)),
1590 __pair1_(__default_init_tag(), __node_allocator(__a)),
15881591 __pair3_(0, __comp)
15891592{
15901593 __begin_node() = __end_node();
......@@ -1656,7 +1659,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _Fo
16561659 typedef typename _ITraits::value_type _ItValueType;
16571660 static_assert((is_same<_ItValueType, __container_value_type>::value),
16581661 "__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,
16601663 "__assign_unique requires a forward iterator");
16611664 if (size() != 0)
16621665 {
......@@ -1697,7 +1700,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
16971700template <class _Tp, class _Compare, class _Allocator>
16981701__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
16991702 : __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())),
17011704 __pair3_(0, __t.value_comp())
17021705{
17031706 __begin_node() = __end_node();
......@@ -1727,7 +1730,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
17271730
17281731template <class _Tp, class _Compare, class _Allocator>
17291732__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)),
17311734 __pair3_(0, _VSTD::move(__t.value_comp()))
17321735{
17331736 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<
477477 >;
478478
479479struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
480 template <class ...>
481 static constexpr bool __enable_default() { return false; }
480
481 static constexpr bool __enable_explicit_default() { return false; }
482 static constexpr bool __enable_implicit_default() { return false; }
482483 template <class ...>
483484 static constexpr bool __enable_explicit() { return false; }
484485 template <class ...>
lib/libcxx/include/algorithm+73-41
......@@ -167,20 +167,20 @@ template <class ForwardIterator, class Size, class T, class BinaryPredicate>
167167 Size count, const T& value, BinaryPredicate pred);
168168
169169template <class InputIterator, class OutputIterator>
170 OutputIterator
170 constexpr OutputIterator // constexpr in C++20
171171 copy(InputIterator first, InputIterator last, OutputIterator result);
172172
173173template<class InputIterator, class OutputIterator, class Predicate>
174 OutputIterator
174 constexpr OutputIterator // constexpr in C++20
175175 copy_if(InputIterator first, InputIterator last,
176176 OutputIterator result, Predicate pred);
177177
178178template<class InputIterator, class Size, class OutputIterator>
179 OutputIterator
179 constexpr OutputIterator // constexpr in C++20
180180 copy_n(InputIterator first, Size n, OutputIterator result);
181181
182182template <class BidirectionalIterator1, class BidirectionalIterator2>
183 BidirectionalIterator2
183 constexpr BidirectionalIterator2 // constexpr in C++20
184184 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
185185 BidirectionalIterator2 result);
186186
......@@ -1631,7 +1631,7 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const
16311631
16321632// copy
16331633template <class _Iter>
1634inline _LIBCPP_INLINE_VISIBILITY
1634inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
16351635_Iter
16361636__unwrap_iter(_Iter __i)
16371637{
......@@ -1639,7 +1639,7 @@ __unwrap_iter(_Iter __i)
16391639}
16401640
16411641template <class _Tp>
1642inline _LIBCPP_INLINE_VISIBILITY
1642inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
16431643typename enable_if
16441644<
16451645 is_trivially_copy_assignable<_Tp>::value,
......@@ -1693,15 +1693,23 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
16931693#endif // _LIBCPP_DEBUG_LEVEL < 2
16941694
16951695template <class _InputIterator, class _OutputIterator>
1696inline _LIBCPP_INLINE_VISIBILITY
1696inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
16971697_OutputIterator
1698__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1698__copy_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
16991699{
17001700 for (; __first != __last; ++__first, (void) ++__result)
17011701 *__result = *__first;
17021702 return __result;
17031703}
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
17051713template <class _Tp, class _Up>
17061714inline _LIBCPP_INLINE_VISIBILITY
17071715typename enable_if
......@@ -1719,25 +1727,39 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)
17191727}
17201728
17211729template <class _InputIterator, class _OutputIterator>
1722inline _LIBCPP_INLINE_VISIBILITY
1730inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
17231731_OutputIterator
17241732copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
17251733{
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 }
17271741}
17281742
17291743// copy_backward
17301744
17311745template <class _BidirectionalIterator, class _OutputIterator>
1732inline _LIBCPP_INLINE_VISIBILITY
1746inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17331747_OutputIterator
1734__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
1748__copy_backward_constexpr(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result)
17351749{
17361750 while (__first != __last)
17371751 *--__result = *--__last;
17381752 return __result;
17391753}
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
17411763template <class _Tp, class _Up>
17421764inline _LIBCPP_INLINE_VISIBILITY
17431765typename enable_if
......@@ -1758,20 +1780,26 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
17581780}
17591781
17601782template <class _BidirectionalIterator1, class _BidirectionalIterator2>
1761inline _LIBCPP_INLINE_VISIBILITY
1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
17621784_BidirectionalIterator2
17631785copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
17641786 _BidirectionalIterator2 __result)
17651787{
1766 return _VSTD::__copy_backward(__unwrap_iter(__first),
1767 __unwrap_iter(__last),
1768 __unwrap_iter(__result));
1788 if (__libcpp_is_constant_evaluated()) {
1789 return _VSTD::__copy_backward_constexpr(__unwrap_iter(__first),
1790 __unwrap_iter(__last),
1791 __unwrap_iter(__result));
1792 } else {
1793 return _VSTD::__copy_backward(__unwrap_iter(__first),
1794 __unwrap_iter(__last),
1795 __unwrap_iter(__result));
1796 }
17691797}
17701798
17711799// copy_if
17721800
17731801template<class _InputIterator, class _OutputIterator, class _Predicate>
1774inline _LIBCPP_INLINE_VISIBILITY
1802inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17751803_OutputIterator
17761804copy_if(_InputIterator __first, _InputIterator __last,
17771805 _OutputIterator __result, _Predicate __pred)
......@@ -1790,11 +1818,11 @@ copy_if(_InputIterator __first, _InputIterator __last,
17901818// copy_n
17911819
17921820template<class _InputIterator, class _Size, class _OutputIterator>
1793inline _LIBCPP_INLINE_VISIBILITY
1821inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
17941822typename enable_if
17951823<
1796 __is_input_iterator<_InputIterator>::value &&
1797 !__is_random_access_iterator<_InputIterator>::value,
1824 __is_cpp17_input_iterator<_InputIterator>::value &&
1825 !__is_cpp17_random_access_iterator<_InputIterator>::value,
17981826 _OutputIterator
17991827>::type
18001828copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
......@@ -1816,10 +1844,10 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
18161844}
18171845
18181846template<class _InputIterator, class _Size, class _OutputIterator>
1819inline _LIBCPP_INLINE_VISIBILITY
1847inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
18201848typename enable_if
18211849<
1822 __is_random_access_iterator<_InputIterator>::value,
1850 __is_cpp17_random_access_iterator<_InputIterator>::value,
18231851 _OutputIterator
18241852>::type
18251853copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
......@@ -2492,7 +2520,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
24922520_ForwardIterator
24932521min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
24942522{
2495 static_assert(__is_forward_iterator<_ForwardIterator>::value,
2523 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
24962524 "std::min_element requires a ForwardIterator");
24972525 if (__first != __last)
24982526 {
......@@ -2564,7 +2592,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
25642592_ForwardIterator
25652593max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
25662594{
2567 static_assert(__is_forward_iterator<_ForwardIterator>::value,
2595 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
25682596 "std::max_element requires a ForwardIterator");
25692597 if (__first != __last)
25702598 {
......@@ -2659,7 +2687,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
26592687std::pair<_ForwardIterator, _ForwardIterator>
26602688minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
26612689{
2662 static_assert(__is_forward_iterator<_ForwardIterator>::value,
2690 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
26632691 "std::minmax_element requires a ForwardIterator");
26642692 std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
26652693 if (__first != __last)
......@@ -3117,10 +3145,10 @@ _SampleIterator __sample(_PopulationIterator __first,
31173145 input_iterator_tag) {
31183146
31193147 _Distance __k = 0;
3120 for (; __first != __last && __k < __n; ++__first, (void)++__k)
3148 for (; __first != __last && __k < __n; ++__first, (void) ++__k)
31213149 __output_iter[__k] = *__first;
31223150 _Distance __sz = __k;
3123 for (; __first != __last; ++__first, (void)++__k) {
3151 for (; __first != __last; ++__first, (void) ++__k) {
31243152 _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
31253153 if (__r < __sz)
31263154 __output_iter[__r] = *__first;
......@@ -3158,8 +3186,8 @@ _SampleIterator __sample(_PopulationIterator __first,
31583186 _PopCategory;
31593187 typedef typename iterator_traits<_PopulationIterator>::difference_type
31603188 _Difference;
3161 static_assert(__is_forward_iterator<_PopulationIterator>::value ||
3162 __is_random_access_iterator<_SampleIterator>::value,
3189 static_assert(__is_cpp17_forward_iterator<_PopulationIterator>::value ||
3190 __is_cpp17_random_access_iterator<_SampleIterator>::value,
31633191 "SampleIterator must meet the requirements of RandomAccessIterator");
31643192 typedef typename common_type<_Distance, _Difference>::type _CommonType;
31653193 _LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
......@@ -3190,7 +3218,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
31903218 if (__d > 1)
31913219 {
31923220 _Dp __uid;
3193 for (--__last, --__d; __first < __last; ++__first, --__d)
3221 for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
31943222 {
31953223 difference_type __i = __uid(__g, _Pp(0, __d));
31963224 if (__i != difference_type(0))
......@@ -3373,7 +3401,7 @@ __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate
33733401 // All trues now at start of range, all falses in buffer
33743402 // Move falses back into range, but don't mess up __first which points to first false
33753403 __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)
33773405 *__i = _VSTD::move(*__t2);
33783406 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
33793407 return __first;
......@@ -3505,7 +3533,7 @@ __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last
35053533 __i = ++__first;
35063534 // All trues now at start of range, all falses in buffer
35073535 // 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)
35093537 *__i = _VSTD::move(*__t2);
35103538 // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
35113539 return __first;
......@@ -4382,7 +4410,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,
43824410{
43834411 typedef typename iterator_traits<_InputIterator1>::value_type __v1;
43844412 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>());
43864414}
43874415
43884416// inplace_merge
......@@ -4428,14 +4456,14 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
44284456 if (__len1 <= __len2)
44294457 {
44304458 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)
44324460 ::new(__p) value_type(_VSTD::move(*__i));
44334461 __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
44344462 }
44354463 else
44364464 {
44374465 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)
44394467 ::new(__p) value_type(_VSTD::move(*__i));
44404468 typedef reverse_iterator<_BidirectionalIterator> _RBi;
44414469 typedef reverse_iterator<value_type*> _Rv;
......@@ -4575,14 +4603,14 @@ __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
45754603 {
45764604 if (__first1 == __last1)
45774605 {
4578 for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0))
4606 for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0))
45794607 ::new (__result) value_type(_VSTD::move(*__first2));
45804608 __h.release();
45814609 return;
45824610 }
45834611 if (__first2 == __last2)
45844612 {
4585 for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0))
4613 for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0))
45864614 ::new (__result) value_type(_VSTD::move(*__first1));
45874615 __h.release();
45884616 return;
......@@ -4612,7 +4640,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
46124640 {
46134641 if (__first2 == __last2)
46144642 {
4615 for (; __first1 != __last1; ++__first1, ++__result)
4643 for (; __first1 != __last1; ++__first1, (void) ++__result)
46164644 *__result = _VSTD::move(*__first1);
46174645 return;
46184646 }
......@@ -4627,7 +4655,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1,
46274655 ++__first1;
46284656 }
46294657 }
4630 for (; __first2 != __last2; ++__first2, ++__result)
4658 for (; __first2 != __last2; ++__first2, (void) ++__result)
46314659 *__result = _VSTD::move(*__first2);
46324660}
46334661
......@@ -4995,7 +5023,7 @@ void
49955023__sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
49965024{
49975025 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)
49995027 __pop_heap<_Compare>(__first, __last, __comp, __n);
50005028}
50015029
......@@ -5065,7 +5093,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
50655093 _RandomAccessIterator __r = __result_first;
50665094 if (__r != __result_last)
50675095 {
5068 for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
5096 for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
50695097 *__r = *__first;
50705098 __make_heap<_Compare>(__result_first, __r, __comp);
50715099 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
......@@ -5678,4 +5706,8 @@ _LIBCPP_END_NAMESPACE_STD
56785706
56795707_LIBCPP_POP_MACROS
56805708
5709#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
5710# include <__pstl_algorithm>
5711#endif
5712
56815713#endif // _LIBCPP_ALGORITHM
lib/libcxx/include/atomic+1-1
......@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {
920920#endif // _LIBCPP_CXX03_LANG
921921 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
922922 : __a_value(value) {}
923 _Atomic(_Tp) __a_value;
923 _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
924924};
925925
926926#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 {
4242 template<class T>
4343 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
4552} // namespace std
4653
4754*/
......@@ -343,7 +350,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
343350bool __ispow2(_Tp __t) _NOEXCEPT
344351{
345352 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));
347354}
348355
349356
......@@ -456,6 +463,20 @@ log2p1(_Tp __t) noexcept
456463 return __t == 0 ? 0 : __bit_log2(__t) + 1;
457464}
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
459480#endif // _LIBCPP_STD_VER > 17
460481
461482_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/chrono+131-15
......@@ -612,13 +612,43 @@ constexpr year_month_weekday_last
612612constexpr year_month_weekday_last
613613 operator/(const month_weekday_last& mwdl, int y) noexcept;
614614
615// 25.9, class template time_of_day // C++20
616template<class Duration> class time_of_day;
615// 26.9, class template hh_mm_ss
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
623653// 25.10.2, time zone database // C++20
624654struct tzdb;
......@@ -1428,7 +1458,7 @@ typename enable_if
14281458>::type
14291459abs(duration<_Rep, _Period> __d)
14301460{
1431 return __d >= __d.zero() ? __d : -__d;
1461 return __d >= __d.zero() ? +__d : -__d;
14321462}
14331463#endif
14341464
......@@ -1810,7 +1840,7 @@ private:
18101840 unsigned char __wd;
18111841public:
18121842 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)) {}
18141844 inline constexpr weekday(const sys_days& __sysd) noexcept
18151845 : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {}
18161846 inline explicit constexpr weekday(const local_days& __locd) noexcept
......@@ -1822,11 +1852,13 @@ public:
18221852 inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
18231853 constexpr weekday& operator+=(const days& __dd) noexcept;
18241854 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; }
18261857 inline constexpr bool ok() const noexcept { return __wd <= 6; }
18271858 constexpr weekday_indexed operator[](unsigned __index) const noexcept;
18281859 constexpr weekday_last operator[](last_spec) const noexcept;
18291860
1861 // TODO: Make private?
18301862 static constexpr unsigned char __weekday_from_days(int __days) noexcept;
18311863};
18321864
......@@ -1842,7 +1874,7 @@ unsigned char weekday::__weekday_from_days(int __days) noexcept
18421874
18431875inline constexpr
18441876bool 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
18471879inline constexpr
18481880bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
......@@ -1850,7 +1882,7 @@ bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
18501882
18511883inline constexpr
18521884bool 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
18551887inline constexpr
18561888bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
......@@ -1866,7 +1898,7 @@ bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept
18661898
18671899constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
18681900{
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();
18701902 auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
18711903 return weekday{static_cast<unsigned>(__mu - __yr * 7)};
18721904}
......@@ -1879,7 +1911,7 @@ constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept
18791911
18801912constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept
18811913{
1882 const int __wdu = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
1914 const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
18831915 const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7;
18841916 return days{__wdu - __wk * 7};
18851917}
......@@ -2537,8 +2569,13 @@ public:
25372569 inline constexpr bool ok() const noexcept
25382570 {
25392571 if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false;
2540 // TODO: make sure it's a valid date
2541 return true;
2572 if (__wdi.index() <= 4) return true;
2573 auto __nth_weekday_day =
2574 __wdi.weekday() -
2575 chrono::weekday{static_cast<sys_days>(__y / __m / 1)} +
2576 days{(__wdi.index() - 1) * 7 + 1};
2577 return static_cast<unsigned>(__nth_weekday_day.count()) <=
2578 static_cast<unsigned>((__y / __m / last).day());
25422579 }
25432580
25442581 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
27152752inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
27162753inline 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
27182833#endif // _LIBCPP_STD_VER > 17
27192834} // chrono
27202835
......@@ -2825,6 +2940,7 @@ struct _FilesystemClock {
28252940 typedef chrono::duration<rep, period> duration;
28262941 typedef chrono::time_point<_FilesystemClock> time_point;
28272942
2943 _LIBCPP_EXPORTED_FROM_ABI
28282944 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
28292945
28302946 _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);
303303#include <__config>
304304#include <math.h>
305305#include <version>
306#include <type_traits>
306307
307308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
308309#pragma GCC system_header
309310#endif
310311
312_LIBCPP_PUSH_MACROS
313#include <__undef_macros>
314
311315_LIBCPP_BEGIN_NAMESPACE_STD
312316
313317using ::signbit;
......@@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __ler
632636
633637#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
635669_LIBCPP_END_NAMESPACE_STD
636670
671_LIBCPP_POP_MACROS
672
637673#endif // _LIBCPP_CMATH
lib/libcxx/include/cstdio+1-1
......@@ -152,7 +152,7 @@ using ::tmpnam;
152152
153153#ifndef _LIBCPP_HAS_NO_STDIN
154154using ::getchar;
155#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
155#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
156156using ::gets;
157157#endif
158158using ::scanf;
lib/libcxx/include/cstdlib+1-1
......@@ -154,7 +154,7 @@ using ::wcstombs;
154154using ::at_quick_exit;
155155using ::quick_exit;
156156#endif
157#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
157#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
158158using ::aligned_alloc;
159159#endif
160160
lib/libcxx/include/ctime+3-3
......@@ -18,7 +18,7 @@ Macros:
1818 NULL
1919 CLOCKS_PER_SEC
2020 TIME_UTC // C++17
21
21
2222namespace std
2323{
2424
......@@ -29,7 +29,7 @@ Types:
2929 time_t
3030 tm
3131 timespec // C++17
32
32
3333clock_t clock();
3434double difftime(time_t time1, time_t time0);
3535time_t mktime(tm* timeptr);
......@@ -58,7 +58,7 @@ using ::clock_t;
5858using ::size_t;
5959using ::time_t;
6060using ::tm;
61#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
61#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
6262using ::timespec;
6363#endif
6464using ::clock;
lib/libcxx/include/deque+182-95
......@@ -190,7 +190,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
190190copy(_RAIter __f,
191191 _RAIter __l,
192192 __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
195195template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
196196 class _OutputIterator>
......@@ -212,7 +212,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
212212copy_backward(_RAIter __f,
213213 _RAIter __l,
214214 __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
217217template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
218218 class _OutputIterator>
......@@ -234,7 +234,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
234234move(_RAIter __f,
235235 _RAIter __l,
236236 __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
239239template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
240240 class _OutputIterator>
......@@ -256,7 +256,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
256256move_backward(_RAIter __f,
257257 _RAIter __l,
258258 __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
261261template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
262262 class _OutputIterator>
......@@ -450,7 +450,7 @@ private:
450450 copy(_RAIter __f,
451451 _RAIter __l,
452452 __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
455455 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
456456 class _OutputIterator>
......@@ -475,7 +475,7 @@ private:
475475 copy_backward(_RAIter __f,
476476 _RAIter __l,
477477 __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
480480 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
481481 class _OutputIterator>
......@@ -500,7 +500,7 @@ private:
500500 move(_RAIter __f,
501501 _RAIter __l,
502502 __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
505505 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
506506 class _OutputIterator>
......@@ -525,7 +525,7 @@ private:
525525 move_backward(_RAIter __f,
526526 _RAIter __l,
527527 __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
530530 template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1,
531531 class _OutputIterator>
......@@ -558,7 +558,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
558558copy(_RAIter __f,
559559 _RAIter __l,
560560 __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*)
562562{
563563 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
564564 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
......@@ -646,7 +646,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
646646copy_backward(_RAIter __f,
647647 _RAIter __l,
648648 __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*)
650650{
651651 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
652652 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
......@@ -734,7 +734,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
734734move(_RAIter __f,
735735 _RAIter __l,
736736 __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*)
738738{
739739 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
740740 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
......@@ -822,7 +822,7 @@ __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>
822822move_backward(_RAIter __f,
823823 _RAIter __l,
824824 __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*)
826826{
827827 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
828828 typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
......@@ -934,7 +934,7 @@ public:
934934 typedef _Allocator allocator_type;
935935 typedef allocator_traits<allocator_type> __alloc_traits;
936936 typedef typename __alloc_traits::size_type size_type;
937protected:
937
938938 typedef _Tp value_type;
939939 typedef value_type& reference;
940940 typedef const value_type& const_reference;
......@@ -956,6 +956,74 @@ protected:
956956 typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
957957 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
9591027protected:
9601028 __map __map_;
9611029 size_type __start_;
......@@ -1103,7 +1171,7 @@ template <class _Tp, class _Allocator>
11031171inline
11041172__deque_base<_Tp, _Allocator>::__deque_base()
11051173 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1106 : __start_(0), __size_(0) {}
1174 : __start_(0), __size_(0, __default_init_tag()) {}
11071175
11081176template <class _Tp, class _Allocator>
11091177inline
......@@ -1222,6 +1290,10 @@ public:
12221290 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
12231291 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
12251297 // construct/copy/destroy:
12261298 _LIBCPP_INLINE_VISIBILITY
12271299 deque()
......@@ -1236,10 +1308,10 @@ public:
12361308 deque(size_type __n, const value_type& __v, const allocator_type& __a);
12371309 template <class _InputIter>
12381310 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);
12401312 template <class _InputIter>
12411313 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);
12431315 deque(const deque& __c);
12441316 deque(const deque& __c, const allocator_type& __a);
12451317
......@@ -1267,11 +1339,11 @@ public:
12671339
12681340 template <class _InputIter>
12691341 void assign(_InputIter __f, _InputIter __l,
1270 typename enable_if<__is_input_iterator<_InputIter>::value &&
1271 !__is_random_access_iterator<_InputIter>::value>::type* = 0);
1342 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value &&
1343 !__is_cpp17_random_access_iterator<_InputIter>::value>::type* = 0);
12721344 template <class _RAIter>
12731345 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);
12751347 void assign(size_type __n, const value_type& __v);
12761348
12771349 _LIBCPP_INLINE_VISIBILITY
......@@ -1371,15 +1443,15 @@ public:
13711443 iterator insert(const_iterator __p, size_type __n, const value_type& __v);
13721444 template <class _InputIter>
13731445 iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
1374 typename enable_if<__is_input_iterator<_InputIter>::value
1375 &&!__is_forward_iterator<_InputIter>::value>::type* = 0);
1446 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value
1447 &&!__is_cpp17_forward_iterator<_InputIter>::value>::type* = 0);
13761448 template <class _ForwardIterator>
13771449 iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
1378 typename enable_if<__is_forward_iterator<_ForwardIterator>::value
1379 &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
1450 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value
1451 &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
13801452 template <class _BiIter>
13811453 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
13841456 void pop_front();
13851457 void pop_back();
......@@ -1399,7 +1471,7 @@ public:
13991471
14001472 _LIBCPP_INLINE_VISIBILITY
14011473 bool __invariants() const {return __base::__invariants();}
1402private:
1474
14031475 typedef typename __base::__map_const_pointer __map_const_pointer;
14041476
14051477 _LIBCPP_INLINE_VISIBILITY
......@@ -1412,24 +1484,62 @@ private:
14121484 {
14131485 return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;
14141486 }
1487 _LIBCPP_INLINE_VISIBILITY
1488 size_type __block_count() const
1489 {
1490 return __base::__map_.size();
1491 }
1492
14151493 _LIBCPP_INLINE_VISIBILITY
14161494 size_type __front_spare() const
14171495 {
14181496 return __base::__start_;
14191497 }
14201498 _LIBCPP_INLINE_VISIBILITY
1499 size_type __front_spare_blocks() const {
1500 return __front_spare() / __base::__block_size;
1501 }
1502 _LIBCPP_INLINE_VISIBILITY
14211503 size_type __back_spare() const
14221504 {
14231505 return __capacity() - (__base::__start_ + __base::size());
14241506 }
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
14261536 template <class _InpIter>
14271537 void __append(_InpIter __f, _InpIter __l,
1428 typename enable_if<__is_input_iterator<_InpIter>::value &&
1429 !__is_forward_iterator<_InpIter>::value>::type* = 0);
1538 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value &&
1539 !__is_cpp17_forward_iterator<_InpIter>::value>::type* = 0);
14301540 template <class _ForIter>
14311541 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);
14331543 void __append(size_type __n);
14341544 void __append(size_type __n, const value_type& __v);
14351545 void __erase_to_end(const_iterator __f);
......@@ -1524,7 +1634,7 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const alloca
15241634template <class _Tp, class _Allocator>
15251635template <class _InputIter>
15261636deque<_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*)
15281638{
15291639 __append(__f, __l);
15301640}
......@@ -1532,7 +1642,7 @@ deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l,
15321642template <class _Tp, class _Allocator>
15331643template <class _InputIter>
15341644deque<_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*)
15361646 : __base(__a)
15371647{
15381648 __append(__f, __l);
......@@ -1640,8 +1750,8 @@ template <class _Tp, class _Allocator>
16401750template <class _InputIter>
16411751void
16421752deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
1643 typename enable_if<__is_input_iterator<_InputIter>::value &&
1644 !__is_random_access_iterator<_InputIter>::value>::type*)
1753 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value &&
1754 !__is_cpp17_random_access_iterator<_InputIter>::value>::type*)
16451755{
16461756 iterator __i = __base::begin();
16471757 iterator __e = __base::end();
......@@ -1657,7 +1767,7 @@ template <class _Tp, class _Allocator>
16571767template <class _RAIter>
16581768void
16591769deque<_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*)
16611771{
16621772 if (static_cast<size_type>(__l - __f) > __base::size())
16631773 {
......@@ -1727,17 +1837,8 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
17271837 }
17281838 else
17291839 {
1730 if (__front_spare() >= __base::__block_size)
1731 {
1732 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
1733 __base::__map_.pop_front();
1734 __base::__start_ -= __base::__block_size;
1735 }
1736 if (__back_spare() >= __base::__block_size)
1737 {
1738 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
1739 __base::__map_.pop_back();
1740 }
1840 __maybe_remove_front_spare(/*__keep_one=*/false);
1841 __maybe_remove_back_spare(/*__keep_one=*/false);
17411842 }
17421843 __base::__map_.shrink_to_fit();
17431844}
......@@ -2151,8 +2252,8 @@ template <class _Tp, class _Allocator>
21512252template <class _InputIter>
21522253typename deque<_Tp, _Allocator>::iterator
21532254deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
2154 typename enable_if<__is_input_iterator<_InputIter>::value
2155 &&!__is_forward_iterator<_InputIter>::value>::type*)
2255 typename enable_if<__is_cpp17_input_iterator<_InputIter>::value
2256 &&!__is_cpp17_forward_iterator<_InputIter>::value>::type*)
21562257{
21572258 __split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
21582259 __buf.__construct_at_end(__f, __l);
......@@ -2164,8 +2265,8 @@ template <class _Tp, class _Allocator>
21642265template <class _ForwardIterator>
21652266typename deque<_Tp, _Allocator>::iterator
21662267deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
2167 typename enable_if<__is_forward_iterator<_ForwardIterator>::value
2168 &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*)
2268 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value
2269 &&!__is_cpp17_bidirectional_iterator<_ForwardIterator>::value>::type*)
21692270{
21702271 size_type __n = _VSTD::distance(__f, __l);
21712272 __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());
......@@ -2178,7 +2279,7 @@ template <class _Tp, class _Allocator>
21782279template <class _BiIter>
21792280typename deque<_Tp, _Allocator>::iterator
21802281deque<_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*)
21822283{
21832284 size_type __n = _VSTD::distance(__f, __l);
21842285 size_type __pos = __p - __base::begin();
......@@ -2247,8 +2348,8 @@ template <class _Tp, class _Allocator>
22472348template <class _InpIter>
22482349void
22492350deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,
2250 typename enable_if<__is_input_iterator<_InpIter>::value &&
2251 !__is_forward_iterator<_InpIter>::value>::type*)
2351 typename enable_if<__is_cpp17_input_iterator<_InpIter>::value &&
2352 !__is_cpp17_forward_iterator<_InpIter>::value>::type*)
22522353{
22532354 for (; __f != __l; ++__f)
22542355#ifdef _LIBCPP_CXX03_LANG
......@@ -2262,7 +2363,7 @@ template <class _Tp, class _Allocator>
22622363template <class _ForIter>
22632364void
22642365deque<_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*)
22662367{
22672368 size_type __n = _VSTD::distance(__f, __l);
22682369 allocator_type& __a = __base::__alloc();
......@@ -2270,8 +2371,12 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
22702371 if (__n > __back_capacity)
22712372 __add_back_capacity(__n - __back_capacity);
22722373 // __n <= __back_capacity
2273 for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
2274 __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
2374 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2375 _ConstructTransaction __tx(this, __br);
2376 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
2377 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
2378 }
2379 }
22752380}
22762381
22772382template <class _Tp, class _Allocator>
......@@ -2283,8 +2388,12 @@ deque<_Tp, _Allocator>::__append(size_type __n)
22832388 if (__n > __back_capacity)
22842389 __add_back_capacity(__n - __back_capacity);
22852390 // __n <= __back_capacity
2286 for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
2287 __alloc_traits::construct(__a, _VSTD::addressof(*__i));
2391 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2392 _ConstructTransaction __tx(this, __br);
2393 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
2394 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
2395 }
2396 }
22882397}
22892398
22902399template <class _Tp, class _Allocator>
......@@ -2296,8 +2405,13 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
22962405 if (__n > __back_capacity)
22972406 __add_back_capacity(__n - __back_capacity);
22982407 // __n <= __back_capacity
2299 for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
2300 __alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);
2408 for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
2409 _ConstructTransaction __tx(this, __br);
2410 for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
2411 __alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
2412 }
2413 }
2414
23012415}
23022416
23032417// Create front capacity for one block of elements.
......@@ -2592,16 +2706,12 @@ void
25922706deque<_Tp, _Allocator>::pop_front()
25932707{
25942708 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() +
25962710 __base::__start_ / __base::__block_size) +
25972711 __base::__start_ % __base::__block_size));
25982712 --__base::size();
2599 if (++__base::__start_ >= 2 * __base::__block_size)
2600 {
2601 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2602 __base::__map_.pop_front();
2603 __base::__start_ -= __base::__block_size;
2604 }
2713 ++__base::__start_;
2714 __maybe_remove_front_spare();
26052715}
26062716
26072717template <class _Tp, class _Allocator>
......@@ -2611,15 +2721,11 @@ deque<_Tp, _Allocator>::pop_back()
26112721 _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
26122722 allocator_type& __a = __base::__alloc();
26132723 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() +
26152725 __p / __base::__block_size) +
26162726 __p % __base::__block_size));
26172727 --__base::size();
2618 if (__back_spare() >= 2 * __base::__block_size)
2619 {
2620 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2621 __base::__map_.pop_back();
2622 }
2728 __maybe_remove_back_spare();
26232729}
26242730
26252731// move assign [__f, __l) to [__r, __r + (__l-__f)).
......@@ -2768,23 +2874,14 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
27682874 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
27692875 --__base::size();
27702876 ++__base::__start_;
2771 if (__front_spare() >= 2 * __base::__block_size)
2772 {
2773 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2774 __base::__map_.pop_front();
2775 __base::__start_ -= __base::__block_size;
2776 }
2877 __maybe_remove_front_spare();
27772878 }
27782879 else
27792880 { // erase from back
27802881 iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p);
27812882 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
27822883 --__base::size();
2783 if (__back_spare() >= 2 * __base::__block_size)
2784 {
2785 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2786 __base::__map_.pop_back();
2787 }
2884 __maybe_remove_back_spare();
27882885 }
27892886 return __base::begin() + __pos;
27902887}
......@@ -2807,11 +2904,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
28072904 __alloc_traits::destroy(__a, _VSTD::addressof(*__b));
28082905 __base::size() -= __n;
28092906 __base::__start_ += __n;
2810 while (__front_spare() >= 2 * __base::__block_size)
2811 {
2812 __alloc_traits::deallocate(__a, __base::__map_.front(), __base::__block_size);
2813 __base::__map_.pop_front();
2814 __base::__start_ -= __base::__block_size;
2907 while (__maybe_remove_front_spare()) {
28152908 }
28162909 }
28172910 else
......@@ -2820,10 +2913,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
28202913 for (iterator __e = __base::end(); __i != __e; ++__i)
28212914 __alloc_traits::destroy(__a, _VSTD::addressof(*__i));
28222915 __base::size() -= __n;
2823 while (__back_spare() >= 2 * __base::__block_size)
2824 {
2825 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2826 __base::__map_.pop_back();
2916 while (__maybe_remove_back_spare()) {
28272917 }
28282918 }
28292919 }
......@@ -2844,10 +2934,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
28442934 for (iterator __p = __b + __pos; __p != __e; ++__p)
28452935 __alloc_traits::destroy(__a, _VSTD::addressof(*__p));
28462936 __base::size() -= __n;
2847 while (__back_spare() >= 2 * __base::__block_size)
2848 {
2849 __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size);
2850 __base::__map_.pop_back();
2937 while (__maybe_remove_back_spare()) {
28512938 }
28522939 }
28532940}
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>>;
5151#include <functional>
5252#include <memory> // for hash<T*>
5353#include <cstddef>
54#include <cassert>
5554#include <__debug>
5655
5756#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<>>
112112class _LIBCPP_TYPE_VIS default_searcher {
113113public:
114114 _LIBCPP_INLINE_VISIBILITY
115 default_searcher(_ForwardIterator __f, _ForwardIterator __l,
115 default_searcher(_ForwardIterator __f, _ForwardIterator __l,
116116 _BinaryPredicate __p = _BinaryPredicate())
117117 : __first_(__f), __last_(__l), __pred_(__p) {}
118118
......@@ -151,12 +151,12 @@ public: // TODO private:
151151
152152 const _Value __default_value_;
153153 std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
154
154
155155public:
156156 _LIBCPP_INLINE_VISIBILITY
157157 _BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
158158 : __default_value_(__default), __table(__sz, __hf, __pred) {}
159
159
160160 _LIBCPP_INLINE_VISIBILITY
161161 void insert(const key_type &__key, value_type __val)
162162 {
......@@ -170,7 +170,7 @@ public:
170170 return __it == __table.end() ? __default_value_ : __it->second;
171171 }
172172};
173
173
174174
175175// Special case small numeric values; use an array
176176template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
......@@ -189,7 +189,7 @@ public:
189189 {
190190 std::fill_n(__table.begin(), __table.size(), __default);
191191 }
192
192
193193 _LIBCPP_INLINE_VISIBILITY
194194 void insert(key_type __key, value_type __val)
195195 {
......@@ -204,8 +204,8 @@ public:
204204};
205205
206206
207template <class _RandomAccessIterator1,
208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
207template <class _RandomAccessIterator1,
208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
209209 class _BinaryPredicate = equal_to<>>
210210class _LIBCPP_TYPE_VIS boyer_moore_searcher {
211211private:
......@@ -217,9 +217,9 @@ private:
217217 is_same<_Hash, hash<value_type>>::value &&
218218 is_same<_BinaryPredicate, equal_to<>>::value
219219 > skip_table_type;
220
220
221221public:
222 boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
222 boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
223223 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
224224 : __first_(__f), __last_(__l), __pred_(__pred),
225225 __pattern_length_(_VSTD::distance(__first_, __last_)),
......@@ -232,13 +232,13 @@ public:
232232
233233 this->__build_suffix_table ( __first_, __last_, __pred_ );
234234 }
235
235
236236 template <typename _RandomAccessIterator2>
237237 pair<_RandomAccessIterator2, _RandomAccessIterator2>
238238 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
239239 {
240240 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,
242242 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
243243 >::value,
244244 "Corpus and Pattern iterators must point to the same type" );
......@@ -247,13 +247,13 @@ public:
247247 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
248248
249249 // 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))
251251 return make_pair(__l, __l);
252252
253 // Do the search
253 // Do the search
254254 return this->__search(__f, __l);
255255 }
256
256
257257public: // TODO private:
258258 _RandomAccessIterator1 __first_;
259259 _RandomAccessIterator1 __last_;
......@@ -270,7 +270,7 @@ public: // TODO private:
270270 const _RandomAccessIterator2 __last = __l - __pattern_length_;
271271 const skip_table_type & __skip = *__skip_.get();
272272 const vector<difference_type> & __suffix = *__suffix_.get();
273
273
274274 while (__cur <= __last)
275275 {
276276
......@@ -282,7 +282,7 @@ public: // TODO private:
282282 if ( __j == 0 )
283283 return make_pair(__cur, __cur + __pattern_length_);
284284 }
285
285
286286 // Since we didn't match, figure out how far to skip forward
287287 difference_type __k = __skip[__cur [ __j - 1 ]];
288288 difference_type __m = __j - __k - 1;
......@@ -291,7 +291,7 @@ public: // TODO private:
291291 else
292292 __cur += __suffix[ __j ];
293293 }
294
294
295295 return make_pair(__l, __l); // We didn't find anything
296296 }
297297
......@@ -300,21 +300,21 @@ public: // TODO private:
300300 void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
301301 {
302302 const std::size_t __count = _VSTD::distance(__f, __l);
303
303
304304 __prefix[0] = 0;
305305 std::size_t __k = 0;
306306 for ( std::size_t __i = 1; __i < __count; ++__i )
307307 {
308308 while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
309309 __k = __prefix [ __k - 1 ];
310
310
311311 if ( __pred ( __f[__k], __f[__i] ))
312312 __k++;
313313 __prefix [ __i ] = __k;
314314 }
315315 }
316316
317 void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
317 void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
318318 _BinaryPredicate __pred)
319319 {
320320 const std::size_t __count = _VSTD::distance(__f, __l);
......@@ -322,19 +322,19 @@ public: // TODO private:
322322 if (__count > 0)
323323 {
324324 _VSTD::vector<value_type> __scratch(__count);
325
325
326326 __compute_bm_prefix(__f, __l, __pred, __scratch);
327327 for ( std::size_t __i = 0; __i <= __count; __i++ )
328328 __suffix[__i] = __count - __scratch[__count-1];
329
329
330330 typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
331331 __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
332
332
333333 for ( std::size_t __i = 0; __i < __count; __i++ )
334334 {
335335 const std::size_t __j = __count - __scratch[__i];
336336 const difference_type __k = __i - __scratch[__i] + 1;
337
337
338338 if (__suffix[__j] > __k)
339339 __suffix[__j] = __k;
340340 }
......@@ -343,20 +343,20 @@ public: // TODO private:
343343
344344};
345345
346template<class _RandomAccessIterator,
347 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
346template<class _RandomAccessIterator,
347 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
348348 class _BinaryPredicate = equal_to<>>
349349_LIBCPP_INLINE_VISIBILITY
350350boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
351make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
351make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
352352 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
353353{
354354 return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
355355}
356356
357357// boyer-moore-horspool
358template <class _RandomAccessIterator1,
359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
358template <class _RandomAccessIterator1,
359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
360360 class _BinaryPredicate = equal_to<>>
361361class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {
362362private:
......@@ -370,7 +370,7 @@ private:
370370 > skip_table_type;
371371
372372public:
373 boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
373 boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
374374 _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
375375 : __first_(__f), __last_(__l), __pred_(__pred),
376376 __pattern_length_(_VSTD::distance(__first_, __last_)),
......@@ -384,13 +384,13 @@ public:
384384 __skip_->insert(*__f, __pattern_length_ - 1 - __i);
385385 }
386386 }
387
387
388388 template <typename _RandomAccessIterator2>
389389 pair<_RandomAccessIterator2, _RandomAccessIterator2>
390390 operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
391391 {
392392 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,
394394 typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
395395 >::value,
396396 "Corpus and Pattern iterators must point to the same type" );
......@@ -399,13 +399,13 @@ public:
399399 if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
400400
401401 // 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))
403403 return make_pair(__l, __l);
404404
405 // Do the search
405 // Do the search
406406 return this->__search(__f, __l);
407407 }
408
408
409409private:
410410 _RandomAccessIterator1 __first_;
411411 _RandomAccessIterator1 __last_;
......@@ -433,17 +433,17 @@ private:
433433 }
434434 __cur += __skip[__cur[__pattern_length_-1]];
435435 }
436
436
437437 return make_pair(__l, __l);
438438 }
439439};
440440
441template<class _RandomAccessIterator,
442 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
441template<class _RandomAccessIterator,
442 class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
443443 class _BinaryPredicate = equal_to<>>
444444_LIBCPP_INLINE_VISIBILITY
445445boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
446make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
446make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
447447 _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
448448{
449449 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 {
2626 typedef void difference_type;
2727 typedef void pointer;
2828 typedef void reference;
29
29
3030 ostream_joiner(ostream_type& s, const DelimT& delimiter);
3131 ostream_joiner(ostream_type& s, DelimT&& delimiter);
3232
33 template<typename T>
33 template<typename T>
3434 ostream_joiner& operator=(const T& value);
3535
3636 ostream_joiner& operator*() noexcept;
3737 ostream_joiner& operator++() noexcept;
3838 ostream_joiner& operator++(int) noexcept;
3939 private:
40 ostream_type* out_stream; // exposition only
41 DelimT delim; // exposition only
40 ostream_type* out_stream; // exposition only
41 DelimT delim; // exposition only
4242 bool first_element; // exposition only
4343 };
4444
......@@ -75,10 +75,10 @@ public:
7575
7676 ostream_joiner(ostream_type& __os, _Delim&& __d)
7777 : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
78
78
7979 ostream_joiner(ostream_type& __os, const _Delim& __d)
8080 : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
81
81
8282
8383 template<typename _Tp>
8484 ostream_joiner& operator=(const _Tp& __v)
lib/libcxx/include/experimental/propagate_const-1
......@@ -575,4 +575,3 @@ _LIBCPP_END_NAMESPACE_STD
575575
576576#endif // _LIBCPP_STD_VER > 11
577577#endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
578
lib/libcxx/include/experimental/type_traits+3-3
......@@ -60,7 +60,7 @@ inline namespace fundamentals_v1 {
6060 using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
6161 template <class To, template<class...> class Op, class... Args>
6262 constexpr bool is_detected_convertible_v
63 = is_detected_convertible<To, Op, Args...>::value;
63 = is_detected_convertible<To, Op, Args...>::value;
6464
6565} // namespace fundamentals_v1
6666} // namespace experimental
......@@ -122,7 +122,7 @@ struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
122122 using value_t = true_type;
123123 using type = _Op<_Args...>;
124124 };
125
125
126126
127127template <template<class...> class _Op, class... _Args>
128128 using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
......@@ -144,7 +144,7 @@ template <class Expected, template<class...> class _Op, class... _Args>
144144template <class To, template<class...> class _Op, class... _Args>
145145 using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>;
146146template <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
150150_LIBCPP_END_NAMESPACE_LFTS
lib/libcxx/include/ext/hash_map+15-13
......@@ -39,14 +39,17 @@ public:
3939 typedef /unspecified/ iterator;
4040 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(),
4344 const key_equal& eql = key_equal(),
4445 const allocator_type& a = allocator_type());
4546 template <class InputIterator>
46 hash_map(InputIterator f, InputIterator l,
47 size_type n = 193, const hasher& hf = hasher(),
48 const key_equal& eql = key_equal(),
49 const allocator_type& a = allocator_type());
47 hash_map(InputIterator f, InputIterator l);
48 template <class InputIterator>
49 hash_map(InputIterator f, InputIterator l,
50 size_type n, const hasher& hf = hasher(),
51 const key_equal& eql = key_equal(),
52 const allocator_type& a = allocator_type());
5053 hash_map(const hash_map&);
5154 ~hash_map();
5255 hash_map& operator=(const hash_map&);
......@@ -315,12 +318,13 @@ private:
315318
316319 allocator_type& __na_;
317320
318 __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
319
320321public:
321322 bool __first_constructed;
322323 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
324328 _LIBCPP_INLINE_VISIBILITY
325329 explicit __hash_map_node_destructor(allocator_type& __na)
326330 : __na_(__na),
......@@ -391,10 +395,10 @@ public:
391395 return __t;
392396 }
393397
394 friend _LIBCPP_INLINE_VISIBILITY
398 friend _LIBCPP_INLINE_VISIBILITY
395399 bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
396400 {return __x.__i_ == __y.__i_;}
397 friend _LIBCPP_INLINE_VISIBILITY
401 friend _LIBCPP_INLINE_VISIBILITY
398402 bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
399403 {return __x.__i_ != __y.__i_;}
400404
......@@ -502,7 +506,7 @@ public:
502506 typedef __hash_map_iterator<typename __table::iterator> iterator;
503507 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() { }
506510 explicit hash_map(size_type __n, const hasher& __hf = hasher(),
507511 const key_equal& __eql = key_equal());
508512 hash_map(size_type __n, const hasher& __hf,
......@@ -623,7 +627,6 @@ template <class _InputIterator>
623627hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
624628 _InputIterator __first, _InputIterator __last)
625629{
626 __table_.rehash(193);
627630 insert(__first, __last);
628631}
629632
......@@ -775,7 +778,7 @@ public:
775778 typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
776779
777780 _LIBCPP_INLINE_VISIBILITY
778 hash_multimap() {__table_.rehash(193);}
781 hash_multimap() { }
779782 explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
780783 const key_equal& __eql = key_equal());
781784 hash_multimap(size_type __n, const hasher& __hf,
......@@ -890,7 +893,6 @@ template <class _InputIterator>
890893hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
891894 _InputIterator __first, _InputIterator __last)
892895{
893 __table_.rehash(193);
894896 insert(__first, __last);
895897}
896898
lib/libcxx/include/ext/hash_set+2-4
......@@ -237,7 +237,7 @@ public:
237237 typedef typename __table::const_iterator const_iterator;
238238
239239 _LIBCPP_INLINE_VISIBILITY
240 hash_set() {__table_.rehash(193);}
240 hash_set() { }
241241 explicit hash_set(size_type __n, const hasher& __hf = hasher(),
242242 const key_equal& __eql = key_equal());
243243 hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
......@@ -347,7 +347,6 @@ template <class _InputIterator>
347347hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
348348 _InputIterator __first, _InputIterator __last)
349349{
350 __table_.rehash(193);
351350 insert(__first, __last);
352351}
353352
......@@ -459,7 +458,7 @@ public:
459458 typedef typename __table::const_iterator const_iterator;
460459
461460 _LIBCPP_INLINE_VISIBILITY
462 hash_multiset() {__table_.rehash(193);}
461 hash_multiset() { }
463462 explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
464463 const key_equal& __eql = key_equal());
465464 hash_multiset(size_type __n, const hasher& __hf,
......@@ -569,7 +568,6 @@ template <class _InputIterator>
569568hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
570569 _InputIterator __first, _InputIterator __last)
571570{
572 __table_.rehash(193);
573571 insert(__first, __last);
574572}
575573
lib/libcxx/include/filesystem+4-3
......@@ -625,7 +625,7 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
625625 static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
626626};
627627
628template <class _Iter, bool _IsIt = __is_input_iterator<_Iter>::value,
628template <class _Iter, bool _IsIt = __is_cpp17_input_iterator<_Iter>::value,
629629 class = void>
630630struct __is_pathable_iter : false_type {};
631631
......@@ -708,14 +708,14 @@ template <>
708708struct _PathCVT<char> {
709709
710710 template <class _Iter>
711 static typename enable_if<__is_exactly_input_iterator<_Iter>::value>::type
711 static typename enable_if<__is_exactly_cpp17_input_iterator<_Iter>::value>::type
712712 __append_range(string& __dest, _Iter __b, _Iter __e) {
713713 for (; __b != __e; ++__b)
714714 __dest.push_back(*__b);
715715 }
716716
717717 template <class _Iter>
718 static typename enable_if<__is_forward_iterator<_Iter>::value>::type
718 static typename enable_if<__is_cpp17_forward_iterator<_Iter>::value>::type
719719 __append_range(string& __dest, _Iter __b, _Iter __e) {
720720 __dest.__append_forward_unsafe(__b, __e);
721721 }
......@@ -2583,6 +2583,7 @@ public:
25832583 void disable_recursion_pending() { __rec_ = false; }
25842584
25852585private:
2586 _LIBCPP_FUNC_VIS
25862587 recursive_directory_iterator(const path& __p, directory_options __opt,
25872588 error_code* __ec);
25882589
lib/libcxx/include/forward_list+12-12
......@@ -490,7 +490,7 @@ protected:
490490 _LIBCPP_INLINE_VISIBILITY
491491 __forward_list_base()
492492 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
493 : __before_begin_(__begin_node()) {}
493 : __before_begin_(__begin_node(), __default_init_tag()) {}
494494 _LIBCPP_INLINE_VISIBILITY
495495 explicit __forward_list_base(const allocator_type& __a)
496496 : __before_begin_(__begin_node(), __node_allocator(__a)) {}
......@@ -670,13 +670,13 @@ public:
670670 template <class _InputIterator>
671671 forward_list(_InputIterator __f, _InputIterator __l,
672672 typename enable_if<
673 __is_input_iterator<_InputIterator>::value
673 __is_cpp17_input_iterator<_InputIterator>::value
674674 >::type* = nullptr);
675675 template <class _InputIterator>
676676 forward_list(_InputIterator __f, _InputIterator __l,
677677 const allocator_type& __a,
678678 typename enable_if<
679 __is_input_iterator<_InputIterator>::value
679 __is_cpp17_input_iterator<_InputIterator>::value
680680 >::type* = nullptr);
681681 forward_list(const forward_list& __x);
682682 forward_list(const forward_list& __x, const allocator_type& __a);
......@@ -711,7 +711,7 @@ public:
711711 template <class _InputIterator>
712712 typename enable_if
713713 <
714 __is_input_iterator<_InputIterator>::value,
714 __is_cpp17_input_iterator<_InputIterator>::value,
715715 void
716716 >::type
717717 assign(_InputIterator __f, _InputIterator __l);
......@@ -792,7 +792,7 @@ public:
792792 _LIBCPP_INLINE_VISIBILITY
793793 typename enable_if
794794 <
795 __is_input_iterator<_InputIterator>::value,
795 __is_cpp17_input_iterator<_InputIterator>::value,
796796 iterator
797797 >::type
798798 insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
......@@ -950,7 +950,7 @@ template <class _Tp, class _Alloc>
950950template <class _InputIterator>
951951forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
952952 typename enable_if<
953 __is_input_iterator<_InputIterator>::value
953 __is_cpp17_input_iterator<_InputIterator>::value
954954 >::type*)
955955{
956956 insert_after(cbefore_begin(), __f, __l);
......@@ -961,7 +961,7 @@ template <class _InputIterator>
961961forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
962962 const allocator_type& __a,
963963 typename enable_if<
964 __is_input_iterator<_InputIterator>::value
964 __is_cpp17_input_iterator<_InputIterator>::value
965965 >::type*)
966966 : base(__a)
967967{
......@@ -1074,7 +1074,7 @@ template <class _Tp, class _Alloc>
10741074template <class _InputIterator>
10751075typename enable_if
10761076<
1077 __is_input_iterator<_InputIterator>::value,
1077 __is_cpp17_input_iterator<_InputIterator>::value,
10781078 void
10791079>::type
10801080forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
......@@ -1270,7 +1270,7 @@ template <class _Tp, class _Alloc>
12701270template <class _InputIterator>
12711271typename enable_if
12721272<
1273 __is_input_iterator<_InputIterator>::value,
1273 __is_cpp17_input_iterator<_InputIterator>::value,
12741274 typename forward_list<_Tp, _Alloc>::iterator
12751275>::type
12761276forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
......@@ -1525,7 +1525,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
15251525 else
15261526 ++__i;
15271527 }
1528
1528
15291529 return (__remove_return_type) __count_removed;
15301530}
15311531
......@@ -1553,7 +1553,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
15531553 else
15541554 ++__i;
15551555 }
1556
1556
15571557 return (__remove_return_type) __count_removed;
15581558}
15591559
......@@ -1573,7 +1573,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
15731573 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
15741574 __i = __j;
15751575 }
1576
1576
15771577 return (__remove_return_type) __count_removed;
15781578}
15791579
lib/libcxx/include/fstream+14-15
......@@ -508,34 +508,34 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
508508 switch (__mode & ~ios_base::ate) {
509509 case ios_base::out:
510510 case ios_base::out | ios_base::trunc:
511 return "w";
511 return "w" _LIBCPP_FOPEN_CLOEXEC_MODE;
512512 case ios_base::out | ios_base::app:
513513 case ios_base::app:
514 return "a";
514 return "a" _LIBCPP_FOPEN_CLOEXEC_MODE;
515515 case ios_base::in:
516 return "r";
516 return "r" _LIBCPP_FOPEN_CLOEXEC_MODE;
517517 case ios_base::in | ios_base::out:
518 return "r+";
518 return "r+" _LIBCPP_FOPEN_CLOEXEC_MODE;
519519 case ios_base::in | ios_base::out | ios_base::trunc:
520 return "w+";
520 return "w+" _LIBCPP_FOPEN_CLOEXEC_MODE;
521521 case ios_base::in | ios_base::out | ios_base::app:
522522 case ios_base::in | ios_base::app:
523 return "a+";
523 return "a+" _LIBCPP_FOPEN_CLOEXEC_MODE;
524524 case ios_base::out | ios_base::binary:
525525 case ios_base::out | ios_base::trunc | ios_base::binary:
526 return "wb";
526 return "wb" _LIBCPP_FOPEN_CLOEXEC_MODE;
527527 case ios_base::out | ios_base::app | ios_base::binary:
528528 case ios_base::app | ios_base::binary:
529 return "ab";
529 return "ab" _LIBCPP_FOPEN_CLOEXEC_MODE;
530530 case ios_base::in | ios_base::binary:
531 return "rb";
531 return "rb" _LIBCPP_FOPEN_CLOEXEC_MODE;
532532 case ios_base::in | ios_base::out | ios_base::binary:
533 return "r+b";
533 return "r+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
534534 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;
536536 case ios_base::in | ios_base::out | ios_base::app | ios_base::binary:
537537 case ios_base::in | ios_base::app | ios_base::binary:
538 return "a+b";
538 return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
539539 default:
540540 return nullptr;
541541 }
......@@ -697,10 +697,9 @@ basic_filebuf<_CharT, _Traits>::close()
697697 unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
698698 if (sync())
699699 __rt = 0;
700 if (fclose(__h.release()) == 0)
701 __file_ = 0;
702 else
700 if (fclose(__h.release()))
703701 __rt = 0;
702 __file_ = 0;
704703 setbuf(0, 0);
705704 }
706705 return __rt;
lib/libcxx/include/functional+54
......@@ -440,6 +440,13 @@ public:
440440 template <typename T> const T* target() const noexcept;
441441};
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
443450// Null pointer comparisons:
444451template <class R, class ... ArgTypes>
445452 bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
......@@ -2335,6 +2342,53 @@ public:
23352342#endif // _LIBCPP_NO_RTTI
23362343};
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
23382392template<class _Rp, class ..._ArgTypes>
23392393function<_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
611611}
612612
613613template <class _Rp>
614class _LIBCPP_AVAILABILITY_FUTURE __assoc_state
614class _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_HIDDEN __assoc_state
615615 : public __assoc_sub_state
616616{
617617 typedef __assoc_sub_state base;
......@@ -1060,7 +1060,7 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS shared_future;
10601060template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
10611061
10621062template <class _Rp, class _Fp>
1063future<_Rp>
1063_LIBCPP_INLINE_VISIBILITY future<_Rp>
10641064#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
10651065__make_deferred_assoc_state(_Fp&& __f);
10661066#else
......@@ -1068,7 +1068,7 @@ __make_deferred_assoc_state(_Fp __f);
10681068#endif
10691069
10701070template <class _Rp, class _Fp>
1071future<_Rp>
1071_LIBCPP_INLINE_VISIBILITY future<_Rp>
10721072#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
10731073__make_async_assoc_state(_Fp&& __f);
10741074#else
......@@ -1767,9 +1767,9 @@ class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgType
17671767 __compressed_pair<_Fp, _Alloc> __f_;
17681768public:
17691769 _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()) {}
17711771 _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()) {}
17731773 _LIBCPP_INLINE_VISIBILITY
17741774 __packaged_task_func(const _Fp& __f, const _Alloc& __a)
17751775 : __f_(__f, __a) {}
......@@ -2266,7 +2266,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
22662266 : public true_type {};
22672267
22682268template <class _Rp, class _Fp>
2269future<_Rp>
2269_LIBCPP_INLINE_VISIBILITY future<_Rp>
22702270#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22712271__make_deferred_assoc_state(_Fp&& __f)
22722272#else
......@@ -2279,7 +2279,7 @@ __make_deferred_assoc_state(_Fp __f)
22792279}
22802280
22812281template <class _Rp, class _Fp>
2282future<_Rp>
2282_LIBCPP_INLINE_VISIBILITY future<_Rp>
22832283#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22842284__make_async_assoc_state(_Fp&& __f)
22852285#else
......@@ -2293,7 +2293,7 @@ __make_async_assoc_state(_Fp __f)
22932293}
22942294
22952295template <class _Fp, class... _Args>
2296class __async_func
2296class _LIBCPP_HIDDEN __async_func
22972297{
22982298 tuple<_Fp, _Args...> __f_;
22992299
lib/libcxx/include/istream+1-1
......@@ -1619,7 +1619,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
16191619 __is.rdbuf()->sbumpc();
16201620 }
16211621 __x = bitset<_Size>(__str);
1622 if (__c == 0)
1622 if (_Size > 0 && __c == 0)
16231623 __state |= ios_base::failbit;
16241624#ifndef _LIBCPP_NO_EXCEPTIONS
16251625 }
lib/libcxx/include/iterator+83-15
......@@ -434,12 +434,65 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
434434#endif
435435
436436_LIBCPP_BEGIN_NAMESPACE_STD
437template <class _Iter>
438struct _LIBCPP_TEMPLATE_VIS iterator_traits;
437439
438440struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};
439441struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};
440442struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};
441443struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
442444struct _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
444497template <class _Tp>
445498struct __has_iterator_typedefs
......@@ -500,7 +553,10 @@ struct __iterator_traits<_Iter, true>
500553
501554template <class _Iter>
502555struct _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
505561template<class _Tp>
506562struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
......@@ -510,6 +566,9 @@ struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>
510566 typedef _Tp* pointer;
511567 typedef _Tp& reference;
512568 typedef random_access_iterator_tag iterator_category;
569#if _LIBCPP_STD_VER > 17
570 typedef contiguous_iterator_tag iterator_concept;
571#endif
513572};
514573
515574template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value>
......@@ -521,19 +580,28 @@ template <class _Tp, class _Up>
521580struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {};
522581
523582template <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
526585template <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
529588template <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
532591template <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
535603template <class _Tp>
536struct __is_exactly_input_iterator
604struct __is_exactly_cpp17_input_iterator
537605 : public integral_constant<bool,
538606 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
539607 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
......@@ -600,7 +668,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
600668void advance(_InputIter& __i,
601669 typename iterator_traits<_InputIter>::difference_type __n)
602670{
603 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
671 _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
604672 "Attempt to advance(it, -n) on a non-bidi iterator");
605673 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
606674}
......@@ -636,13 +704,13 @@ template <class _InputIter>
636704inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
637705typename enable_if
638706<
639 __is_input_iterator<_InputIter>::value,
707 __is_cpp17_input_iterator<_InputIter>::value,
640708 _InputIter
641709>::type
642710next(_InputIter __x,
643711 typename iterator_traits<_InputIter>::difference_type __n = 1)
644712{
645 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
713 _LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
646714 "Attempt to next(it, -n) on a non-bidi iterator");
647715
648716 _VSTD::advance(__x, __n);
......@@ -653,13 +721,13 @@ template <class _InputIter>
653721inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
654722typename enable_if
655723<
656 __is_input_iterator<_InputIter>::value,
724 __is_cpp17_input_iterator<_InputIter>::value,
657725 _InputIter
658726>::type
659727prev(_InputIter __x,
660728 typename iterator_traits<_InputIter>::difference_type __n = 1)
661729{
662 _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value,
730 _LIBCPP_ASSERT(__n <= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
663731 "Attempt to prev(it, +n) on a non-bidi iterator");
664732 _VSTD::advance(__x, -__n);
665733 return __x;
......@@ -1304,8 +1372,8 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
13041372__wrap_iter<_Iter>
13051373operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
13061374
1307template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
1308template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
1375template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op);
1376template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2);
13091377template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
13101378template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
13111379
......@@ -1515,8 +1583,8 @@ private:
15151583 __wrap_iter<_Iter1>
15161584 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
15171585
1518 template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
1519 template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
1586 template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op);
1587 template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 copy_backward(_B1, _B1, _B2);
15201588 template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
15211589 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>
715715inline
716716__list_imp<_Tp, _Alloc>::__list_imp()
717717 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
718 : __size_alloc_(0)
718 : __size_alloc_(0, __default_init_tag())
719719{
720720}
721721
......@@ -887,10 +887,10 @@ public:
887887 list(size_type __n, const value_type& __x, const allocator_type& __a);
888888 template <class _InpIter>
889889 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);
891891 template <class _InpIter>
892892 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
895895 list(const list& __c);
896896 list(const list& __c, const allocator_type& __a);
......@@ -922,7 +922,7 @@ public:
922922
923923 template <class _InpIter>
924924 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);
926926 void assign(size_type __n, const value_type& __x);
927927
928928 _LIBCPP_INLINE_VISIBILITY
......@@ -1039,7 +1039,7 @@ public:
10391039 iterator insert(const_iterator __p, size_type __n, const value_type& __x);
10401040 template <class _InpIter>
10411041 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
10441044 _LIBCPP_INLINE_VISIBILITY
10451045 void swap(list& __c)
......@@ -1252,7 +1252,7 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_ty
12521252template <class _Tp, class _Alloc>
12531253template <class _InpIter>
12541254list<_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*)
12561256{
12571257#if _LIBCPP_DEBUG_LEVEL >= 2
12581258 __get_db()->__insert_c(this);
......@@ -1264,7 +1264,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
12641264template <class _Tp, class _Alloc>
12651265template <class _InpIter>
12661266list<_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*)
12681268 : base(__a)
12691269{
12701270#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1403,7 +1403,7 @@ template <class _Tp, class _Alloc>
14031403template <class _InpIter>
14041404void
14051405list<_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*)
14071407{
14081408 iterator __i = begin();
14091409 iterator __e = end();
......@@ -1532,7 +1532,7 @@ template <class _Tp, class _Alloc>
15321532template <class _InpIter>
15331533typename list<_Tp, _Alloc>::iterator
15341534list<_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*)
15361536{
15371537#if _LIBCPP_DEBUG_LEVEL >= 2
15381538 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
......@@ -2211,7 +2211,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
22112211 __i = __j;
22122212 }
22132213 }
2214
2214
22152215 return (__remove_return_type) __deleted_nodes.size();
22162216}
22172217
lib/libcxx/include/map+12-12
......@@ -1474,26 +1474,26 @@ private:
14741474#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
14751475template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
14761476 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1477 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1478 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1477 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
1478 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
14791479map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
14801480 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
14811481
14821482template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
14831483 class _Allocator = allocator<pair<const _Key, _Tp>>,
1484 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1485 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1484 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
1485 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
14861486map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
14871487 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
14881488
14891489template<class _InputIterator, class _Allocator,
1490 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1490 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
14911491map(_InputIterator, _InputIterator, _Allocator)
14921492 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
14931493 less<__iter_key_type<_InputIterator>>, _Allocator>;
14941494
14951495template<class _Key, class _Tp, class _Allocator,
1496 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1496 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
14971497map(initializer_list<pair<_Key, _Tp>>, _Allocator)
14981498 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
14991499#endif
......@@ -2131,26 +2131,26 @@ private:
21312131#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
21322132template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
21332133 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2134 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2135 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2134 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
2135 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
21362136multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
21372137 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
21382138
21392139template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
21402140 class _Allocator = allocator<pair<const _Key, _Tp>>,
2141 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2142 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2141 class = _EnableIf<!__is_allocator<_Compare>::value, void>,
2142 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
21432143multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
21442144 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
21452145
21462146template<class _InputIterator, class _Allocator,
2147 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2147 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
21482148multimap(_InputIterator, _InputIterator, _Allocator)
21492149 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
21502150 less<__iter_key_type<_InputIterator>>, _Allocator>;
21512151
21522152template<class _Key, class _Tp, class _Allocator,
2153 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2153 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
21542154multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
21552155 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
21562156#endif
lib/libcxx/include/math.h+4
......@@ -510,7 +510,11 @@ _LIBCPP_INLINE_VISIBILITY
510510bool
511511__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
512512{
513#if __has_builtin(__builtin_isnan)
514 return __builtin_isnan(__lcpp_x);
515#else
513516 return isnan(__lcpp_x);
517#endif
514518}
515519
516520#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);
662662#include <tuple>
663663#include <stdexcept>
664664#include <cstring>
665#include <cassert>
666665#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
667666# include <atomic>
668667#endif
......@@ -1099,40 +1098,51 @@ struct __const_void_pointer<_Ptr, _Alloc, false>
10991098#endif
11001099};
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
11021118template <class _Tp>
11031119inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
11041120_Tp*
1105__to_raw_pointer(_Tp* __p) _NOEXCEPT
1121__to_address(_Tp* __p) _NOEXCEPT
11061122{
1123 static_assert(!is_function<_Tp>::value, "_Tp is a function type");
11071124 return __p;
11081125}
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
11191127template <class _Pointer>
1120inline _LIBCPP_INLINE_VISIBILITY
1121auto
1122__to_raw_pointer(const _Pointer& __p) _NOEXCEPT
1123-> decltype(pointer_traits<_Pointer>::to_address(__p))
1124{
1125 return pointer_traits<_Pointer>::to_address(__p);
1128inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1129typename __choose_to_address<_Pointer>::template __return_type<_Pointer>
1130__to_address(const _Pointer& __p) _NOEXCEPT {
1131 return __choose_to_address<_Pointer>::__do_it(__p);
11261132}
11271133
1128template <class _Pointer, class... _None>
1129inline _LIBCPP_INLINE_VISIBILITY
1130auto
1131__to_raw_pointer(const _Pointer& __p, _None...) _NOEXCEPT
1132{
1133 return _VSTD::__to_raw_pointer(__p.operator->());
1134}
1134template <> struct __to_address_helper<false> {
1135 template <class _Pointer>
1136 using __return_type = typename pointer_traits<_Pointer>::element_type*;
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
11361146template <class _Tp>
11371147inline _LIBCPP_INLINE_VISIBILITY constexpr
11381148_Tp*
......@@ -1147,7 +1157,7 @@ inline _LIBCPP_INLINE_VISIBILITY
11471157auto
11481158to_address(const _Pointer& __p) _NOEXCEPT
11491159{
1150 return _VSTD::__to_raw_pointer(__p);
1160 return _VSTD::__to_address(__p);
11511161}
11521162#endif
11531163
......@@ -1507,6 +1517,31 @@ struct __is_default_allocator : false_type {};
15071517template <class _Tp>
15081518struct __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
15101545template <class _Alloc>
15111546struct _LIBCPP_TEMPLATE_VIS allocator_traits
15121547{
......@@ -1609,10 +1644,18 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
16091644 _LIBCPP_INLINE_VISIBILITY
16101645 static
16111646 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)
16131648 {
1649 static_assert(__is_cpp17_move_insertable<allocator_type>::value,
1650 "The specified type does not meet the requirements of Cpp17MoveInsertible");
16141651 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 );
16161659 }
16171660
16181661 template <class _Tp>
......@@ -1625,7 +1668,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
16251668 is_trivially_move_constructible<_Tp>::value,
16261669 void
16271670 >::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)
16291672 {
16301673 ptrdiff_t _Np = __end1 - __begin1;
16311674 if (_Np > 0)
......@@ -1642,7 +1685,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
16421685 __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)
16431686 {
16441687 for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
1645 construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1);
1688 construct(__a, _VSTD::__to_address(__begin2), *__begin1);
16461689 }
16471690
16481691 template <class _SourceTp, class _DestTp,
......@@ -1672,12 +1715,20 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
16721715 _LIBCPP_INLINE_VISIBILITY
16731716 static
16741717 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)
16761719 {
1720 static_assert(__is_cpp17_move_insertable<allocator_type>::value,
1721 "The specified type does not meet the requirements of Cpp17MoveInsertable");
16771722 while (__end1 != __begin1)
16781723 {
1679 construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));
1680 --__end2;
1724 construct(__a, _VSTD::__to_address(__end2 - 1),
1725#ifdef _LIBCPP_NO_EXCEPTIONS
1726 _VSTD::move(*--__end1)
1727#else
1728 _VSTD::move_if_noexcept(*--__end1)
1729#endif
1730 );
1731 --__end2;
16811732 }
16821733 }
16831734
......@@ -1691,7 +1742,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
16911742 is_trivially_move_constructible<_Tp>::value,
16921743 void
16931744 >::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)
16951746 {
16961747 ptrdiff_t _Np = __end1 - __begin1;
16971748 __end2 -= _Np;
......@@ -2127,6 +2178,10 @@ public:
21272178};
21282179#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
21302185template <class _Tp, int _Idx,
21312186 bool _CanBeEmptyBase =
21322187 is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>
......@@ -2135,30 +2190,31 @@ struct __compressed_pair_elem {
21352190 typedef _Tp& reference;
21362191 typedef const _Tp& const_reference;
21372192
2138#ifndef _LIBCPP_CXX03_LANG
2139 _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {}
2193 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2194 __compressed_pair_elem(__default_init_tag) {}
2195 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2196 __compressed_pair_elem(__value_init_tag) : __value_() {}
21402197
21412198 template <class _Up, class = typename enable_if<
21422199 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
21432200 >::type>
21442201 _LIBCPP_INLINE_VISIBILITY
2145 constexpr explicit
2202 _LIBCPP_CONSTEXPR explicit
21462203 __compressed_pair_elem(_Up&& __u)
21472204 : __value_(_VSTD::forward<_Up>(__u))
21482205 {
21492206 }
21502207
2208
2209#ifndef _LIBCPP_CXX03_LANG
21512210 template <class... _Args, size_t... _Indexes>
21522211 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
21532212 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
21542213 __tuple_indices<_Indexes...>)
21552214 : __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)) {}
21602215#endif
21612216
2217
21622218 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; }
21632219 _LIBCPP_INLINE_VISIBILITY
21642220 const_reference __get() const _NOEXCEPT { return __value_; }
......@@ -2174,28 +2230,27 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
21742230 typedef const _Tp& const_reference;
21752231 typedef _Tp __value_type;
21762232
2177#ifndef _LIBCPP_CXX03_LANG
2178 _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default;
2233 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair_elem() = default;
2234 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2235 __compressed_pair_elem(__default_init_tag) {}
2236 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2237 __compressed_pair_elem(__value_init_tag) : __value_type() {}
21792238
21802239 template <class _Up, class = typename enable_if<
21812240 !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
21822241 >::type>
21832242 _LIBCPP_INLINE_VISIBILITY
2184 constexpr explicit
2243 _LIBCPP_CONSTEXPR explicit
21852244 __compressed_pair_elem(_Up&& __u)
21862245 : __value_type(_VSTD::forward<_Up>(__u))
21872246 {}
21882247
2248#ifndef _LIBCPP_CXX03_LANG
21892249 template <class... _Args, size_t... _Indexes>
21902250 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
21912251 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
21922252 __tuple_indices<_Indexes...>)
21932253 : __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)) {}
21992254#endif
22002255
22012256 _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; }
......@@ -2203,9 +2258,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
22032258 const_reference __get() const _NOEXCEPT { return *this; }
22042259};
22052260
2206// Tag used to construct the second element of the compressed pair.
2207struct __second_tag {};
2208
22092261template <class _T1, class _T2>
22102262class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
22112263 private __compressed_pair_elem<_T2, 1> {
......@@ -2222,33 +2274,21 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
22222274 "implementation for this configuration");
22232275
22242276public:
2225#ifndef _LIBCPP_CXX03_LANG
2226 template <bool _Dummy = true,
2277 template <bool _Dummy = true,
22272278 class = typename enable_if<
22282279 __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
22292280 __dependent_type<is_default_constructible<_T2>, _Dummy>::value
22302281 >::type
22312282 >
22322283 _LIBCPP_INLINE_VISIBILITY
2233 constexpr __compressed_pair() {}
2234
2235 template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type,
2236 __compressed_pair>::value,
2237 bool>::type = true>
2238 _LIBCPP_INLINE_VISIBILITY constexpr explicit
2239 __compressed_pair(_Tp&& __t)
2240 : _Base1(std::forward<_Tp>(__t)), _Base2() {}
2241
2242 template <class _Tp>
2243 _LIBCPP_INLINE_VISIBILITY constexpr
2244 __compressed_pair(__second_tag, _Tp&& __t)
2245 : _Base1(), _Base2(std::forward<_Tp>(__t)) {}
2284 _LIBCPP_CONSTEXPR __compressed_pair() : _Base1(__value_init_tag()), _Base2(__value_init_tag()) {}
22462285
22472286 template <class _U1, class _U2>
2248 _LIBCPP_INLINE_VISIBILITY constexpr
2287 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
22492288 __compressed_pair(_U1&& __t1, _U2&& __t2)
22502289 : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
22512290
2291#ifndef _LIBCPP_CXX03_LANG
22522292 template <class... _Args1, class... _Args2>
22532293 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
22542294 __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
......@@ -2257,21 +2297,6 @@ public:
22572297 typename __make_tuple_indices<sizeof...(_Args1)>::type()),
22582298 _Base2(__pc, _VSTD::move(__second_args),
22592299 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)) {}
22752300#endif
22762301
22772302 _LIBCPP_INLINE_VISIBILITY
......@@ -2452,17 +2477,17 @@ public:
24522477 template <bool _Dummy = true,
24532478 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24542479 _LIBCPP_INLINE_VISIBILITY
2455 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
2480 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
24562481
24572482 template <bool _Dummy = true,
24582483 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24592484 _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
24622487 template <bool _Dummy = true,
24632488 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
24642489 _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
24672492 template <bool _Dummy = true,
24682493 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
......@@ -2504,7 +2529,7 @@ public:
25042529 typename enable_if<is_convertible<_Up*, _Tp*>::value &&
25052530 is_same<_Dp, default_delete<_Tp> >::value,
25062531 __nat>::type = __nat()) _NOEXCEPT
2507 : __ptr_(__p.release()) {}
2532 : __ptr_(__p.release(), __default_init_tag()) {}
25082533#endif
25092534
25102535 _LIBCPP_INLINE_VISIBILITY
......@@ -2675,19 +2700,19 @@ public:
26752700 template <bool _Dummy = true,
26762701 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
26772702 _LIBCPP_INLINE_VISIBILITY
2678 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
2703 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {}
26792704
26802705 template <bool _Dummy = true,
26812706 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
26822707 _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
26852710 template <class _Pp, bool _Dummy = true,
26862711 class = _EnableIfDeleterDefaultConstructible<_Dummy>,
26872712 class = _EnableIfPointerConvertible<_Pp> >
26882713 _LIBCPP_INLINE_VISIBILITY
26892714 explicit unique_ptr(_Pp __p) _NOEXCEPT
2690 : __ptr_(__p) {}
2715 : __ptr_(__p, __default_init_tag()) {}
26912716
26922717 template <class _Pp, bool _Dummy = true,
26932718 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
......@@ -3531,24 +3556,20 @@ class __shared_ptr_emplace
35313556{
35323557 __compressed_pair<_Alloc, _Tp> __data_;
35333558public:
3534#ifndef _LIBCPP_HAS_NO_VARIADICS
35353559
35363560 _LIBCPP_INLINE_VISIBILITY
35373561 __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
35403566 template <class ..._Args>
35413567 _LIBCPP_INLINE_VISIBILITY
35423568 __shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
35433569 : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
35443570 _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}
3545
35463571#else // _LIBCPP_HAS_NO_VARIADICS
35473572
3548 _LIBCPP_INLINE_VISIBILITY
3549 __shared_ptr_emplace(_Alloc __a)
3550 : __data_(__a) {}
3551
35523573 template <class _A0>
35533574 _LIBCPP_INLINE_VISIBILITY
35543575 __shared_ptr_emplace(_Alloc __a, _A0& __a0)
......@@ -3831,49 +3852,22 @@ public:
38313852 : nullptr);}
38323853#endif // _LIBCPP_NO_RTTI
38333854
3834#ifndef _LIBCPP_HAS_NO_VARIADICS
3835
3836 template<class ..._Args>
3837 static
3838 shared_ptr<_Tp>
3839 make_shared(_Args&& ...__args);
3855 template<class _Yp, class _CntrlBlk>
3856 static shared_ptr<_Tp>
3857 __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl)
3858 {
3859 shared_ptr<_Tp> __r;
3860 __r.__ptr_ = __p;
3861 __r.__cntrl_ = __cntrl;
3862 __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);
3863 return __r;
3864 }
38403865
38413866 template<class _Alloc, class ..._Args>
38423867 static
38433868 shared_ptr<_Tp>
38443869 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
38773871private:
38783872 template <class _Yp, bool = is_function<_Yp>::value>
38793873 struct __shared_ptr_default_allocator
......@@ -4186,27 +4180,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
41864180 __r.release();
41874181}
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
42104183template<class _Tp>
42114184template<class _Alloc, class ..._Args>
42124185shared_ptr<_Tp>
......@@ -4227,165 +4200,6 @@ shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
42274200 return __r;
42284201}
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
43894203template<class _Tp>
43904204shared_ptr<_Tp>::~shared_ptr()
43914205{
......@@ -4567,8 +4381,6 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
45674381 shared_ptr(__p, __d, __a).swap(*this);
45684382}
45694383
4570#ifndef _LIBCPP_HAS_NO_VARIADICS
4571
45724384template<class _Tp, class ..._Args>
45734385inline _LIBCPP_INLINE_VISIBILITY
45744386typename enable_if
......@@ -4578,7 +4390,17 @@ typename enable_if
45784390>::type
45794391make_shared(_Args&& ...__args)
45804392{
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());
45824404}
45834405
45844406template<class _Tp, class _Alloc, class ..._Args>
......@@ -4593,74 +4415,6 @@ allocate_shared(const _Alloc& __a, _Args&& ...__args)
45934415 return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);
45944416}
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
46644418template<class _Tp, class _Up>
46654419inline _LIBCPP_INLINE_VISIBILITY
46664420bool
......@@ -5590,4 +5344,8 @@ _LIBCPP_END_NAMESPACE_STD
55905344
55915345_LIBCPP_POP_MACROS
55925346
5347#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
5348# include <__pstl_memory>
5349#endif
5350
55935351#endif // _LIBCPP_MEMORY
lib/libcxx/include/module.modulemap+4
......@@ -275,6 +275,10 @@ module std [system] {
275275 header "exception"
276276 export *
277277 }
278 module execution {
279 header "execution"
280 export *
281 }
278282 module filesystem {
279283 header "filesystem"
280284 export *
lib/libcxx/include/mutex+4-4
......@@ -86,9 +86,9 @@ public:
8686 void unlock();
8787};
8888
89struct defer_lock_t {};
90struct try_to_lock_t {};
91struct adopt_lock_t {};
89struct defer_lock_t { explicit defer_lock_t() = default; };
90struct try_to_lock_t { explicit try_to_lock_t() = default; };
91struct adopt_lock_t { explicit adopt_lock_t() = default; };
9292
9393inline constexpr defer_lock_t defer_lock{};
9494inline constexpr try_to_lock_t try_to_lock{};
......@@ -650,7 +650,7 @@ public:
650650#endif
651651
652652template <class _Fp>
653void
653void _LIBCPP_INLINE_VISIBILITY
654654__call_once_proxy(void* __vp)
655655{
656656 __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
3939};
4040inline constexpr destroying_delete_t destroying_delete{}; // C++20
4141
42struct nothrow_t {};
42struct nothrow_t { explicit nothrow_t() = default; };
4343extern const nothrow_t nothrow;
4444typedef void (*new_handler)();
4545new_handler set_new_handler(new_handler new_p) noexcept;
......@@ -126,7 +126,7 @@ namespace std // purposefully not using versioning namespace
126126{
127127
128128#if !defined(_LIBCPP_ABI_VCRUNTIME)
129struct _LIBCPP_TYPE_VIS nothrow_t {};
129struct _LIBCPP_TYPE_VIS nothrow_t { explicit nothrow_t() = default; };
130130extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
131131
132132class _LIBCPP_EXCEPTION_ABI bad_alloc
lib/libcxx/include/numeric+12-11
......@@ -532,17 +532,14 @@ midpoint(_Tp __a, _Tp __b) noexcept
532532_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
533533{
534534 using _Up = std::make_unsigned_t<_Tp>;
535 constexpr _Up __bitshift = std::numeric_limits<_Up>::digits - 1;
535536
536 int __sign = 1;
537 _Up __m = __a;
538 _Up __M = __b;
539 if (__a > __b)
540 {
541 __sign = -1;
542 __m = __b;
543 __M = __a;
544 }
545 return __a + __sign * _Tp(_Up(__M-__m) >> 1);
537 _Up __diff = _Up(__b) - _Up(__a);
538 _Up __sign_bit = __b < __a;
539
540 _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
541
542 return __a + __half_diff;
546543}
547544
548545
......@@ -576,7 +573,7 @@ midpoint(_Fp __a, _Fp __b) noexcept
576573 return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible
577574 (__a + __b)/2 : // always correctly rounded
578575 __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a
579 __fp_abs(__a) < __lo ? __a/2 + __b : // not safe to halve b
576 __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b
580577 __a/2 + __b/2; // otherwise correctly rounded
581578}
582579
......@@ -586,4 +583,8 @@ _LIBCPP_END_NAMESPACE_STD
586583
587584_LIBCPP_POP_MACROS
588585
586#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
587# include <__pstl_numeric>
588#endif
589
589590#endif // _LIBCPP_NUMERIC
lib/libcxx/include/ostream+1-1
......@@ -1055,7 +1055,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
10551055template<class _CharT, class _Traits>
10561056basic_ostream<_CharT, _Traits>&
10571057operator<<(basic_ostream<_CharT, _Traits>& __os,
1058 const basic_string_view<_CharT, _Traits> __sv)
1058 basic_string_view<_CharT, _Traits> __sv)
10591059{
10601060 return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
10611061}
lib/libcxx/include/queue+1-1
......@@ -562,7 +562,7 @@ priority_queue(_Compare, _Container)
562562template<class _InputIterator,
563563 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
564564 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,
566566 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
567567 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
568568>
lib/libcxx/include/random+27-22
......@@ -3645,7 +3645,7 @@ generate_canonical(_URNG& __g)
36453645 const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
36463646#endif
36473647 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);
36493649 _RealType __base = _Rp;
36503650 _RealType _Sp = __g() - _URNG::min();
36513651 for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)
......@@ -4592,7 +4592,10 @@ public:
45924592
45934593template<class _IntType>
45944594poisson_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)
45964599{
45974600 if (__mean_ < 10)
45984601 {
......@@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
46104613 {
46114614 __s_ = _VSTD::sqrt(__mean_);
46124615 __d_ = 6 * __mean_ * __mean_;
4613 __l_ = static_cast<result_type>(__mean_ - 1.1484);
4616 __l_ = std::trunc(__mean_ - 1.1484);
46144617 __omega_ = .3989423 / __s_;
46154618 double __b1_ = .4166667E-1 / __mean_;
46164619 double __b2_ = .3 * __b1_ * __b1_;
......@@ -4627,12 +4630,12 @@ template<class _URNG>
46274630_IntType
46284631poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr)
46294632{
4630 result_type __x;
4633 double __tx;
46314634 uniform_real_distribution<double> __urd;
46324635 if (__pr.__mean_ < 10)
46334636 {
4634 __x = 0;
4635 for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)
4637 __tx = 0;
4638 for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx)
46364639 __p *= __urd(__urng);
46374640 }
46384641 else
......@@ -4642,19 +4645,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
46424645 double __u;
46434646 if (__g > 0)
46444647 {
4645 __x = static_cast<result_type>(__g);
4646 if (__x >= __pr.__l_)
4647 return __x;
4648 __difmuk = __pr.__mean_ - __x;
4648 __tx = std::trunc(__g);
4649 if (__tx >= __pr.__l_)
4650 return std::__clamp_to_integral<result_type>(__tx);
4651 __difmuk = __pr.__mean_ - __tx;
46494652 __u = __urd(__urng);
46504653 if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
4651 return __x;
4654 return std::__clamp_to_integral<result_type>(__tx);
46524655 }
46534656 exponential_distribution<double> __edist;
46544657 for (bool __using_exp_dist = false; true; __using_exp_dist = true)
46554658 {
46564659 double __e;
4657 if (__using_exp_dist || __g < 0)
4660 if (__using_exp_dist || __g <= 0)
46584661 {
46594662 double __t;
46604663 do
......@@ -4664,31 +4667,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
46644667 __u += __u - 1;
46654668 __t = 1.8 + (__u < 0 ? -__e : __e);
46664669 } while (__t <= -.6744);
4667 __x = __pr.__mean_ + __pr.__s_ * __t;
4668 __difmuk = __pr.__mean_ - __x;
4670 __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
4671 __difmuk = __pr.__mean_ - __tx;
46694672 __using_exp_dist = true;
46704673 }
46714674 double __px;
46724675 double __py;
4673 if (__x < 10)
4676 if (__tx < 10 && __tx >= 0)
46744677 {
46754678 const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
46764679 40320, 362880};
46774680 __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)];
46794682 }
46804683 else
46814684 {
4682 double __del = .8333333E-1 / __x;
4685 double __del = .8333333E-1 / __tx;
46834686 __del -= 4.8 * __del * __del * __del;
4684 double __v = __difmuk / __x;
4687 double __v = __difmuk / __tx;
46854688 if (_VSTD::abs(__v) > 0.25)
4686 __px = __x * _VSTD::log(1 + __v) - __difmuk - __del;
4689 __px = __tx * _VSTD::log(1 + __v) - __difmuk - __del;
46874690 else
4688 __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) *
4691 __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) *
46894692 __v + .1421878) * __v + -.1661269) * __v + .2000118) *
46904693 __v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
4691 __py = .3989423 / _VSTD::sqrt(__x);
4694 __py = .3989423 / _VSTD::sqrt(__tx);
46924695 }
46934696 double __r = (0.5 - __difmuk) / __pr.__s_;
46944697 double __r2 = __r * __r;
......@@ -4708,7 +4711,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
47084711 }
47094712 }
47104713 }
4711 return __x;
4714 return std::__clamp_to_integral<result_type>(__tx);
47124715}
47134716
47144717template <class _CharT, class _Traits, class _IntType>
......@@ -6102,6 +6105,7 @@ public:
61026105 template<class _UnaryOperation>
61036106 param_type(size_t __nw, result_type __xmin, result_type __xmax,
61046107 _UnaryOperation __fw);
6108 param_type(param_type const&) = default;
61056109 param_type & operator=(const param_type& __rhs);
61066110
61076111 _LIBCPP_INLINE_VISIBILITY
......@@ -6425,6 +6429,7 @@ public:
64256429 template<class _UnaryOperation>
64266430 param_type(size_t __nw, result_type __xmin, result_type __xmax,
64276431 _UnaryOperation __fw);
6432 param_type(param_type const&) = default;
64286433 param_type & operator=(const param_type& __rhs);
64296434
64306435 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/regex+31-21
......@@ -169,15 +169,15 @@ public:
169169 // assign:
170170 basic_regex& assign(const basic_regex& that);
171171 basic_regex& assign(basic_regex&& that) noexcept;
172 basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
173 basic_regex& assign(const charT* p, size_t len, flag_type f);
172 basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
173 basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
174174 template <class string_traits, class A>
175175 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);
177177 template <class InputIterator>
178178 basic_regex& assign(InputIterator first, InputIterator last,
179 flag_type f = regex_constants::ECMAScript);
180 basic_regex& assign(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
179 flag_type f = regex_constants::ECMAScript);
180 basic_regex& assign(initializer_list<charT>, flag_type f = regex_constants::ECMAScript);
181181
182182 // const operations:
183183 unsigned mark_count() const;
......@@ -965,7 +965,8 @@ enum error_type
965965 error_stack,
966966 __re_err_grammar,
967967 __re_err_empty,
968 __re_err_unknown
968 __re_err_unknown,
969 __re_err_parse
969970};
970971
971972} // regex_constants
......@@ -2539,8 +2540,7 @@ public:
25392540 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25402541 __end_(0)
25412542 {
2542 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2543 __parse(__p, __p + __traits_.length(__p));
2543 __init(__p, __p + __traits_.length(__p));
25442544 }
25452545
25462546 _LIBCPP_INLINE_VISIBILITY
......@@ -2548,8 +2548,7 @@ public:
25482548 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25492549 __end_(0)
25502550 {
2551 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2552 __parse(__p, __p + __len);
2551 __init(__p, __p + __len);
25532552 }
25542553
25552554// basic_regex(const basic_regex&) = default;
......@@ -2561,8 +2560,7 @@ public:
25612560 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25622561 __end_(0)
25632562 {
2564 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2565 __parse(__p.begin(), __p.end());
2563 __init(__p.begin(), __p.end());
25662564 }
25672565
25682566 template <class _ForwardIterator>
......@@ -2572,8 +2570,7 @@ public:
25722570 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25732571 __end_(0)
25742572 {
2575 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2576 __parse(__first, __last);
2573 __init(__first, __last);
25772574 }
25782575#ifndef _LIBCPP_CXX03_LANG
25792576 _LIBCPP_INLINE_VISIBILITY
......@@ -2582,8 +2579,7 @@ public:
25822579 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
25832580 __end_(0)
25842581 {
2585 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2586 __parse(__il.begin(), __il.end());
2582 __init(__il.begin(), __il.end());
25872583 }
25882584#endif // _LIBCPP_CXX03_LANG
25892585
......@@ -2617,7 +2613,7 @@ public:
26172613 basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
26182614 {return assign(__p, __p + __traits_.length(__p), __f);}
26192615 _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)
26212617 {return assign(__p, __p + __len, __f);}
26222618 template <class _ST, class _SA>
26232619 _LIBCPP_INLINE_VISIBILITY
......@@ -2629,8 +2625,8 @@ public:
26292625 _LIBCPP_INLINE_VISIBILITY
26302626 typename enable_if
26312627 <
2632 __is_input_iterator <_InputIterator>::value &&
2633 !__is_forward_iterator<_InputIterator>::value,
2628 __is_cpp17_input_iterator <_InputIterator>::value &&
2629 !__is_cpp17_forward_iterator<_InputIterator>::value,
26342630 basic_regex&
26352631 >::type
26362632 assign(_InputIterator __first, _InputIterator __last,
......@@ -2656,7 +2652,7 @@ public:
26562652 _LIBCPP_INLINE_VISIBILITY
26572653 typename enable_if
26582654 <
2659 __is_forward_iterator<_ForwardIterator>::value,
2655 __is_cpp17_forward_iterator<_ForwardIterator>::value,
26602656 basic_regex&
26612657 >::type
26622658 assign(_ForwardIterator __first, _ForwardIterator __last,
......@@ -2698,6 +2694,9 @@ private:
26982694 _LIBCPP_INLINE_VISIBILITY
26992695 unsigned __loop_count() const {return __loop_count_;}
27002696
2697 template <class _ForwardIterator>
2698 void
2699 __init(_ForwardIterator __first, _ForwardIterator __last);
27012700 template <class _ForwardIterator>
27022701 _ForwardIterator
27032702 __parse(_ForwardIterator __first, _ForwardIterator __last);
......@@ -2953,7 +2952,7 @@ private:
29532952
29542953#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
29552954template <class _ForwardIterator,
2956 class = typename enable_if<__is_forward_iterator<_ForwardIterator>::value, nullptr_t>::type
2955 class = typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value, nullptr_t>::type
29572956>
29582957basic_regex(_ForwardIterator, _ForwardIterator,
29592958 regex_constants::syntax_option_type = regex_constants::ECMAScript)
......@@ -3054,6 +3053,17 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
30543053 }
30553054}
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
30573067template <class _CharT, class _Traits>
30583068template <class _ForwardIterator>
30593069_ForwardIterator
lib/libcxx/include/set+12-12
......@@ -852,26 +852,26 @@ public:
852852template<class _InputIterator,
853853 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
854854 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
855 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
856 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
855 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
856 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
857857set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
858858 -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
859859
860860template<class _Key, class _Compare = less<_Key>,
861861 class _Allocator = allocator<_Key>,
862 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
863 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
862 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
863 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
864864set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
865865 -> set<_Key, _Compare, _Allocator>;
866866
867867template<class _InputIterator, class _Allocator,
868 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
868 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
869869set(_InputIterator, _InputIterator, _Allocator)
870870 -> set<typename iterator_traits<_InputIterator>::value_type,
871871 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
872872
873873template<class _Key, class _Allocator,
874 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
874 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
875875set(initializer_list<_Key>, _Allocator)
876876 -> set<_Key, less<_Key>, _Allocator>;
877877#endif
......@@ -1377,26 +1377,26 @@ public:
13771377template<class _InputIterator,
13781378 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
13791379 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
1380 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1381 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1380 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
1381 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
13821382multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
13831383 -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
13841384
13851385template<class _Key, class _Compare = less<_Key>,
13861386 class _Allocator = allocator<_Key>,
1387 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1388 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1387 class = _EnableIf<__is_allocator<_Allocator>::value, void>,
1388 class = _EnableIf<!__is_allocator<_Compare>::value, void>>
13891389multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
13901390 -> multiset<_Key, _Compare, _Allocator>;
13911391
13921392template<class _InputIterator, class _Allocator,
1393 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1393 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
13941394multiset(_InputIterator, _InputIterator, _Allocator)
13951395 -> multiset<typename iterator_traits<_InputIterator>::value_type,
13961396 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
13971397
13981398template<class _Key, class _Allocator,
1399 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1399 class = _EnableIf<__is_allocator<_Allocator>::value, void>>
14001400multiset(initializer_list<_Key>, _Allocator)
14011401 -> multiset<_Key, less<_Key>, _Allocator>;
14021402#endif
lib/libcxx/include/span+36-36
......@@ -39,7 +39,7 @@ public:
3939 // constants and types
4040 using element_type = ElementType;
4141 using value_type = remove_cv_t<ElementType>;
42 using index_type = size_t;
42 using size_type = size_t;
4343 using difference_type = ptrdiff_t;
4444 using pointer = element_type*;
4545 using const_pointer = const element_type*;
......@@ -49,11 +49,11 @@ public:
4949 using const_iterator = implementation-defined;
5050 using reverse_iterator = std::reverse_iterator<iterator>;
5151 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
52 static constexpr index_type extent = Extent;
52 static constexpr size_type extent = Extent;
5353
5454 // [span.cons], span constructors, copy, assignment, and destructor
5555 constexpr span() noexcept;
56 constexpr span(pointer ptr, index_type count);
56 constexpr span(pointer ptr, size_type count);
5757 constexpr span(pointer firstElem, pointer lastElem);
5858 template <size_t N>
5959 constexpr span(element_type (&arr)[N]) noexcept;
......@@ -79,17 +79,17 @@ public:
7979 template <size_t Offset, size_t Count = dynamic_extent>
8080 constexpr span<element_type, see below> subspan() const;
8181
82 constexpr span<element_type, dynamic_extent> first(index_type count) const;
83 constexpr span<element_type, dynamic_extent> last(index_type count) const;
84 constexpr span<element_type, dynamic_extent> subspan(index_type offset, index_type count = dynamic_extent) const;
82 constexpr span<element_type, dynamic_extent> first(size_type count) const;
83 constexpr span<element_type, dynamic_extent> last(size_type count) const;
84 constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const;
8585
8686 // [span.obs], span observers
87 constexpr index_type size() const noexcept;
88 constexpr index_type size_bytes() const noexcept;
87 constexpr size_type size() const noexcept;
88 constexpr size_type size_bytes() const noexcept;
8989 constexpr bool empty() const noexcept;
9090
9191 // [span.elem], span element access
92 constexpr reference operator[](index_type idx) const;
92 constexpr reference operator[](size_type idx) const;
9393 constexpr reference front() const;
9494 constexpr reference back() const;
9595 constexpr pointer data() const noexcept;
......@@ -105,8 +105,8 @@ public:
105105 constexpr const_reverse_iterator crend() const noexcept;
106106
107107private:
108 pointer data_; // exposition only
109 index_type size_; // exposition only
108 pointer data_; // exposition only
109 size_type size_; // exposition only
110110};
111111
112112template<class T, size_t N>
......@@ -195,7 +195,7 @@ public:
195195// constants and types
196196 using element_type = _Tp;
197197 using value_type = remove_cv_t<_Tp>;
198 using index_type = size_t;
198 using size_type = size_t;
199199 using difference_type = ptrdiff_t;
200200 using pointer = _Tp *;
201201 using const_pointer = const _Tp *;
......@@ -206,7 +206,7 @@ public:
206206 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
207207 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
211211// [span.cons], span constructors, copy, assignment, and destructor
212212 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
......@@ -215,7 +215,7 @@ public:
215215 constexpr span (const span&) noexcept = default;
216216 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}
219219 { (void)__count; _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (ptr, len)"); }
220220 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}
221221 { (void)__l; _LIBCPP_ASSERT(_Extent == distance(__f, __l), "size mismatch in span's constructor (ptr, ptr)"); }
......@@ -260,14 +260,14 @@ public:
260260 }
261261
262262 _LIBCPP_INLINE_VISIBILITY
263 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
263 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
264264 {
265265 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
266266 return {data(), __count};
267267 }
268268
269269 _LIBCPP_INLINE_VISIBILITY
270 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept
270 constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
271271 {
272272 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
273273 return {data() + size() - __count, __count};
......@@ -285,7 +285,7 @@ public:
285285
286286 _LIBCPP_INLINE_VISIBILITY
287287 constexpr span<element_type, dynamic_extent>
288 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
288 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
289289 {
290290 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
291291 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
......@@ -295,11 +295,11 @@ public:
295295 return {data() + __offset, __count};
296296 }
297297
298 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return _Extent; }
299 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
300 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
298 _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return _Extent; }
299 _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
300 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return _Extent == 0; }
301301
302 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept
302 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
303303 {
304304 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");
305305 return __data[__idx];
......@@ -356,7 +356,7 @@ public:
356356// constants and types
357357 using element_type = _Tp;
358358 using value_type = remove_cv_t<_Tp>;
359 using index_type = size_t;
359 using size_type = size_t;
360360 using difference_type = ptrdiff_t;
361361 using pointer = _Tp *;
362362 using const_pointer = const _Tp *;
......@@ -367,7 +367,7 @@ public:
367367 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
368368 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
372372// [span.cons], span constructors, copy, assignment, and destructor
373373 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}, __size{0} {}
......@@ -375,7 +375,7 @@ public:
375375 constexpr span (const span&) noexcept = default;
376376 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} {}
379379 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
380380
381381 template <size_t _Sz>
......@@ -394,13 +394,13 @@ public:
394394 _LIBCPP_INLINE_VISIBILITY
395395 constexpr span( _Container& __c,
396396 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
399399 template <class _Container>
400400 _LIBCPP_INLINE_VISIBILITY
401401 constexpr span(const _Container& __c,
402402 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
406406 template <class _OtherElementType, size_t _OtherExtent>
......@@ -430,14 +430,14 @@ public:
430430 }
431431
432432 _LIBCPP_INLINE_VISIBILITY
433 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
433 constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
434434 {
435435 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
436436 return {data(), __count};
437437 }
438438
439439 _LIBCPP_INLINE_VISIBILITY
440 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept
440 constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
441441 {
442442 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
443443 return {data() + size() - __count, __count};
......@@ -454,7 +454,7 @@ public:
454454
455455 constexpr span<element_type, dynamic_extent>
456456 _LIBCPP_INLINE_VISIBILITY
457 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
457 subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
458458 {
459459 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
460460 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
......@@ -464,11 +464,11 @@ public:
464464 return {data() + __offset, __count};
465465 }
466466
467 _LIBCPP_INLINE_VISIBILITY constexpr index_type size() const noexcept { return __size; }
468 _LIBCPP_INLINE_VISIBILITY constexpr index_type size_bytes() const noexcept { return __size * sizeof(element_type); }
469 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }
467 _LIBCPP_INLINE_VISIBILITY constexpr size_type size() const noexcept { return __size; }
468 _LIBCPP_INLINE_VISIBILITY constexpr size_type size_bytes() const noexcept { return __size * sizeof(element_type); }
469 _LIBCPP_INLINE_VISIBILITY constexpr bool empty() const noexcept { return __size == 0; }
470470
471 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](index_type __idx) const noexcept
471 _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
472472 {
473473 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");
474474 return __data[__idx];
......@@ -505,7 +505,7 @@ public:
505505 __data = __other.__data;
506506 __other.__data = __p;
507507
508 index_type __sz = __size;
508 size_type __sz = __size;
509509 __size = __other.__size;
510510 __other.__size = __sz;
511511 }
......@@ -517,8 +517,8 @@ public:
517517 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
518518
519519private:
520 pointer __data;
521 index_type __size;
520 pointer __data;
521 size_type __size;
522522};
523523
524524// tuple interface
lib/libcxx/include/string+96-90
......@@ -625,7 +625,7 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {};
625625template <class _Iter>
626626struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
627627#else
628template <class _Iter, bool = __is_forward_iterator<_Iter>::value>
628template <class _Iter, bool = __is_cpp17_forward_iterator<_Iter>::value>
629629struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
630630 noexcept(++(declval<_Iter&>())) &&
631631 is_nothrow_assignable<_Iter&, _Iter>::value &&
......@@ -812,11 +812,9 @@ public:
812812 basic_string(basic_string&& __str, const allocator_type& __a);
813813#endif // _LIBCPP_CXX03_LANG
814814
815#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
816815 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
817#endif
818816 _LIBCPP_INLINE_VISIBILITY
819 basic_string(const _CharT* __s) {
817 basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
820818 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
821819 __init(__s, traits_type::length(__s));
822820# if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -824,9 +822,7 @@ public:
824822# endif
825823 }
826824
827#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
828825 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
829#endif
830826 _LIBCPP_INLINE_VISIBILITY
831827 basic_string(const _CharT* __s, const _Allocator& __a);
832828
......@@ -837,9 +833,7 @@ public:
837833 _LIBCPP_INLINE_VISIBILITY
838834 basic_string(size_type __n, _CharT __c);
839835
840#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
841836 template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
842#endif
843837 _LIBCPP_INLINE_VISIBILITY
844838 basic_string(size_type __n, _CharT __c, const _Allocator& __a);
845839
......@@ -862,10 +856,10 @@ public:
862856 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
863857 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>
866860 _LIBCPP_INLINE_VISIBILITY
867861 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>
869863 _LIBCPP_INLINE_VISIBILITY
870864 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
871865#ifndef _LIBCPP_CXX03_LANG
......@@ -1029,7 +1023,7 @@ public:
10291023 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
10301024 typename enable_if
10311025 <
1032 __is_exactly_input_iterator<_InputIterator>::value
1026 __is_exactly_cpp17_input_iterator<_InputIterator>::value
10331027 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
10341028 basic_string&
10351029 >::type
......@@ -1043,7 +1037,7 @@ public:
10431037 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
10441038 typename enable_if
10451039 <
1046 __is_forward_iterator<_ForwardIterator>::value
1040 __is_cpp17_forward_iterator<_ForwardIterator>::value
10471041 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
10481042 basic_string&
10491043 >::type
......@@ -1097,7 +1091,7 @@ public:
10971091 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
10981092 typename enable_if
10991093 <
1100 __is_exactly_input_iterator<_InputIterator>::value
1094 __is_exactly_cpp17_input_iterator<_InputIterator>::value
11011095 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
11021096 basic_string&
11031097 >::type
......@@ -1106,7 +1100,7 @@ public:
11061100 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
11071101 typename enable_if
11081102 <
1109 __is_forward_iterator<_ForwardIterator>::value
1103 __is_cpp17_forward_iterator<_ForwardIterator>::value
11101104 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
11111105 basic_string&
11121106 >::type
......@@ -1148,7 +1142,7 @@ public:
11481142 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
11491143 typename enable_if
11501144 <
1151 __is_exactly_input_iterator<_InputIterator>::value
1145 __is_exactly_cpp17_input_iterator<_InputIterator>::value
11521146 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
11531147 iterator
11541148 >::type
......@@ -1157,7 +1151,7 @@ public:
11571151 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
11581152 typename enable_if
11591153 <
1160 __is_forward_iterator<_ForwardIterator>::value
1154 __is_cpp17_forward_iterator<_ForwardIterator>::value
11611155 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
11621156 iterator
11631157 >::type
......@@ -1219,7 +1213,7 @@ public:
12191213 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
12201214 typename enable_if
12211215 <
1222 __is_input_iterator<_InputIterator>::value,
1216 __is_cpp17_input_iterator<_InputIterator>::value,
12231217 basic_string&
12241218 >::type
12251219 replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
......@@ -1245,10 +1239,10 @@ public:
12451239 _LIBCPP_INLINE_VISIBILITY
12461240 const value_type* c_str() const _NOEXCEPT {return data();}
12471241 _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());}
12491243#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY)
12501244 _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());}
12521246#endif
12531247
12541248 _LIBCPP_INLINE_VISIBILITY
......@@ -1553,7 +1547,7 @@ private:
15531547 inline
15541548 typename enable_if
15551549 <
1556 __is_exactly_input_iterator<_InputIterator>::value,
1550 __is_exactly_cpp17_input_iterator<_InputIterator>::value,
15571551 void
15581552 >::type
15591553 __init(_InputIterator __first, _InputIterator __last);
......@@ -1562,7 +1556,7 @@ private:
15621556 inline
15631557 typename enable_if
15641558 <
1565 __is_forward_iterator<_ForwardIterator>::value,
1559 __is_cpp17_forward_iterator<_ForwardIterator>::value,
15661560 void
15671561 >::type
15681562 __init(_ForwardIterator __first, _ForwardIterator __last);
......@@ -1658,7 +1652,7 @@ private:
16581652template<class _InputIterator,
16591653 class _CharT = typename iterator_traits<_InputIterator>::value_type,
16601654 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,
16621656 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type
16631657 >
16641658basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
......@@ -1727,6 +1721,7 @@ template <class _CharT, class _Traits, class _Allocator>
17271721inline
17281722basic_string<_CharT, _Traits, _Allocator>::basic_string()
17291723 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1724 : __r_(__default_init_tag(), __default_init_tag())
17301725{
17311726#if _LIBCPP_DEBUG_LEVEL >= 2
17321727 __get_db()->__insert_c(this);
......@@ -1742,7 +1737,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
17421737#else
17431738 _NOEXCEPT
17441739#endif
1745: __r_(__second_tag(), __a)
1740: __r_(__default_init_tag(), __a)
17461741{
17471742#if _LIBCPP_DEBUG_LEVEL >= 2
17481743 __get_db()->__insert_c(this);
......@@ -1771,7 +1766,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
17711766 __set_long_cap(__cap+1);
17721767 __set_long_size(__sz);
17731768 }
1774 traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
1769 traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
17751770 traits_type::assign(__p[__sz], value_type());
17761771}
17771772
......@@ -1795,16 +1790,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
17951790 __set_long_cap(__cap+1);
17961791 __set_long_size(__sz);
17971792 }
1798 traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
1793 traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
17991794 traits_type::assign(__p[__sz], value_type());
18001795}
18011796
18021797template <class _CharT, class _Traits, class _Allocator>
1803#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
18041798template <class>
1805#endif
18061799basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
1807 : __r_(__second_tag(), __a)
1800 : __r_(__default_init_tag(), __a)
18081801{
18091802 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
18101803 __init(__s, traits_type::length(__s));
......@@ -1816,6 +1809,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const
18161809template <class _CharT, class _Traits, class _Allocator>
18171810inline
18181811basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
1812 : __r_(__default_init_tag(), __default_init_tag())
18191813{
18201814 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
18211815 __init(__s, __n);
......@@ -1827,7 +1821,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
18271821template <class _CharT, class _Traits, class _Allocator>
18281822inline
18291823basic_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)
18311825{
18321826 _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
18331827 __init(__s, __n);
......@@ -1838,12 +1832,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
18381832
18391833template <class _CharT, class _Traits, class _Allocator>
18401834basic_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()))
18421836{
18431837 if (!__str.__is_long())
18441838 __r_.first().__r = __str.__r_.first().__r;
18451839 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());
18471841#if _LIBCPP_DEBUG_LEVEL >= 2
18481842 __get_db()->__insert_c(this);
18491843#endif
......@@ -1852,12 +1846,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
18521846template <class _CharT, class _Traits, class _Allocator>
18531847basic_string<_CharT, _Traits, _Allocator>::basic_string(
18541848 const basic_string& __str, const allocator_type& __a)
1855 : __r_(__second_tag(), __a)
1849 : __r_(__default_init_tag(), __a)
18561850{
18571851 if (!__str.__is_long())
18581852 __r_.first().__r = __str.__r_.first().__r;
18591853 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());
18611855#if _LIBCPP_DEBUG_LEVEL >= 2
18621856 __get_db()->__insert_c(this);
18631857#endif
......@@ -1886,10 +1880,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
18861880template <class _CharT, class _Traits, class _Allocator>
18871881inline
18881882basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
1889 : __r_(__second_tag(), __a)
1883 : __r_(__default_init_tag(), __a)
18901884{
18911885 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());
18931887 else
18941888 {
18951889 __r_.first().__r = __str.__r_.first().__r;
......@@ -1924,13 +1918,14 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
19241918 __set_long_cap(__cap+1);
19251919 __set_long_size(__n);
19261920 }
1927 traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c);
1921 traits_type::assign(_VSTD::__to_address(__p), __n, __c);
19281922 traits_type::assign(__p[__n], value_type());
19291923}
19301924
19311925template <class _CharT, class _Traits, class _Allocator>
19321926inline
19331927basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
1928 : __r_(__default_init_tag(), __default_init_tag())
19341929{
19351930 __init(__n, __c);
19361931#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1939,11 +1934,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
19391934}
19401935
19411936template <class _CharT, class _Traits, class _Allocator>
1942#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
19431937template <class>
1944#endif
19451938basic_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)
19471940{
19481941 __init(__n, __c);
19491942#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -1955,7 +1948,7 @@ template <class _CharT, class _Traits, class _Allocator>
19551948basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
19561949 size_type __pos, size_type __n,
19571950 const _Allocator& __a)
1958 : __r_(__second_tag(), __a)
1951 : __r_(__default_init_tag(), __a)
19591952{
19601953 size_type __str_sz = __str.size();
19611954 if (__pos > __str_sz)
......@@ -1970,7 +1963,7 @@ template <class _CharT, class _Traits, class _Allocator>
19701963inline
19711964basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
19721965 const _Allocator& __a)
1973 : __r_(__second_tag(), __a)
1966 : __r_(__default_init_tag(), __a)
19741967{
19751968 size_type __str_sz = __str.size();
19761969 if (__pos > __str_sz)
......@@ -1985,7 +1978,7 @@ template <class _CharT, class _Traits, class _Allocator>
19851978template <class _Tp, class>
19861979basic_string<_CharT, _Traits, _Allocator>::basic_string(
19871980 const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
1988 : __r_(__second_tag(), __a)
1981 : __r_(__default_init_tag(), __a)
19891982{
19901983 __self_view __sv0 = __t;
19911984 __self_view __sv = __sv0.substr(__pos, __n);
......@@ -1998,6 +1991,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
19981991template <class _CharT, class _Traits, class _Allocator>
19991992template <class _Tp, class>
20001993basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
1994 : __r_(__default_init_tag(), __default_init_tag())
20011995{
20021996 __self_view __sv = __t;
20031997 __init(__sv.data(), __sv.size());
......@@ -2009,7 +2003,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
20092003template <class _CharT, class _Traits, class _Allocator>
20102004template <class _Tp, class>
20112005basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
2012 : __r_(__second_tag(), __a)
2006 : __r_(__default_init_tag(), __a)
20132007{
20142008 __self_view __sv = __t;
20152009 __init(__sv.data(), __sv.size());
......@@ -2022,7 +2016,7 @@ template <class _CharT, class _Traits, class _Allocator>
20222016template <class _InputIterator>
20232017typename enable_if
20242018<
2025 __is_exactly_input_iterator<_InputIterator>::value,
2019 __is_exactly_cpp17_input_iterator<_InputIterator>::value,
20262020 void
20272021>::type
20282022basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
......@@ -2049,7 +2043,7 @@ template <class _CharT, class _Traits, class _Allocator>
20492043template <class _ForwardIterator>
20502044typename enable_if
20512045<
2052 __is_forward_iterator<_ForwardIterator>::value,
2046 __is_cpp17_forward_iterator<_ForwardIterator>::value,
20532047 void
20542048>::type
20552049basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
......@@ -2080,6 +2074,7 @@ template <class _CharT, class _Traits, class _Allocator>
20802074template<class _InputIterator, class>
20812075inline
20822076basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
2077 : __r_(__default_init_tag(), __default_init_tag())
20832078{
20842079 __init(__first, __last);
20852080#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -2092,7 +2087,7 @@ template<class _InputIterator, class>
20922087inline
20932088basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
20942089 const allocator_type& __a)
2095 : __r_(__second_tag(), __a)
2090 : __r_(__default_init_tag(), __a)
20962091{
20972092 __init(__first, __last);
20982093#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -2106,6 +2101,7 @@ template <class _CharT, class _Traits, class _Allocator>
21062101inline
21072102basic_string<_CharT, _Traits, _Allocator>::basic_string(
21082103 initializer_list<_CharT> __il)
2104 : __r_(__default_init_tag(), __default_init_tag())
21092105{
21102106 __init(__il.begin(), __il.end());
21112107#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -2118,7 +2114,7 @@ inline
21182114
21192115basic_string<_CharT, _Traits, _Allocator>::basic_string(
21202116 initializer_list<_CharT> __il, const _Allocator& __a)
2121 : __r_(__second_tag(), __a)
2117 : __r_(__default_init_tag(), __a)
21222118{
21232119 __init(__il.begin(), __il.end());
21242120#if _LIBCPP_DEBUG_LEVEL >= 2
......@@ -2154,14 +2150,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
21542150 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
21552151 __invalidate_all_iterators();
21562152 if (__n_copy != 0)
2157 traits_type::copy(_VSTD::__to_raw_pointer(__p),
2158 _VSTD::__to_raw_pointer(__old_p), __n_copy);
2153 traits_type::copy(_VSTD::__to_address(__p),
2154 _VSTD::__to_address(__old_p), __n_copy);
21592155 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);
21612157 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
21622158 if (__sec_cp_sz != 0)
2163 traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
2164 _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2159 traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2160 _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
21652161 if (__old_cap+1 != __min_cap)
21662162 __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
21672163 __set_long_pointer(__p);
......@@ -2186,12 +2182,12 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
21862182 pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
21872183 __invalidate_all_iterators();
21882184 if (__n_copy != 0)
2189 traits_type::copy(_VSTD::__to_raw_pointer(__p),
2190 _VSTD::__to_raw_pointer(__old_p), __n_copy);
2185 traits_type::copy(_VSTD::__to_address(__p),
2186 _VSTD::__to_address(__old_p), __n_copy);
21912187 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
21922188 if (__sec_cp_sz != 0)
2193 traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
2194 _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del,
2189 traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2190 _VSTD::__to_address(__old_p) + __n_copy + __n_del,
21952191 __sec_cp_sz);
21962192 if (__old_cap+1 != __min_cap)
21972193 __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
22092205 size_type __cap = capacity();
22102206 if (__cap >= __n)
22112207 {
2212 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
2208 value_type* __p = _VSTD::__to_address(__get_pointer());
22132209 traits_type::move(__p, __s, __n);
22142210 traits_type::assign(__p[__n], value_type());
22152211 __set_size(__n);
......@@ -2235,7 +2231,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
22352231 }
22362232 else
22372233 __invalidate_iterators_past(__n);
2238 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
2234 value_type* __p = _VSTD::__to_address(__get_pointer());
22392235 traits_type::assign(__p, __n, __c);
22402236 traits_type::assign(__p[__n], value_type());
22412237 __set_size(__n);
......@@ -2270,7 +2266,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
22702266 if (this != &__str)
22712267 {
22722268 __copy_assign_alloc(__str);
2273 assign(__str.data(), __str.size());
2269 return assign(__str.data(), __str.size());
22742270 }
22752271 return *this;
22762272}
......@@ -2299,10 +2295,20 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
22992295 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
23002296#endif
23012297{
2302 __clear_and_shrink();
2303 __r_.first() = __str.__r_.first();
2304 __move_assign_alloc(__str);
2305 __str.__zero();
2298 if (__is_long()) {
2299 __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
2300 __get_long_cap());
2301#if _LIBCPP_STD_VER <= 14
2302 if (!is_nothrow_move_assignable<allocator_type>::value) {
2303 __set_short_size(0);
2304 traits_type::assign(__get_short_pointer()[0], value_type());
2305 }
2306#endif
2307 }
2308 __move_assign_alloc(__str);
2309 __r_.first() = __str.__r_.first();
2310 __str.__set_short_size(0);
2311 traits_type::assign(__str.__get_short_pointer()[0], value_type());
23062312}
23072313
23082314template <class _CharT, class _Traits, class _Allocator>
......@@ -2322,7 +2328,7 @@ template <class _CharT, class _Traits, class _Allocator>
23222328template<class _InputIterator>
23232329typename enable_if
23242330<
2325 __is_exactly_input_iterator <_InputIterator>::value
2331 __is_exactly_cpp17_input_iterator <_InputIterator>::value
23262332 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
23272333 basic_string<_CharT, _Traits, _Allocator>&
23282334>::type
......@@ -2337,7 +2343,7 @@ template <class _CharT, class _Traits, class _Allocator>
23372343template<class _ForwardIterator>
23382344typename enable_if
23392345<
2340 __is_forward_iterator<_ForwardIterator>::value
2346 __is_cpp17_forward_iterator<_ForwardIterator>::value
23412347 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
23422348 basic_string<_CharT, _Traits, _Allocator>&
23432349>::type
......@@ -2408,7 +2414,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
24082414 {
24092415 if (__n)
24102416 {
2411 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
2417 value_type* __p = _VSTD::__to_address(__get_pointer());
24122418 traits_type::copy(__p + __sz, __s, __n);
24132419 __sz += __n;
24142420 __set_size(__sz);
......@@ -2431,7 +2437,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
24312437 if (__cap - __sz < __n)
24322438 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
24332439 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);
24352441 __sz += __n;
24362442 __set_size(__sz);
24372443 traits_type::assign(__p[__sz], value_type());
......@@ -2511,7 +2517,7 @@ basic_string<_CharT, _Traits, _Allocator>&
25112517basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
25122518 _ForwardIterator __first, _ForwardIterator __last)
25132519{
2514 static_assert(__is_forward_iterator<_ForwardIterator>::value,
2520 static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
25152521 "function requires a ForwardIterator");
25162522 size_type __sz = size();
25172523 size_type __cap = capacity();
......@@ -2596,7 +2602,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
25962602 {
25972603 if (__n)
25982604 {
2599 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
2605 value_type* __p = _VSTD::__to_address(__get_pointer());
26002606 size_type __n_move = __sz - __pos;
26012607 if (__n_move != 0)
26022608 {
......@@ -2628,7 +2634,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
26282634 value_type* __p;
26292635 if (__cap - __sz >= __n)
26302636 {
2631 __p = _VSTD::__to_raw_pointer(__get_pointer());
2637 __p = _VSTD::__to_address(__get_pointer());
26322638 size_type __n_move = __sz - __pos;
26332639 if (__n_move != 0)
26342640 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
26362642 else
26372643 {
26382644 __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());
26402646 }
26412647 traits_type::assign(__p + __pos, __n, __c);
26422648 __sz += __n;
......@@ -2650,7 +2656,7 @@ template <class _CharT, class _Traits, class _Allocator>
26502656template<class _InputIterator>
26512657typename enable_if
26522658<
2653 __is_exactly_input_iterator<_InputIterator>::value
2659 __is_exactly_cpp17_input_iterator<_InputIterator>::value
26542660 || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
26552661 typename basic_string<_CharT, _Traits, _Allocator>::iterator
26562662>::type
......@@ -2669,7 +2675,7 @@ template <class _CharT, class _Traits, class _Allocator>
26692675template<class _ForwardIterator>
26702676typename enable_if
26712677<
2672 __is_forward_iterator<_ForwardIterator>::value
2678 __is_cpp17_forward_iterator<_ForwardIterator>::value
26732679 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
26742680 typename basic_string<_CharT, _Traits, _Allocator>::iterator
26752681>::type
......@@ -2697,7 +2703,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
26972703 value_type* __p;
26982704 if (__cap - __sz >= __n)
26992705 {
2700 __p = _VSTD::__to_raw_pointer(__get_pointer());
2706 __p = _VSTD::__to_address(__get_pointer());
27012707 size_type __n_move = __sz - __ip;
27022708 if (__n_move != 0)
27032709 traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
......@@ -2705,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
27052711 else
27062712 {
27072713 __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());
27092715 }
27102716 __sz += __n;
27112717 __set_size(__sz);
......@@ -2771,11 +2777,11 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
27712777 if (__cap == __sz)
27722778 {
27732779 __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());
27752781 }
27762782 else
27772783 {
2778 __p = _VSTD::__to_raw_pointer(__get_pointer());
2784 __p = _VSTD::__to_address(__get_pointer());
27792785 size_type __n_move = __sz - __ip;
27802786 if (__n_move != 0)
27812787 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 __
28162822 size_type __cap = capacity();
28172823 if (__cap - __sz + __n1 >= __n2)
28182824 {
2819 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
2825 value_type* __p = _VSTD::__to_address(__get_pointer());
28202826 if (__n1 != __n2)
28212827 {
28222828 size_type __n_move = __sz - __pos - __n1;
......@@ -2871,7 +2877,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
28712877 value_type* __p;
28722878 if (__cap - __sz + __n1 >= __n2)
28732879 {
2874 __p = _VSTD::__to_raw_pointer(__get_pointer());
2880 __p = _VSTD::__to_address(__get_pointer());
28752881 if (__n1 != __n2)
28762882 {
28772883 size_type __n_move = __sz - __pos - __n1;
......@@ -2882,7 +2888,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
28822888 else
28832889 {
28842890 __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());
28862892 }
28872893 traits_type::assign(__p + __pos, __n2, __c);
28882894 __sz += __n2 - __n1;
......@@ -2896,7 +2902,7 @@ template <class _CharT, class _Traits, class _Allocator>
28962902template<class _InputIterator>
28972903typename enable_if
28982904<
2899 __is_input_iterator<_InputIterator>::value,
2905 __is_cpp17_input_iterator<_InputIterator>::value,
29002906 basic_string<_CharT, _Traits, _Allocator>&
29012907>::type
29022908basic_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)
29943000 this->__throw_out_of_range();
29953001 if (__n)
29963002 {
2997 value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
3003 value_type* __p = _VSTD::__to_address(__get_pointer());
29983004 __n = _VSTD::min(__n, __sz - __pos);
29993005 size_type __n_move = __sz - __pos - __n;
30003006 if (__n_move != 0)
......@@ -3182,8 +3188,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
31823188 __was_long = __is_long();
31833189 __p = __get_pointer();
31843190 }
3185 traits_type::copy(_VSTD::__to_raw_pointer(__new_data),
3186 _VSTD::__to_raw_pointer(__p), size()+1);
3191 traits_type::copy(_VSTD::__to_address(__new_data),
3192 _VSTD::__to_address(__p), size()+1);
31873193 if (__was_long)
31883194 __alloc_traits::deallocate(__alloc(), __p, __cap+1);
31893195 if (__now_long)
......@@ -4294,23 +4300,23 @@ template<class _CharT, class _Traits, class _Allocator>
42944300bool
42954301basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const
42964302{
4297 return this->data() <= _VSTD::__to_raw_pointer(__i->base()) &&
4298 _VSTD::__to_raw_pointer(__i->base()) < this->data() + this->size();
4303 return this->data() <= _VSTD::__to_address(__i->base()) &&
4304 _VSTD::__to_address(__i->base()) < this->data() + this->size();
42994305}
43004306
43014307template<class _CharT, class _Traits, class _Allocator>
43024308bool
43034309basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const
43044310{
4305 return this->data() < _VSTD::__to_raw_pointer(__i->base()) &&
4306 _VSTD::__to_raw_pointer(__i->base()) <= this->data() + this->size();
4311 return this->data() < _VSTD::__to_address(__i->base()) &&
4312 _VSTD::__to_address(__i->base()) <= this->data() + this->size();
43074313}
43084314
43094315template<class _CharT, class _Traits, class _Allocator>
43104316bool
43114317basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
43124318{
4313 const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;
4319 const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
43144320 return this->data() <= __p && __p <= this->data() + this->size();
43154321}
43164322
......@@ -4318,7 +4324,7 @@ template<class _CharT, class _Traits, class _Allocator>
43184324bool
43194325basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
43204326{
4321 const value_type* __p = _VSTD::__to_raw_pointer(__i->base()) + __n;
4327 const value_type* __p = _VSTD::__to_address(__i->base()) + __n;
43224328 return this->data() <= __p && __p < this->data() + this->size();
43234329}
43244330
lib/libcxx/include/string_view+8-1
......@@ -173,6 +173,7 @@ namespace std {
173173
174174#include <__config>
175175#include <__string>
176#include <iosfwd>
176177#include <algorithm>
177178#include <iterator>
178179#include <limits>
......@@ -235,7 +236,7 @@ public:
235236
236237 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
237238 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
240241 // [string.view.iterators], iterators
241242 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
......@@ -767,6 +768,12 @@ bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type
767768 return __lhs.compare(__rhs) >= 0;
768769}
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
770777typedef basic_string_view<char> string_view;
771778#ifndef _LIBCPP_NO_HAS_CHAR8_T
772779typedef basic_string_view<char8_t> u8string_view;
lib/libcxx/include/support/android/locale_bionic.h+2
......@@ -27,7 +27,9 @@ extern "C" {
2727
2828#include <android/api-level.h>
2929#include <android/ndk-version.h>
30#if __ANDROID_API__ < 21
3031#include <support/xlocale/__posix_l_fallback.h>
32#endif
3133// In NDK versions later than 16, locale-aware functions are provided by
3234// legacy_stdlib_inlines.h
3335#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)
8787static inline
8888int iswalnum_l(wchar_t wc, locale_t locale)
8989{
90 return __xiswalnum(locale, wc);
90 return __xiswalnum(locale, wc);
9191}
9292
9393static inline
......@@ -159,7 +159,7 @@ int iswxdigit_l(wchar_t wc, locale_t locale)
159159static inline
160160int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
161161{
162 return __xiswctype(locale, wc, desc);
162 return __xiswctype(locale, wc, desc);
163163}
164164
165165static inline
......@@ -261,7 +261,7 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
261261 str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
262262 }
263263 return str_size;
264}
264}
265265
266266#ifdef __cplusplus
267267}
lib/libcxx/include/support/solaris/wchar.h+1-1
......@@ -26,7 +26,7 @@
2626#define wctype sun_wctype
2727#define _WCHAR_T 1
2828#include_next "wchar.h"
29#undef iswalpha
29#undef iswalpha
3030#undef iswupper
3131#undef iswlower
3232#undef iswdigit
lib/libcxx/include/support/win32/locale_win32.h+71-5
......@@ -28,14 +28,72 @@
2828 | LC_NUMERIC_MASK \
2929 | 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
3176class locale_t {
3277public:
3378 locale_t()
34 : __locale(nullptr), __locale_str(nullptr) {}
79 : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {}
3580 locale_t(std::nullptr_t)
36 : __locale(nullptr), __locale_str(nullptr) {}
81 : __locale(nullptr), __locale_str(nullptr), __lc(nullptr) {}
3782 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
4098 friend bool operator==(const locale_t& __left, const locale_t& __right) {
4199 return __left.__locale == __right.__locale;
......@@ -94,9 +152,16 @@ public:
94152 operator _locale_t() const {
95153 return __locale;
96154 }
155
156 lconv *__store_lconv(const lconv *__input_lc) {
157 delete __lc;
158 __lc = new __lconv_storage(__input_lc);
159 return __lc->__get();
160 }
97161private:
98162 _locale_t __locale;
99163 const char* __locale_str;
164 __lconv_storage *__lc = nullptr;
100165};
101166
102167// Locale management functions
......@@ -109,7 +174,7 @@ locale_t newlocale( int mask, const char * locale, locale_t base );
109174// We can still implement raii even without uselocale though.
110175
111176
112lconv *localeconv_l( locale_t loc );
177lconv *localeconv_l( locale_t &loc );
113178size_t mbrlen_l( const char *__restrict s, size_t n,
114179 mbstate_t *__restrict ps, locale_t loc);
115180size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
......@@ -173,7 +238,8 @@ isupper_l(int c, _locale_t loc)
173238#define towupper_l _towupper_l
174239#define towlower_l _towlower_l
175240#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);
177243#else
178244#define strftime_l _strftime_l
179245#endif
lib/libcxx/include/thread+1-4
......@@ -14,8 +14,6 @@
1414
1515 thread synopsis
1616
17#define __STDCPP_THREADS__ __cplusplus
18
1917namespace std
2018{
2119
......@@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
107105_LIBCPP_PUSH_MACROS
108106#include <__undef_macros>
109107
110#define __STDCPP_THREADS__ __cplusplus
111
112108#ifdef _LIBCPP_HAS_NO_THREADS
113109#error <thread> is not supported on this single threaded system
114110#else // !_LIBCPP_HAS_NO_THREADS
......@@ -278,6 +274,7 @@ __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
278274}
279275
280276template <class _Fp>
277_LIBCPP_INLINE_VISIBILITY
281278void* __thread_proxy(void* __vp)
282279{
283280 // _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...>
lib/libcxx/include/tuple+84-45
......@@ -19,40 +19,40 @@ namespace std
1919template <class... T>
2020class tuple {
2121public:
22 constexpr tuple();
23 explicit tuple(const T&...); // constexpr in C++14
22 explicit(see-below) constexpr tuple();
23 explicit(see-below) tuple(const T&...); // constexpr in C++14
2424 template <class... U>
25 explicit tuple(U&&...); // constexpr in C++14
25 explicit(see-below) tuple(U&&...); // constexpr in C++14
2626 tuple(const tuple&) = default;
2727 tuple(tuple&&) = default;
2828 template <class... U>
29 tuple(const tuple<U...>&); // constexpr in C++14
29 explicit(see-below) tuple(const tuple<U...>&); // constexpr in C++14
3030 template <class... U>
31 tuple(tuple<U...>&&); // constexpr in C++14
31 explicit(see-below) tuple(tuple<U...>&&); // constexpr in C++14
3232 template <class U1, class U2>
33 tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
33 explicit(see-below) tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
3434 template <class U1, class U2>
35 tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
35 explicit(see-below) tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
3636
3737 // allocator-extended constructors
3838 template <class Alloc>
3939 tuple(allocator_arg_t, const Alloc& a);
4040 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&...);
4242 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&&...);
4444 template <class Alloc>
4545 tuple(allocator_arg_t, const Alloc& a, const tuple&);
4646 template <class Alloc>
4747 tuple(allocator_arg_t, const Alloc& a, tuple&&);
4848 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...>&);
5050 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...>&&);
5252 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>&);
5454 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
5757 tuple& operator=(const tuple&);
5858 tuple&
......@@ -69,6 +69,17 @@ public:
6969 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
7070};
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
7283inline constexpr unspecified ignore;
7384
7485template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
......@@ -488,11 +499,19 @@ class _LIBCPP_TEMPLATE_VIS tuple
488499 template <class _Dummy>
489500 struct _CheckArgsConstructor<true, _Dummy>
490501 {
491 template <class ..._Args>
492 static constexpr bool __enable_default() {
493 return __all<is_default_constructible<_Args>::value...>::value;
502 template <int&...>
503 static constexpr bool __enable_implicit_default() {
504 return __all<__is_implicitly_default_constructible<_Tp>::value... >::value;
505 }
506
507 template <int&...>
508 static constexpr bool __enable_explicit_default() {
509 return
510 __all<is_default_constructible<_Tp>::value...>::value &&
511 !__enable_implicit_default< >();
494512 }
495513
514
496515 template <class ..._Args>
497516 static constexpr bool __enable_explicit() {
498517 return
......@@ -630,22 +649,26 @@ class _LIBCPP_TEMPLATE_VIS tuple
630649 const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
631650public:
632651
633 template <bool _Dummy = true, class = typename enable_if<
634 _CheckArgsConstructor<_Dummy>::template __enable_default<_Tp...>()
635 >::type>
636 _LIBCPP_INLINE_VISIBILITY
637 _LIBCPP_CONSTEXPR tuple()
652 template <bool _Dummy = true, _EnableIf<
653 _CheckArgsConstructor<_Dummy>::__enable_implicit_default()
654 , void*> = nullptr>
655 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
656 tuple()
657 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
658
659 template <bool _Dummy = true, _EnableIf<
660 _CheckArgsConstructor<_Dummy>::__enable_explicit_default()
661 , void*> = nullptr>
662 explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
663 tuple()
638664 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
639665
640666 tuple(tuple const&) = default;
641667 tuple(tuple&&) = default;
642668
643 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf<
644 _And<
645 _IsSame<allocator_arg_t, _AllocArgT>,
646 __dependent_type<is_default_constructible<_Tp>, _Dummy>...
647 >::value
648 >
669 template <class _AllocArgT, class _Alloc, _EnableIf<
670 _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value >::__enable_implicit_default()
671 , void*> = nullptr
649672 >
650673 _LIBCPP_INLINE_VISIBILITY
651674 tuple(_AllocArgT, _Alloc const& __a)
......@@ -654,6 +677,17 @@ public:
654677 typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
655678 __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
657691 template <bool _Dummy = true,
658692 typename enable_if
659693 <
......@@ -943,13 +977,16 @@ public:
943977};
944978
945979#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
946// NOTE: These are not yet standardized, but are required to simulate the
947// implicit deduction guide that should be generated had libc++ declared the
948// tuple-like constructors "correctly"
949template <class _Alloc, class ..._Args>
950tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>;
951template <class _Alloc, class ..._Args>
952tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;
980template <class ..._Tp>
981tuple(_Tp...) -> tuple<_Tp...>;
982template <class _Tp1, class _Tp2>
983tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
984template <class _Alloc, class ..._Tp>
985tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>;
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...>;
953990#endif
954991
955992template <class ..._Tp>
......@@ -1312,8 +1349,9 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13121349 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
13131350 operator()(tuple<_Types...> __t, _Tuple0&& __t0)
13141351 {
1315 return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1316 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
1352 return _VSTD::forward_as_tuple(
1353 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1354 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
13171355 }
13181356
13191357 template <class _Tuple0, class _Tuple1, class ..._Tuples>
......@@ -1324,15 +1362,16 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13241362 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
13251363 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;
13261364 return __tuple_cat<
1327 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
1328 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
1329 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
1330 (forward_as_tuple(
1331 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1332 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
1333 ),
1334 _VSTD::forward<_Tuple1>(__t1),
1335 _VSTD::forward<_Tuples>(__tpls)...);
1365 tuple<_Types...,
1366 typename __apply_cv<_Tuple0, typename tuple_element<
1367 _J0, _T0>::type>::type&&...>,
1368 typename __make_tuple_indices<sizeof...(_Types) +
1369 tuple_size<_T0>::value>::type,
1370 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
1371 _VSTD::forward_as_tuple(
1372 _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
1373 _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...),
1374 _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...);
13361375 }
13371376};
13381377
lib/libcxx/include/type_traits+105-89
......@@ -427,7 +427,6 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
427427template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
428428template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
429429
430
431430template <class _Tp, _Tp __v>
432431struct _LIBCPP_TEMPLATE_VIS integral_constant
433432{
......@@ -509,8 +508,8 @@ struct _Lazy : _Func<_Args...> {};
509508
510509// Member detector base
511510
512template <template <class...> class _Templ, class ..._Args>
513true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >);
511template <template <class...> class _Templ, class ..._Args, class = _Templ<_Args...> >
512true_type __sfinae_test_impl(int);
514513template <template <class...> class, class ...>
515514false_type __sfinae_test_impl(...);
516515
......@@ -526,6 +525,7 @@ struct __identity { typedef _Tp type; };
526525template <class _Tp, bool>
527526struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};
528527
528
529529template <bool _Bp, class _If, class _Then>
530530 struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
531531template <class _If, class _Then>
......@@ -570,6 +570,17 @@ using _IsNotSame = _BoolConstant<
570570 !_VSTD::is_same<_Tp, _Up>::value
571571#endif
572572>;
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
573584// addressof
574585#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
575586
......@@ -720,7 +731,7 @@ template <class _Tp>
720731_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_null_pointer_v
721732 = is_null_pointer<_Tp>::value;
722733#endif
723#endif
734#endif // _LIBCPP_STD_VER > 11
724735
725736// is_integral
726737
......@@ -886,28 +897,15 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v
886897
887898// 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
909900template <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
912910#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
913911template <class _Tp>
......@@ -915,27 +913,24 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_function_v
915913 = is_function<_Tp>::value;
916914#endif
917915
918// is_member_function_pointer
919
920// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
921// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
922//
923
924template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
925struct __member_pointer_traits_imp
926{ // forward declaration; specializations later
916template <class _Tp> struct __libcpp_is_member_pointer {
917 enum {
918 __is_member = false,
919 __is_func = false,
920 __is_obj = false
921 };
922};
923template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> {
924 enum {
925 __is_member = true,
926 __is_func = is_function<_Tp>::value,
927 __is_obj = !__is_func,
928 };
927929};
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
937932template <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
940935#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
941936template <class _Tp>
......@@ -945,11 +940,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
945940
946941// 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
951943template <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
954946#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
955947template <class _Tp>
......@@ -960,8 +952,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v
960952// is_member_object_pointer
961953
962954template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
963 : public integral_constant<bool, is_member_pointer<_Tp>::value &&
964 !is_member_function_pointer<_Tp>::value> {};
955 : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {};
965956
966957#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
967958template <class _Tp>
......@@ -1080,16 +1071,9 @@ struct __is_referenceable : integral_constant<bool,
10801071
10811072// add_const
10821073
1083template <class _Tp, bool = is_reference<_Tp>::value ||
1084 is_function<_Tp>::value ||
1085 is_const<_Tp>::value >
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;};
1074template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const {
1075 typedef _LIBCPP_NODEBUG_TYPE const _Tp type;
1076};
10931077
10941078#if _LIBCPP_STD_VER > 11
10951079template <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
10981082// add_volatile
10991083
1100template <class _Tp, bool = is_reference<_Tp>::value ||
1101 is_function<_Tp>::value ||
1102 is_volatile<_Tp>::value >
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;};
1084template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile {
1085 typedef _LIBCPP_NODEBUG_TYPE volatile _Tp type;
1086};
11101087
11111088#if _LIBCPP_STD_VER > 11
11121089template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
11131090#endif
11141091
11151092// add_cv
1116
1117template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv
1118 {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;};
1093template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv {
1094 typedef _LIBCPP_NODEBUG_TYPE const volatile _Tp type;
1095};
11191096
11201097#if _LIBCPP_STD_VER > 11
11211098template <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
11531130template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
11541131#endif
11551132
1133// Suppress deprecation notice for volatile-qualified return type resulting
1134// from volatile-qualified types _Tp.
1135_LIBCPP_SUPPRESS_DEPRECATED_PUSH
11561136template <class _Tp> _Tp&& __declval(int);
11571137template <class _Tp> _Tp __declval(long);
1138_LIBCPP_SUPPRESS_DEPRECATED_POP
11581139
11591140template <class _Tp>
11601141decltype(_VSTD::__declval<_Tp>(0))
......@@ -1448,8 +1429,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v
14481429#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
14491430
14501431template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
1451 : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
1452 !is_abstract<_T2>::value> {};
1432 : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
14531433
14541434#else // __has_feature(is_convertible_to)
14551435
......@@ -2307,6 +2287,11 @@ __decay_copy(_Tp&& __t)
23072287 return _VSTD::forward<_Tp>(__t);
23082288}
23092289
2290template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
2291struct __member_pointer_traits_imp
2292{
2293};
2294
23102295template <class _Rp, class _Class, class ..._Param>
23112296struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
23122297{
......@@ -2836,6 +2821,30 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v
28362821 = is_default_constructible<_Tp>::value;
28372822#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
28392848// is_copy_constructible
28402849
28412850template <class _Tp>
......@@ -3681,6 +3690,13 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v
36813690template <class _Tp> struct __is_swappable;
36823691template <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
36843700template <class _Tp>
36853701inline _LIBCPP_INLINE_VISIBILITY
36863702#ifndef _LIBCPP_CXX03_LANG
......@@ -3706,7 +3722,22 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
37063722typename enable_if<
37073723 __is_swappable<_Tp>::value
37083724>::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
37113742template <class _ForwardIterator1, class _ForwardIterator2>
37123743inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
......@@ -3985,21 +4016,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
39854016
39864017#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
40034019#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
40044020#if _LIBCPP_STD_VER > 17
40054021_LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/utility+30-33
......@@ -69,11 +69,11 @@ struct pair
6969
7070 pair(const pair&) = default;
7171 pair(pair&&) = default;
72 constexpr pair();
73 pair(const T1& x, const T2& y); // constexpr in C++14
74 template <class U, class V> pair(U&& x, V&& y); // constexpr in C++14
75 template <class U, class V> pair(const pair<U, V>& p); // constexpr in C++14
76 template <class U, class V> pair(pair<U, V>&& p); // constexpr in C++14
72 explicit(see-below) constexpr pair();
73 explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14
74 template <class U, class V> explicit(see-below) pair(U&& x, V&& y); // constexpr in C++14
75 template <class U, class V> explicit(see-below) pair(const pair<U, V>& p); // constexpr in C++14
76 template <class U, class V> explicit(see-below) pair(pair<U, V>&& p); // constexpr in C++14
7777 template <class... Args1, class... Args2>
7878 pair(piecewise_construct_t, tuple<Args1...> first_args,
7979 tuple<Args2...> second_args);
......@@ -99,7 +99,7 @@ template <class T1, class T2>
9999void
100100swap(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; };
103103inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
104104
105105template <class T> struct tuple_size;
......@@ -248,29 +248,11 @@ operator>=(const _Tp& __x, const _Tp& __y)
248248
249249} // rel_ops
250250
251// swap_ranges
251// swap_ranges is defined in <type_traits>`
252252
253// swap is defined in <type_traits>
253254
254template <class _ForwardIterator1, class _ForwardIterator2>
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}
255// move_if_noexcept
274256
275257template <class _Tp>
276258inline _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
294276template <class _Tp> void as_const(const _Tp&&) = delete;
295277#endif
296278
297struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { };
279struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
298280#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
299281extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
300282#else
......@@ -352,10 +334,17 @@ struct _LIBCPP_TEMPLATE_VIS pair
352334 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
353335
354336 struct _CheckArgs {
355 template <class _U1, class _U2>
356 static constexpr bool __enable_default() {
357 return is_default_constructible<_U1>::value
358 && is_default_constructible<_U2>::value;
337 template <int&...>
338 static constexpr bool __enable_explicit_default() {
339 return is_default_constructible<_T1>::value
340 && is_default_constructible<_T2>::value
341 && !__enable_implicit_default<>();
342 }
343
344 template <int&...>
345 static constexpr bool __enable_implicit_default() {
346 return __is_implicitly_default_constructible<_T1>::value
347 && __is_implicitly_default_constructible<_T2>::value;
359348 }
360349
361350 template <class _U1, class _U2>
......@@ -406,7 +395,15 @@ struct _LIBCPP_TEMPLATE_VIS pair
406395 >::type;
407396
408397 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()
410407 > = false>
411408 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
412409 pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value &&
lib/libcxx/include/valarray+7-19
......@@ -1256,6 +1256,8 @@ public:
12561256 _LIBCPP_INLINE_VISIBILITY
12571257 operator>>=(const _Expr& __v) const;
12581258
1259 slice_array(slice_array const&) = default;
1260
12591261 _LIBCPP_INLINE_VISIBILITY
12601262 const slice_array& operator=(const slice_array& __sa) const;
12611263
......@@ -1505,11 +1507,6 @@ public:
15051507
15061508#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
15131510 _LIBCPP_INLINE_VISIBILITY
15141511 size_t start() const {return __1d_.size() ? __1d_[0] : 0;}
15151512
......@@ -1645,10 +1642,7 @@ public:
16451642 _LIBCPP_INLINE_VISIBILITY
16461643 void operator=(const value_type& __x) const;
16471644
1648// gslice_array(const gslice_array&) = default;
1649// gslice_array(gslice_array&&) = default;
1650// gslice_array& operator=(const gslice_array&) = default;
1651// gslice_array& operator=(gslice_array&&) = default;
1645 gslice_array(const gslice_array&) = default;
16521646
16531647private:
16541648 gslice_array(const gslice& __gs, const valarray<value_type>& __v)
......@@ -1977,17 +1971,14 @@ public:
19771971 _LIBCPP_INLINE_VISIBILITY
19781972 operator>>=(const _Expr& __v) const;
19791973
1974 mask_array(const mask_array&) = default;
1975
19801976 _LIBCPP_INLINE_VISIBILITY
19811977 const mask_array& operator=(const mask_array& __ma) const;
19821978
19831979 _LIBCPP_INLINE_VISIBILITY
19841980 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
19911982private:
19921983 _LIBCPP_INLINE_VISIBILITY
19931984 mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
......@@ -2336,17 +2327,14 @@ public:
23362327 _LIBCPP_INLINE_VISIBILITY
23372328 operator>>=(const _Expr& __v) const;
23382329
2330 indirect_array(const indirect_array&) = default;
2331
23392332 _LIBCPP_INLINE_VISIBILITY
23402333 const indirect_array& operator=(const indirect_array& __ia) const;
23412334
23422335 _LIBCPP_INLINE_VISIBILITY
23432336 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
23502338private:
23512339 _LIBCPP_INLINE_VISIBILITY
23522340 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
297297_LIBCPP_BEGIN_NAMESPACE_STD
298298
299299template <bool>
300class __vector_base_common
300class _LIBCPP_TEMPLATE_VIS __vector_base_common
301301{
302302protected:
303303 _LIBCPP_INLINE_VISIBILITY __vector_base_common() {}
......@@ -423,7 +423,7 @@ __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
423423{
424424 pointer __soon_to_be_end = __end_;
425425 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));
427427 __end_ = __new_last;
428428}
429429
......@@ -433,7 +433,7 @@ __vector_base<_Tp, _Allocator>::__vector_base()
433433 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
434434 : __begin_(nullptr),
435435 __end_(nullptr),
436 __end_cap_(nullptr)
436 __end_cap_(nullptr, __default_init_tag())
437437{
438438}
439439
......@@ -518,29 +518,29 @@ public:
518518 vector(size_type __n, const value_type& __x, const allocator_type& __a);
519519 template <class _InputIterator>
520520 vector(_InputIterator __first,
521 typename enable_if<__is_input_iterator <_InputIterator>::value &&
522 !__is_forward_iterator<_InputIterator>::value &&
521 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
522 !__is_cpp17_forward_iterator<_InputIterator>::value &&
523523 is_constructible<
524524 value_type,
525525 typename iterator_traits<_InputIterator>::reference>::value,
526526 _InputIterator>::type __last);
527527 template <class _InputIterator>
528528 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
529 typename enable_if<__is_input_iterator <_InputIterator>::value &&
530 !__is_forward_iterator<_InputIterator>::value &&
529 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
530 !__is_cpp17_forward_iterator<_InputIterator>::value &&
531531 is_constructible<
532532 value_type,
533533 typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
534534 template <class _ForwardIterator>
535535 vector(_ForwardIterator __first,
536 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
536 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
537537 is_constructible<
538538 value_type,
539539 typename iterator_traits<_ForwardIterator>::reference>::value,
540540 _ForwardIterator>::type __last);
541541 template <class _ForwardIterator>
542542 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 &&
544544 is_constructible<
545545 value_type,
546546 typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
......@@ -589,8 +589,8 @@ public:
589589 template <class _InputIterator>
590590 typename enable_if
591591 <
592 __is_input_iterator <_InputIterator>::value &&
593 !__is_forward_iterator<_InputIterator>::value &&
592 __is_cpp17_input_iterator <_InputIterator>::value &&
593 !__is_cpp17_forward_iterator<_InputIterator>::value &&
594594 is_constructible<
595595 value_type,
596596 typename iterator_traits<_InputIterator>::reference>::value,
......@@ -600,7 +600,7 @@ public:
600600 template <class _ForwardIterator>
601601 typename enable_if
602602 <
603 __is_forward_iterator<_ForwardIterator>::value &&
603 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
604604 is_constructible<
605605 value_type,
606606 typename iterator_traits<_ForwardIterator>::reference>::value,
......@@ -692,10 +692,10 @@ public:
692692
693693 _LIBCPP_INLINE_VISIBILITY
694694 value_type* data() _NOEXCEPT
695 {return _VSTD::__to_raw_pointer(this->__begin_);}
695 {return _VSTD::__to_address(this->__begin_);}
696696 _LIBCPP_INLINE_VISIBILITY
697697 const value_type* data() const _NOEXCEPT
698 {return _VSTD::__to_raw_pointer(this->__begin_);}
698 {return _VSTD::__to_address(this->__begin_);}
699699
700700#ifdef _LIBCPP_CXX03_LANG
701701 _LIBCPP_INLINE_VISIBILITY
......@@ -737,8 +737,8 @@ public:
737737 template <class _InputIterator>
738738 typename enable_if
739739 <
740 __is_input_iterator <_InputIterator>::value &&
741 !__is_forward_iterator<_InputIterator>::value &&
740 __is_cpp17_input_iterator <_InputIterator>::value &&
741 !__is_cpp17_forward_iterator<_InputIterator>::value &&
742742 is_constructible<
743743 value_type,
744744 typename iterator_traits<_InputIterator>::reference>::value,
......@@ -748,7 +748,7 @@ public:
748748 template <class _ForwardIterator>
749749 typename enable_if
750750 <
751 __is_forward_iterator<_ForwardIterator>::value &&
751 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
752752 is_constructible<
753753 value_type,
754754 typename iterator_traits<_ForwardIterator>::reference>::value,
......@@ -808,7 +808,7 @@ private:
808808 template <class _ForwardIterator>
809809 typename enable_if
810810 <
811 __is_forward_iterator<_ForwardIterator>::value,
811 __is_cpp17_forward_iterator<_ForwardIterator>::value,
812812 void
813813 >::type
814814 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n);
......@@ -864,58 +864,67 @@ private:
864864#else
865865 _LIBCPP_INLINE_VISIBILITY
866866 void __annotate_contiguous_container(const void*, const void*, const void*,
867 const void*) const {}
867 const void*) const _NOEXCEPT {}
868868#endif
869869 _LIBCPP_INLINE_VISIBILITY
870 void __annotate_new(size_type __current_size) const {
870 void __annotate_new(size_type __current_size) const _NOEXCEPT {
871871 __annotate_contiguous_container(data(), data() + capacity(),
872872 data() + capacity(), data() + __current_size);
873873 }
874874
875875 _LIBCPP_INLINE_VISIBILITY
876 void __annotate_delete() const {
876 void __annotate_delete() const _NOEXCEPT {
877877 __annotate_contiguous_container(data(), data() + capacity(),
878878 data() + size(), data() + capacity());
879879 }
880880
881881 _LIBCPP_INLINE_VISIBILITY
882 void __annotate_increase(size_type __n) const
882 void __annotate_increase(size_type __n) const _NOEXCEPT
883883 {
884884 __annotate_contiguous_container(data(), data() + capacity(),
885885 data() + size(), data() + size() + __n);
886886 }
887887
888888 _LIBCPP_INLINE_VISIBILITY
889 void __annotate_shrink(size_type __old_size) const
889 void __annotate_shrink(size_type __old_size) const _NOEXCEPT
890890 {
891891 __annotate_contiguous_container(data(), data() + capacity(),
892892 data() + __old_size, data() + size());
893893 }
894
895 struct _ConstructTransaction {
896 explicit _ConstructTransaction(vector &__v, size_type __n)
897 : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
894898#ifndef _LIBCPP_HAS_NO_ASAN
895 // The annotation for size increase should happen before the actual increase,
896 // but if an exception is thrown after that the annotation has to be undone.
897 struct __RAII_IncreaseAnnotator {
898 __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1)
899 : __commit(false), __v(__v), __old_size(__v.size() + __n) {
900 __v.__annotate_increase(__n);
901 }
902 void __done() { __commit = true; }
903 ~__RAII_IncreaseAnnotator() {
904 if (__commit) return;
905 __v.__annotate_shrink(__old_size);
899 __v_.__annotate_increase(__n);
900#endif
901 }
902 ~_ConstructTransaction() {
903 __v_.__end_ = __pos_;
904#ifndef _LIBCPP_HAS_NO_ASAN
905 if (__pos_ != __new_end_) {
906 __v_.__annotate_shrink(__new_end_ - __v_.__begin_);
906907 }
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 };
917908#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 }
919928};
920929
921930#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
......@@ -938,8 +947,10 @@ template <class _Tp, class _Allocator>
938947void
939948vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
940949{
950
941951 __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_);
943954 _VSTD::swap(this->__begin_, __v.__begin_);
944955 _VSTD::swap(this->__end_, __v.__end_);
945956 _VSTD::swap(this->__end_cap(), __v.__end_cap());
......@@ -954,8 +965,10 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
954965{
955966 __annotate_delete();
956967 pointer __r = __v.__begin_;
957 __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_);
958 __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_);
968 __alloc_traits::__construct_backward_with_exception_guarantees(
969 this->__alloc(), this->__begin_, __p, __v.__begin_);
970 __alloc_traits::__construct_forward_with_exception_guarantees(
971 this->__alloc(), __p, this->__end_, __v.__end_);
959972 _VSTD::swap(this->__begin_, __v.__begin_);
960973 _VSTD::swap(this->__end_, __v.__end_);
961974 _VSTD::swap(this->__end_cap(), __v.__end_cap());
......@@ -1027,15 +1040,10 @@ template <class _Tp, class _Allocator>
10271040void
10281041vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
10291042{
1030 allocator_type& __a = this->__alloc();
1031 do
1032 {
1033 __RAII_IncreaseAnnotator __annotator(*this);
1034 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
1035 ++this->__end_;
1036 --__n;
1037 __annotator.__done();
1038 } while (__n > 0);
1043 _ConstructTransaction __tx(*this, __n);
1044 for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) {
1045 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_));
1046 }
10391047}
10401048
10411049// Copy constructs __n objects starting at __end_ from __x
......@@ -1049,30 +1057,23 @@ inline
10491057void
10501058vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
10511059{
1052 allocator_type& __a = this->__alloc();
1053 do
1054 {
1055 __RAII_IncreaseAnnotator __annotator(*this);
1056 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
1057 ++this->__end_;
1058 --__n;
1059 __annotator.__done();
1060 } while (__n > 0);
1060 _ConstructTransaction __tx(*this, __n);
1061 for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) {
1062 __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), __x);
1063 }
10611064}
10621065
10631066template <class _Tp, class _Allocator>
10641067template <class _ForwardIterator>
10651068typename enable_if
10661069<
1067 __is_forward_iterator<_ForwardIterator>::value,
1070 __is_cpp17_forward_iterator<_ForwardIterator>::value,
10681071 void
10691072>::type
10701073vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
10711074{
1072 allocator_type& __a = this->__alloc();
1073 __RAII_IncreaseAnnotator __annotator(*this, __n);
1074 __alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_);
1075 __annotator.__done();
1075 _ConstructTransaction __tx(*this, __n);
1076 __alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_);
10761077}
10771078
10781079// Default constructs __n objects starting at __end_
......@@ -1172,8 +1173,8 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allo
11721173template <class _Tp, class _Allocator>
11731174template <class _InputIterator>
11741175vector<_Tp, _Allocator>::vector(_InputIterator __first,
1175 typename enable_if<__is_input_iterator <_InputIterator>::value &&
1176 !__is_forward_iterator<_InputIterator>::value &&
1176 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
1177 !__is_cpp17_forward_iterator<_InputIterator>::value &&
11771178 is_constructible<
11781179 value_type,
11791180 typename iterator_traits<_InputIterator>::reference>::value,
......@@ -1189,8 +1190,8 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,
11891190template <class _Tp, class _Allocator>
11901191template <class _InputIterator>
11911192vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
1192 typename enable_if<__is_input_iterator <_InputIterator>::value &&
1193 !__is_forward_iterator<_InputIterator>::value &&
1193 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
1194 !__is_cpp17_forward_iterator<_InputIterator>::value &&
11941195 is_constructible<
11951196 value_type,
11961197 typename iterator_traits<_InputIterator>::reference>::value>::type*)
......@@ -1206,7 +1207,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
12061207template <class _Tp, class _Allocator>
12071208template <class _ForwardIterator>
12081209vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
1209 typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
1210 typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value &&
12101211 is_constructible<
12111212 value_type,
12121213 typename iterator_traits<_ForwardIterator>::reference>::value,
......@@ -1226,7 +1227,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
12261227template <class _Tp, class _Allocator>
12271228template <class _ForwardIterator>
12281229vector<_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 &&
12301231 is_constructible<
12311232 value_type,
12321233 typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
......@@ -1409,8 +1410,8 @@ template <class _Tp, class _Allocator>
14091410template <class _InputIterator>
14101411typename enable_if
14111412<
1412 __is_input_iterator <_InputIterator>::value &&
1413 !__is_forward_iterator<_InputIterator>::value &&
1413 __is_cpp17_input_iterator <_InputIterator>::value &&
1414 !__is_cpp17_forward_iterator<_InputIterator>::value &&
14141415 is_constructible<
14151416 _Tp,
14161417 typename iterator_traits<_InputIterator>::reference>::value,
......@@ -1427,7 +1428,7 @@ template <class _Tp, class _Allocator>
14271428template <class _ForwardIterator>
14281429typename enable_if
14291430<
1430 __is_forward_iterator<_ForwardIterator>::value &&
1431 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
14311432 is_constructible<
14321433 _Tp,
14331434 typename iterator_traits<_ForwardIterator>::reference>::value,
......@@ -1621,7 +1622,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
16211622 allocator_type& __a = this->__alloc();
16221623 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
16231624 // __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));
16251626 __v.__end_++;
16261627 __swap_out_circular_buffer(__v);
16271628}
......@@ -1633,11 +1634,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
16331634{
16341635 if (this->__end_ != this->__end_cap())
16351636 {
1636 __RAII_IncreaseAnnotator __annotator(*this);
1637 __alloc_traits::construct(this->__alloc(),
1638 _VSTD::__to_raw_pointer(this->__end_), __x);
1639 __annotator.__done();
1640 ++this->__end_;
1637 __construct_one_at_end(__x);
16411638 }
16421639 else
16431640 __push_back_slow_path(__x);
......@@ -1652,12 +1649,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
16521649{
16531650 if (this->__end_ < this->__end_cap())
16541651 {
1655 __RAII_IncreaseAnnotator __annotator(*this);
1656 __alloc_traits::construct(this->__alloc(),
1657 _VSTD::__to_raw_pointer(this->__end_),
1658 _VSTD::move(__x));
1659 __annotator.__done();
1660 ++this->__end_;
1652 __construct_one_at_end(_VSTD::move(__x));
16611653 }
16621654 else
16631655 __push_back_slow_path(_VSTD::move(__x));
......@@ -1671,7 +1663,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
16711663 allocator_type& __a = this->__alloc();
16721664 __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
16731665// __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)...);
16751667 __v.__end_++;
16761668 __swap_out_circular_buffer(__v);
16771669}
......@@ -1688,12 +1680,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
16881680{
16891681 if (this->__end_ < this->__end_cap())
16901682 {
1691 __RAII_IncreaseAnnotator __annotator(*this);
1692 __alloc_traits::construct(this->__alloc(),
1693 _VSTD::__to_raw_pointer(this->__end_),
1694 _VSTD::forward<_Args>(__args)...);
1695 __annotator.__done();
1696 ++this->__end_;
1683 __construct_one_at_end(_VSTD::forward<_Args>(__args)...);
16971684 }
16981685 else
16991686 __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
......@@ -1761,10 +1748,15 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe
17611748{
17621749 pointer __old_last = this->__end_;
17631750 difference_type __n = __old_last - __to;
1764 for (pointer __i = __from_s + __n; __i < __from_e; ++__i, ++this->__end_)
1765 __alloc_traits::construct(this->__alloc(),
1766 _VSTD::__to_raw_pointer(this->__end_),
1767 _VSTD::move(*__i));
1751 {
1752 pointer __i = __from_s + __n;
1753 _ConstructTransaction __tx(*this, __from_e - __i);
1754 for (; __i < __from_e; ++__i, ++__tx.__pos_) {
1755 __alloc_traits::construct(this->__alloc(),
1756 _VSTD::__to_address(__tx.__pos_),
1757 _VSTD::move(*__i));
1758 }
1759 }
17681760 _VSTD::move_backward(__from_s, __from_s + __n, __old_last);
17691761}
17701762
......@@ -1780,12 +1772,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
17801772 pointer __p = this->__begin_ + (__position - begin());
17811773 if (this->__end_ < this->__end_cap())
17821774 {
1783 __RAII_IncreaseAnnotator __annotator(*this);
17841775 if (__p == this->__end_)
17851776 {
1786 __alloc_traits::construct(this->__alloc(),
1787 _VSTD::__to_raw_pointer(this->__end_), __x);
1788 ++this->__end_;
1777 __construct_one_at_end(__x);
17891778 }
17901779 else
17911780 {
......@@ -1795,7 +1784,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
17951784 ++__xr;
17961785 *__p = *__xr;
17971786 }
1798 __annotator.__done();
17991787 }
18001788 else
18011789 {
......@@ -1821,20 +1809,15 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
18211809 pointer __p = this->__begin_ + (__position - begin());
18221810 if (this->__end_ < this->__end_cap())
18231811 {
1824 __RAII_IncreaseAnnotator __annotator(*this);
18251812 if (__p == this->__end_)
18261813 {
1827 __alloc_traits::construct(this->__alloc(),
1828 _VSTD::__to_raw_pointer(this->__end_),
1829 _VSTD::move(__x));
1830 ++this->__end_;
1814 __construct_one_at_end(_VSTD::move(__x));
18311815 }
18321816 else
18331817 {
18341818 __move_range(__p, this->__end_, __p + 1);
18351819 *__p = _VSTD::move(__x);
18361820 }
1837 __annotator.__done();
18381821 }
18391822 else
18401823 {
......@@ -1859,13 +1842,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
18591842 pointer __p = this->__begin_ + (__position - begin());
18601843 if (this->__end_ < this->__end_cap())
18611844 {
1862 __RAII_IncreaseAnnotator __annotator(*this);
18631845 if (__p == this->__end_)
18641846 {
1865 __alloc_traits::construct(this->__alloc(),
1866 _VSTD::__to_raw_pointer(this->__end_),
1867 _VSTD::forward<_Args>(__args)...);
1868 ++this->__end_;
1847 __construct_one_at_end(_VSTD::forward<_Args>(__args)...);
18691848 }
18701849 else
18711850 {
......@@ -1873,7 +1852,6 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
18731852 __move_range(__p, this->__end_, __p + 1);
18741853 *__p = _VSTD::move(__tmp.get());
18751854 }
1876 __annotator.__done();
18771855 }
18781856 else
18791857 {
......@@ -1911,9 +1889,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_
19111889 }
19121890 if (__n > 0)
19131891 {
1914 __RAII_IncreaseAnnotator __annotator(*this, __n);
19151892 __move_range(__p, __old_last, __p + __old_n);
1916 __annotator.__done();
19171893 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
19181894 if (__p <= __xr && __xr < this->__end_)
19191895 __xr += __old_n;
......@@ -1935,8 +1911,8 @@ template <class _Tp, class _Allocator>
19351911template <class _InputIterator>
19361912typename enable_if
19371913<
1938 __is_input_iterator <_InputIterator>::value &&
1939 !__is_forward_iterator<_InputIterator>::value &&
1914 __is_cpp17_input_iterator <_InputIterator>::value &&
1915 !__is_cpp17_forward_iterator<_InputIterator>::value &&
19401916 is_constructible<
19411917 _Tp,
19421918 typename iterator_traits<_InputIterator>::reference>::value,
......@@ -1955,11 +1931,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
19551931 pointer __old_last = this->__end_;
19561932 for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
19571933 {
1958 __RAII_IncreaseAnnotator __annotator(*this);
1959 __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
1960 *__first);
1961 ++this->__end_;
1962 __annotator.__done();
1934 __construct_one_at_end(*__first);
19631935 }
19641936 __split_buffer<value_type, allocator_type&> __v(__a);
19651937 if (__first != __last)
......@@ -1993,7 +1965,7 @@ template <class _Tp, class _Allocator>
19931965template <class _ForwardIterator>
19941966typename enable_if
19951967<
1996 __is_forward_iterator<_ForwardIterator>::value &&
1968 __is_cpp17_forward_iterator<_ForwardIterator>::value &&
19971969 is_constructible<
19981970 _Tp,
19991971 typename iterator_traits<_ForwardIterator>::reference>::value,
......@@ -2026,9 +1998,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi
20261998 }
20271999 if (__n > 0)
20282000 {
2029 __RAII_IncreaseAnnotator __annotator(*this, __n);
20302001 __move_range(__p, __old_last, __p + __old_n);
2031 __annotator.__done();
20322002 _VSTD::copy(__first, __m, __p);
20332003 }
20342004 }
......@@ -2261,18 +2231,18 @@ public:
22612231 vector(size_type __n, const value_type& __v, const allocator_type& __a);
22622232 template <class _InputIterator>
22632233 vector(_InputIterator __first, _InputIterator __last,
2264 typename enable_if<__is_input_iterator <_InputIterator>::value &&
2265 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
2234 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2235 !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0);
22662236 template <class _InputIterator>
22672237 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
2268 typename enable_if<__is_input_iterator <_InputIterator>::value &&
2269 !__is_forward_iterator<_InputIterator>::value>::type* = 0);
2238 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2239 !__is_cpp17_forward_iterator<_InputIterator>::value>::type* = 0);
22702240 template <class _ForwardIterator>
22712241 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);
22732243 template <class _ForwardIterator>
22742244 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
22772247 vector(const vector& __v);
22782248 vector(const vector& __v, const allocator_type& __a);
......@@ -2303,15 +2273,15 @@ public:
23032273 template <class _InputIterator>
23042274 typename enable_if
23052275 <
2306 __is_input_iterator<_InputIterator>::value &&
2307 !__is_forward_iterator<_InputIterator>::value,
2276 __is_cpp17_input_iterator<_InputIterator>::value &&
2277 !__is_cpp17_forward_iterator<_InputIterator>::value,
23082278 void
23092279 >::type
23102280 assign(_InputIterator __first, _InputIterator __last);
23112281 template <class _ForwardIterator>
23122282 typename enable_if
23132283 <
2314 __is_forward_iterator<_ForwardIterator>::value,
2284 __is_cpp17_forward_iterator<_ForwardIterator>::value,
23152285 void
23162286 >::type
23172287 assign(_ForwardIterator __first, _ForwardIterator __last);
......@@ -2419,15 +2389,15 @@ public:
24192389 template <class _InputIterator>
24202390 typename enable_if
24212391 <
2422 __is_input_iterator <_InputIterator>::value &&
2423 !__is_forward_iterator<_InputIterator>::value,
2392 __is_cpp17_input_iterator <_InputIterator>::value &&
2393 !__is_cpp17_forward_iterator<_InputIterator>::value,
24242394 iterator
24252395 >::type
24262396 insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
24272397 template <class _ForwardIterator>
24282398 typename enable_if
24292399 <
2430 __is_forward_iterator<_ForwardIterator>::value,
2400 __is_cpp17_forward_iterator<_ForwardIterator>::value,
24312401 iterator
24322402 >::type
24332403 insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
......@@ -2470,7 +2440,7 @@ private:
24702440 template <class _ForwardIterator>
24712441 typename enable_if
24722442 <
2473 __is_forward_iterator<_ForwardIterator>::value,
2443 __is_cpp17_forward_iterator<_ForwardIterator>::value,
24742444 void
24752445 >::type
24762446 __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
......@@ -2629,7 +2599,7 @@ template <class _Allocator>
26292599template <class _ForwardIterator>
26302600typename enable_if
26312601<
2632 __is_forward_iterator<_ForwardIterator>::value,
2602 __is_cpp17_forward_iterator<_ForwardIterator>::value,
26332603 void
26342604>::type
26352605vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
......@@ -2652,7 +2622,7 @@ vector<bool, _Allocator>::vector()
26522622 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
26532623 : __begin_(nullptr),
26542624 __size_(0),
2655 __cap_alloc_(0)
2625 __cap_alloc_(0, __default_init_tag())
26562626{
26572627}
26582628
......@@ -2674,7 +2644,7 @@ template <class _Allocator>
26742644vector<bool, _Allocator>::vector(size_type __n)
26752645 : __begin_(nullptr),
26762646 __size_(0),
2677 __cap_alloc_(0)
2647 __cap_alloc_(0, __default_init_tag())
26782648{
26792649 if (__n > 0)
26802650 {
......@@ -2702,7 +2672,7 @@ template <class _Allocator>
27022672vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
27032673 : __begin_(nullptr),
27042674 __size_(0),
2705 __cap_alloc_(0)
2675 __cap_alloc_(0, __default_init_tag())
27062676{
27072677 if (__n > 0)
27082678 {
......@@ -2727,11 +2697,11 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const all
27272697template <class _Allocator>
27282698template <class _InputIterator>
27292699vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
2730 typename enable_if<__is_input_iterator <_InputIterator>::value &&
2731 !__is_forward_iterator<_InputIterator>::value>::type*)
2700 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2701 !__is_cpp17_forward_iterator<_InputIterator>::value>::type*)
27322702 : __begin_(nullptr),
27332703 __size_(0),
2734 __cap_alloc_(0)
2704 __cap_alloc_(0, __default_init_tag())
27352705{
27362706#ifndef _LIBCPP_NO_EXCEPTIONS
27372707 try
......@@ -2754,8 +2724,8 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
27542724template <class _Allocator>
27552725template <class _InputIterator>
27562726vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
2757 typename enable_if<__is_input_iterator <_InputIterator>::value &&
2758 !__is_forward_iterator<_InputIterator>::value>::type*)
2727 typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value &&
2728 !__is_cpp17_forward_iterator<_InputIterator>::value>::type*)
27592729 : __begin_(nullptr),
27602730 __size_(0),
27612731 __cap_alloc_(0, static_cast<__storage_allocator>(__a))
......@@ -2781,10 +2751,10 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
27812751template <class _Allocator>
27822752template <class _ForwardIterator>
27832753vector<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*)
27852755 : __begin_(nullptr),
27862756 __size_(0),
2787 __cap_alloc_(0)
2757 __cap_alloc_(0, __default_init_tag())
27882758{
27892759 size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
27902760 if (__n > 0)
......@@ -2797,7 +2767,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
27972767template <class _Allocator>
27982768template <class _ForwardIterator>
27992769vector<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*)
28012771 : __begin_(nullptr),
28022772 __size_(0),
28032773 __cap_alloc_(0, static_cast<__storage_allocator>(__a))
......@@ -2816,7 +2786,7 @@ template <class _Allocator>
28162786vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
28172787 : __begin_(nullptr),
28182788 __size_(0),
2819 __cap_alloc_(0)
2789 __cap_alloc_(0, __default_init_tag())
28202790{
28212791 size_type __n = static_cast<size_type>(__il.size());
28222792 if (__n > 0)
......@@ -2998,8 +2968,8 @@ template <class _Allocator>
29982968template <class _InputIterator>
29992969typename enable_if
30002970<
3001 __is_input_iterator<_InputIterator>::value &&
3002 !__is_forward_iterator<_InputIterator>::value,
2971 __is_cpp17_input_iterator<_InputIterator>::value &&
2972 !__is_cpp17_forward_iterator<_InputIterator>::value,
30032973 void
30042974>::type
30052975vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
......@@ -3013,7 +2983,7 @@ template <class _Allocator>
30132983template <class _ForwardIterator>
30142984typename enable_if
30152985<
3016 __is_forward_iterator<_ForwardIterator>::value,
2986 __is_cpp17_forward_iterator<_ForwardIterator>::value,
30172987 void
30182988>::type
30192989vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
......@@ -3150,8 +3120,8 @@ template <class _Allocator>
31503120template <class _InputIterator>
31513121typename enable_if
31523122<
3153 __is_input_iterator <_InputIterator>::value &&
3154 !__is_forward_iterator<_InputIterator>::value,
3123 __is_cpp17_input_iterator <_InputIterator>::value &&
3124 !__is_cpp17_forward_iterator<_InputIterator>::value,
31553125 typename vector<bool, _Allocator>::iterator
31563126>::type
31573127vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
......@@ -3195,7 +3165,7 @@ template <class _Allocator>
31953165template <class _ForwardIterator>
31963166typename enable_if
31973167<
3198 __is_forward_iterator<_ForwardIterator>::value,
3168 __is_cpp17_forward_iterator<_ForwardIterator>::value,
31993169 typename vector<bool, _Allocator>::iterator
32003170>::type
32013171vector<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
4343__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
4444__cpp_lib_destroying_delete 201806L <new>
4545__cpp_lib_enable_shared_from_this 201603L <memory>
46__cpp_lib_endian 201907L <bit>
4647__cpp_lib_erase_if 201811L <string> <deque> <forward_list>
4748 <list> <vector> <map>
4849 <set> <unordered_map> <unordered_set>
......@@ -223,6 +224,7 @@ __cpp_lib_void_t 201411L <type_traits>
223224# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
224225# define __cpp_lib_destroying_delete 201806L
225226# endif
227# define __cpp_lib_endian 201907L
226228# define __cpp_lib_erase_if 201811L
227229// # define __cpp_lib_generic_unordered_lookup 201811L
228230# define __cpp_lib_interpolate 201902L