authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-19 16:55:59-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-19 16:55:59-04:00
log70e05c67ce6f044b5b99e01a5d972bbe92c38344
tree6f13ca6ee7147f053b88d33e62bfdd1e284d9019
parentdab0cf6428d96af540399563f2e2d5a79c3a7d5e
signaturelock-open Commit is signed but in an unrecognized format.

update libcxx to llvm9

upstream commit 1931d3cb20a00da732c5210b123656632982fde0

181 files changed, 5576 insertions(+), 4763 deletions(-)

lib/libcxx/include/__bit_reference+17-18
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -69,7 +68,7 @@ public:...@@ -69,7 +68,7 @@ public:
6968
70 _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}69 _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
71 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT70 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
72 {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}71 {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
73private:72private:
74 _LIBCPP_INLINE_VISIBILITY73 _LIBCPP_INLINE_VISIBILITY
75 __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT74 __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
...@@ -141,7 +140,7 @@ public:...@@ -141,7 +140,7 @@ public:
141 {return static_cast<bool>(*__seg_ & __mask_);}140 {return static_cast<bool>(*__seg_ & __mask_);}
142141
143 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT142 _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
144 {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}143 {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
145private:144private:
146 _LIBCPP_INLINE_VISIBILITY145 _LIBCPP_INLINE_VISIBILITY
147 _LIBCPP_CONSTEXPR146 _LIBCPP_CONSTEXPR
...@@ -168,7 +167,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -168,7 +167,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
168 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));167 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
169 __storage_type __b = *__first.__seg_ & __m;168 __storage_type __b = *__first.__seg_ & __m;
170 if (__b)169 if (__b)
171 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));170 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
172 if (__n == __dn)171 if (__n == __dn)
173 return __first + __n;172 return __first + __n;
174 __n -= __dn;173 __n -= __dn;
...@@ -177,14 +176,14 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -177,14 +176,14 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
177 // do middle whole words176 // do middle whole words
178 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)177 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
179 if (*__first.__seg_)178 if (*__first.__seg_)
180 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));179 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(*__first.__seg_)));
181 // do last partial word180 // do last partial word
182 if (__n > 0)181 if (__n > 0)
183 {182 {
184 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);183 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
185 __storage_type __b = *__first.__seg_ & __m;184 __storage_type __b = *__first.__seg_ & __m;
186 if (__b)185 if (__b)
187 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));186 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
188 }187 }
189 return _It(__first.__seg_, static_cast<unsigned>(__n));188 return _It(__first.__seg_, static_cast<unsigned>(__n));
190}189}
...@@ -204,7 +203,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -204,7 +203,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
204 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));203 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
205 __storage_type __b = ~*__first.__seg_ & __m;204 __storage_type __b = ~*__first.__seg_ & __m;
206 if (__b)205 if (__b)
207 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));206 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
208 if (__n == __dn)207 if (__n == __dn)
209 return __first + __n;208 return __first + __n;
210 __n -= __dn;209 __n -= __dn;
...@@ -215,7 +214,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -215,7 +214,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
215 {214 {
216 __storage_type __b = ~*__first.__seg_;215 __storage_type __b = ~*__first.__seg_;
217 if (__b)216 if (__b)
218 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));217 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
219 }218 }
220 // do last partial word219 // do last partial word
221 if (__n > 0)220 if (__n > 0)
...@@ -223,7 +222,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -223,7 +222,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
223 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);222 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
224 __storage_type __b = ~*__first.__seg_ & __m;223 __storage_type __b = ~*__first.__seg_ & __m;
225 if (__b)224 if (__b)
226 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));225 return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__libcpp_ctz(__b)));
227 }226 }
228 return _It(__first.__seg_, static_cast<unsigned>(__n));227 return _It(__first.__seg_, static_cast<unsigned>(__n));
229}228}
...@@ -255,18 +254,18 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type...@@ -255,18 +254,18 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
255 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);254 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
256 __storage_type __dn = _VSTD::min(__clz_f, __n);255 __storage_type __dn = _VSTD::min(__clz_f, __n);
257 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));256 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
258 __r = _VSTD::__popcount(*__first.__seg_ & __m);257 __r = _VSTD::__libcpp_popcount(*__first.__seg_ & __m);
259 __n -= __dn;258 __n -= __dn;
260 ++__first.__seg_;259 ++__first.__seg_;
261 }260 }
262 // do middle whole words261 // do middle whole words
263 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)262 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
264 __r += _VSTD::__popcount(*__first.__seg_);263 __r += _VSTD::__libcpp_popcount(*__first.__seg_);
265 // do last partial word264 // do last partial word
266 if (__n > 0)265 if (__n > 0)
267 {266 {
268 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);267 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
269 __r += _VSTD::__popcount(*__first.__seg_ & __m);268 __r += _VSTD::__libcpp_popcount(*__first.__seg_ & __m);
270 }269 }
271 return __r;270 return __r;
272}271}
...@@ -286,18 +285,18 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ...@@ -286,18 +285,18 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
286 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);285 __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
287 __storage_type __dn = _VSTD::min(__clz_f, __n);286 __storage_type __dn = _VSTD::min(__clz_f, __n);
288 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));287 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
289 __r = _VSTD::__popcount(~*__first.__seg_ & __m);288 __r = _VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
290 __n -= __dn;289 __n -= __dn;
291 ++__first.__seg_;290 ++__first.__seg_;
292 }291 }
293 // do middle whole words292 // do middle whole words
294 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)293 for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
295 __r += _VSTD::__popcount(~*__first.__seg_);294 __r += _VSTD::__libcpp_popcount(~*__first.__seg_);
296 // do last partial word295 // do last partial word
297 if (__n > 0)296 if (__n > 0)
298 {297 {
299 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);298 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
300 __r += _VSTD::__popcount(~*__first.__seg_ & __m);299 __r += _VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
301 }300 }
302 return __r;301 return __r;
303}302}
lib/libcxx/include/__bsd_locale_defaults.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------- __bsd_locale_defaults.h -----------------------===//2//===---------------------- __bsd_locale_defaults.h -----------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10// The BSDs have lots of *_l functions. We don't want to define those symbols9// The BSDs have lots of *_l functions. We don't want to define those symbols
lib/libcxx/include/__bsd_locale_fallbacks.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------- __bsd_locale_fallbacks.h ----------------------===//2//===---------------------- __bsd_locale_fallbacks.h ----------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10// The BSDs have lots of *_l functions. This file provides reimplementations9// The BSDs have lots of *_l functions. This file provides reimplementations
lib/libcxx/include/__config+130-157
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- __config ---------------------------------===//2//===--------------------------- __config ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -33,12 +32,16 @@...@@ -33,12 +32,16 @@
33# define _GNUC_VER_NEW 032# define _GNUC_VER_NEW 0
34#endif33#endif
3534
36#define _LIBCPP_VERSION 800035#define _LIBCPP_VERSION 9000
3736
38#ifndef _LIBCPP_ABI_VERSION37#ifndef _LIBCPP_ABI_VERSION
39# define _LIBCPP_ABI_VERSION 138# define _LIBCPP_ABI_VERSION 1
40#endif39#endif
4140
41#ifndef __STDC_HOSTED__
42# define _LIBCPP_FREESTANDING
43#endif
44
42#ifndef _LIBCPP_STD_VER45#ifndef _LIBCPP_STD_VER
43# if __cplusplus <= 201103L46# if __cplusplus <= 201103L
44# define _LIBCPP_STD_VER 1147# define _LIBCPP_STD_VER 11
...@@ -93,10 +96,12 @@...@@ -93,10 +96,12 @@
93// Enable optimized version of __do_get_(un)signed which avoids redundant copies.96// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
94# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET97# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
95// Use the smallest possible integer type to represent the index of the variant.98// Use the smallest possible integer type to represent the index of the variant.
96// Previously libc++ used "unsigned int" exclusivly.99// Previously libc++ used "unsigned int" exclusively.
97# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION100# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
98// Unstable attempt to provide a more optimized std::function101// Unstable attempt to provide a more optimized std::function
99# define _LIBCPP_ABI_OPTIMIZED_FUNCTION102# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
103// All the regex constants must be distinct and nonzero.
104# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
100#elif _LIBCPP_ABI_VERSION == 1105#elif _LIBCPP_ABI_VERSION == 1
101# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)106# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
102// Enable compiling copies of now inline methods into the dylib to support107// Enable compiling copies of now inline methods into the dylib to support
...@@ -182,6 +187,10 @@...@@ -182,6 +187,10 @@
182#define _LIBCPP_CLANG_VER 0187#define _LIBCPP_CLANG_VER 0
183#endif188#endif
184189
190#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
191#error "libc++ does not support using GCC with C++03. Please enable C++11"
192#endif
193
185// FIXME: ABI detection should be done via compiler builtin macros. This194// FIXME: ABI detection should be done via compiler builtin macros. This
186// is just a placeholder until Clang implements such macros. For now assume195// is just a placeholder until Clang implements such macros. For now assume
187// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,196// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
...@@ -201,6 +210,10 @@...@@ -201,6 +210,10 @@
201# endif210# endif
202#endif211#endif
203212
213#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
214# define _LIBCPP_ABI_VCRUNTIME
215#endif
216
204// Need to detect which libc we're using if we're on Linux.217// Need to detect which libc we're using if we're on Linux.
205#if defined(__linux__)218#if defined(__linux__)
206# include <features.h>219# include <features.h>
...@@ -257,7 +270,7 @@...@@ -257,7 +270,7 @@
257# define _LIBCPP_WIN32API270# define _LIBCPP_WIN32API
258# define _LIBCPP_LITTLE_ENDIAN271# define _LIBCPP_LITTLE_ENDIAN
259# define _LIBCPP_SHORT_WCHAR 1272# define _LIBCPP_SHORT_WCHAR 1
260// Both MinGW and native MSVC provide a "MSVC"-like enviroment273// Both MinGW and native MSVC provide a "MSVC"-like environment
261# define _LIBCPP_MSVCRT_LIKE274# define _LIBCPP_MSVCRT_LIKE
262// If mingw not explicitly detected, assume using MS C runtime only if275// If mingw not explicitly detected, assume using MS C runtime only if
263// a MS compatibility version is specified.276// a MS compatibility version is specified.
...@@ -298,7 +311,7 @@...@@ -298,7 +311,7 @@
298 // random data even when using sandboxing mechanisms such as chroots,311 // random data even when using sandboxing mechanisms such as chroots,
299 // Capsicum, etc.312 // Capsicum, etc.
300# define _LIBCPP_USING_ARC4_RANDOM313# define _LIBCPP_USING_ARC4_RANDOM
301#elif defined(__Fuchsia__)314#elif defined(__Fuchsia__) || defined(__wasi__)
302# define _LIBCPP_USING_GETENTROPY315# define _LIBCPP_USING_GETENTROPY
303#elif defined(__native_client__)316#elif defined(__native_client__)
304 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,317 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
...@@ -332,7 +345,7 @@...@@ -332,7 +345,7 @@
332# if defined(__FreeBSD__)345# if defined(__FreeBSD__)
333# define _LIBCPP_HAS_QUICK_EXIT346# define _LIBCPP_HAS_QUICK_EXIT
334# define _LIBCPP_HAS_C11_FEATURES347# define _LIBCPP_HAS_C11_FEATURES
335# elif defined(__Fuchsia__)348# elif defined(__Fuchsia__) || defined(__wasi__)
336# define _LIBCPP_HAS_QUICK_EXIT349# define _LIBCPP_HAS_QUICK_EXIT
337# define _LIBCPP_HAS_TIMESPEC_GET350# define _LIBCPP_HAS_TIMESPEC_GET
338# define _LIBCPP_HAS_C11_FEATURES351# define _LIBCPP_HAS_C11_FEATURES
...@@ -400,10 +413,6 @@ typedef __char32_t char32_t;...@@ -400,10 +413,6 @@ typedef __char32_t char32_t;
400#define _LIBCPP_HAS_NO_STRONG_ENUMS413#define _LIBCPP_HAS_NO_STRONG_ENUMS
401#endif414#endif
402415
403#if !(__has_feature(cxx_decltype))
404#define _LIBCPP_HAS_NO_DECLTYPE
405#endif
406
407#if __has_feature(cxx_attributes)416#if __has_feature(cxx_attributes)
408# define _LIBCPP_NORETURN [[noreturn]]417# define _LIBCPP_NORETURN [[noreturn]]
409#else418#else
...@@ -434,18 +443,6 @@ typedef __char32_t char32_t;...@@ -434,18 +443,6 @@ typedef __char32_t char32_t;
434#define _LIBCPP_HAS_NO_VARIADICS443#define _LIBCPP_HAS_NO_VARIADICS
435#endif444#endif
436445
437#if !(__has_feature(cxx_generalized_initializers))
438#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
439#endif
440
441#if __has_feature(is_base_of)
442#define _LIBCPP_HAS_IS_BASE_OF
443#endif
444
445#if __has_feature(is_final)
446#define _LIBCPP_HAS_IS_FINAL
447#endif
448
449// Objective-C++ features (opt-in)446// Objective-C++ features (opt-in)
450#if __has_feature(objc_arc)447#if __has_feature(objc_arc)
451#define _LIBCPP_HAS_OBJC_ARC448#define _LIBCPP_HAS_OBJC_ARC
...@@ -455,10 +452,6 @@ typedef __char32_t char32_t;...@@ -455,10 +452,6 @@ typedef __char32_t char32_t;
455#define _LIBCPP_HAS_OBJC_ARC_WEAK452#define _LIBCPP_HAS_OBJC_ARC_WEAK
456#endif453#endif
457454
458#if !(__has_feature(cxx_constexpr))
459#define _LIBCPP_HAS_NO_CONSTEXPR
460#endif
461
462#if !(__has_feature(cxx_relaxed_constexpr))455#if !(__has_feature(cxx_relaxed_constexpr))
463#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR456#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
464#endif457#endif
...@@ -471,14 +464,6 @@ typedef __char32_t char32_t;...@@ -471,14 +464,6 @@ typedef __char32_t char32_t;
471#define _LIBCPP_HAS_NO_NOEXCEPT464#define _LIBCPP_HAS_NO_NOEXCEPT
472#endif465#endif
473466
474#if __has_feature(underlying_type)
475#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
476#endif
477
478#if __has_feature(is_literal)
479#define _LIBCPP_IS_LITERAL(T) __is_literal(T)
480#endif
481
482#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)467#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
483#define _LIBCPP_HAS_NO_ASAN468#define _LIBCPP_HAS_NO_ASAN
484#endif469#endif
...@@ -510,69 +495,20 @@ typedef __char32_t char32_t;...@@ -510,69 +495,20 @@ typedef __char32_t char32_t;
510495
511#define _LIBCPP_NORETURN __attribute__((noreturn))496#define _LIBCPP_NORETURN __attribute__((noreturn))
512497
513#if _GNUC_VER >= 407
514#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
515#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
516#define _LIBCPP_HAS_IS_FINAL
517#endif
518
519#if defined(__GNUC__) && _GNUC_VER >= 403
520#define _LIBCPP_HAS_IS_BASE_OF
521#endif
522
523#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)498#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
524#define _LIBCPP_NO_EXCEPTIONS499#define _LIBCPP_NO_EXCEPTIONS
525#endif500#endif
526501
527// constexpr was added to GCC in 4.6.
528#if _GNUC_VER < 406
529# define _LIBCPP_HAS_NO_CONSTEXPR
530// Can only use constexpr in c++11 mode.
531#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
532# define _LIBCPP_HAS_NO_CONSTEXPR
533#endif
534
535// Determine if GCC supports relaxed constexpr502// Determine if GCC supports relaxed constexpr
536#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L503#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
537#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR504#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
538#endif505#endif
539506
540// GCC 5 will support variable templates507// GCC 5 supports variable templates
541#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L508#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
542#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES509#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
543#endif510#endif
544511
545#ifndef __GXX_EXPERIMENTAL_CXX0X__
546
547#define _LIBCPP_HAS_NO_DECLTYPE
548#define _LIBCPP_HAS_NO_NULLPTR
549#define _LIBCPP_HAS_NO_UNICODE_CHARS
550#define _LIBCPP_HAS_NO_VARIADICS
551#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
552#define _LIBCPP_HAS_NO_STRONG_ENUMS
553#define _LIBCPP_HAS_NO_NOEXCEPT
554
555#else // __GXX_EXPERIMENTAL_CXX0X__
556
557#if _GNUC_VER < 403
558#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
559#endif
560
561
562#if _GNUC_VER < 404
563#define _LIBCPP_HAS_NO_DECLTYPE
564#define _LIBCPP_HAS_NO_UNICODE_CHARS
565#define _LIBCPP_HAS_NO_VARIADICS
566#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
567#endif // _GNUC_VER < 404
568
569#if _GNUC_VER < 406
570#define _LIBCPP_HAS_NO_NOEXCEPT
571#define _LIBCPP_HAS_NO_NULLPTR
572#endif
573
574#endif // __GXX_EXPERIMENTAL_CXX0X__
575
576#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)512#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
577#define _LIBCPP_HAS_NO_ASAN513#define _LIBCPP_HAS_NO_ASAN
578#endif514#endif
...@@ -597,16 +533,12 @@ typedef __char32_t char32_t;...@@ -597,16 +533,12 @@ typedef __char32_t char32_t;
597#error "MSVC versions prior to Visual Studio 2015 are not supported"533#error "MSVC versions prior to Visual Studio 2015 are not supported"
598#endif534#endif
599535
600#define _LIBCPP_HAS_IS_BASE_OF
601#define _LIBCPP_HAS_NO_CONSTEXPR
602#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR536#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
603#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES537#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
604#define _LIBCPP_HAS_NO_NOEXCEPT
605#define __alignof__ __alignof538#define __alignof__ __alignof
606#define _LIBCPP_NORETURN __declspec(noreturn)539#define _LIBCPP_NORETURN __declspec(noreturn)
607#define _ALIGNAS(x) __declspec(align(x))540#define _ALIGNAS(x) __declspec(align(x))
608#define _ALIGNAS_TYPE(x) alignas(x)541#define _ALIGNAS_TYPE(x) alignas(x)
609#define _LIBCPP_HAS_NO_VARIADICS
610542
611#define _LIBCPP_WEAK543#define _LIBCPP_WEAK
612544
...@@ -623,12 +555,7 @@ typedef __char32_t char32_t;...@@ -623,12 +555,7 @@ typedef __char32_t char32_t;
623#define _ATTRIBUTE(x) __attribute__((x))555#define _ATTRIBUTE(x) __attribute__((x))
624#define _LIBCPP_NORETURN __attribute__((noreturn))556#define _LIBCPP_NORETURN __attribute__((noreturn))
625557
626#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
627#define _LIBCPP_HAS_NO_NOEXCEPT
628#define _LIBCPP_HAS_NO_NULLPTR
629#define _LIBCPP_HAS_NO_UNICODE_CHARS558#define _LIBCPP_HAS_NO_UNICODE_CHARS
630#define _LIBCPP_HAS_IS_BASE_OF
631#define _LIBCPP_HAS_IS_FINAL
632#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES559#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
633560
634#if defined(_AIX)561#if defined(_AIX)
...@@ -659,8 +586,13 @@ typedef __char32_t char32_t;...@@ -659,8 +586,13 @@ typedef __char32_t char32_t;
659# define _LIBCPP_EXPORTED_FROM_ABI586# define _LIBCPP_EXPORTED_FROM_ABI
660#elif defined(_LIBCPP_BUILDING_LIBRARY)587#elif defined(_LIBCPP_BUILDING_LIBRARY)
661# define _LIBCPP_DLL_VIS __declspec(dllexport)588# define _LIBCPP_DLL_VIS __declspec(dllexport)
662# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS589# if defined(__MINGW32__)
663# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS590# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
591# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
592# else
593# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
594# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
595# endif
664# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS596# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
665# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)597# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
666#else598#else
...@@ -777,7 +709,7 @@ typedef __char32_t char32_t;...@@ -777,7 +709,7 @@ typedef __char32_t char32_t;
777#else709#else
778 // Try to approximate the effect of exclude_from_explicit_instantiation710 // Try to approximate the effect of exclude_from_explicit_instantiation
779 // (which is that entities are not assumed to be provided by explicit711 // (which is that entities are not assumed to be provided by explicit
780 // template instantitations in the dylib) by always inlining those entities.712 // template instantiations in the dylib) by always inlining those entities.
781# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE713# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
782#endif714#endif
783715
...@@ -789,6 +721,16 @@ typedef __char32_t char32_t;...@@ -789,6 +721,16 @@ typedef __char32_t char32_t;
789# endif721# endif
790#endif722#endif
791723
724#ifndef _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
725# ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
726# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 0
727#else
728// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
729// And we should consider defaulting to OFF.
730# define _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 1
731#endif
732#endif
733
792#ifndef _LIBCPP_HIDE_FROM_ABI734#ifndef _LIBCPP_HIDE_FROM_ABI
793# if _LIBCPP_HIDE_FROM_ABI_PER_TU735# if _LIBCPP_HIDE_FROM_ABI_PER_TU
794# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE736# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
...@@ -843,22 +785,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD...@@ -843,22 +785,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
843# define _NOEXCEPT_(x)785# define _NOEXCEPT_(x)
844#endif786#endif
845787
846#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
847# if !defined(_LIBCPP_DEBUG)
848# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
849# endif
850# ifdef _LIBCPP_HAS_NO_NOEXCEPT
851# define _NOEXCEPT_DEBUG
852# define _NOEXCEPT_DEBUG_(x)
853# else
854# define _NOEXCEPT_DEBUG noexcept(false)
855# define _NOEXCEPT_DEBUG_(x) noexcept(false)
856# endif
857#else
858# define _NOEXCEPT_DEBUG _NOEXCEPT
859# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
860#endif
861
862#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS788#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
863typedef unsigned short char16_t;789typedef unsigned short char16_t;
864typedef unsigned int char32_t;790typedef unsigned int char32_t;
...@@ -869,30 +795,11 @@ typedef unsigned int char32_t;...@@ -869,30 +795,11 @@ typedef unsigned int char32_t;
869#endif795#endif
870796
871#ifdef _LIBCPP_CXX03_LANG797#ifdef _LIBCPP_CXX03_LANG
872# if __has_extension(c_static_assert)798# define static_assert(...) _Static_assert(__VA_ARGS__)
873# define static_assert(__b, __m) _Static_assert(__b, __m)799# define decltype(...) __decltype(__VA_ARGS__)
874# else
875extern "C++" {
876template <bool> struct __static_assert_test;
877template <> struct __static_assert_test<true> {};
878template <unsigned> struct __static_assert_check {};
879}
880# define static_assert(__b, __m) \
881 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
882 _LIBCPP_CONCAT(__t, __LINE__)
883# endif // __has_extension(c_static_assert)
884#endif // _LIBCPP_CXX03_LANG800#endif // _LIBCPP_CXX03_LANG
885801
886#ifdef _LIBCPP_HAS_NO_DECLTYPE802#ifdef _LIBCPP_CXX03_LANG
887// GCC 4.6 provides __decltype in all standard modes.
888# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
889# define decltype(__x) __decltype(__x)
890# else
891# define decltype(__x) __typeof__(__x)
892# endif
893#endif
894
895#ifdef _LIBCPP_HAS_NO_CONSTEXPR
896# define _LIBCPP_CONSTEXPR803# define _LIBCPP_CONSTEXPR
897#else804#else
898# define _LIBCPP_CONSTEXPR constexpr805# define _LIBCPP_CONSTEXPR constexpr
...@@ -911,9 +818,9 @@ template <unsigned> struct __static_assert_check {};...@@ -911,9 +818,9 @@ template <unsigned> struct __static_assert_check {};
911#endif818#endif
912819
913#ifdef __GNUC__820#ifdef __GNUC__
914# define _NOALIAS __attribute__((__malloc__))821# define _LIBCPP_NOALIAS __attribute__((__malloc__))
915#else822#else
916# define _NOALIAS823# define _LIBCPP_NOALIAS
917#endif824#endif
918825
919#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \826#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
...@@ -966,10 +873,6 @@ template <unsigned> struct __static_assert_check {};...@@ -966,10 +873,6 @@ template <unsigned> struct __static_assert_check {};
966#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;873#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
967#endif874#endif
968875
969#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
970#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
971#endif
972
973#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \876#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
974 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)877 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
975#define _LIBCPP_LOCALE__L_EXTENSIONS 1878#define _LIBCPP_LOCALE__L_EXTENSIONS 1
...@@ -990,13 +893,10 @@ template <unsigned> struct __static_assert_check {};...@@ -990,13 +893,10 @@ template <unsigned> struct __static_assert_check {};
990// for align_val_t were added in 19.12, aka VS 2017 version 15.3.893// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
991#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912894#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
992# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION895# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
993#elif defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)896#elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
994# define _LIBCPP_DEFER_NEW_TO_VCRUNTIME897 // We're deferring to Microsoft's STL to provide aligned new et al. We don't
995# if !defined(__cpp_aligned_new)898 // have it unless the language feature test macro is defined.
996 // We're defering to Microsoft's STL to provide aligned new et al. We don't899# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
997 // have it unless the language feature test macro is defined.
998# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
999# endif
1000#endif900#endif
1001901
1002#if defined(__APPLE__)902#if defined(__APPLE__)
...@@ -1025,8 +925,10 @@ template <unsigned> struct __static_assert_check {};...@@ -1025,8 +925,10 @@ template <unsigned> struct __static_assert_check {};
1025#endif925#endif
1026926
1027// Deprecation macros.927// Deprecation macros.
1028// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.928//
1029#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)929// Deprecations warnings are always enabled, except when users explicitly opt-out
930// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
931#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
1030# if __has_attribute(deprecated)932# if __has_attribute(deprecated)
1031# define _LIBCPP_DEPRECATED __attribute__ ((deprecated))933# define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
1032# elif _LIBCPP_STD_VER > 11934# elif _LIBCPP_STD_VER > 11
...@@ -1128,6 +1030,12 @@ template <unsigned> struct __static_assert_check {};...@@ -1128,6 +1030,12 @@ template <unsigned> struct __static_assert_check {};
1128#endif1030#endif
1129#endif1031#endif
11301032
1033#if __has_attribute(no_destroy)
1034# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
1035#else
1036# define _LIBCPP_NO_DESTROY
1037#endif
1038
1131#ifndef _LIBCPP_HAS_NO_ASAN1039#ifndef _LIBCPP_HAS_NO_ASAN
1132_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(1040_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1133 const void *, const void *, const void *, const void *);1041 const void *, const void *, const void *, const void *);
...@@ -1158,6 +1066,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1158,6 +1066,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1158 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)1066 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1159# if defined(__FreeBSD__) || \1067# if defined(__FreeBSD__) || \
1160 defined(__Fuchsia__) || \1068 defined(__Fuchsia__) || \
1069 defined(__wasi__) || \
1161 defined(__NetBSD__) || \1070 defined(__NetBSD__) || \
1162 defined(__linux__) || \1071 defined(__linux__) || \
1163 defined(__GNU__) || \1072 defined(__GNU__) || \
...@@ -1188,6 +1097,23 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1188,6 +1097,23 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1188 _LIBCPP_HAS_NO_THREADS is defined.1097 _LIBCPP_HAS_NO_THREADS is defined.
1189#endif1098#endif
11901099
1100// The Apple, glibc, and Bionic implementation of pthreads implements
1101// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
1102// mutexes have no destroy mechanism.
1103// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
1104// speaking to their respective stakeholders.
1105#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
1106 || defined(_LIBCPP_HAS_THREAD_API_WIN32)
1107# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
1108#endif
1109
1110// Destroying a condvar is a nop on Windows.
1111// TODO(EricWF): This is potentially true for some pthread implementations
1112// as well.
1113#if defined(_LIBCPP_HAS_THREAD_API_WIN32)
1114# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
1115#endif
1116
1191// Systems that use capability-based security (FreeBSD with Capsicum,1117// Systems that use capability-based security (FreeBSD with Capsicum,
1192// Nuxi CloudABI) may only provide local filesystem access (using *at()).1118// Nuxi CloudABI) may only provide local filesystem access (using *at()).
1193// Functions like open(), rename(), unlink() and stat() should not be1119// Functions like open(), rename(), unlink() and stat() should not be
...@@ -1204,7 +1130,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1204,7 +1130,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1204#endif1130#endif
12051131
1206#if defined(__BIONIC__) || defined(__CloudABI__) || \1132#if defined(__BIONIC__) || defined(__CloudABI__) || \
1207 defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)1133 defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1208#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE1134#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1209#endif1135#endif
12101136
...@@ -1216,13 +1142,22 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1216,13 +1142,22 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
12161142
1217#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)1143#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1218# define _LIBCPP_HAS_C_ATOMIC_IMP1144# define _LIBCPP_HAS_C_ATOMIC_IMP
1219#elif _GNUC_VER > 4071145#elif defined(_LIBCPP_COMPILER_GCC)
1220# define _LIBCPP_HAS_GCC_ATOMIC_IMP1146# define _LIBCPP_HAS_GCC_ATOMIC_IMP
1221#endif1147#endif
12221148
1223#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \1149#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
1150 !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
1151 !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
1224 || defined(_LIBCPP_HAS_NO_THREADS)1152 || defined(_LIBCPP_HAS_NO_THREADS)
1225#define _LIBCPP_HAS_NO_ATOMIC_HEADER1153# define _LIBCPP_HAS_NO_ATOMIC_HEADER
1154#else
1155# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
1156# define _LIBCPP_ATOMIC_FLAG_TYPE bool
1157# endif
1158# ifdef _LIBCPP_FREESTANDING
1159# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1160# endif
1226#endif1161#endif
12271162
1228#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK1163#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
...@@ -1250,6 +1185,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1250,6 +1185,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1250#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF1185#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1251#endif1186#endif
12521187
1188#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900
1189#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
1190#endif
1191
1253#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)1192#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1254# if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)1193# if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1255# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS1194# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
...@@ -1277,6 +1216,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1277,6 +1216,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1277# define _LIBCPP_FALLTHROUGH() ((void)0)1216# define _LIBCPP_FALLTHROUGH() ((void)0)
1278#endif1217#endif
12791218
1219#if __has_attribute(__nodebug__)
1220#define _LIBCPP_NODEBUG __attribute__((__nodebug__))
1221#else
1222#define _LIBCPP_NODEBUG
1223#endif
1224
1225#ifndef _LIBCPP_NODEBUG_TYPE
1226#if __has_attribute(__nodebug__) && \
1227 (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
1228#define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
1229#else
1230#define _LIBCPP_NODEBUG_TYPE
1231#endif
1232#endif // !defined(_LIBCPP_NODEBUG_TYPE)
1233
1280#if defined(_LIBCPP_ABI_MICROSOFT) && \1234#if defined(_LIBCPP_ABI_MICROSOFT) && \
1281 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))1235 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
1282# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)1236# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
...@@ -1312,7 +1266,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1312,7 +1266,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1312#if !defined(_LIBCPP_BUILDING_LIBRARY) && \1266#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
1313 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \1267 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
1314 __has_feature(attribute_availability_with_strict) && \1268 __has_feature(attribute_availability_with_strict) && \
1315 __has_feature(attribute_availability_in_templates)1269 __has_feature(attribute_availability_in_templates) && \
1270 __has_extension(pragma_clang_attribute_external_declaration)
1316# ifdef __APPLE__1271# ifdef __APPLE__
1317# define _LIBCPP_USE_AVAILABILITY_APPLE1272# define _LIBCPP_USE_AVAILABILITY_APPLE
1318# endif1273# endif
...@@ -1355,6 +1310,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1355,6 +1310,21 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1355# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \1310# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
1356 __attribute__((availability(macosx,strict,introduced=10.9))) \1311 __attribute__((availability(macosx,strict,introduced=10.9))) \
1357 __attribute__((availability(ios,strict,introduced=7.0)))1312 __attribute__((availability(ios,strict,introduced=7.0)))
1313# define _LIBCPP_AVAILABILITY_FILESYSTEM \
1314 __attribute__((availability(macosx,strict,introduced=10.15))) \
1315 __attribute__((availability(ios,strict,introduced=13.0))) \
1316 __attribute__((availability(tvos,strict,introduced=13.0))) \
1317 __attribute__((availability(watchos,strict,introduced=6.0)))
1318# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
1319 _Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
1320 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
1321 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
1322 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
1323# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
1324 _Pragma("clang attribute pop") \
1325 _Pragma("clang attribute pop") \
1326 _Pragma("clang attribute pop") \
1327 _Pragma("clang attribute pop")
1358#else1328#else
1359# define _LIBCPP_AVAILABILITY_SHARED_MUTEX1329# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
1360# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS1330# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
...@@ -1366,6 +1336,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(...@@ -1366,6 +1336,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1366# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE1336# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
1367# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY1337# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
1368# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR1338# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1339# define _LIBCPP_AVAILABILITY_FILESYSTEM
1340# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
1341# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
1369#endif1342#endif
13701343
1371// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.1344// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
lib/libcxx/include/__config_site.in+4-4
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1//===----------------------------------------------------------------------===//1//===----------------------------------------------------------------------===//
2//2//
3// The LLVM Compiler Infrastructure3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4//4// See https://llvm.org/LICENSE.txt for license information.
5// This file is dual licensed under the MIT and the University of Illinois Open5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6// Source Licenses. See LICENSE.TXT for details.
7//6//
8//===----------------------------------------------------------------------===//7//===----------------------------------------------------------------------===//
98
...@@ -28,6 +27,7 @@...@@ -28,6 +27,7 @@
28#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL27#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
29#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS28#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
30#cmakedefine _LIBCPP_NO_VCRUNTIME29#cmakedefine _LIBCPP_NO_VCRUNTIME
30#cmakedefine01 _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
31#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@31#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
3232
33@_LIBCPP_ABI_DEFINES@33@_LIBCPP_ABI_DEFINES@
lib/libcxx/include/__debug+16-39
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- __debug ----------------------------------===//2//===--------------------------- __debug ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -12,6 +11,7 @@...@@ -12,6 +11,7 @@
12#define _LIBCPP_DEBUG_H11#define _LIBCPP_DEBUG_H
1312
14#include <__config>13#include <__config>
14#include <iosfwd>
1515
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17#pragma GCC system_header17#pragma GCC system_header
...@@ -25,7 +25,6 @@...@@ -25,7 +25,6 @@
25# include <cstdlib>25# include <cstdlib>
26# include <cstdio>26# include <cstdio>
27# include <cstddef>27# include <cstddef>
28# include <exception>
29#endif28#endif
3029
31#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)30#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)
...@@ -50,10 +49,6 @@...@@ -50,10 +49,6 @@
50#define _LIBCPP_DEBUG_MODE(...) ((void)0)49#define _LIBCPP_DEBUG_MODE(...) ((void)0)
51#endif50#endif
5251
53#if _LIBCPP_DEBUG_LEVEL < 1
54class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception;
55#endif
56
57_LIBCPP_BEGIN_NAMESPACE_STD52_LIBCPP_BEGIN_NAMESPACE_STD
5853
59struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {54struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
...@@ -63,6 +58,9 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {...@@ -63,6 +58,9 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
63 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR58 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
64 __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)59 __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
65 : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}60 : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
61
62 _LIBCPP_FUNC_VIS std::string what() const;
63
66 const char* __file_;64 const char* __file_;
67 int __line_;65 int __line_;
68 const char* __pred_;66 const char* __pred_;
...@@ -80,38 +78,11 @@ extern _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_function_type __libcpp_debug_fun...@@ -80,38 +78,11 @@ extern _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_function_type __libcpp_debug_fun
80_LIBCPP_NORETURN _LIBCPP_FUNC_VIS78_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
81void __libcpp_abort_debug_function(__libcpp_debug_info const&);79void __libcpp_abort_debug_function(__libcpp_debug_info const&);
8280
83/// __libcpp_throw_debug_function - A debug handler that throws
84/// an instance of __libcpp_debug_exception when called.
85 _LIBCPP_NORETURN _LIBCPP_FUNC_VIS
86void __libcpp_throw_debug_function(__libcpp_debug_info const&);
87
88/// __libcpp_set_debug_function - Set the debug handler to the specified81/// __libcpp_set_debug_function - Set the debug handler to the specified
89/// function.82/// function.
90_LIBCPP_FUNC_VIS83_LIBCPP_FUNC_VIS
91bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);84bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
9285
93// Setup the throwing debug handler during dynamic initialization.
94#if _LIBCPP_DEBUG_LEVEL >= 1 && defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
95# if defined(_LIBCPP_NO_EXCEPTIONS)
96# error _LIBCPP_DEBUG_USE_EXCEPTIONS cannot be used when exceptions are disabled.
97# endif
98static bool __init_dummy = __libcpp_set_debug_function(__libcpp_throw_debug_function);
99#endif
100
101#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
102class _LIBCPP_EXCEPTION_ABI __libcpp_debug_exception : public exception {
103public:
104 __libcpp_debug_exception() _NOEXCEPT;
105 explicit __libcpp_debug_exception(__libcpp_debug_info const& __i);
106 __libcpp_debug_exception(__libcpp_debug_exception const&);
107 ~__libcpp_debug_exception() _NOEXCEPT;
108 const char* what() const _NOEXCEPT;
109private:
110 struct __libcpp_debug_exception_imp;
111 __libcpp_debug_exception_imp *__imp_;
112};
113#endif
114
115#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)86#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
11687
117struct _LIBCPP_TYPE_VIS __c_node;88struct _LIBCPP_TYPE_VIS __c_node;
...@@ -251,16 +222,22 @@ public:...@@ -251,16 +222,22 @@ public:
251 __db_c_const_iterator __c_end() const;222 __db_c_const_iterator __c_end() const;
252 __db_i_const_iterator __i_end() const;223 __db_i_const_iterator __i_end() const;
253224
225 typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*);
226
227 template <class _Cont>
228 _LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
229 return ::new(__mem) _C_node<_Cont>(__c, __next);
230 }
231
254 template <class _Cont>232 template <class _Cont>
255 _LIBCPP_INLINE_VISIBILITY233 _LIBCPP_INLINE_VISIBILITY
256 void __insert_c(_Cont* __c)234 void __insert_c(_Cont* __c)
257 {235 {
258 __c_node* __n = __insert_c(static_cast<void*>(__c));236 __insert_c(static_cast<void*>(__c), &__create_C_node<_Cont>);
259 ::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
260 }237 }
261238
262 void __insert_i(void* __i);239 void __insert_i(void* __i);
263 __c_node* __insert_c(void* __c);240 void __insert_c(void* __c, _InsertConstruct* __fn);
264 void __erase_c(void* __c);241 void __erase_c(void* __c);
265242
266 void __insert_ic(void* __i, const void* __c);243 void __insert_ic(void* __i, const void* __c);
lib/libcxx/include/__errc+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- __errc ----------------------------------===//2//===---------------------------- __errc ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__functional_03+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__functional_base+8-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -126,7 +125,7 @@ struct __weak_result_type_imp // bool is true...@@ -126,7 +125,7 @@ struct __weak_result_type_imp // bool is true
126 : public __maybe_derive_from_unary_function<_Tp>,125 : public __maybe_derive_from_unary_function<_Tp>,
127 public __maybe_derive_from_binary_function<_Tp>126 public __maybe_derive_from_binary_function<_Tp>
128{127{
129 typedef typename _Tp::result_type result_type;128 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::result_type result_type;
130};129};
131130
132template <class _Tp>131template <class _Tp>
...@@ -147,19 +146,19 @@ struct __weak_result_type...@@ -147,19 +146,19 @@ struct __weak_result_type
147template <class _Rp>146template <class _Rp>
148struct __weak_result_type<_Rp ()>147struct __weak_result_type<_Rp ()>
149{148{
150 typedef _Rp result_type;149 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
151};150};
152151
153template <class _Rp>152template <class _Rp>
154struct __weak_result_type<_Rp (&)()>153struct __weak_result_type<_Rp (&)()>
155{154{
156 typedef _Rp result_type;155 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
157};156};
158157
159template <class _Rp>158template <class _Rp>
160struct __weak_result_type<_Rp (*)()>159struct __weak_result_type<_Rp (*)()>
161{160{
162 typedef _Rp result_type;161 typedef _LIBCPP_NODEBUG_TYPE _Rp result_type;
163};162};
164163
165// 1 argument case164// 1 argument case
...@@ -611,7 +610,7 @@ _LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Allo...@@ -611,7 +610,7 @@ _LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Allo
611template <class _Tp, class _Alloc, class ..._Args>610template <class _Tp, class _Alloc, class ..._Args>
612struct __uses_alloc_ctor_imp611struct __uses_alloc_ctor_imp
613{612{
614 typedef typename __uncvref<_Alloc>::type _RawAlloc;613 typedef _LIBCPP_NODEBUG_TYPE typename __uncvref<_Alloc>::type _RawAlloc;
615 static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;614 static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
616 static const bool __ic =615 static const bool __ic =
617 is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;616 is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
lib/libcxx/include/__functional_base_03+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__hash_table+15-15
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -123,7 +122,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -123,7 +122,7 @@ inline _LIBCPP_INLINE_VISIBILITY
123size_t122size_t
124__next_hash_pow2(size_t __n)123__next_hash_pow2(size_t __n)
125{124{
126 return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));125 return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
127}126}
128127
129128
...@@ -876,9 +875,9 @@ struct __enforce_unordered_container_requirements {...@@ -876,9 +875,9 @@ struct __enforce_unordered_container_requirements {
876template <class _Key, class _Hash, class _Equal>875template <class _Key, class _Hash, class _Equal>
877#ifndef _LIBCPP_CXX03_LANG876#ifndef _LIBCPP_CXX03_LANG
878 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,877 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value,
879 "the specified comparator type does not provide a const call operator")878 "the specified comparator type does not provide a viable const call operator")
880 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,879 _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value,
881 "the specified hash functor does not provide a const call operator")880 "the specified hash functor does not provide a viable const call operator")
882#endif881#endif
883typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type882typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
884__diagnose_unordered_container_requirements(int);883__diagnose_unordered_container_requirements(int);
...@@ -1261,7 +1260,7 @@ public:...@@ -1261,7 +1260,7 @@ public:
12611260
1262 void swap(__hash_table& __u)1261 void swap(__hash_table& __u)
1263#if _LIBCPP_STD_VER <= 111262#if _LIBCPP_STD_VER <= 11
1264 _NOEXCEPT_DEBUG_(1263 _NOEXCEPT_(
1265 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value1264 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
1266 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value1265 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
1267 || __is_nothrow_swappable<__pointer_allocator>::value)1266 || __is_nothrow_swappable<__pointer_allocator>::value)
...@@ -1269,7 +1268,7 @@ public:...@@ -1269,7 +1268,7 @@ public:
1269 || __is_nothrow_swappable<__node_allocator>::value)1268 || __is_nothrow_swappable<__node_allocator>::value)
1270 );1269 );
1271#else1270#else
1272 _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);1271 _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
1273#endif1272#endif
12741273
1275 _LIBCPP_INLINE_VISIBILITY1274 _LIBCPP_INLINE_VISIBILITY
...@@ -2249,7 +2248,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(...@@ -2249,7 +2248,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
2249 return _InsertReturnType{end(), false, _NodeHandle()};2248 return _InsertReturnType{end(), false, _NodeHandle()};
2250 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);2249 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
2251 if (__result.second)2250 if (__result.second)
2252 __nh.__release();2251 __nh.__release_ptr();
2253 return _InsertReturnType{__result.first, __result.second, _VSTD::move(__nh)};2252 return _InsertReturnType{__result.first, __result.second, _VSTD::move(__nh)};
2254}2253}
22552254
...@@ -2264,7 +2263,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(...@@ -2264,7 +2263,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(
2264 return end();2263 return end();
2265 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);2264 pair<iterator, bool> __result = __node_insert_unique(__nh.__ptr_);
2266 if (__result.second)2265 if (__result.second)
2267 __nh.__release();2266 __nh.__release_ptr();
2268 return __result.first;2267 return __result.first;
2269}2268}
22702269
...@@ -2328,7 +2327,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(...@@ -2328,7 +2327,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
2328 if (__nh.empty())2327 if (__nh.empty())
2329 return end();2328 return end();
2330 iterator __result = __node_insert_multi(__nh.__ptr_);2329 iterator __result = __node_insert_multi(__nh.__ptr_);
2331 __nh.__release();2330 __nh.__release_ptr();
2332 return __result;2331 return __result;
2333}2332}
23342333
...@@ -2342,7 +2341,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(...@@ -2342,7 +2341,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(
2342 if (__nh.empty())2341 if (__nh.empty())
2343 return end();2342 return end();
2344 iterator __result = __node_insert_multi(__hint, __nh.__ptr_);2343 iterator __result = __node_insert_multi(__hint, __nh.__ptr_);
2345 __nh.__release();2344 __nh.__release_ptr();
2346 return __result;2345 return __result;
2347}2346}
23482347
...@@ -2372,6 +2371,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(...@@ -2372,6 +2371,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(
2372template <class _Tp, class _Hash, class _Equal, class _Alloc>2371template <class _Tp, class _Hash, class _Equal, class _Alloc>
2373void2372void
2374__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)2373__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
2374_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2375{2375{
2376 if (__n == 1)2376 if (__n == 1)
2377 __n = 2;2377 __n = 2;
...@@ -2807,7 +2807,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>...@@ -2807,7 +2807,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
2807void2807void
2808__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)2808__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
2809#if _LIBCPP_STD_VER <= 112809#if _LIBCPP_STD_VER <= 11
2810 _NOEXCEPT_DEBUG_(2810 _NOEXCEPT_(
2811 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value2811 __is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
2812 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value2812 && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
2813 || __is_nothrow_swappable<__pointer_allocator>::value)2813 || __is_nothrow_swappable<__pointer_allocator>::value)
...@@ -2815,7 +2815,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)...@@ -2815,7 +2815,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
2815 || __is_nothrow_swappable<__node_allocator>::value)2815 || __is_nothrow_swappable<__node_allocator>::value)
2816 )2816 )
2817#else2817#else
2818 _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)2818 _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
2819#endif2819#endif
2820{2820{
2821 _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value ||2821 _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value ||
lib/libcxx/include/__libcpp_version+1-1
...@@ -1 +1 @@...@@ -1 +1 @@
1800019000
lib/libcxx/include/__locale+55-25
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -20,6 +19,7 @@...@@ -20,6 +19,7 @@
20#include <cctype>19#include <cctype>
21#include <locale.h>20#include <locale.h>
22#if defined(_LIBCPP_MSVCRT_LIKE)21#if defined(_LIBCPP_MSVCRT_LIKE)
22# include <cstring>
23# include <support/win32/locale_win32.h>23# include <support/win32/locale_win32.h>
24#elif defined(_AIX)24#elif defined(_AIX)
25# include <support/ibm/xlocale.h>25# include <support/ibm/xlocale.h>
...@@ -35,6 +35,9 @@...@@ -35,6 +35,9 @@
35# include <xlocale.h>35# include <xlocale.h>
36#elif defined(__Fuchsia__)36#elif defined(__Fuchsia__)
37# include <support/fuchsia/xlocale.h>37# include <support/fuchsia/xlocale.h>
38#elif defined(__wasi__)
39// WASI libc uses musl's locales support.
40# include <support/musl/xlocale.h>
38#elif defined(_LIBCPP_HAS_MUSL_LIBC)41#elif defined(_LIBCPP_HAS_MUSL_LIBC)
39# include <support/musl/xlocale.h>42# include <support/musl/xlocale.h>
40#endif43#endif
...@@ -64,28 +67,41 @@ private:...@@ -64,28 +67,41 @@ private:
64#elif defined(_LIBCPP_MSVCRT_LIKE)67#elif defined(_LIBCPP_MSVCRT_LIKE)
65struct __libcpp_locale_guard {68struct __libcpp_locale_guard {
66 __libcpp_locale_guard(locale_t __l) :69 __libcpp_locale_guard(locale_t __l) :
67 __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)),70 __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
68 __locale_collate(setlocale(LC_COLLATE, __l.__get_locale())),71 // Setting the locale can be expensive even when the locale given is
69 __locale_ctype(setlocale(LC_CTYPE, __l.__get_locale())),72 // already the current locale, so do an explicit check to see if the
70 __locale_monetary(setlocale(LC_MONETARY, __l.__get_locale())),73 // current locale is already the one we want.
71 __locale_numeric(setlocale(LC_NUMERIC, __l.__get_locale())),74 const char* __lc = __setlocale(nullptr);
72 __locale_time(setlocale(LC_TIME, __l.__get_locale()))75 // If every category is the same, the locale string will simply be the
73 // LC_MESSAGES is not supported on Windows.76 // locale name, otherwise it will be a semicolon-separated string listing
74 {}77 // each category. In the second case, we know at least one category won't
78 // be what we want, so we only have to check the first case.
79 if (strcmp(__l.__get_locale(), __lc) != 0) {
80 __locale_all = _strdup(__lc);
81 if (__locale_all == nullptr)
82 __throw_bad_alloc();
83 __setlocale(__l.__get_locale());
84 }
85 }
75 ~__libcpp_locale_guard() {86 ~__libcpp_locale_guard() {
76 setlocale(LC_COLLATE, __locale_collate);87 // The CRT documentation doesn't explicitly say, but setlocale() does the
77 setlocale(LC_CTYPE, __locale_ctype);88 // right thing when given a semicolon-separated list of locale settings
78 setlocale(LC_MONETARY, __locale_monetary);89 // for the different categories in the same format as returned by
79 setlocale(LC_NUMERIC, __locale_numeric);90 // setlocale(LC_ALL, nullptr).
80 setlocale(LC_TIME, __locale_time);91 if (__locale_all != nullptr) {
81 _configthreadlocale(__status);92 __setlocale(__locale_all);
93 free(__locale_all);
94 }
95 _configthreadlocale(__status);
96 }
97 static const char* __setlocale(const char* __locale) {
98 const char* __new_locale = setlocale(LC_ALL, __locale);
99 if (__new_locale == nullptr)
100 __throw_bad_alloc();
101 return __new_locale;
82 }102 }
83 int __status;103 int __status;
84 char* __locale_collate;104 char* __locale_all = nullptr;
85 char* __locale_ctype;
86 char* __locale_monetary;
87 char* __locale_numeric;
88 char* __locale_time;
89};105};
90#endif106#endif
91107
...@@ -255,7 +271,10 @@ public:...@@ -255,7 +271,10 @@ public:
255 return do_compare(__lo1, __hi1, __lo2, __hi2);271 return do_compare(__lo1, __hi1, __lo2, __hi2);
256 }272 }
257273
274 // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
275 // around a dllimport bug that expects an external instantiation.
258 _LIBCPP_INLINE_VISIBILITY276 _LIBCPP_INLINE_VISIBILITY
277 _LIBCPP_ALWAYS_INLINE
259 string_type transform(const char_type* __lo, const char_type* __hi) const278 string_type transform(const char_type* __lo, const char_type* __hi) const
260 {279 {
261 return do_transform(__lo, __hi);280 return do_transform(__lo, __hi);
...@@ -389,6 +408,11 @@ public:...@@ -389,6 +408,11 @@ public:
389 static const mask punct = _ISpunct;408 static const mask punct = _ISpunct;
390 static const mask xdigit = _ISxdigit;409 static const mask xdigit = _ISxdigit;
391 static const mask blank = _ISblank;410 static const mask blank = _ISblank;
411#if defined(__mips__)
412 static const mask __regex_word = static_cast<char_class_type>(_ISbit(15));
413#else
414 static const mask __regex_word = 0x80;
415#endif
392#elif defined(_LIBCPP_MSVCRT_LIKE)416#elif defined(_LIBCPP_MSVCRT_LIKE)
393 typedef unsigned short mask;417 typedef unsigned short mask;
394 static const mask space = _SPACE;418 static const mask space = _SPACE;
...@@ -401,6 +425,7 @@ public:...@@ -401,6 +425,7 @@ public:
401 static const mask punct = _PUNCT;425 static const mask punct = _PUNCT;
402 static const mask xdigit = _HEX;426 static const mask xdigit = _HEX;
403 static const mask blank = _BLANK;427 static const mask blank = _BLANK;
428 static const mask __regex_word = 0x80;
404# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT429# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
405#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)430#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
406# ifdef __APPLE__431# ifdef __APPLE__
...@@ -422,8 +447,12 @@ public:...@@ -422,8 +447,12 @@ public:
422447
423# if defined(__NetBSD__)448# if defined(__NetBSD__)
424 static const mask blank = _CTYPE_BL;449 static const mask blank = _CTYPE_BL;
450 // NetBSD defines classes up to 0x2000
451 // see sys/ctype_bits.h, _CTYPE_Q
452 static const mask __regex_word = 0x8000;
425# else453# else
426 static const mask blank = _CTYPE_B;454 static const mask blank = _CTYPE_B;
455 static const mask __regex_word = 0x80;
427# endif456# endif
428#elif defined(__sun__) || defined(_AIX)457#elif defined(__sun__) || defined(_AIX)
429 typedef unsigned int mask;458 typedef unsigned int mask;
...@@ -437,6 +466,7 @@ public:...@@ -437,6 +466,7 @@ public:
437 static const mask punct = _ISPUNCT;466 static const mask punct = _ISPUNCT;
438 static const mask xdigit = _ISXDIGIT;467 static const mask xdigit = _ISXDIGIT;
439 static const mask blank = _ISBLANK;468 static const mask blank = _ISBLANK;
469 static const mask __regex_word = 0x80;
440#elif defined(_NEWLIB_VERSION)470#elif defined(_NEWLIB_VERSION)
441 // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.471 // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
442 typedef char mask;472 typedef char mask;
...@@ -450,6 +480,7 @@ public:...@@ -450,6 +480,7 @@ public:
450 static const mask punct = _P;480 static const mask punct = _P;
451 static const mask xdigit = _X | _N;481 static const mask xdigit = _X | _N;
452 static const mask blank = _B;482 static const mask blank = _B;
483 static const mask __regex_word = 0x80;
453# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT484# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
454# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA485# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
455# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT486# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
...@@ -465,6 +496,7 @@ public:...@@ -465,6 +496,7 @@ public:
465 static const mask punct = 1<<7;496 static const mask punct = 1<<7;
466 static const mask xdigit = 1<<8;497 static const mask xdigit = 1<<8;
467 static const mask blank = 1<<9;498 static const mask blank = 1<<9;
499 static const mask __regex_word = 1<<10;
468#endif500#endif
469 static const mask alnum = alpha | digit;501 static const mask alnum = alpha | digit;
470 static const mask graph = alnum | punct;502 static const mask graph = alnum | punct;
...@@ -1230,8 +1262,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<w...@@ -1230,8 +1262,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<w
1230_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)1262_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
1231_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)1263_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
12321264
1233_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
1234
1235template <size_t _Np>1265template <size_t _Np>
1236struct __narrow_to_utf81266struct __narrow_to_utf8
1237{1267{
lib/libcxx/include/__mutex_base+19-30
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -37,28 +36,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD...@@ -37,28 +36,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
37# endif36# endif
38#endif // _LIBCPP_THREAD_SAFETY_ANNOTATION37#endif // _LIBCPP_THREAD_SAFETY_ANNOTATION
3938
39
40class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex40class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
41{41{
42#ifndef _LIBCPP_CXX03_LANG
43 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;42 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
44#else
45 __libcpp_mutex_t __m_;
46#endif
4743
48public:44public:
49 _LIBCPP_INLINE_VISIBILITY45 _LIBCPP_INLINE_VISIBILITY
50#ifndef _LIBCPP_CXX03_LANG46 _LIBCPP_CONSTEXPR mutex() = default;
51 constexpr mutex() = default;47
48 mutex(const mutex&) = delete;
49 mutex& operator=(const mutex&) = delete;
50
51#if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION)
52 ~mutex() = default;
52#else53#else
53 mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}54 ~mutex() _NOEXCEPT;
54#endif55#endif
55 ~mutex();
5656
57private:
58 mutex(const mutex&);// = delete;
59 mutex& operator=(const mutex&);// = delete;
60
61public:
62 void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability());57 void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability());
63 bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true));58 bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true));
64 void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability());59 void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability());
...@@ -287,26 +282,20 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)...@@ -287,26 +282,20 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
287282
288class _LIBCPP_TYPE_VIS condition_variable283class _LIBCPP_TYPE_VIS condition_variable
289{284{
290#ifndef _LIBCPP_CXX03_LANG
291 __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;285 __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
292#else
293 __libcpp_condvar_t __cv_;
294#endif
295
296public:286public:
297 _LIBCPP_INLINE_VISIBILITY287 _LIBCPP_INLINE_VISIBILITY
298#ifndef _LIBCPP_CXX03_LANG288 _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
299 constexpr condition_variable() _NOEXCEPT = default;289
290#ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
291 ~condition_variable() = default;
300#else292#else
301 condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
302#endif
303 ~condition_variable();293 ~condition_variable();
294#endif
304295
305private:296 condition_variable(const condition_variable&) = delete;
306 condition_variable(const condition_variable&); // = delete;297 condition_variable& operator=(const condition_variable&) = delete;
307 condition_variable& operator=(const condition_variable&); // = delete;
308298
309public:
310 void notify_one() _NOEXCEPT;299 void notify_one() _NOEXCEPT;
311 void notify_all() _NOEXCEPT;300 void notify_all() _NOEXCEPT;
312301
lib/libcxx/include/__node_handle+5-7
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -57,7 +56,7 @@ private:...@@ -57,7 +56,7 @@ private:
57 optional<allocator_type> __alloc_;56 optional<allocator_type> __alloc_;
5857
59 _LIBCPP_INLINE_VISIBILITY58 _LIBCPP_INLINE_VISIBILITY
60 void __release()59 void __release_ptr()
61 {60 {
62 __ptr_ = nullptr;61 __ptr_ = nullptr;
63 __alloc_ = _VSTD::nullopt;62 __alloc_ = _VSTD::nullopt;
...@@ -194,8 +193,7 @@ using __map_node_handle =...@@ -194,8 +193,7 @@ using __map_node_handle =
194 __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;193 __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
195194
196template <class _Iterator, class _NodeType>195template <class _Iterator, class _NodeType>
197_LIBCPP_TEMPLATE_VIS196struct _LIBCPP_TEMPLATE_VIS __insert_return_type
198struct __insert_return_type
199{197{
200 _Iterator position;198 _Iterator position;
201 bool inserted;199 bool inserted;
lib/libcxx/include/__nullptr+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- __nullptr --------------------------------===//2//===--------------------------- __nullptr --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__sso_allocator+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__std_stream+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__string+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- __string ----------------------------------===//2//===-------------------------- __string ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/__threading_support+10-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -23,6 +22,8 @@...@@ -23,6 +22,8 @@
23# include <__external_threading>22# include <__external_threading>
24#elif !defined(_LIBCPP_HAS_NO_THREADS)23#elif !defined(_LIBCPP_HAS_NO_THREADS)
2524
25typedef ::timespec __libcpp_timespec_t;
26
26#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)27#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
27# include <pthread.h>28# include <pthread.h>
28# include <sched.h>29# include <sched.h>
...@@ -149,7 +150,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);...@@ -149,7 +150,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
149150
150_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS151_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
151int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,152int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
152 timespec *__ts);153 __libcpp_timespec_t *__ts);
153154
154_LIBCPP_THREAD_ABI_VISIBILITY155_LIBCPP_THREAD_ABI_VISIBILITY
155int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);156int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
...@@ -157,7 +158,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);...@@ -157,7 +158,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
157// Execute once158// Execute once
158_LIBCPP_THREAD_ABI_VISIBILITY159_LIBCPP_THREAD_ABI_VISIBILITY
159int __libcpp_execute_once(__libcpp_exec_once_flag *flag,160int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
160 void (*init_routine)(void));161 void (*init_routine)());
161162
162// Thread id163// Thread id
163_LIBCPP_THREAD_ABI_VISIBILITY164_LIBCPP_THREAD_ABI_VISIBILITY
...@@ -288,7 +289,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)...@@ -288,7 +289,7 @@ int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
288}289}
289290
290int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,291int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
291 timespec *__ts)292 __libcpp_timespec_t *__ts)
292{293{
293 return pthread_cond_timedwait(__cv, __m, __ts);294 return pthread_cond_timedwait(__cv, __m, __ts);
294}295}
...@@ -300,7 +301,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)...@@ -300,7 +301,7 @@ int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
300301
301// Execute once302// Execute once
302int __libcpp_execute_once(__libcpp_exec_once_flag *flag,303int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
303 void (*init_routine)(void)) {304 void (*init_routine)()) {
304 return pthread_once(flag, init_routine);305 return pthread_once(flag, init_routine);
305}306}
306307
...@@ -357,7 +358,7 @@ void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)...@@ -357,7 +358,7 @@ void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
357{358{
358 using namespace chrono;359 using namespace chrono;
359 seconds __s = duration_cast<seconds>(__ns);360 seconds __s = duration_cast<seconds>(__ns);
360 timespec __ts;361 __libcpp_timespec_t __ts;
361 typedef decltype(__ts.tv_sec) ts_sec;362 typedef decltype(__ts.tv_sec) ts_sec;
362 _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();363 _LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
363364
lib/libcxx/include/__tree+91-127
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -27,6 +26,13 @@ _LIBCPP_PUSH_MACROS...@@ -27,6 +26,13 @@ _LIBCPP_PUSH_MACROS
2726
28_LIBCPP_BEGIN_NAMESPACE_STD27_LIBCPP_BEGIN_NAMESPACE_STD
2928
29#if defined(__GNUC__) && !defined(__clang__) // gcc.gnu.org/PR37804
30template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS map;
31template <class, class, class, class> class _LIBCPP_TEMPLATE_VIS multimap;
32template <class, class, class> class _LIBCPP_TEMPLATE_VIS set;
33template <class, class, class> class _LIBCPP_TEMPLATE_VIS multiset;
34#endif
35
30template <class _Tp, class _Compare, class _Allocator> class __tree;36template <class _Tp, class _Compare, class _Allocator> class __tree;
31template <class _Tp, class _NodePtr, class _DiffType>37template <class _Tp, class _NodePtr, class _DiffType>
32 class _LIBCPP_TEMPLATE_VIS __tree_iterator;38 class _LIBCPP_TEMPLATE_VIS __tree_iterator;
...@@ -965,7 +971,7 @@ private:...@@ -965,7 +971,7 @@ private:
965template<class _Tp, class _Compare>971template<class _Tp, class _Compare>
966#ifndef _LIBCPP_CXX03_LANG972#ifndef _LIBCPP_CXX03_LANG
967 _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,973 _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
968 "the specified comparator type does not provide a const call operator")974 "the specified comparator type does not provide a viable const call operator")
969#endif975#endif
970int __diagnose_non_const_comparator();976int __diagnose_non_const_comparator();
971977
...@@ -1090,8 +1096,8 @@ public:...@@ -1090,8 +1096,8 @@ public:
1090 __tree(const value_compare& __comp, const allocator_type& __a);1096 __tree(const value_compare& __comp, const allocator_type& __a);
1091 __tree(const __tree& __t);1097 __tree(const __tree& __t);
1092 __tree& operator=(const __tree& __t);1098 __tree& operator=(const __tree& __t);
1093 template <class _InputIterator>1099 template <class _ForwardIterator>
1094 void __assign_unique(_InputIterator __first, _InputIterator __last);1100 void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
1095 template <class _InputIterator>1101 template <class _InputIterator>
1096 void __assign_multi(_InputIterator __first, _InputIterator __last);1102 void __assign_multi(_InputIterator __first, _InputIterator __last);
1097#ifndef _LIBCPP_CXX03_LANG1103#ifndef _LIBCPP_CXX03_LANG
...@@ -1326,10 +1332,7 @@ public:...@@ -1326,10 +1332,7 @@ public:
1326#endif // !_LIBCPP_CXX03_LANG1332#endif // !_LIBCPP_CXX03_LANG
13271333
1328 _LIBCPP_INLINE_VISIBILITY1334 _LIBCPP_INLINE_VISIBILITY
1329 pair<iterator, bool> __node_insert_unique(__node_pointer __nd);1335 pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
1330 _LIBCPP_INLINE_VISIBILITY
1331 iterator __node_insert_unique(const_iterator __p,
1332 __node_pointer __nd);
13331336
1334 _LIBCPP_INLINE_VISIBILITY1337 _LIBCPP_INLINE_VISIBILITY
1335 iterator __node_insert_multi(__node_pointer __nd);1338 iterator __node_insert_multi(__node_pointer __nd);
...@@ -1509,8 +1512,50 @@ private:...@@ -1509,8 +1512,50 @@ private:
1509 _LIBCPP_INLINE_VISIBILITY1512 _LIBCPP_INLINE_VISIBILITY
1510 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}1513 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
15111514
1512 __node_pointer __detach();1515 struct _DetachedTreeCache {
1513 static __node_pointer __detach(__node_pointer);1516 _LIBCPP_INLINE_VISIBILITY
1517 explicit _DetachedTreeCache(__tree *__t) _NOEXCEPT : __t_(__t),
1518 __cache_root_(__detach_from_tree(__t)) {
1519 __advance();
1520 }
1521
1522 _LIBCPP_INLINE_VISIBILITY
1523 __node_pointer __get() const _NOEXCEPT {
1524 return __cache_elem_;
1525 }
1526
1527 _LIBCPP_INLINE_VISIBILITY
1528 void __advance() _NOEXCEPT {
1529 __cache_elem_ = __cache_root_;
1530 if (__cache_root_) {
1531 __cache_root_ = __detach_next(__cache_root_);
1532 }
1533 }
1534
1535 _LIBCPP_INLINE_VISIBILITY
1536 ~_DetachedTreeCache() {
1537 __t_->destroy(__cache_elem_);
1538 if (__cache_root_) {
1539 while (__cache_root_->__parent_ != nullptr)
1540 __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_);
1541 __t_->destroy(__cache_root_);
1542 }
1543 }
1544
1545 _DetachedTreeCache(_DetachedTreeCache const&) = delete;
1546 _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete;
1547
1548 private:
1549 _LIBCPP_INLINE_VISIBILITY
1550 static __node_pointer __detach_from_tree(__tree *__t) _NOEXCEPT;
1551 _LIBCPP_INLINE_VISIBILITY
1552 static __node_pointer __detach_next(__node_pointer) _NOEXCEPT;
1553
1554 __tree *__t_;
1555 __node_pointer __cache_root_;
1556 __node_pointer __cache_elem_;
1557 };
1558
15141559
1515 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;1560 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
1516 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;1561 template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
...@@ -1548,13 +1593,13 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,...@@ -1548,13 +1593,13 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
1548// Precondition: size() != 01593// Precondition: size() != 0
1549template <class _Tp, class _Compare, class _Allocator>1594template <class _Tp, class _Compare, class _Allocator>
1550typename __tree<_Tp, _Compare, _Allocator>::__node_pointer1595typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1551__tree<_Tp, _Compare, _Allocator>::__detach()1596__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) _NOEXCEPT
1552{1597{
1553 __node_pointer __cache = static_cast<__node_pointer>(__begin_node());1598 __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node());
1554 __begin_node() = __end_node();1599 __t->__begin_node() = __t->__end_node();
1555 __end_node()->__left_->__parent_ = nullptr;1600 __t->__end_node()->__left_->__parent_ = nullptr;
1556 __end_node()->__left_ = nullptr;1601 __t->__end_node()->__left_ = nullptr;
1557 size() = 0;1602 __t->size() = 0;
1558 // __cache->__left_ == nullptr1603 // __cache->__left_ == nullptr
1559 if (__cache->__right_ != nullptr)1604 if (__cache->__right_ != nullptr)
1560 __cache = static_cast<__node_pointer>(__cache->__right_);1605 __cache = static_cast<__node_pointer>(__cache->__right_);
...@@ -1569,7 +1614,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach()...@@ -1569,7 +1614,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach()
1569// This is no longer a red-black tree1614// This is no longer a red-black tree
1570template <class _Tp, class _Compare, class _Allocator>1615template <class _Tp, class _Compare, class _Allocator>
1571typename __tree<_Tp, _Compare, _Allocator>::__node_pointer1616typename __tree<_Tp, _Compare, _Allocator>::__node_pointer
1572__tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)1617__tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) _NOEXCEPT
1573{1618{
1574 if (__cache->__parent_ == nullptr)1619 if (__cache->__parent_ == nullptr)
1575 return nullptr;1620 return nullptr;
...@@ -1603,45 +1648,23 @@ __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)...@@ -1603,45 +1648,23 @@ __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t)
1603}1648}
16041649
1605template <class _Tp, class _Compare, class _Allocator>1650template <class _Tp, class _Compare, class _Allocator>
1606template <class _InputIterator>1651template <class _ForwardIterator>
1607void1652void
1608__tree<_Tp, _Compare, _Allocator>::__assign_unique(_InputIterator __first, _InputIterator __last)1653__tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last)
1609{1654{
1610 typedef iterator_traits<_InputIterator> _ITraits;1655 typedef iterator_traits<_ForwardIterator> _ITraits;
1611 typedef typename _ITraits::value_type _ItValueType;1656 typedef typename _ITraits::value_type _ItValueType;
1612 static_assert((is_same<_ItValueType, __container_value_type>::value),1657 static_assert((is_same<_ItValueType, __container_value_type>::value),
1613 "__assign_unique may only be called with the containers value type");1658 "__assign_unique may only be called with the containers value type");
16141659 static_assert(__is_forward_iterator<_ForwardIterator>::value,
1660 "__assign_unique requires a forward iterator");
1615 if (size() != 0)1661 if (size() != 0)
1616 {1662 {
1617 __node_pointer __cache = __detach();1663 _DetachedTreeCache __cache(this);
1618#ifndef _LIBCPP_NO_EXCEPTIONS1664 for (; __cache.__get() != nullptr && __first != __last; ++__first) {
1619 try1665 if (__node_assign_unique(*__first, __cache.__get()).second)
1620 {1666 __cache.__advance();
1621#endif // _LIBCPP_NO_EXCEPTIONS
1622 for (; __cache != nullptr && __first != __last; ++__first)
1623 {
1624 __cache->__value_ = *__first;
1625 __node_pointer __next = __detach(__cache);
1626 __node_insert_unique(__cache);
1627 __cache = __next;
1628 }1667 }
1629#ifndef _LIBCPP_NO_EXCEPTIONS
1630 }
1631 catch (...)
1632 {
1633 while (__cache->__parent_ != nullptr)
1634 __cache = static_cast<__node_pointer>(__cache->__parent_);
1635 destroy(__cache);
1636 throw;
1637 }
1638#endif // _LIBCPP_NO_EXCEPTIONS
1639 if (__cache != nullptr)
1640 {
1641 while (__cache->__parent_ != nullptr)
1642 __cache = static_cast<__node_pointer>(__cache->__parent_);
1643 destroy(__cache);
1644 }
1645 }1668 }
1646 for (; __first != __last; ++__first)1669 for (; __first != __last; ++__first)
1647 __insert_unique(*__first);1670 __insert_unique(*__first);
...@@ -1660,33 +1683,11 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input...@@ -1660,33 +1683,11 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
1660 " or the nodes value type");1683 " or the nodes value type");
1661 if (size() != 0)1684 if (size() != 0)
1662 {1685 {
1663 __node_pointer __cache = __detach();1686 _DetachedTreeCache __cache(this);
1664#ifndef _LIBCPP_NO_EXCEPTIONS1687 for (; __cache.__get() && __first != __last; ++__first) {
1665 try1688 __cache.__get()->__value_ = *__first;
1666 {1689 __node_insert_multi(__cache.__get());
1667#endif // _LIBCPP_NO_EXCEPTIONS1690 __cache.__advance();
1668 for (; __cache != nullptr && __first != __last; ++__first)
1669 {
1670 __cache->__value_ = *__first;
1671 __node_pointer __next = __detach(__cache);
1672 __node_insert_multi(__cache);
1673 __cache = __next;
1674 }
1675#ifndef _LIBCPP_NO_EXCEPTIONS
1676 }
1677 catch (...)
1678 {
1679 while (__cache->__parent_ != nullptr)
1680 __cache = static_cast<__node_pointer>(__cache->__parent_);
1681 destroy(__cache);
1682 throw;
1683 }
1684#endif // _LIBCPP_NO_EXCEPTIONS
1685 if (__cache != nullptr)
1686 {
1687 while (__cache->__parent_ != nullptr)
1688 __cache = static_cast<__node_pointer>(__cache->__parent_);
1689 destroy(__cache);
1690 }1691 }
1691 }1692 }
1692 for (; __first != __last; ++__first)1693 for (; __first != __last; ++__first)
...@@ -1784,33 +1785,11 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)...@@ -1784,33 +1785,11 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
1784 const_iterator __e = end();1785 const_iterator __e = end();
1785 if (size() != 0)1786 if (size() != 0)
1786 {1787 {
1787 __node_pointer __cache = __detach();1788 _DetachedTreeCache __cache(this);
1788#ifndef _LIBCPP_NO_EXCEPTIONS1789 while (__cache.__get() != nullptr && __t.size() != 0) {
1789 try1790 __cache.__get()->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
1790 {1791 __node_insert_multi(__cache.__get());
1791#endif // _LIBCPP_NO_EXCEPTIONS1792 __cache.__advance();
1792 while (__cache != nullptr && __t.size() != 0)
1793 {
1794 __cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
1795 __node_pointer __next = __detach(__cache);
1796 __node_insert_multi(__cache);
1797 __cache = __next;
1798 }
1799#ifndef _LIBCPP_NO_EXCEPTIONS
1800 }
1801 catch (...)
1802 {
1803 while (__cache->__parent_ != nullptr)
1804 __cache = static_cast<__node_pointer>(__cache->__parent_);
1805 destroy(__cache);
1806 throw;
1807 }
1808#endif // _LIBCPP_NO_EXCEPTIONS
1809 if (__cache != nullptr)
1810 {
1811 while (__cache->__parent_ != nullptr)
1812 __cache = static_cast<__node_pointer>(__cache->__parent_);
1813 destroy(__cache);
1814 }1793 }
1815 }1794 }
1816 while (__t.size() != 0)1795 while (__t.size() != 0)
...@@ -2319,14 +2298,15 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __co...@@ -2319,14 +2298,15 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __co
23192298
2320template <class _Tp, class _Compare, class _Allocator>2299template <class _Tp, class _Compare, class _Allocator>
2321pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>2300pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
2322__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)2301__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
2323{2302{
2324 __parent_pointer __parent;2303 __parent_pointer __parent;
2325 __node_base_pointer& __child = __find_equal(__parent, __nd->__value_);2304 __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v));
2326 __node_pointer __r = static_cast<__node_pointer>(__child);2305 __node_pointer __r = static_cast<__node_pointer>(__child);
2327 bool __inserted = false;2306 bool __inserted = false;
2328 if (__child == nullptr)2307 if (__child == nullptr)
2329 {2308 {
2309 __nd->__value_ = __v;
2330 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));2310 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
2331 __r = __nd;2311 __r = __nd;
2332 __inserted = true;2312 __inserted = true;
...@@ -2334,22 +2314,6 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)...@@ -2334,22 +2314,6 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
2334 return pair<iterator, bool>(iterator(__r), __inserted);2314 return pair<iterator, bool>(iterator(__r), __inserted);
2335}2315}
23362316
2337template <class _Tp, class _Compare, class _Allocator>
2338typename __tree<_Tp, _Compare, _Allocator>::iterator
2339__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
2340 __node_pointer __nd)
2341{
2342 __parent_pointer __parent;
2343 __node_base_pointer __dummy;
2344 __node_base_pointer& __child = __find_equal(__p, __parent, __nd->__value_);
2345 __node_pointer __r = static_cast<__node_pointer>(__child);
2346 if (__child == nullptr)
2347 {
2348 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
2349 __r = __nd;
2350 }
2351 return iterator(__r);
2352}
23532317
2354template <class _Tp, class _Compare, class _Allocator>2318template <class _Tp, class _Compare, class _Allocator>
2355typename __tree<_Tp, _Compare, _Allocator>::iterator2319typename __tree<_Tp, _Compare, _Allocator>::iterator
...@@ -2408,7 +2372,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(...@@ -2408,7 +2372,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
24082372
2409 __insert_node_at(__parent, __child,2373 __insert_node_at(__parent, __child,
2410 static_cast<__node_base_pointer>(__ptr));2374 static_cast<__node_base_pointer>(__ptr));
2411 __nh.__release();2375 __nh.__release_ptr();
2412 return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};2376 return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
2413}2377}
24142378
...@@ -2433,7 +2397,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(...@@ -2433,7 +2397,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(
2433 __insert_node_at(__parent, __child,2397 __insert_node_at(__parent, __child,
2434 static_cast<__node_base_pointer>(__ptr));2398 static_cast<__node_base_pointer>(__ptr));
2435 __r = __ptr;2399 __r = __ptr;
2436 __nh.__release();2400 __nh.__release_ptr();
2437 }2401 }
2438 return iterator(__r);2402 return iterator(__r);
2439}2403}
...@@ -2498,7 +2462,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh...@@ -2498,7 +2462,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh
2498 __node_base_pointer& __child = __find_leaf_high(2462 __node_base_pointer& __child = __find_leaf_high(
2499 __parent, _NodeTypes::__get_key(__ptr->__value_));2463 __parent, _NodeTypes::__get_key(__ptr->__value_));
2500 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));2464 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2501 __nh.__release();2465 __nh.__release_ptr();
2502 return iterator(__ptr);2466 return iterator(__ptr);
2503}2467}
25042468
...@@ -2517,7 +2481,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(...@@ -2517,7 +2481,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(
2517 __node_base_pointer& __child = __find_leaf(__hint, __parent,2481 __node_base_pointer& __child = __find_leaf(__hint, __parent,
2518 _NodeTypes::__get_key(__ptr->__value_));2482 _NodeTypes::__get_key(__ptr->__value_));
2519 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));2483 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2520 __nh.__release();2484 __nh.__release_ptr();
2521 return iterator(__ptr);2485 return iterator(__ptr);
2522}2486}
25232487
lib/libcxx/include/__tuple+31-37
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -54,27 +53,24 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : publ...@@ -54,27 +53,24 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : publ
54template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};53template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
55#endif54#endif
5655
57template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;56template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element;
5857
59template <size_t _Ip, class _Tp>58template <size_t _Ip, class _Tp>
60class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>59struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
61{60{
62public:61 typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
63 typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
64};62};
6563
66template <size_t _Ip, class _Tp>64template <size_t _Ip, class _Tp>
67class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>65struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
68{66{
69public:67 typedef _LIBCPP_NODEBUG_TYPE typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
70 typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
71};68};
7269
73template <size_t _Ip, class _Tp>70template <size_t _Ip, class _Tp>
74class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>71struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
75{72{
76public:73 typedef _LIBCPP_NODEBUG_TYPE typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
77 typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
78};74};
7975
80template <class _Tp> struct __tuple_like : false_type {};76template <class _Tp> struct __tuple_like : false_type {};
...@@ -103,7 +99,7 @@ namespace __detail {...@@ -103,7 +99,7 @@ namespace __detail {
10399
104template<typename _Tp, size_t ..._Extra> struct __repeat;100template<typename _Tp, size_t ..._Extra> struct __repeat;
105template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {101template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
106 typedef __integer_sequence<_Tp,102 typedef _LIBCPP_NODEBUG_TYPE __integer_sequence<_Tp,
107 _Np...,103 _Np...,
108 sizeof...(_Np) + _Np...,104 sizeof...(_Np) + _Np...,
109 2 * sizeof...(_Np) + _Np...,105 2 * sizeof...(_Np) + _Np...,
...@@ -257,7 +253,7 @@ template <class ..._Tp> struct __tuple_types {};...@@ -257,7 +253,7 @@ template <class ..._Tp> struct __tuple_types {};
257namespace __indexer_detail {253namespace __indexer_detail {
258254
259template <size_t _Idx, class _Tp>255template <size_t _Idx, class _Tp>
260struct __indexed { using type = _Tp; };256struct __indexed { using type _LIBCPP_NODEBUG_TYPE = _Tp; };
261257
262template <class _Types, class _Indexes> struct __indexer;258template <class _Types, class _Indexes> struct __indexer;
263259
...@@ -272,7 +268,7 @@ __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);...@@ -272,7 +268,7 @@ __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
272} // namespace __indexer_detail268} // namespace __indexer_detail
273269
274template <size_t _Idx, class ..._Types>270template <size_t _Idx, class ..._Types>
275using __type_pack_element = typename decltype(271using __type_pack_element _LIBCPP_NODEBUG_TYPE = typename decltype(
276 __indexer_detail::__at_index<_Idx>(272 __indexer_detail::__at_index<_Idx>(
277 __indexer_detail::__indexer<273 __indexer_detail::__indexer<
278 __tuple_types<_Types...>,274 __tuple_types<_Types...>,
...@@ -282,11 +278,10 @@ using __type_pack_element = typename decltype(...@@ -282,11 +278,10 @@ using __type_pack_element = typename decltype(
282#endif278#endif
283279
284template <size_t _Ip, class ..._Types>280template <size_t _Ip, class ..._Types>
285class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>281struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
286{282{
287public:
288 static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");283 static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
289 typedef __type_pack_element<_Ip, _Types...> type;284 typedef _LIBCPP_NODEBUG_TYPE __type_pack_element<_Ip, _Types...> type;
290};285};
291286
292287
...@@ -306,34 +301,34 @@ struct __apply_cv_mf<false, false, false> {...@@ -306,34 +301,34 @@ struct __apply_cv_mf<false, false, false> {
306};301};
307template <>302template <>
308struct __apply_cv_mf<false, true, false> {303struct __apply_cv_mf<false, true, false> {
309 template <class _Tp> using __apply = const _Tp;304 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp;
310};305};
311template <>306template <>
312struct __apply_cv_mf<false, false, true> {307struct __apply_cv_mf<false, false, true> {
313 template <class _Tp> using __apply = volatile _Tp;308 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp;
314};309};
315template <>310template <>
316struct __apply_cv_mf<false, true, true> {311struct __apply_cv_mf<false, true, true> {
317 template <class _Tp> using __apply = const volatile _Tp;312 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp;
318};313};
319template <>314template <>
320struct __apply_cv_mf<true, false, false> {315struct __apply_cv_mf<true, false, false> {
321 template <class _Tp> using __apply = _Tp&;316 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = _Tp&;
322};317};
323template <>318template <>
324struct __apply_cv_mf<true, true, false> {319struct __apply_cv_mf<true, true, false> {
325 template <class _Tp> using __apply = const _Tp&;320 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp&;
326};321};
327template <>322template <>
328struct __apply_cv_mf<true, false, true> {323struct __apply_cv_mf<true, false, true> {
329 template <class _Tp> using __apply = volatile _Tp&;324 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp&;
330};325};
331template <>326template <>
332struct __apply_cv_mf<true, true, true> {327struct __apply_cv_mf<true, true, true> {
333 template <class _Tp> using __apply = const volatile _Tp&;328 template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp&;
334};329};
335template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type>330template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type>
336using __apply_cv_t = __apply_cv_mf<331using __apply_cv_t _LIBCPP_NODEBUG_TYPE = __apply_cv_mf<
337 is_lvalue_reference<_Tp>::value,332 is_lvalue_reference<_Tp>::value,
338 is_const<_RawTp>::value,333 is_const<_RawTp>::value,
339 is_volatile<_RawTp>::value>;334 is_volatile<_RawTp>::value>;
...@@ -352,7 +347,7 @@ template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>...@@ -352,7 +347,7 @@ template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
352struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {347struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
353 // Specialization for pair, tuple, and __tuple_types348 // Specialization for pair, tuple, and __tuple_types
354 template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>349 template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
355 using __apply_quals = __tuple_types<350 using __apply_quals _LIBCPP_NODEBUG_TYPE = __tuple_types<
356 typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>...351 typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>...
357 >;352 >;
358};353};
...@@ -380,19 +375,19 @@ struct __make_tuple_types...@@ -380,19 +375,19 @@ struct __make_tuple_types
380375
381template <class ..._Types, size_t _Ep>376template <class ..._Types, size_t _Ep>
382struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {377struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
383 typedef __tuple_types<_Types...> type;378 typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
384};379};
385380
386template <class ..._Types, size_t _Ep>381template <class ..._Types, size_t _Ep>
387struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {382struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
388 typedef __tuple_types<_Types...> type;383 typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type;
389};384};
390385
391template <bool ..._Preds>386template <bool ..._Preds>
392struct __all_dummy;387struct __all_dummy;
393388
394template <bool ..._Pred>389template <bool ..._Pred>
395using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;390using __all = _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
396391
397struct __tuple_sfinae_base {392struct __tuple_sfinae_base {
398 template <template <class, class...> class _Trait,393 template <template <class, class...> class _Trait,
...@@ -457,15 +452,14 @@ struct __tuple_assignable<_Tp, _Up, true, true>...@@ -457,15 +452,14 @@ struct __tuple_assignable<_Tp, _Up, true, true>
457452
458453
459template <size_t _Ip, class ..._Tp>454template <size_t _Ip, class ..._Tp>
460class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >455struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
461{456{
462public:457 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
463 typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
464};458};
465459
466#if _LIBCPP_STD_VER > 11460#if _LIBCPP_STD_VER > 11
467template <size_t _Ip, class ..._Tp>461template <size_t _Ip, class ..._Tp>
468using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;462using tuple_element_t _LIBCPP_NODEBUG_TYPE = typename tuple_element <_Ip, _Tp...>::type;
469#endif463#endif
470464
471template <bool _IsTuple, class _SizeTrait, size_t _Expected>465template <bool _IsTuple, class _SizeTrait, size_t _Expected>
...@@ -477,7 +471,7 @@ struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected>...@@ -477,7 +471,7 @@ struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected>
477471
478template <class _Tuple, size_t _ExpectedSize,472template <class _Tuple, size_t _ExpectedSize,
479 class _RawTuple = typename __uncvref<_Tuple>::type>473 class _RawTuple = typename __uncvref<_Tuple>::type>
480using __tuple_like_with_size = __tuple_like_with_size_imp<474using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp<
481 __tuple_like<_RawTuple>::value,475 __tuple_like<_RawTuple>::value,
482 tuple_size<_RawTuple>, _ExpectedSize476 tuple_size<_RawTuple>, _ExpectedSize
483 >;477 >;
lib/libcxx/include/__undef_macros+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ __undef_macros ------------------------------===//2//===------------------------ __undef_macros ------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/algorithm+215-244
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- algorithm ---------------------------------===//2//===-------------------------- algorithm ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -781,11 +780,23 @@ __half_positive(_Tp __value)...@@ -781,11 +780,23 @@ __half_positive(_Tp __value)
781template <class _Compare>780template <class _Compare>
782struct __debug_less781struct __debug_less
783{782{
784 _Compare __comp_;783 _Compare &__comp_;
784 _LIBCPP_CONSTEXPR_AFTER_CXX17
785 __debug_less(_Compare& __c) : __comp_(__c) {}785 __debug_less(_Compare& __c) : __comp_(__c) {}
786786
787 template <class _Tp, class _Up>787 template <class _Tp, class _Up>
788 bool operator()(const _Tp& __x, const _Up& __y)788 _LIBCPP_CONSTEXPR_AFTER_CXX17
789 bool operator()(const _Tp& __x, const _Up& __y)
790 {
791 bool __r = __comp_(__x, __y);
792 if (__r)
793 __do_compare_assert(0, __y, __x);
794 return __r;
795 }
796
797 template <class _Tp, class _Up>
798 _LIBCPP_CONSTEXPR_AFTER_CXX17
799 bool operator()(_Tp& __x, _Up& __y)
789 {800 {
790 bool __r = __comp_(__x, __y);801 bool __r = __comp_(__x, __y);
791 if (__r)802 if (__r)
...@@ -794,25 +805,39 @@ struct __debug_less...@@ -794,25 +805,39 @@ struct __debug_less
794 }805 }
795806
796 template <class _LHS, class _RHS>807 template <class _LHS, class _RHS>
808 _LIBCPP_CONSTEXPR_AFTER_CXX17
797 inline _LIBCPP_INLINE_VISIBILITY809 inline _LIBCPP_INLINE_VISIBILITY
798 decltype((void)_VSTD::declval<_Compare&>()(810 decltype((void)_VSTD::declval<_Compare&>()(
799 _VSTD::declval<_LHS const&>(), _VSTD::declval<_RHS const&>()))811 _VSTD::declval<_LHS &>(), _VSTD::declval<_RHS &>()))
800 __do_compare_assert(int, _LHS const& __l, _RHS const& __r) {812 __do_compare_assert(int, _LHS & __l, _RHS & __r) {
801 _LIBCPP_ASSERT(!__comp_(__l, __r),813 _LIBCPP_ASSERT(!__comp_(__l, __r),
802 "Comparator does not induce a strict weak ordering");814 "Comparator does not induce a strict weak ordering");
803 }815 }
804816
805 template <class _LHS, class _RHS>817 template <class _LHS, class _RHS>
818 _LIBCPP_CONSTEXPR_AFTER_CXX17
806 inline _LIBCPP_INLINE_VISIBILITY819 inline _LIBCPP_INLINE_VISIBILITY
807 void __do_compare_assert(long, _LHS const&, _RHS const&) {}820 void __do_compare_assert(long, _LHS &, _RHS &) {}
808};821};
809822
810#endif // _LIBCPP_DEBUG823#endif // _LIBCPP_DEBUG
824
825template <class _Comp>
826struct __comp_ref_type {
827 // Pass the comparator by lvalue reference. Or in debug mode, using a
828 // debugging wrapper that stores a reference.
829#ifndef _LIBCPP_DEBUG
830 typedef typename add_lvalue_reference<_Comp>::type type;
831#else
832 typedef __debug_less<_Comp> type;
833#endif
834};
811835
812// all_of836// all_of
813837
814template <class _InputIterator, class _Predicate>838template <class _InputIterator, class _Predicate>
815inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17839_LIBCPP_NODISCARD_EXT inline
840_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
816bool841bool
817all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)842all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
818{843{
...@@ -825,7 +850,8 @@ all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)...@@ -825,7 +850,8 @@ all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
825// any_of850// any_of
826851
827template <class _InputIterator, class _Predicate>852template <class _InputIterator, class _Predicate>
828inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17853_LIBCPP_NODISCARD_EXT inline
854_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
829bool855bool
830any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)856any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
831{857{
...@@ -838,7 +864,8 @@ any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)...@@ -838,7 +864,8 @@ any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
838// none_of864// none_of
839865
840template <class _InputIterator, class _Predicate>866template <class _InputIterator, class _Predicate>
841inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17867_LIBCPP_NODISCARD_EXT inline
868_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
842bool869bool
843none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)870none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
844{871{
...@@ -883,7 +910,8 @@ for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)...@@ -883,7 +910,8 @@ for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
883// find910// find
884911
885template <class _InputIterator, class _Tp>912template <class _InputIterator, class _Tp>
886inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17913_LIBCPP_NODISCARD_EXT inline
914_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
887_InputIterator915_InputIterator
888find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)916find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
889{917{
...@@ -896,7 +924,8 @@ find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)...@@ -896,7 +924,8 @@ find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
896// find_if924// find_if
897925
898template <class _InputIterator, class _Predicate>926template <class _InputIterator, class _Predicate>
899inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17927_LIBCPP_NODISCARD_EXT inline
928_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
900_InputIterator929_InputIterator
901find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)930find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
902{931{
...@@ -909,7 +938,8 @@ find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)...@@ -909,7 +938,8 @@ find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
909// find_if_not938// find_if_not
910939
911template<class _InputIterator, class _Predicate>940template<class _InputIterator, class _Predicate>
912inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17941_LIBCPP_NODISCARD_EXT inline
942_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
913_InputIterator943_InputIterator
914find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)944find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)
915{945{
...@@ -1044,7 +1074,8 @@ __find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,...@@ -1044,7 +1074,8 @@ __find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
1044}1074}
10451075
1046template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>1076template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1047inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171077_LIBCPP_NODISCARD_EXT inline
1078_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1048_ForwardIterator11079_ForwardIterator1
1049find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1080find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1050 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)1081 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
...@@ -1056,7 +1087,8 @@ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1056,7 +1087,8 @@ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1056}1087}
10571088
1058template <class _ForwardIterator1, class _ForwardIterator2>1089template <class _ForwardIterator1, class _ForwardIterator2>
1059inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171090_LIBCPP_NODISCARD_EXT inline
1091_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1060_ForwardIterator11092_ForwardIterator1
1061find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1093find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1062 _ForwardIterator2 __first2, _ForwardIterator2 __last2)1094 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -1082,7 +1114,8 @@ __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1082,7 +1114,8 @@ __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
10821114
10831115
1084template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>1116template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1085inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171117_LIBCPP_NODISCARD_EXT inline
1118_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1086_ForwardIterator11119_ForwardIterator1
1087find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1120find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1088 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)1121 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
...@@ -1091,7 +1124,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1091,7 +1124,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1091}1124}
10921125
1093template <class _ForwardIterator1, class _ForwardIterator2>1126template <class _ForwardIterator1, class _ForwardIterator2>
1094inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171127_LIBCPP_NODISCARD_EXT inline
1128_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1095_ForwardIterator11129_ForwardIterator1
1096find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1130find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1097 _ForwardIterator2 __first2, _ForwardIterator2 __last2)1131 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -1104,7 +1138,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1104,7 +1138,8 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1104// adjacent_find1138// adjacent_find
11051139
1106template <class _ForwardIterator, class _BinaryPredicate>1140template <class _ForwardIterator, class _BinaryPredicate>
1107inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171141_LIBCPP_NODISCARD_EXT inline
1142_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1108_ForwardIterator1143_ForwardIterator
1109adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)1144adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
1110{1145{
...@@ -1122,7 +1157,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicat...@@ -1122,7 +1157,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicat
1122}1157}
11231158
1124template <class _ForwardIterator>1159template <class _ForwardIterator>
1125inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171160_LIBCPP_NODISCARD_EXT inline
1161_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1126_ForwardIterator1162_ForwardIterator
1127adjacent_find(_ForwardIterator __first, _ForwardIterator __last)1163adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
1128{1164{
...@@ -1133,7 +1169,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)...@@ -1133,7 +1169,8 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
1133// count1169// count
11341170
1135template <class _InputIterator, class _Tp>1171template <class _InputIterator, class _Tp>
1136inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171172_LIBCPP_NODISCARD_EXT inline
1173_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1137typename iterator_traits<_InputIterator>::difference_type1174typename iterator_traits<_InputIterator>::difference_type
1138count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)1175count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
1139{1176{
...@@ -1147,7 +1184,8 @@ count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)...@@ -1147,7 +1184,8 @@ count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
1147// count_if1184// count_if
11481185
1149template <class _InputIterator, class _Predicate>1186template <class _InputIterator, class _Predicate>
1150inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171187_LIBCPP_NODISCARD_EXT inline
1188_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1151typename iterator_traits<_InputIterator>::difference_type1189typename iterator_traits<_InputIterator>::difference_type
1152count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)1190count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
1153{1191{
...@@ -1161,7 +1199,8 @@ count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)...@@ -1161,7 +1199,8 @@ count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
1161// mismatch1199// mismatch
11621200
1163template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>1201template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1164inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171202_LIBCPP_NODISCARD_EXT inline
1203_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1165pair<_InputIterator1, _InputIterator2>1204pair<_InputIterator1, _InputIterator2>
1166mismatch(_InputIterator1 __first1, _InputIterator1 __last1,1205mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1167 _InputIterator2 __first2, _BinaryPredicate __pred)1206 _InputIterator2 __first2, _BinaryPredicate __pred)
...@@ -1173,7 +1212,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -1173,7 +1212,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1173}1212}
11741213
1175template <class _InputIterator1, class _InputIterator2>1214template <class _InputIterator1, class _InputIterator2>
1176inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171215_LIBCPP_NODISCARD_EXT inline
1216_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1177pair<_InputIterator1, _InputIterator2>1217pair<_InputIterator1, _InputIterator2>
1178mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)1218mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
1179{1219{
...@@ -1184,7 +1224,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi...@@ -1184,7 +1224,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
11841224
1185#if _LIBCPP_STD_VER > 111225#if _LIBCPP_STD_VER > 11
1186template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>1226template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1187inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171227_LIBCPP_NODISCARD_EXT inline
1228_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1188pair<_InputIterator1, _InputIterator2>1229pair<_InputIterator1, _InputIterator2>
1189mismatch(_InputIterator1 __first1, _InputIterator1 __last1,1230mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1190 _InputIterator2 __first2, _InputIterator2 __last2,1231 _InputIterator2 __first2, _InputIterator2 __last2,
...@@ -1197,7 +1238,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -1197,7 +1238,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1197}1238}
11981239
1199template <class _InputIterator1, class _InputIterator2>1240template <class _InputIterator1, class _InputIterator2>
1200inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171241_LIBCPP_NODISCARD_EXT inline
1242_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1201pair<_InputIterator1, _InputIterator2>1243pair<_InputIterator1, _InputIterator2>
1202mismatch(_InputIterator1 __first1, _InputIterator1 __last1,1244mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1203 _InputIterator2 __first2, _InputIterator2 __last2)1245 _InputIterator2 __first2, _InputIterator2 __last2)
...@@ -1211,7 +1253,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -1211,7 +1253,8 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1211// equal1253// equal
12121254
1213template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>1255template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1214inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171256_LIBCPP_NODISCARD_EXT inline
1257_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1215bool1258bool
1216equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)1259equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
1217{1260{
...@@ -1222,7 +1265,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first...@@ -1222,7 +1265,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
1222}1265}
12231266
1224template <class _InputIterator1, class _InputIterator2>1267template <class _InputIterator1, class _InputIterator2>
1225inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171268_LIBCPP_NODISCARD_EXT inline
1269_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1226bool1270bool
1227equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)1271equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2)
1228{1272{
...@@ -1260,7 +1304,8 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,...@@ -1260,7 +1304,8 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
1260}1304}
12611305
1262template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>1306template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
1263inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171307_LIBCPP_NODISCARD_EXT inline
1308_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1264bool1309bool
1265equal(_InputIterator1 __first1, _InputIterator1 __last1,1310equal(_InputIterator1 __first1, _InputIterator1 __last1,
1266 _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )1311 _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )
...@@ -1272,7 +1317,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -1272,7 +1317,8 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,
1272}1317}
12731318
1274template <class _InputIterator1, class _InputIterator2>1319template <class _InputIterator1, class _InputIterator2>
1275inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171320_LIBCPP_NODISCARD_EXT inline
1321_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1276bool1322bool
1277equal(_InputIterator1 __first1, _InputIterator1 __last1,1323equal(_InputIterator1 __first1, _InputIterator1 __last1,
1278 _InputIterator2 __first2, _InputIterator2 __last2)1324 _InputIterator2 __first2, _InputIterator2 __last2)
...@@ -1288,7 +1334,7 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -1288,7 +1334,7 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1,
1288// is_permutation1334// is_permutation
12891335
1290template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>1336template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1291_LIBCPP_CONSTEXPR_AFTER_CXX17 bool1337_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
1292is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1338is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1293 _ForwardIterator2 __first2, _BinaryPredicate __pred)1339 _ForwardIterator2 __first2, _BinaryPredicate __pred)
1294{1340{
...@@ -1335,7 +1381,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1335,7 +1381,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1335}1381}
13361382
1337template<class _ForwardIterator1, class _ForwardIterator2>1383template<class _ForwardIterator1, class _ForwardIterator2>
1338inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171384_LIBCPP_NODISCARD_EXT inline
1385_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1339bool1386bool
1340is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1387is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1341 _ForwardIterator2 __first2)1388 _ForwardIterator2 __first2)
...@@ -1414,7 +1461,8 @@ __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1...@@ -1414,7 +1461,8 @@ __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1
1414}1461}
14151462
1416template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>1463template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1417inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171464_LIBCPP_NODISCARD_EXT inline
1465_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1418bool1466bool
1419is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1467is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1420 _ForwardIterator2 __first2, _ForwardIterator2 __last2,1468 _ForwardIterator2 __first2, _ForwardIterator2 __last2,
...@@ -1427,7 +1475,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1427,7 +1475,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1427}1475}
14281476
1429template<class _ForwardIterator1, class _ForwardIterator2>1477template<class _ForwardIterator1, class _ForwardIterator2>
1430inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171478_LIBCPP_NODISCARD_EXT inline
1479_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1431bool1480bool
1432is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1481is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1433 _ForwardIterator2 __first2, _ForwardIterator2 __last2)1482 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -1445,7 +1494,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1445,7 +1494,8 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1445// __search is in <functional>1494// __search is in <functional>
14461495
1447template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>1496template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
1448inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171497_LIBCPP_NODISCARD_EXT inline
1498_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1449_ForwardIterator11499_ForwardIterator1
1450search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1500search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1451 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)1501 _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
...@@ -1458,7 +1508,8 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1458,7 +1508,8 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1458}1508}
14591509
1460template <class _ForwardIterator1, class _ForwardIterator2>1510template <class _ForwardIterator1, class _ForwardIterator2>
1461inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171511_LIBCPP_NODISCARD_EXT inline
1512_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1462_ForwardIterator11513_ForwardIterator1
1463search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,1514search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
1464 _ForwardIterator2 __first2, _ForwardIterator2 __last2)1515 _ForwardIterator2 __first2, _ForwardIterator2 __last2)
...@@ -1471,7 +1522,7 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,...@@ -1471,7 +1522,7 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
14711522
1472#if _LIBCPP_STD_VER > 141523#if _LIBCPP_STD_VER > 14
1473template <class _ForwardIterator, class _Searcher>1524template <class _ForwardIterator, class _Searcher>
1474_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171525_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1475_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)1526_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
1476{ return __s(__f, __l).first; }1527{ return __s(__f, __l).first; }
1477#endif1528#endif
...@@ -1556,7 +1607,8 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,...@@ -1556,7 +1607,8 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
1556}1607}
15571608
1558template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>1609template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate>
1559inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171610_LIBCPP_NODISCARD_EXT inline
1611_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1560_ForwardIterator1612_ForwardIterator
1561search_n(_ForwardIterator __first, _ForwardIterator __last,1613search_n(_ForwardIterator __first, _ForwardIterator __last,
1562 _Size __count, const _Tp& __value_, _BinaryPredicate __pred)1614 _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
...@@ -1567,7 +1619,8 @@ search_n(_ForwardIterator __first, _ForwardIterator __last,...@@ -1567,7 +1619,8 @@ search_n(_ForwardIterator __first, _ForwardIterator __last,
1567}1619}
15681620
1569template <class _ForwardIterator, class _Size, class _Tp>1621template <class _ForwardIterator, class _Size, class _Tp>
1570inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX171622_LIBCPP_NODISCARD_EXT inline
1623_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1571_ForwardIterator1624_ForwardIterator
1572search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)1625search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
1573{1626{
...@@ -1611,6 +1664,18 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)...@@ -1611,6 +1664,18 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
1611 return __i.base();1664 return __i.base();
1612}1665}
16131666
1667template <class _Tp>
1668inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1669typename enable_if
1670<
1671 is_trivially_copy_assignable<_Tp>::value,
1672 const _Tp*
1673>::type
1674__unwrap_iter(__wrap_iter<const _Tp*> __i)
1675{
1676 return __i.base();
1677}
1678
1614#else1679#else
16151680
1616template <class _Tp>1681template <class _Tp>
...@@ -1984,7 +2049,7 @@ generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)...@@ -1984,7 +2049,7 @@ generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
1984// generate_n2049// generate_n
19852050
1986template <class _OutputIterator, class _Size, class _Generator>2051template <class _OutputIterator, class _Size, class _Generator>
1987inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX172052inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
1988_OutputIterator2053_OutputIterator
1989generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)2054generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
1990{2055{
...@@ -1998,7 +2063,7 @@ generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)...@@ -1998,7 +2063,7 @@ generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
1998// remove2063// remove
19992064
2000template <class _ForwardIterator, class _Tp>2065template <class _ForwardIterator, class _Tp>
2001_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator2066_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2002remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)2067remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
2003{2068{
2004 __first = _VSTD::find(__first, __last, __value_);2069 __first = _VSTD::find(__first, __last, __value_);
...@@ -2020,7 +2085,7 @@ remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)...@@ -2020,7 +2085,7 @@ remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
2020// remove_if2085// remove_if
20212086
2022template <class _ForwardIterator, class _Predicate>2087template <class _ForwardIterator, class _Predicate>
2023_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator2088_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2024remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)2089remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
2025{2090{
2026 __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>2091 __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>
...@@ -2079,7 +2144,7 @@ remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __...@@ -2079,7 +2144,7 @@ remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __
2079// unique2144// unique
20802145
2081template <class _ForwardIterator, class _BinaryPredicate>2146template <class _ForwardIterator, class _BinaryPredicate>
2082_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator2147_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
2083unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)2148unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
2084{2149{
2085 __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type>2150 __first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type>
...@@ -2098,7 +2163,8 @@ unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pre...@@ -2098,7 +2163,8 @@ unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pre
2098}2163}
20992164
2100template <class _ForwardIterator>2165template <class _ForwardIterator>
2101inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX172166_LIBCPP_NODISCARD_EXT inline
2167_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
2102_ForwardIterator2168_ForwardIterator
2103unique(_ForwardIterator __first, _ForwardIterator __last)2169unique(_ForwardIterator __first, _ForwardIterator __last)
2104{2170{
...@@ -2421,7 +2487,8 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato...@@ -2421,7 +2487,8 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato
2421// min_element2487// min_element
24222488
2423template <class _ForwardIterator, class _Compare>2489template <class _ForwardIterator, class _Compare>
2424inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112490_LIBCPP_NODISCARD_EXT inline
2491_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2425_ForwardIterator2492_ForwardIterator
2426min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2493min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2427{2494{
...@@ -2438,7 +2505,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)...@@ -2438,7 +2505,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2438}2505}
24392506
2440template <class _ForwardIterator>2507template <class _ForwardIterator>
2441inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112508_LIBCPP_NODISCARD_EXT inline
2509_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2442_ForwardIterator2510_ForwardIterator
2443min_element(_ForwardIterator __first, _ForwardIterator __last)2511min_element(_ForwardIterator __first, _ForwardIterator __last)
2444{2512{
...@@ -2449,7 +2517,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last)...@@ -2449,7 +2517,8 @@ min_element(_ForwardIterator __first, _ForwardIterator __last)
2449// min2517// min
24502518
2451template <class _Tp, class _Compare>2519template <class _Tp, class _Compare>
2452inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112520_LIBCPP_NODISCARD_EXT inline
2521_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2453const _Tp&2522const _Tp&
2454min(const _Tp& __a, const _Tp& __b, _Compare __comp)2523min(const _Tp& __a, const _Tp& __b, _Compare __comp)
2455{2524{
...@@ -2457,7 +2526,8 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp)...@@ -2457,7 +2526,8 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp)
2457}2526}
24582527
2459template <class _Tp>2528template <class _Tp>
2460inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112529_LIBCPP_NODISCARD_EXT inline
2530_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2461const _Tp&2531const _Tp&
2462min(const _Tp& __a, const _Tp& __b)2532min(const _Tp& __a, const _Tp& __b)
2463{2533{
...@@ -2467,7 +2537,8 @@ min(const _Tp& __a, const _Tp& __b)...@@ -2467,7 +2537,8 @@ min(const _Tp& __a, const _Tp& __b)
2467#ifndef _LIBCPP_CXX03_LANG2537#ifndef _LIBCPP_CXX03_LANG
24682538
2469template<class _Tp, class _Compare>2539template<class _Tp, class _Compare>
2470inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112540_LIBCPP_NODISCARD_EXT inline
2541_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2471_Tp2542_Tp
2472min(initializer_list<_Tp> __t, _Compare __comp)2543min(initializer_list<_Tp> __t, _Compare __comp)
2473{2544{
...@@ -2475,7 +2546,8 @@ min(initializer_list<_Tp> __t, _Compare __comp)...@@ -2475,7 +2546,8 @@ min(initializer_list<_Tp> __t, _Compare __comp)
2475}2546}
24762547
2477template<class _Tp>2548template<class _Tp>
2478inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112549_LIBCPP_NODISCARD_EXT inline
2550_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2479_Tp2551_Tp
2480min(initializer_list<_Tp> __t)2552min(initializer_list<_Tp> __t)
2481{2553{
...@@ -2487,7 +2559,8 @@ min(initializer_list<_Tp> __t)...@@ -2487,7 +2559,8 @@ min(initializer_list<_Tp> __t)
2487// max_element2559// max_element
24882560
2489template <class _ForwardIterator, class _Compare>2561template <class _ForwardIterator, class _Compare>
2490inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112562_LIBCPP_NODISCARD_EXT inline
2563_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2491_ForwardIterator2564_ForwardIterator
2492max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2565max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2493{2566{
...@@ -2505,7 +2578,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)...@@ -2505,7 +2578,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
25052578
25062579
2507template <class _ForwardIterator>2580template <class _ForwardIterator>
2508inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112581_LIBCPP_NODISCARD_EXT inline
2582_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2509_ForwardIterator2583_ForwardIterator
2510max_element(_ForwardIterator __first, _ForwardIterator __last)2584max_element(_ForwardIterator __first, _ForwardIterator __last)
2511{2585{
...@@ -2516,7 +2590,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last)...@@ -2516,7 +2590,8 @@ max_element(_ForwardIterator __first, _ForwardIterator __last)
2516// max2590// max
25172591
2518template <class _Tp, class _Compare>2592template <class _Tp, class _Compare>
2519inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112593_LIBCPP_NODISCARD_EXT inline
2594_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2520const _Tp&2595const _Tp&
2521max(const _Tp& __a, const _Tp& __b, _Compare __comp)2596max(const _Tp& __a, const _Tp& __b, _Compare __comp)
2522{2597{
...@@ -2524,7 +2599,8 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp)...@@ -2524,7 +2599,8 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp)
2524}2599}
25252600
2526template <class _Tp>2601template <class _Tp>
2527inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112602_LIBCPP_NODISCARD_EXT inline
2603_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2528const _Tp&2604const _Tp&
2529max(const _Tp& __a, const _Tp& __b)2605max(const _Tp& __a, const _Tp& __b)
2530{2606{
...@@ -2534,7 +2610,8 @@ max(const _Tp& __a, const _Tp& __b)...@@ -2534,7 +2610,8 @@ max(const _Tp& __a, const _Tp& __b)
2534#ifndef _LIBCPP_CXX03_LANG2610#ifndef _LIBCPP_CXX03_LANG
25352611
2536template<class _Tp, class _Compare>2612template<class _Tp, class _Compare>
2537inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112613_LIBCPP_NODISCARD_EXT inline
2614_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2538_Tp2615_Tp
2539max(initializer_list<_Tp> __t, _Compare __comp)2616max(initializer_list<_Tp> __t, _Compare __comp)
2540{2617{
...@@ -2542,7 +2619,8 @@ max(initializer_list<_Tp> __t, _Compare __comp)...@@ -2542,7 +2619,8 @@ max(initializer_list<_Tp> __t, _Compare __comp)
2542}2619}
25432620
2544template<class _Tp>2621template<class _Tp>
2545inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112622_LIBCPP_NODISCARD_EXT inline
2623_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2546_Tp2624_Tp
2547max(initializer_list<_Tp> __t)2625max(initializer_list<_Tp> __t)
2548{2626{
...@@ -2554,7 +2632,8 @@ max(initializer_list<_Tp> __t)...@@ -2554,7 +2632,8 @@ max(initializer_list<_Tp> __t)
2554#if _LIBCPP_STD_VER > 142632#if _LIBCPP_STD_VER > 14
2555// clamp2633// clamp
2556template<class _Tp, class _Compare>2634template<class _Tp, class _Compare>
2557inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR2635_LIBCPP_NODISCARD_EXT inline
2636_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2558const _Tp&2637const _Tp&
2559clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)2638clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
2560{2639{
...@@ -2564,7 +2643,8 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)...@@ -2564,7 +2643,8 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
2564}2643}
25652644
2566template<class _Tp>2645template<class _Tp>
2567inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR2646_LIBCPP_NODISCARD_EXT inline
2647_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2568const _Tp&2648const _Tp&
2569clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)2649clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
2570{2650{
...@@ -2575,7 +2655,7 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)...@@ -2575,7 +2655,7 @@ clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
2575// minmax_element2655// minmax_element
25762656
2577template <class _ForwardIterator, class _Compare>2657template <class _ForwardIterator, class _Compare>
2578_LIBCPP_CONSTEXPR_AFTER_CXX112658_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
2579std::pair<_ForwardIterator, _ForwardIterator>2659std::pair<_ForwardIterator, _ForwardIterator>
2580minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)2660minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2581{2661{
...@@ -2625,7 +2705,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com...@@ -2625,7 +2705,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
2625}2705}
26262706
2627template <class _ForwardIterator>2707template <class _ForwardIterator>
2628inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112708_LIBCPP_NODISCARD_EXT inline
2709_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2629std::pair<_ForwardIterator, _ForwardIterator>2710std::pair<_ForwardIterator, _ForwardIterator>
2630minmax_element(_ForwardIterator __first, _ForwardIterator __last)2711minmax_element(_ForwardIterator __first, _ForwardIterator __last)
2631{2712{
...@@ -2636,7 +2717,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last)...@@ -2636,7 +2717,8 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last)
2636// minmax2717// minmax
26372718
2638template<class _Tp, class _Compare>2719template<class _Tp, class _Compare>
2639inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112720_LIBCPP_NODISCARD_EXT inline
2721_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2640pair<const _Tp&, const _Tp&>2722pair<const _Tp&, const _Tp&>
2641minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)2723minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
2642{2724{
...@@ -2645,7 +2727,8 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)...@@ -2645,7 +2727,8 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
2645}2727}
26462728
2647template<class _Tp>2729template<class _Tp>
2648inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112730_LIBCPP_NODISCARD_EXT inline
2731_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2649pair<const _Tp&, const _Tp&>2732pair<const _Tp&, const _Tp&>
2650minmax(const _Tp& __a, const _Tp& __b)2733minmax(const _Tp& __a, const _Tp& __b)
2651{2734{
...@@ -2655,7 +2738,8 @@ minmax(const _Tp& __a, const _Tp& __b)...@@ -2655,7 +2738,8 @@ minmax(const _Tp& __a, const _Tp& __b)
2655#ifndef _LIBCPP_CXX03_LANG2738#ifndef _LIBCPP_CXX03_LANG
26562739
2657template<class _Tp, class _Compare>2740template<class _Tp, class _Compare>
2658inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112741_LIBCPP_NODISCARD_EXT inline
2742_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2659pair<_Tp, _Tp>2743pair<_Tp, _Tp>
2660minmax(initializer_list<_Tp> __t, _Compare __comp)2744minmax(initializer_list<_Tp> __t, _Compare __comp)
2661{2745{
...@@ -2692,7 +2776,8 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)...@@ -2692,7 +2776,8 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
2692}2776}
26932777
2694template<class _Tp>2778template<class _Tp>
2695inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX112779_LIBCPP_NODISCARD_EXT inline
2780_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
2696pair<_Tp, _Tp>2781pair<_Tp, _Tp>
2697minmax(initializer_list<_Tp> __t)2782minmax(initializer_list<_Tp> __t)
2698{2783{
...@@ -2936,7 +3021,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK...@@ -2936,7 +3021,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2936 typedef __independent_bits_engine<_URNG, _UIntType> _Eng;3021 typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
2937 if (_Rp == 0)3022 if (_Rp == 0)
2938 return static_cast<result_type>(_Eng(__g, _Dt)());3023 return static_cast<result_type>(_Eng(__g, _Dt)());
2939 size_t __w = _Dt - __clz(_Rp) - 1;3024 size_t __w = _Dt - __libcpp_clz(_Rp) - 1;
2940 if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)3025 if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
2941 ++__w;3026 ++__w;
2942 _Eng __e(__g, __w);3027 _Eng __e(__g, __w);
...@@ -2990,7 +3075,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)...@@ -2990,7 +3075,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
2990 {3075 {
2991 _Dp __uid;3076 _Dp __uid;
2992 __rs_default __g = __rs_get();3077 __rs_default __g = __rs_get();
2993 for (--__last, --__d; __first < __last; ++__first, --__d)3078 for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
2994 {3079 {
2995 difference_type __i = __uid(__g, _Pp(0, __d));3080 difference_type __i = __uid(__g, _Pp(0, __d));
2996 if (__i != difference_type(0))3081 if (__i != difference_type(0))
...@@ -3012,7 +3097,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,...@@ -3012,7 +3097,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
3012 difference_type __d = __last - __first;3097 difference_type __d = __last - __first;
3013 if (__d > 1)3098 if (__d > 1)
3014 {3099 {
3015 for (--__last; __first < __last; ++__first, --__d)3100 for (--__last; __first < __last; ++__first, (void) --__d)
3016 {3101 {
3017 difference_type __i = __rand(__d);3102 difference_type __i = __rand(__d);
3018 if (__i != difference_type(0))3103 if (__i != difference_type(0))
...@@ -3096,11 +3181,7 @@ _SampleIterator sample(_PopulationIterator __first,...@@ -3096,11 +3181,7 @@ _SampleIterator sample(_PopulationIterator __first,
30963181
3097template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>3182template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
3098 void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,3183 void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
3099#ifndef _LIBCPP_CXX03_LANG
3100 _UniformRandomNumberGenerator&& __g)3184 _UniformRandomNumberGenerator&& __g)
3101#else
3102 _UniformRandomNumberGenerator& __g)
3103#endif
3104{3185{
3105 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;3186 typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
3106 typedef uniform_int_distribution<ptrdiff_t> _Dp;3187 typedef uniform_int_distribution<ptrdiff_t> _Dp;
...@@ -3119,7 +3200,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>...@@ -3119,7 +3200,7 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
3119}3200}
31203201
3121template <class _InputIterator, class _Predicate>3202template <class _InputIterator, class _Predicate>
3122_LIBCPP_CONSTEXPR_AFTER_CXX17 bool3203_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
3123is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)3204is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
3124{3205{
3125 for (; __first != __last; ++__first)3206 for (; __first != __last; ++__first)
...@@ -3527,7 +3608,7 @@ stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate _...@@ -3527,7 +3608,7 @@ stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate _
3527// is_sorted_until3608// is_sorted_until
35283609
3529template <class _ForwardIterator, class _Compare>3610template <class _ForwardIterator, class _Compare>
3530_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator3611_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
3531is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)3612is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
3532{3613{
3533 if (__first != __last)3614 if (__first != __last)
...@@ -3544,7 +3625,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __co...@@ -3544,7 +3625,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __co
3544}3625}
35453626
3546template<class _ForwardIterator>3627template<class _ForwardIterator>
3547inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX173628_LIBCPP_NODISCARD_EXT inline
3629_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3548_ForwardIterator3630_ForwardIterator
3549is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)3631is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
3550{3632{
...@@ -3554,7 +3636,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)...@@ -3554,7 +3636,8 @@ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
3554// is_sorted3636// is_sorted
35553637
3556template <class _ForwardIterator, class _Compare>3638template <class _ForwardIterator, class _Compare>
3557inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX173639_LIBCPP_NODISCARD_EXT inline
3640_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3558bool3641bool
3559is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)3642is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
3560{3643{
...@@ -3562,7 +3645,8 @@ is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)...@@ -3562,7 +3645,8 @@ is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
3562}3645}
35633646
3564template<class _ForwardIterator>3647template<class _ForwardIterator>
3565inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX173648_LIBCPP_NODISCARD_EXT inline
3649_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
3566bool3650bool
3567is_sorted(_ForwardIterator __first, _ForwardIterator __last)3651is_sorted(_ForwardIterator __first, _ForwardIterator __last)
3568{3652{
...@@ -4009,14 +4093,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -4009,14 +4093,8 @@ inline _LIBCPP_INLINE_VISIBILITY
4009void4093void
4010sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4094sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4011{4095{
4012#ifdef _LIBCPP_DEBUG4096 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4013 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;4097 _VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp));
4014 __debug_less<_Compare> __c(__comp);
4015 __sort<_Comp_ref>(__first, __last, __c);
4016#else // _LIBCPP_DEBUG
4017 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4018 __sort<_Comp_ref>(__first, __last, __comp);
4019#endif // _LIBCPP_DEBUG
4020}4098}
40214099
4022template <class _RandomAccessIterator>4100template <class _RandomAccessIterator>
...@@ -4111,7 +4189,8 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va...@@ -4111,7 +4189,8 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
4111}4189}
41124190
4113template <class _ForwardIterator, class _Tp, class _Compare>4191template <class _ForwardIterator, class _Tp, class _Compare>
4114inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174192_LIBCPP_NODISCARD_EXT inline
4193_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4115_ForwardIterator4194_ForwardIterator
4116lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)4195lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4117{4196{
...@@ -4120,7 +4199,8 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu...@@ -4120,7 +4199,8 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
4120}4199}
41214200
4122template <class _ForwardIterator, class _Tp>4201template <class _ForwardIterator, class _Tp>
4123inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174202_LIBCPP_NODISCARD_EXT inline
4203_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4124_ForwardIterator4204_ForwardIterator
4125lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)4205lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4126{4206{
...@@ -4153,7 +4233,8 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va...@@ -4153,7 +4233,8 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
4153}4233}
41544234
4155template <class _ForwardIterator, class _Tp, class _Compare>4235template <class _ForwardIterator, class _Tp, class _Compare>
4156inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174236_LIBCPP_NODISCARD_EXT inline
4237_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4157_ForwardIterator4238_ForwardIterator
4158upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)4239upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4159{4240{
...@@ -4162,7 +4243,8 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu...@@ -4162,7 +4243,8 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
4162}4243}
41634244
4164template <class _ForwardIterator, class _Tp>4245template <class _ForwardIterator, class _Tp>
4165inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174246_LIBCPP_NODISCARD_EXT inline
4247_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4166_ForwardIterator4248_ForwardIterator
4167upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)4249upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4168{4250{
...@@ -4207,22 +4289,18 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va...@@ -4207,22 +4289,18 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
4207}4289}
42084290
4209template <class _ForwardIterator, class _Tp, class _Compare>4291template <class _ForwardIterator, class _Tp, class _Compare>
4210inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174292_LIBCPP_NODISCARD_EXT inline
4293_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4211pair<_ForwardIterator, _ForwardIterator>4294pair<_ForwardIterator, _ForwardIterator>
4212equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)4295equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4213{4296{
4214#ifdef _LIBCPP_DEBUG4297 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4215 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4216 __debug_less<_Compare> __c(__comp);
4217 return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
4218#else // _LIBCPP_DEBUG
4219 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4220 return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);4298 return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
4221#endif // _LIBCPP_DEBUG
4222}4299}
42234300
4224template <class _ForwardIterator, class _Tp>4301template <class _ForwardIterator, class _Tp>
4225inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174302_LIBCPP_NODISCARD_EXT inline
4303_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4226pair<_ForwardIterator, _ForwardIterator>4304pair<_ForwardIterator, _ForwardIterator>
4227equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)4305equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4228{4306{
...@@ -4242,22 +4320,18 @@ __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __...@@ -4242,22 +4320,18 @@ __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __
4242}4320}
42434321
4244template <class _ForwardIterator, class _Tp, class _Compare>4322template <class _ForwardIterator, class _Tp, class _Compare>
4245inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174323_LIBCPP_NODISCARD_EXT inline
4324_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4246bool4325bool
4247binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)4326binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4248{4327{
4249#ifdef _LIBCPP_DEBUG4328 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4250 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4251 __debug_less<_Compare> __c(__comp);
4252 return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
4253#else // _LIBCPP_DEBUG
4254 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4255 return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);4329 return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
4256#endif // _LIBCPP_DEBUG
4257}4330}
42584331
4259template <class _ForwardIterator, class _Tp>4332template <class _ForwardIterator, class _Tp>
4260inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174333_LIBCPP_NODISCARD_EXT inline
4334_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4261bool4335bool
4262binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)4336binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4263{4337{
...@@ -4296,14 +4370,8 @@ _OutputIterator...@@ -4296,14 +4370,8 @@ _OutputIterator
4296merge(_InputIterator1 __first1, _InputIterator1 __last1,4370merge(_InputIterator1 __first1, _InputIterator1 __last1,
4297 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)4371 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
4298{4372{
4299#ifdef _LIBCPP_DEBUG4373 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4300 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4301 __debug_less<_Compare> __c(__comp);
4302 return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
4303#else // _LIBCPP_DEBUG
4304 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4305 return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);4374 return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
4306#endif // _LIBCPP_DEBUG
4307}4375}
43084376
4309template <class _InputIterator1, class _InputIterator2, class _OutputIterator>4377template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
...@@ -4478,17 +4546,9 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _...@@ -4478,17 +4546,9 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
4478 difference_type __buf_size = _VSTD::min(__len1, __len2);4546 difference_type __buf_size = _VSTD::min(__len1, __len2);
4479 pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);4547 pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
4480 unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);4548 unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
44814549 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4482#ifdef _LIBCPP_DEBUG
4483 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4484 __debug_less<_Compare> __c(__comp);
4485 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
4486 __buf.first, __buf.second);
4487#else // _LIBCPP_DEBUG
4488 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4489 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,4550 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
4490 __buf.first, __buf.second);4551 __buf.first, __buf.second);
4491#endif // _LIBCPP_DEBUG
4492}4552}
44934553
4494template <class _BidirectionalIterator>4554template <class _BidirectionalIterator>
...@@ -4690,14 +4750,8 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar...@@ -4690,14 +4750,8 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
4690 __buf = _VSTD::get_temporary_buffer<value_type>(__len);4750 __buf = _VSTD::get_temporary_buffer<value_type>(__len);
4691 __h.reset(__buf.first);4751 __h.reset(__buf.first);
4692 }4752 }
4693#ifdef _LIBCPP_DEBUG4753 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4694 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4695 __debug_less<_Compare> __c(__comp);
4696 __stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
4697#else // _LIBCPP_DEBUG
4698 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4699 __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);4754 __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
4700#endif // _LIBCPP_DEBUG
4701}4755}
47024756
4703template <class _RandomAccessIterator>4757template <class _RandomAccessIterator>
...@@ -4711,7 +4765,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)...@@ -4711,7 +4765,7 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
4711// is_heap_until4765// is_heap_until
47124766
4713template <class _RandomAccessIterator, class _Compare>4767template <class _RandomAccessIterator, class _Compare>
4714_LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator4768_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
4715is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4769is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4716{4770{
4717 typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type;4771 typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type difference_type;
...@@ -4738,7 +4792,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp...@@ -4738,7 +4792,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
4738}4792}
47394793
4740template<class _RandomAccessIterator>4794template<class _RandomAccessIterator>
4741inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174795_LIBCPP_NODISCARD_EXT inline
4796_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4742_RandomAccessIterator4797_RandomAccessIterator
4743is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)4798is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
4744{4799{
...@@ -4748,7 +4803,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)...@@ -4748,7 +4803,8 @@ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
4748// is_heap4803// is_heap
47494804
4750template <class _RandomAccessIterator, class _Compare>4805template <class _RandomAccessIterator, class _Compare>
4751inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174806_LIBCPP_NODISCARD_EXT inline
4807_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4752bool4808bool
4753is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4809is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4754{4810{
...@@ -4756,7 +4812,8 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __...@@ -4756,7 +4812,8 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __
4756}4812}
47574813
4758template<class _RandomAccessIterator>4814template<class _RandomAccessIterator>
4759inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX174815_LIBCPP_NODISCARD_EXT inline
4816_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4760bool4817bool
4761is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)4818is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
4762{4819{
...@@ -4797,14 +4854,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -4797,14 +4854,8 @@ inline _LIBCPP_INLINE_VISIBILITY
4797void4854void
4798push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4855push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4799{4856{
4800#ifdef _LIBCPP_DEBUG4857 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4801 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4802 __debug_less<_Compare> __c(__comp);
4803 __sift_up<_Comp_ref>(__first, __last, __c, __last - __first);
4804#else // _LIBCPP_DEBUG
4805 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4806 __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);4858 __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);
4807#endif // _LIBCPP_DEBUG
4808}4859}
48094860
4810template <class _RandomAccessIterator>4861template <class _RandomAccessIterator>
...@@ -4890,14 +4941,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -4890,14 +4941,8 @@ inline _LIBCPP_INLINE_VISIBILITY
4890void4941void
4891pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4942pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4892{4943{
4893#ifdef _LIBCPP_DEBUG4944 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4894 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4895 __debug_less<_Compare> __c(__comp);
4896 __pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
4897#else // _LIBCPP_DEBUG
4898 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4899 __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);4945 __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
4900#endif // _LIBCPP_DEBUG
4901}4946}
49024947
4903template <class _RandomAccessIterator>4948template <class _RandomAccessIterator>
...@@ -4931,14 +4976,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -4931,14 +4976,8 @@ inline _LIBCPP_INLINE_VISIBILITY
4931void4976void
4932make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)4977make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4933{4978{
4934#ifdef _LIBCPP_DEBUG4979 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4935 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4936 __debug_less<_Compare> __c(__comp);
4937 __make_heap<_Comp_ref>(__first, __last, __c);
4938#else // _LIBCPP_DEBUG
4939 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4940 __make_heap<_Comp_ref>(__first, __last, __comp);4980 __make_heap<_Comp_ref>(__first, __last, __comp);
4941#endif // _LIBCPP_DEBUG
4942}4981}
49434982
4944template <class _RandomAccessIterator>4983template <class _RandomAccessIterator>
...@@ -4965,14 +5004,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -4965,14 +5004,8 @@ inline _LIBCPP_INLINE_VISIBILITY
4965void5004void
4966sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)5005sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4967{5006{
4968#ifdef _LIBCPP_DEBUG5007 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
4969 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
4970 __debug_less<_Compare> __c(__comp);
4971 __sort_heap<_Comp_ref>(__first, __last, __c);
4972#else // _LIBCPP_DEBUG
4973 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
4974 __sort_heap<_Comp_ref>(__first, __last, __comp);5008 __sort_heap<_Comp_ref>(__first, __last, __comp);
4975#endif // _LIBCPP_DEBUG
4976}5009}
49775010
4978template <class _RandomAccessIterator>5011template <class _RandomAccessIterator>
...@@ -5009,14 +5042,8 @@ void...@@ -5009,14 +5042,8 @@ void
5009partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,5042partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
5010 _Compare __comp)5043 _Compare __comp)
5011{5044{
5012#ifdef _LIBCPP_DEBUG5045 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5013 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5014 __debug_less<_Compare> __c(__comp);
5015 __partial_sort<_Comp_ref>(__first, __middle, __last, __c);
5016#else // _LIBCPP_DEBUG
5017 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5018 __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);5046 __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
5019#endif // _LIBCPP_DEBUG
5020}5047}
50215048
5022template <class _RandomAccessIterator>5049template <class _RandomAccessIterator>
...@@ -5059,14 +5086,8 @@ _RandomAccessIterator...@@ -5059,14 +5086,8 @@ _RandomAccessIterator
5059partial_sort_copy(_InputIterator __first, _InputIterator __last,5086partial_sort_copy(_InputIterator __first, _InputIterator __last,
5060 _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)5087 _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
5061{5088{
5062#ifdef _LIBCPP_DEBUG5089 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5063 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5064 __debug_less<_Compare> __c(__comp);
5065 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
5066#else // _LIBCPP_DEBUG
5067 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5068 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);5090 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
5069#endif // _LIBCPP_DEBUG
5070}5091}
50715092
5072template <class _InputIterator, class _RandomAccessIterator>5093template <class _InputIterator, class _RandomAccessIterator>
...@@ -5273,14 +5294,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -5273,14 +5294,8 @@ inline _LIBCPP_INLINE_VISIBILITY
5273void5294void
5274nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)5295nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
5275{5296{
5276#ifdef _LIBCPP_DEBUG5297 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5277 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5278 __debug_less<_Compare> __c(__comp);
5279 __nth_element<_Comp_ref>(__first, __nth, __last, __c);
5280#else // _LIBCPP_DEBUG
5281 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5282 __nth_element<_Comp_ref>(__first, __nth, __last, __comp);5298 __nth_element<_Comp_ref>(__first, __nth, __last, __comp);
5283#endif // _LIBCPP_DEBUG
5284}5299}
52855300
5286template <class _RandomAccessIterator>5301template <class _RandomAccessIterator>
...@@ -5309,23 +5324,19 @@ __includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __...@@ -5309,23 +5324,19 @@ __includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __
5309}5324}
53105325
5311template <class _InputIterator1, class _InputIterator2, class _Compare>5326template <class _InputIterator1, class _InputIterator2, class _Compare>
5312inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX175327_LIBCPP_NODISCARD_EXT inline
5328_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5313bool5329bool
5314includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,5330includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
5315 _Compare __comp)5331 _Compare __comp)
5316{5332{
5317#ifdef _LIBCPP_DEBUG5333 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5318 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5319 __debug_less<_Compare> __c(__comp);
5320 return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
5321#else // _LIBCPP_DEBUG
5322 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5323 return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);5334 return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
5324#endif // _LIBCPP_DEBUG
5325}5335}
53265336
5327template <class _InputIterator1, class _InputIterator2>5337template <class _InputIterator1, class _InputIterator2>
5328inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX175338_LIBCPP_NODISCARD_EXT inline
5339_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5329bool5340bool
5330includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)5341includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
5331{5342{
...@@ -5367,14 +5378,8 @@ _OutputIterator...@@ -5367,14 +5378,8 @@ _OutputIterator
5367set_union(_InputIterator1 __first1, _InputIterator1 __last1,5378set_union(_InputIterator1 __first1, _InputIterator1 __last1,
5368 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)5379 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
5369{5380{
5370#ifdef _LIBCPP_DEBUG5381 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5371 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5372 __debug_less<_Compare> __c(__comp);
5373 return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5374#else // _LIBCPP_DEBUG
5375 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5376 return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);5382 return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5377#endif // _LIBCPP_DEBUG
5378}5383}
53795384
5380template <class _InputIterator1, class _InputIterator2, class _OutputIterator>5385template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
...@@ -5419,14 +5424,8 @@ _OutputIterator...@@ -5419,14 +5424,8 @@ _OutputIterator
5419set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,5424set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
5420 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)5425 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
5421{5426{
5422#ifdef _LIBCPP_DEBUG5427 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5423 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5424 __debug_less<_Compare> __c(__comp);
5425 return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5426#else // _LIBCPP_DEBUG
5427 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5428 return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);5428 return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5429#endif // _LIBCPP_DEBUG
5430}5429}
54315430
5432template <class _InputIterator1, class _InputIterator2, class _OutputIterator>5431template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
...@@ -5473,14 +5472,8 @@ _OutputIterator...@@ -5473,14 +5472,8 @@ _OutputIterator
5473set_difference(_InputIterator1 __first1, _InputIterator1 __last1,5472set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
5474 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)5473 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
5475{5474{
5476#ifdef _LIBCPP_DEBUG5475 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5477 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5478 __debug_less<_Compare> __c(__comp);
5479 return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5480#else // _LIBCPP_DEBUG
5481 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5482 return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);5476 return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5483#endif // _LIBCPP_DEBUG
5484}5477}
54855478
5486template <class _InputIterator1, class _InputIterator2, class _OutputIterator>5479template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
...@@ -5532,14 +5525,8 @@ _OutputIterator...@@ -5532,14 +5525,8 @@ _OutputIterator
5532set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,5525set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
5533 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)5526 _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
5534{5527{
5535#ifdef _LIBCPP_DEBUG5528 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5536 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5537 __debug_less<_Compare> __c(__comp);
5538 return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
5539#else // _LIBCPP_DEBUG
5540 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5541 return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);5529 return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
5542#endif // _LIBCPP_DEBUG
5543}5530}
55445531
5545template <class _InputIterator1, class _InputIterator2, class _OutputIterator>5532template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
...@@ -5571,23 +5558,19 @@ __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,...@@ -5571,23 +5558,19 @@ __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
5571}5558}
55725559
5573template <class _InputIterator1, class _InputIterator2, class _Compare>5560template <class _InputIterator1, class _InputIterator2, class _Compare>
5574inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX175561_LIBCPP_NODISCARD_EXT inline
5562_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5575bool5563bool
5576lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,5564lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
5577 _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)5565 _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
5578{5566{
5579#ifdef _LIBCPP_DEBUG5567 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5580 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5581 __debug_less<_Compare> __c(__comp);
5582 return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
5583#else // _LIBCPP_DEBUG
5584 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5585 return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);5568 return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
5586#endif // _LIBCPP_DEBUG
5587}5569}
55885570
5589template <class _InputIterator1, class _InputIterator2>5571template <class _InputIterator1, class _InputIterator2>
5590inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX175572_LIBCPP_NODISCARD_EXT inline
5573_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
5591bool5574bool
5592lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,5575lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
5593 _InputIterator2 __first2, _InputIterator2 __last2)5576 _InputIterator2 __first2, _InputIterator2 __last2)
...@@ -5631,14 +5614,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -5631,14 +5614,8 @@ inline _LIBCPP_INLINE_VISIBILITY
5631bool5614bool
5632next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)5615next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5633{5616{
5634#ifdef _LIBCPP_DEBUG5617 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5635 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5636 __debug_less<_Compare> __c(__comp);
5637 return __next_permutation<_Comp_ref>(__first, __last, __c);
5638#else // _LIBCPP_DEBUG
5639 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5640 return __next_permutation<_Comp_ref>(__first, __last, __comp);5618 return __next_permutation<_Comp_ref>(__first, __last, __comp);
5641#endif // _LIBCPP_DEBUG
5642}5619}
56435620
5644template <class _BidirectionalIterator>5621template <class _BidirectionalIterator>
...@@ -5684,14 +5661,8 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -5684,14 +5661,8 @@ inline _LIBCPP_INLINE_VISIBILITY
5684bool5661bool
5685prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)5662prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5686{5663{
5687#ifdef _LIBCPP_DEBUG5664 typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
5688 typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
5689 __debug_less<_Compare> __c(__comp);
5690 return __prev_permutation<_Comp_ref>(__first, __last, __c);
5691#else // _LIBCPP_DEBUG
5692 typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
5693 return __prev_permutation<_Comp_ref>(__first, __last, __comp);5665 return __prev_permutation<_Comp_ref>(__first, __last, __comp);
5694#endif // _LIBCPP_DEBUG
5695}5666}
56965667
5697template <class _BidirectionalIterator>5668template <class _BidirectionalIterator>
lib/libcxx/include/any+4-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ any -----------------------------------===//2//===------------------------------ any -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -508,7 +507,7 @@ any::any(_ValueType && __v) : __h(nullptr)...@@ -508,7 +507,7 @@ any::any(_ValueType && __v) : __h(nullptr)
508template <class _ValueType, class ..._Args, class _Tp, class>507template <class _ValueType, class ..._Args, class _Tp, class>
509any::any(in_place_type_t<_ValueType>, _Args&&... __args) {508any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
510 __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);509 __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
511};510}
512511
513template <class _ValueType, class _Up, class ..._Args, class _Tp, class>512template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
514any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {513any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
lib/libcxx/include/array+17-19
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- array -----------------------------------===//2//===---------------------------- array -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -92,7 +91,7 @@ template <class T, size_t N >...@@ -92,7 +91,7 @@ template <class T, size_t N >
92 void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); // C++1791 void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); // C++17
9392
94template <class T> struct tuple_size;93template <class T> struct tuple_size;
95template <size_t I, class T> class tuple_element;94template <size_t I, class T> struct tuple_element;
96template <class T, size_t N> struct tuple_size<array<T, N>>;95template <class T, size_t N> struct tuple_size<array<T, N>>;
97template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;96template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
98template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++1497template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
...@@ -191,17 +190,17 @@ struct _LIBCPP_TEMPLATE_VIS array...@@ -191,17 +190,17 @@ struct _LIBCPP_TEMPLATE_VIS array
191190
192 // element access:191 // element access:
193 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14192 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
194 reference operator[](size_type __n) {return __elems_[__n];}193 reference operator[](size_type __n) _NOEXCEPT {return __elems_[__n];}
195 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11194 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
196 const_reference operator[](size_type __n) const {return __elems_[__n];}195 const_reference operator[](size_type __n) const _NOEXCEPT {return __elems_[__n];}
197196
198 _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n);197 _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n);
199 _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;198 _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
200199
201 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];}200 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() _NOEXCEPT {return __elems_[0];}
202 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}201 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const _NOEXCEPT {return __elems_[0];}
203 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size - 1];}202 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() _NOEXCEPT {return __elems_[_Size - 1];}
204 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size - 1];}203 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const _NOEXCEPT {return __elems_[_Size - 1];}
205204
206 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14205 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
207 value_type* data() _NOEXCEPT {return __elems_;}206 value_type* data() _NOEXCEPT {return __elems_;}
...@@ -304,13 +303,13 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>...@@ -304,13 +303,13 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
304303
305 // element access:304 // element access:
306 _LIBCPP_INLINE_VISIBILITY305 _LIBCPP_INLINE_VISIBILITY
307 reference operator[](size_type) {306 reference operator[](size_type) _NOEXCEPT {
308 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");307 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
309 _LIBCPP_UNREACHABLE();308 _LIBCPP_UNREACHABLE();
310 }309 }
311310
312 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11311 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
313 const_reference operator[](size_type) const {312 const_reference operator[](size_type) const _NOEXCEPT {
314 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");313 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
315 _LIBCPP_UNREACHABLE();314 _LIBCPP_UNREACHABLE();
316 }315 }
...@@ -328,25 +327,25 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>...@@ -328,25 +327,25 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
328 }327 }
329328
330 _LIBCPP_INLINE_VISIBILITY329 _LIBCPP_INLINE_VISIBILITY
331 reference front() {330 reference front() _NOEXCEPT {
332 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");331 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
333 _LIBCPP_UNREACHABLE();332 _LIBCPP_UNREACHABLE();
334 }333 }
335334
336 _LIBCPP_INLINE_VISIBILITY335 _LIBCPP_INLINE_VISIBILITY
337 const_reference front() const {336 const_reference front() const _NOEXCEPT {
338 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");337 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
339 _LIBCPP_UNREACHABLE();338 _LIBCPP_UNREACHABLE();
340 }339 }
341340
342 _LIBCPP_INLINE_VISIBILITY341 _LIBCPP_INLINE_VISIBILITY
343 reference back() {342 reference back() _NOEXCEPT {
344 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");343 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
345 _LIBCPP_UNREACHABLE();344 _LIBCPP_UNREACHABLE();
346 }345 }
347346
348 _LIBCPP_INLINE_VISIBILITY347 _LIBCPP_INLINE_VISIBILITY
349 const_reference back() const {348 const_reference back() const _NOEXCEPT {
350 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");349 _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
351 _LIBCPP_UNREACHABLE();350 _LIBCPP_UNREACHABLE();
352 }351 }
...@@ -434,10 +433,9 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >...@@ -434,10 +433,9 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
434 : public integral_constant<size_t, _Size> {};433 : public integral_constant<size_t, _Size> {};
435434
436template <size_t _Ip, class _Tp, size_t _Size>435template <size_t _Ip, class _Tp, size_t _Size>
437class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >436struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
438{437{
439 static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");438 static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
440public:
441 typedef _Tp type;439 typedef _Tp type;
442};440};
443441
lib/libcxx/include/atomic+811-257
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- atomic -----------------------------------===//2//===--------------------------- atomic -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -21,17 +20,24 @@ namespace std...@@ -21,17 +20,24 @@ namespace std
2120
22#define __cpp_lib_atomic_is_always_lock_free // as specified by SG1021#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
2322
24// order and consistency23 // order and consistency
2524
26typedef enum memory_order25 enum memory_order: unspecified // enum class in C++20
27{26 {
28 memory_order_relaxed,27 relaxed,
29 memory_order_consume, // load-consume28 consume, // load-consume
30 memory_order_acquire, // load-acquire29 acquire, // load-acquire
31 memory_order_release, // store-release30 release, // store-release
32 memory_order_acq_rel, // store-release load-acquire31 acq_rel, // store-release load-acquire
33 memory_order_seq_cst // store-release load-acquire32 seq_cst // store-release load-acquire
34} memory_order;33 };
34
35 inline constexpr auto memory_order_relaxed = memory_order::relaxed;
36 inline constexpr auto memory_order_consume = memory_order::consume;
37 inline constexpr auto memory_order_acquire = memory_order::acquire;
38 inline constexpr auto memory_order_release = memory_order::release;
39 inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
40 inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
3541
36template <class T> T kill_dependency(T y) noexcept;42template <class T> T kill_dependency(T y) noexcept;
3743
...@@ -551,13 +557,13 @@ void atomic_signal_fence(memory_order m) noexcept;...@@ -551,13 +557,13 @@ void atomic_signal_fence(memory_order m) noexcept;
551#endif557#endif
552558
553#ifdef _LIBCPP_HAS_NO_THREADS559#ifdef _LIBCPP_HAS_NO_THREADS
554#error <atomic> is not supported on this single threaded system560# error <atomic> is not supported on this single threaded system
555#endif561#endif
556#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)562#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
557#error <atomic> is not implemented563# error <atomic> is not implemented
558#endif564#endif
559#ifdef kill_dependency565#ifdef kill_dependency
560#error C++ standard library is incompatible with <stdatomic.h>566# error C++ standard library is incompatible with <stdatomic.h>
561#endif567#endif
562568
563#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \569#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
...@@ -578,49 +584,94 @@ void atomic_signal_fence(memory_order m) noexcept;...@@ -578,49 +584,94 @@ void atomic_signal_fence(memory_order m) noexcept;
578584
579_LIBCPP_BEGIN_NAMESPACE_STD585_LIBCPP_BEGIN_NAMESPACE_STD
580586
581typedef enum memory_order587// Figure out what the underlying type for `memory_order` would be if it were
582{588// declared as an unscoped enum (accounting for -fshort-enums). Use this result
583 memory_order_relaxed, memory_order_consume, memory_order_acquire,589// to pin the underlying type in C++20.
584 memory_order_release, memory_order_acq_rel, memory_order_seq_cst590enum __legacy_memory_order {
591 __mo_relaxed,
592 __mo_consume,
593 __mo_acquire,
594 __mo_release,
595 __mo_acq_rel,
596 __mo_seq_cst
597};
598
599typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t;
600
601#if _LIBCPP_STD_VER > 17
602
603enum class memory_order : __memory_order_underlying_t {
604 relaxed = __mo_relaxed,
605 consume = __mo_consume,
606 acquire = __mo_acquire,
607 release = __mo_release,
608 acq_rel = __mo_acq_rel,
609 seq_cst = __mo_seq_cst
610};
611
612inline constexpr auto memory_order_relaxed = memory_order::relaxed;
613inline constexpr auto memory_order_consume = memory_order::consume;
614inline constexpr auto memory_order_acquire = memory_order::acquire;
615inline constexpr auto memory_order_release = memory_order::release;
616inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
617inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
618
619#else
620
621typedef enum memory_order {
622 memory_order_relaxed = __mo_relaxed,
623 memory_order_consume = __mo_consume,
624 memory_order_acquire = __mo_acquire,
625 memory_order_release = __mo_release,
626 memory_order_acq_rel = __mo_acq_rel,
627 memory_order_seq_cst = __mo_seq_cst,
585} memory_order;628} memory_order;
586629
587#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)630#endif // _LIBCPP_STD_VER > 17
588namespace __gcc_atomic {631
589template <typename _Tp>632static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
590struct __gcc_atomic_t {633 "unexpected underlying type for std::memory_order");
634
635#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
636 defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS)
637
638// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
639// the default operator= in an object is not volatile, a byte-by-byte copy
640// is required.
641template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
642typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
643__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) {
644 __a_value = __val;
645}
646template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY
647typename enable_if<is_assignable<_Tp&, _Tv>::value>::type
648__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) {
649 volatile char* __to = reinterpret_cast<volatile char*>(&__a_value);
650 volatile char* __end = __to + sizeof(_Tp);
651 volatile const char* __from = reinterpret_cast<volatile const char*>(&__val);
652 while (__to != __end)
653 *__to++ = *__from++;
654}
591655
592#if _GNUC_VER >= 501
593 static_assert(is_trivially_copyable<_Tp>::value,
594 "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
595#endif656#endif
596657
658#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
659
660template <typename _Tp>
661struct __cxx_atomic_base_impl {
662
597 _LIBCPP_INLINE_VISIBILITY663 _LIBCPP_INLINE_VISIBILITY
598#ifndef _LIBCPP_CXX03_LANG664#ifndef _LIBCPP_CXX03_LANG
599 __gcc_atomic_t() _NOEXCEPT = default;665 __cxx_atomic_base_impl() _NOEXCEPT = default;
600#else666#else
601 __gcc_atomic_t() _NOEXCEPT : __a_value() {}667 __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
602#endif // _LIBCPP_CXX03_LANG668#endif // _LIBCPP_CXX03_LANG
603 _LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT669 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
604 : __a_value(value) {}670 : __a_value(value) {}
605 _Tp __a_value;671 _Tp __a_value;
606};672};
607#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
608
609template <typename _Tp> _Tp __create();
610
611template <typename _Tp, typename _Td>
612typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
613 __test_atomic_assignable(int);
614template <typename _Tp, typename _Up>
615__two __test_atomic_assignable(...);
616
617template <typename _Tp, typename _Td>
618struct __can_assign {
619 static const bool value =
620 sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
621};
622673
623static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {674_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
624 // Avoid switch statement to make this a constexpr.675 // Avoid switch statement to make this a constexpr.
625 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:676 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
626 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:677 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
...@@ -630,7 +681,7 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {...@@ -630,7 +681,7 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
630 __ATOMIC_CONSUME))));681 __ATOMIC_CONSUME))));
631}682}
632683
633static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {684_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
634 // Avoid switch statement to make this a constexpr.685 // Avoid switch statement to make this a constexpr.
635 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:686 return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
636 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:687 (__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
...@@ -640,133 +691,125 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order)...@@ -640,133 +691,125 @@ static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order)
640 __ATOMIC_CONSUME))));691 __ATOMIC_CONSUME))));
641}692}
642693
643} // namespace __gcc_atomic
644
645template <typename _Tp>
646static inline
647typename enable_if<
648 __gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value>::type
649__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
650 __a->__a_value = __val;
651}
652
653template <typename _Tp>694template <typename _Tp>
654static inline695_LIBCPP_INLINE_VISIBILITY
655typename enable_if<696void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
656 !__gcc_atomic::__can_assign<volatile _Atomic(_Tp)*, _Tp>::value &&697 __cxx_atomic_assign_volatile(__a->__a_value, __val);
657 __gcc_atomic::__can_assign< _Atomic(_Tp)*, _Tp>::value>::type
658__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
659 // [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because
660 // the default operator= in an object is not volatile, a byte-by-byte copy
661 // is required.
662 volatile char* to = reinterpret_cast<volatile char*>(&__a->__a_value);
663 volatile char* end = to + sizeof(_Tp);
664 char* from = reinterpret_cast<char*>(&__val);
665 while (to != end) {
666 *to++ = *from++;
667 }
668}698}
669699
670template <typename _Tp>700template <typename _Tp>
671static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) {701_LIBCPP_INLINE_VISIBILITY
702void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) {
672 __a->__a_value = __val;703 __a->__a_value = __val;
673}704}
674705
675static inline void __c11_atomic_thread_fence(memory_order __order) {706_LIBCPP_INLINE_VISIBILITY inline
676 __atomic_thread_fence(__gcc_atomic::__to_gcc_order(__order));707void __cxx_atomic_thread_fence(memory_order __order) {
708 __atomic_thread_fence(__to_gcc_order(__order));
677}709}
678710
679static inline void __c11_atomic_signal_fence(memory_order __order) {711_LIBCPP_INLINE_VISIBILITY inline
680 __atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order));712void __cxx_atomic_signal_fence(memory_order __order) {
713 __atomic_signal_fence(__to_gcc_order(__order));
681}714}
682715
683template <typename _Tp>716template <typename _Tp>
684static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,717_LIBCPP_INLINE_VISIBILITY
685 memory_order __order) {718void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
686 return __atomic_store(&__a->__a_value, &__val,719 memory_order __order) {
687 __gcc_atomic::__to_gcc_order(__order));720 __atomic_store(&__a->__a_value, &__val,
721 __to_gcc_order(__order));
688}722}
689723
690template <typename _Tp>724template <typename _Tp>
691static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val,725_LIBCPP_INLINE_VISIBILITY
692 memory_order __order) {726void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val,
727 memory_order __order) {
693 __atomic_store(&__a->__a_value, &__val,728 __atomic_store(&__a->__a_value, &__val,
694 __gcc_atomic::__to_gcc_order(__order));729 __to_gcc_order(__order));
695}730}
696731
697template <typename _Tp>732template <typename _Tp>
698static inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a,733_LIBCPP_INLINE_VISIBILITY
699 memory_order __order) {734_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a,
735 memory_order __order) {
700 _Tp __ret;736 _Tp __ret;
701 __atomic_load(&__a->__a_value, &__ret,737 __atomic_load(&__a->__a_value, &__ret,
702 __gcc_atomic::__to_gcc_order(__order));738 __to_gcc_order(__order));
703 return __ret;739 return __ret;
704}740}
705741
706template <typename _Tp>742template <typename _Tp>
707static inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) {743_LIBCPP_INLINE_VISIBILITY
744_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) {
708 _Tp __ret;745 _Tp __ret;
709 __atomic_load(&__a->__a_value, &__ret,746 __atomic_load(&__a->__a_value, &__ret,
710 __gcc_atomic::__to_gcc_order(__order));747 __to_gcc_order(__order));
711 return __ret;748 return __ret;
712}749}
713750
714template <typename _Tp>751template <typename _Tp>
715static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a,752_LIBCPP_INLINE_VISIBILITY
716 _Tp __value, memory_order __order) {753_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a,
754 _Tp __value, memory_order __order) {
717 _Tp __ret;755 _Tp __ret;
718 __atomic_exchange(&__a->__a_value, &__value, &__ret,756 __atomic_exchange(&__a->__a_value, &__value, &__ret,
719 __gcc_atomic::__to_gcc_order(__order));757 __to_gcc_order(__order));
720 return __ret;758 return __ret;
721}759}
722760
723template <typename _Tp>761template <typename _Tp>
724static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __value,762_LIBCPP_INLINE_VISIBILITY
725 memory_order __order) {763_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value,
764 memory_order __order) {
726 _Tp __ret;765 _Tp __ret;
727 __atomic_exchange(&__a->__a_value, &__value, &__ret,766 __atomic_exchange(&__a->__a_value, &__value, &__ret,
728 __gcc_atomic::__to_gcc_order(__order));767 __to_gcc_order(__order));
729 return __ret;768 return __ret;
730}769}
731770
732template <typename _Tp>771template <typename _Tp>
733static inline bool __c11_atomic_compare_exchange_strong(772_LIBCPP_INLINE_VISIBILITY
734 volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,773bool __cxx_atomic_compare_exchange_strong(
774 volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
735 memory_order __success, memory_order __failure) {775 memory_order __success, memory_order __failure) {
736 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,776 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
737 false,777 false,
738 __gcc_atomic::__to_gcc_order(__success),778 __to_gcc_order(__success),
739 __gcc_atomic::__to_gcc_failure_order(__failure));779 __to_gcc_failure_order(__failure));
740}780}
741781
742template <typename _Tp>782template <typename _Tp>
743static inline bool __c11_atomic_compare_exchange_strong(783_LIBCPP_INLINE_VISIBILITY
744 _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,784bool __cxx_atomic_compare_exchange_strong(
785 __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
745 memory_order __failure) {786 memory_order __failure) {
746 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,787 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
747 false,788 false,
748 __gcc_atomic::__to_gcc_order(__success),789 __to_gcc_order(__success),
749 __gcc_atomic::__to_gcc_failure_order(__failure));790 __to_gcc_failure_order(__failure));
750}791}
751792
752template <typename _Tp>793template <typename _Tp>
753static inline bool __c11_atomic_compare_exchange_weak(794_LIBCPP_INLINE_VISIBILITY
754 volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,795bool __cxx_atomic_compare_exchange_weak(
796 volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value,
755 memory_order __success, memory_order __failure) {797 memory_order __success, memory_order __failure) {
756 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,798 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
757 true,799 true,
758 __gcc_atomic::__to_gcc_order(__success),800 __to_gcc_order(__success),
759 __gcc_atomic::__to_gcc_failure_order(__failure));801 __to_gcc_failure_order(__failure));
760}802}
761803
762template <typename _Tp>804template <typename _Tp>
763static inline bool __c11_atomic_compare_exchange_weak(805_LIBCPP_INLINE_VISIBILITY
764 _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value, memory_order __success,806bool __cxx_atomic_compare_exchange_weak(
807 __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success,
765 memory_order __failure) {808 memory_order __failure) {
766 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,809 return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
767 true,810 true,
768 __gcc_atomic::__to_gcc_order(__success),811 __to_gcc_order(__success),
769 __gcc_atomic::__to_gcc_failure_order(__failure));812 __to_gcc_failure_order(__failure));
770}813}
771814
772template <typename _Tp>815template <typename _Tp>
...@@ -783,80 +826,264 @@ template <typename _Tp, int n>...@@ -783,80 +826,264 @@ template <typename _Tp, int n>
783struct __skip_amt<_Tp[n]> { };826struct __skip_amt<_Tp[n]> { };
784827
785template <typename _Tp, typename _Td>828template <typename _Tp, typename _Td>
786static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,829_LIBCPP_INLINE_VISIBILITY
787 _Td __delta, memory_order __order) {830_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a,
831 _Td __delta, memory_order __order) {
788 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,832 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
789 __gcc_atomic::__to_gcc_order(__order));833 __to_gcc_order(__order));
790}834}
791835
792template <typename _Tp, typename _Td>836template <typename _Tp, typename _Td>
793static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a, _Td __delta,837_LIBCPP_INLINE_VISIBILITY
794 memory_order __order) {838_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
839 memory_order __order) {
795 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,840 return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
796 __gcc_atomic::__to_gcc_order(__order));841 __to_gcc_order(__order));
797}842}
798843
799template <typename _Tp, typename _Td>844template <typename _Tp, typename _Td>
800static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,845_LIBCPP_INLINE_VISIBILITY
801 _Td __delta, memory_order __order) {846_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a,
847 _Td __delta, memory_order __order) {
802 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,848 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
803 __gcc_atomic::__to_gcc_order(__order));849 __to_gcc_order(__order));
804}850}
805851
806template <typename _Tp, typename _Td>852template <typename _Tp, typename _Td>
807static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a, _Td __delta,853_LIBCPP_INLINE_VISIBILITY
808 memory_order __order) {854_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta,
855 memory_order __order) {
809 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,856 return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value,
810 __gcc_atomic::__to_gcc_order(__order));857 __to_gcc_order(__order));
811}858}
812859
813template <typename _Tp>860template <typename _Tp>
814static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,861_LIBCPP_INLINE_VISIBILITY
815 _Tp __pattern, memory_order __order) {862_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a,
863 _Tp __pattern, memory_order __order) {
816 return __atomic_fetch_and(&__a->__a_value, __pattern,864 return __atomic_fetch_and(&__a->__a_value, __pattern,
817 __gcc_atomic::__to_gcc_order(__order));865 __to_gcc_order(__order));
818}866}
819867
820template <typename _Tp>868template <typename _Tp>
821static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,869_LIBCPP_INLINE_VISIBILITY
822 _Tp __pattern, memory_order __order) {870_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a,
871 _Tp __pattern, memory_order __order) {
823 return __atomic_fetch_and(&__a->__a_value, __pattern,872 return __atomic_fetch_and(&__a->__a_value, __pattern,
824 __gcc_atomic::__to_gcc_order(__order));873 __to_gcc_order(__order));
825}874}
826875
827template <typename _Tp>876template <typename _Tp>
828static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,877_LIBCPP_INLINE_VISIBILITY
829 _Tp __pattern, memory_order __order) {878_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a,
879 _Tp __pattern, memory_order __order) {
830 return __atomic_fetch_or(&__a->__a_value, __pattern,880 return __atomic_fetch_or(&__a->__a_value, __pattern,
831 __gcc_atomic::__to_gcc_order(__order));881 __to_gcc_order(__order));
832}882}
833883
834template <typename _Tp>884template <typename _Tp>
835static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a, _Tp __pattern,885_LIBCPP_INLINE_VISIBILITY
836 memory_order __order) {886_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
887 memory_order __order) {
837 return __atomic_fetch_or(&__a->__a_value, __pattern,888 return __atomic_fetch_or(&__a->__a_value, __pattern,
838 __gcc_atomic::__to_gcc_order(__order));889 __to_gcc_order(__order));
839}890}
840891
841template <typename _Tp>892template <typename _Tp>
842static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,893_LIBCPP_INLINE_VISIBILITY
843 _Tp __pattern, memory_order __order) {894_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a,
895 _Tp __pattern, memory_order __order) {
844 return __atomic_fetch_xor(&__a->__a_value, __pattern,896 return __atomic_fetch_xor(&__a->__a_value, __pattern,
845 __gcc_atomic::__to_gcc_order(__order));897 __to_gcc_order(__order));
846}898}
847899
848template <typename _Tp>900template <typename _Tp>
849static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,901_LIBCPP_INLINE_VISIBILITY
850 memory_order __order) {902_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern,
903 memory_order __order) {
851 return __atomic_fetch_xor(&__a->__a_value, __pattern,904 return __atomic_fetch_xor(&__a->__a_value, __pattern,
852 __gcc_atomic::__to_gcc_order(__order));905 __to_gcc_order(__order));
906}
907
908#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0)
909
910#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP)
911
912template <typename _Tp>
913struct __cxx_atomic_base_impl {
914
915 _LIBCPP_INLINE_VISIBILITY
916#ifndef _LIBCPP_CXX03_LANG
917 __cxx_atomic_base_impl() _NOEXCEPT = default;
918#else
919 __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {}
920#endif // _LIBCPP_CXX03_LANG
921 _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
922 : __a_value(value) {}
923 _Atomic(_Tp) __a_value;
924};
925
926#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)
927
928_LIBCPP_INLINE_VISIBILITY inline
929void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT {
930 __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order));
931}
932
933_LIBCPP_INLINE_VISIBILITY inline
934void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT {
935 __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order));
936}
937
938template<class _Tp>
939_LIBCPP_INLINE_VISIBILITY
940void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT {
941 __c11_atomic_init(&__a->__a_value, __val);
942}
943template<class _Tp>
944_LIBCPP_INLINE_VISIBILITY
945void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT {
946 __c11_atomic_init(&__a->__a_value, __val);
947}
948
949template<class _Tp>
950_LIBCPP_INLINE_VISIBILITY
951void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT {
952 __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
953}
954template<class _Tp>
955_LIBCPP_INLINE_VISIBILITY
956void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT {
957 __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order));
958}
959
960template<class _Tp>
961_LIBCPP_INLINE_VISIBILITY
962_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT {
963 using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
964 return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
965}
966template<class _Tp>
967_LIBCPP_INLINE_VISIBILITY
968_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
969 using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*;
970 return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
971}
972
973template<class _Tp>
974_LIBCPP_INLINE_VISIBILITY
975_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT {
976 return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
977}
978template<class _Tp>
979_LIBCPP_INLINE_VISIBILITY
980_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT {
981 return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order));
982}
983
984template<class _Tp>
985_LIBCPP_INLINE_VISIBILITY
986bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
987 return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
988}
989template<class _Tp>
990_LIBCPP_INLINE_VISIBILITY
991bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
992 return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
993}
994
995template<class _Tp>
996_LIBCPP_INLINE_VISIBILITY
997bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
998 return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
999}
1000template<class _Tp>
1001_LIBCPP_INLINE_VISIBILITY
1002bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT {
1003 return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure));
1004}
1005
1006template<class _Tp>
1007_LIBCPP_INLINE_VISIBILITY
1008_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1009 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1010}
1011template<class _Tp>
1012_LIBCPP_INLINE_VISIBILITY
1013_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1014 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1015}
1016
1017template<class _Tp>
1018_LIBCPP_INLINE_VISIBILITY
1019_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1020 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
853}1021}
854#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP1022template<class _Tp>
1023_LIBCPP_INLINE_VISIBILITY
1024_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1025 return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1026}
1027
1028template<class _Tp>
1029_LIBCPP_INLINE_VISIBILITY
1030_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1031 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1032}
1033template<class _Tp>
1034_LIBCPP_INLINE_VISIBILITY
1035_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT {
1036 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1037}
1038template<class _Tp>
1039_LIBCPP_INLINE_VISIBILITY
1040_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1041 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1042}
1043template<class _Tp>
1044_LIBCPP_INLINE_VISIBILITY
1045_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
1046 return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
1047}
1048
1049template<class _Tp>
1050_LIBCPP_INLINE_VISIBILITY
1051_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1052 return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1053}
1054template<class _Tp>
1055_LIBCPP_INLINE_VISIBILITY
1056_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1057 return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1058}
1059
1060template<class _Tp>
1061_LIBCPP_INLINE_VISIBILITY
1062_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1063 return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1064}
1065template<class _Tp>
1066_LIBCPP_INLINE_VISIBILITY
1067_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1068 return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1069}
1070
1071template<class _Tp>
1072_LIBCPP_INLINE_VISIBILITY
1073_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1074 return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1075}
1076template<class _Tp>
1077_LIBCPP_INLINE_VISIBILITY
1078_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT {
1079 return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order));
1080}
1081
1082#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP
8551083
856template <class _Tp>1084template <class _Tp>
857inline _LIBCPP_INLINE_VISIBILITY1085_LIBCPP_INLINE_VISIBILITY
858_Tp1086_Tp kill_dependency(_Tp __y) _NOEXCEPT
859kill_dependency(_Tp __y) _NOEXCEPT
860{1087{
861 return __y;1088 return __y;
862}1089}
...@@ -872,7 +1099,7 @@ kill_dependency(_Tp __y) _NOEXCEPT...@@ -872,7 +1099,7 @@ kill_dependency(_Tp __y) _NOEXCEPT
872# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE1099# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
873# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE1100# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
874# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE1101# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
875#else1102#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
876# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE1103# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
877# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE1104# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
878# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE1105# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
...@@ -885,12 +1112,352 @@ kill_dependency(_Tp __y) _NOEXCEPT...@@ -885,12 +1112,352 @@ kill_dependency(_Tp __y) _NOEXCEPT
885# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE1112# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
886#endif1113#endif
8871114
1115#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1116
1117template<typename _Tp>
1118struct __cxx_atomic_lock_impl {
1119
1120 _LIBCPP_INLINE_VISIBILITY
1121 __cxx_atomic_lock_impl() _NOEXCEPT
1122 : __a_value(), __a_lock(0) {}
1123 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit
1124 __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT
1125 : __a_value(value), __a_lock(0) {}
1126
1127 _Tp __a_value;
1128 mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock;
1129
1130 _LIBCPP_INLINE_VISIBILITY void __lock() const volatile {
1131 while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
1132 /*spin*/;
1133 }
1134 _LIBCPP_INLINE_VISIBILITY void __lock() const {
1135 while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire))
1136 /*spin*/;
1137 }
1138 _LIBCPP_INLINE_VISIBILITY void __unlock() const volatile {
1139 __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
1140 }
1141 _LIBCPP_INLINE_VISIBILITY void __unlock() const {
1142 __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release);
1143 }
1144 _LIBCPP_INLINE_VISIBILITY _Tp __read() const volatile {
1145 __lock();
1146 _Tp __old;
1147 __cxx_atomic_assign_volatile(__old, __a_value);
1148 __unlock();
1149 return __old;
1150 }
1151 _LIBCPP_INLINE_VISIBILITY _Tp __read() const {
1152 __lock();
1153 _Tp __old = __a_value;
1154 __unlock();
1155 return __old;
1156 }
1157};
1158
1159template <typename _Tp>
1160_LIBCPP_INLINE_VISIBILITY
1161void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
1162 __cxx_atomic_assign_volatile(__a->__a_value, __val);
1163}
1164template <typename _Tp>
1165_LIBCPP_INLINE_VISIBILITY
1166void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) {
1167 __a->__a_value = __val;
1168}
1169
1170template <typename _Tp>
1171_LIBCPP_INLINE_VISIBILITY
1172void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
1173 __a->__lock();
1174 __cxx_atomic_assign_volatile(__a->__a_value, __val);
1175 __a->__unlock();
1176}
1177template <typename _Tp>
1178_LIBCPP_INLINE_VISIBILITY
1179void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) {
1180 __a->__lock();
1181 __a->__a_value = __val;
1182 __a->__unlock();
1183}
1184
1185template <typename _Tp>
1186_LIBCPP_INLINE_VISIBILITY
1187_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
1188 return __a->__read();
1189}
1190template <typename _Tp>
1191_LIBCPP_INLINE_VISIBILITY
1192_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) {
1193 return __a->__read();
1194}
1195
1196template <typename _Tp>
1197_LIBCPP_INLINE_VISIBILITY
1198_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
1199 __a->__lock();
1200 _Tp __old;
1201 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1202 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1203 __a->__unlock();
1204 return __old;
1205}
1206template <typename _Tp>
1207_LIBCPP_INLINE_VISIBILITY
1208_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) {
1209 __a->__lock();
1210 _Tp __old = __a->__a_value;
1211 __a->__a_value = __value;
1212 __a->__unlock();
1213 return __old;
1214}
1215
1216template <typename _Tp>
1217_LIBCPP_INLINE_VISIBILITY
1218bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1219 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1220 __a->__lock();
1221 _Tp temp;
1222 __cxx_atomic_assign_volatile(temp, __a->__a_value);
1223 bool __ret = temp == *__expected;
1224 if(__ret)
1225 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1226 else
1227 __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
1228 __a->__unlock();
1229 return __ret;
1230}
1231template <typename _Tp>
1232_LIBCPP_INLINE_VISIBILITY
1233bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
1234 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1235 __a->__lock();
1236 bool __ret = __a->__a_value == *__expected;
1237 if(__ret)
1238 __a->__a_value = __value;
1239 else
1240 *__expected = __a->__a_value;
1241 __a->__unlock();
1242 return __ret;
1243}
1244
1245template <typename _Tp>
1246_LIBCPP_INLINE_VISIBILITY
1247bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1248 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1249 __a->__lock();
1250 _Tp temp;
1251 __cxx_atomic_assign_volatile(temp, __a->__a_value);
1252 bool __ret = temp == *__expected;
1253 if(__ret)
1254 __cxx_atomic_assign_volatile(__a->__a_value, __value);
1255 else
1256 __cxx_atomic_assign_volatile(*__expected, __a->__a_value);
1257 __a->__unlock();
1258 return __ret;
1259}
1260template <typename _Tp>
1261_LIBCPP_INLINE_VISIBILITY
1262bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
1263 _Tp* __expected, _Tp __value, memory_order, memory_order) {
1264 __a->__lock();
1265 bool __ret = __a->__a_value == *__expected;
1266 if(__ret)
1267 __a->__a_value = __value;
1268 else
1269 *__expected = __a->__a_value;
1270 __a->__unlock();
1271 return __ret;
1272}
1273
1274template <typename _Tp, typename _Td>
1275_LIBCPP_INLINE_VISIBILITY
1276_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1277 _Td __delta, memory_order) {
1278 __a->__lock();
1279 _Tp __old;
1280 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1281 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta));
1282 __a->__unlock();
1283 return __old;
1284}
1285template <typename _Tp, typename _Td>
1286_LIBCPP_INLINE_VISIBILITY
1287_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a,
1288 _Td __delta, memory_order) {
1289 __a->__lock();
1290 _Tp __old = __a->__a_value;
1291 __a->__a_value += __delta;
1292 __a->__unlock();
1293 return __old;
1294}
1295
1296template <typename _Tp, typename _Td>
1297_LIBCPP_INLINE_VISIBILITY
1298_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a,
1299 ptrdiff_t __delta, memory_order) {
1300 __a->__lock();
1301 _Tp* __old;
1302 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1303 __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta);
1304 __a->__unlock();
1305 return __old;
1306}
1307template <typename _Tp, typename _Td>
1308_LIBCPP_INLINE_VISIBILITY
1309_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a,
1310 ptrdiff_t __delta, memory_order) {
1311 __a->__lock();
1312 _Tp* __old = __a->__a_value;
1313 __a->__a_value += __delta;
1314 __a->__unlock();
1315 return __old;
1316}
1317
1318template <typename _Tp, typename _Td>
1319_LIBCPP_INLINE_VISIBILITY
1320_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1321 _Td __delta, memory_order) {
1322 __a->__lock();
1323 _Tp __old;
1324 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1325 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta));
1326 __a->__unlock();
1327 return __old;
1328}
1329template <typename _Tp, typename _Td>
1330_LIBCPP_INLINE_VISIBILITY
1331_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a,
1332 _Td __delta, memory_order) {
1333 __a->__lock();
1334 _Tp __old = __a->__a_value;
1335 __a->__a_value -= __delta;
1336 __a->__unlock();
1337 return __old;
1338}
1339
1340template <typename _Tp>
1341_LIBCPP_INLINE_VISIBILITY
1342_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1343 _Tp __pattern, memory_order) {
1344 __a->__lock();
1345 _Tp __old;
1346 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1347 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern));
1348 __a->__unlock();
1349 return __old;
1350}
1351template <typename _Tp>
1352_LIBCPP_INLINE_VISIBILITY
1353_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a,
1354 _Tp __pattern, memory_order) {
1355 __a->__lock();
1356 _Tp __old = __a->__a_value;
1357 __a->__a_value &= __pattern;
1358 __a->__unlock();
1359 return __old;
1360}
1361
1362template <typename _Tp>
1363_LIBCPP_INLINE_VISIBILITY
1364_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1365 _Tp __pattern, memory_order) {
1366 __a->__lock();
1367 _Tp __old;
1368 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1369 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern));
1370 __a->__unlock();
1371 return __old;
1372}
1373template <typename _Tp>
1374_LIBCPP_INLINE_VISIBILITY
1375_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a,
1376 _Tp __pattern, memory_order) {
1377 __a->__lock();
1378 _Tp __old = __a->__a_value;
1379 __a->__a_value |= __pattern;
1380 __a->__unlock();
1381 return __old;
1382}
1383
1384template <typename _Tp>
1385_LIBCPP_INLINE_VISIBILITY
1386_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a,
1387 _Tp __pattern, memory_order) {
1388 __a->__lock();
1389 _Tp __old;
1390 __cxx_atomic_assign_volatile(__old, __a->__a_value);
1391 __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern));
1392 __a->__unlock();
1393 return __old;
1394}
1395template <typename _Tp>
1396_LIBCPP_INLINE_VISIBILITY
1397_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
1398 _Tp __pattern, memory_order) {
1399 __a->__lock();
1400 _Tp __old = __a->__a_value;
1401 __a->__a_value ^= __pattern;
1402 __a->__unlock();
1403 return __old;
1404}
1405
1406#ifdef __cpp_lib_atomic_is_always_lock_free
1407
1408template<typename _Tp> struct __cxx_is_always_lock_free {
1409 enum { __value = __atomic_always_lock_free(sizeof(_Tp), 0) }; };
1410
1411#else
1412
1413template<typename _Tp> struct __cxx_is_always_lock_free { enum { __value = false }; };
1414// Implementations must match the C ATOMIC_*_LOCK_FREE macro values.
1415template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC_BOOL_LOCK_FREE }; };
1416template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1417template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1418template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
1419template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
1420template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
1421template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
1422template<> struct __cxx_is_always_lock_free<short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
1423template<> struct __cxx_is_always_lock_free<unsigned short> { enum { __value = 2 == ATOMIC_SHORT_LOCK_FREE }; };
1424template<> struct __cxx_is_always_lock_free<int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
1425template<> struct __cxx_is_always_lock_free<unsigned int> { enum { __value = 2 == ATOMIC_INT_LOCK_FREE }; };
1426template<> struct __cxx_is_always_lock_free<long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
1427template<> struct __cxx_is_always_lock_free<unsigned long> { enum { __value = 2 == ATOMIC_LONG_LOCK_FREE }; };
1428template<> struct __cxx_is_always_lock_free<long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
1429template<> struct __cxx_is_always_lock_free<unsigned long long> { enum { __value = 2 == ATOMIC_LLONG_LOCK_FREE }; };
1430template<typename _Tp> struct __cxx_is_always_lock_free<_Tp*> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1431template<> struct __cxx_is_always_lock_free<std::nullptr_t> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1432
1433#endif //__cpp_lib_atomic_is_always_lock_free
1434
1435template <typename _Tp,
1436 typename _Base = typename conditional<__cxx_is_always_lock_free<_Tp>::__value,
1437 __cxx_atomic_base_impl<_Tp>,
1438 __cxx_atomic_lock_impl<_Tp> >::type>
1439#else
1440template <typename _Tp,
1441 typename _Base = __cxx_atomic_base_impl<_Tp> >
1442#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS
1443struct __cxx_atomic_impl : public _Base {
1444
1445#if _GNUC_VER >= 501
1446 static_assert(is_trivially_copyable<_Tp>::value,
1447 "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
1448#endif
1449
1450 _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT _LIBCPP_DEFAULT
1451 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp value) _NOEXCEPT
1452 : _Base(value) {}
1453};
1454
888// general atomic<T>1455// general atomic<T>
8891456
890template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>1457template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
891struct __atomic_base // false1458struct __atomic_base // false
892{1459{
893 mutable _Atomic(_Tp) __a_;1460 mutable __cxx_atomic_impl<_Tp> __a_;
8941461
895#if defined(__cpp_lib_atomic_is_always_lock_free)1462#if defined(__cpp_lib_atomic_is_always_lock_free)
896 static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);1463 static _LIBCPP_CONSTEXPR bool is_always_lock_free = __atomic_always_lock_free(sizeof(__a_), 0);
...@@ -898,88 +1465,79 @@ struct __atomic_base // false...@@ -898,88 +1465,79 @@ struct __atomic_base // false
8981465
899 _LIBCPP_INLINE_VISIBILITY1466 _LIBCPP_INLINE_VISIBILITY
900 bool is_lock_free() const volatile _NOEXCEPT1467 bool is_lock_free() const volatile _NOEXCEPT
901 {1468 {return __cxx_atomic_is_lock_free(sizeof(_Tp));}
902#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
903 return __c11_atomic_is_lock_free(sizeof(_Tp));
904#else
905 return __atomic_is_lock_free(sizeof(_Tp), 0);
906#endif
907 }
908 _LIBCPP_INLINE_VISIBILITY1469 _LIBCPP_INLINE_VISIBILITY
909 bool is_lock_free() const _NOEXCEPT1470 bool is_lock_free() const _NOEXCEPT
910 {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}1471 {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
911 _LIBCPP_INLINE_VISIBILITY1472 _LIBCPP_INLINE_VISIBILITY
912 void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1473 void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
913 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)1474 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
914 {__c11_atomic_store(&__a_, __d, __m);}1475 {__cxx_atomic_store(&__a_, __d, __m);}
915 _LIBCPP_INLINE_VISIBILITY1476 _LIBCPP_INLINE_VISIBILITY
916 void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT1477 void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
917 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)1478 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
918 {__c11_atomic_store(&__a_, __d, __m);}1479 {__cxx_atomic_store(&__a_, __d, __m);}
919 _LIBCPP_INLINE_VISIBILITY1480 _LIBCPP_INLINE_VISIBILITY
920 _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT1481 _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
921 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)1482 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
922 {return __c11_atomic_load(&__a_, __m);}1483 {return __cxx_atomic_load(&__a_, __m);}
923 _LIBCPP_INLINE_VISIBILITY1484 _LIBCPP_INLINE_VISIBILITY
924 _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT1485 _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
925 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)1486 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
926 {return __c11_atomic_load(&__a_, __m);}1487 {return __cxx_atomic_load(&__a_, __m);}
927 _LIBCPP_INLINE_VISIBILITY1488 _LIBCPP_INLINE_VISIBILITY
928 operator _Tp() const volatile _NOEXCEPT {return load();}1489 operator _Tp() const volatile _NOEXCEPT {return load();}
929 _LIBCPP_INLINE_VISIBILITY1490 _LIBCPP_INLINE_VISIBILITY
930 operator _Tp() const _NOEXCEPT {return load();}1491 operator _Tp() const _NOEXCEPT {return load();}
931 _LIBCPP_INLINE_VISIBILITY1492 _LIBCPP_INLINE_VISIBILITY
932 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1493 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
933 {return __c11_atomic_exchange(&__a_, __d, __m);}1494 {return __cxx_atomic_exchange(&__a_, __d, __m);}
934 _LIBCPP_INLINE_VISIBILITY1495 _LIBCPP_INLINE_VISIBILITY
935 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT1496 _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
936 {return __c11_atomic_exchange(&__a_, __d, __m);}1497 {return __cxx_atomic_exchange(&__a_, __d, __m);}
937 _LIBCPP_INLINE_VISIBILITY1498 _LIBCPP_INLINE_VISIBILITY
938 bool compare_exchange_weak(_Tp& __e, _Tp __d,1499 bool compare_exchange_weak(_Tp& __e, _Tp __d,
939 memory_order __s, memory_order __f) volatile _NOEXCEPT1500 memory_order __s, memory_order __f) volatile _NOEXCEPT
940 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)1501 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
941 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}1502 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
942 _LIBCPP_INLINE_VISIBILITY1503 _LIBCPP_INLINE_VISIBILITY
943 bool compare_exchange_weak(_Tp& __e, _Tp __d,1504 bool compare_exchange_weak(_Tp& __e, _Tp __d,
944 memory_order __s, memory_order __f) _NOEXCEPT1505 memory_order __s, memory_order __f) _NOEXCEPT
945 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)1506 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
946 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}1507 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
947 _LIBCPP_INLINE_VISIBILITY1508 _LIBCPP_INLINE_VISIBILITY
948 bool compare_exchange_strong(_Tp& __e, _Tp __d,1509 bool compare_exchange_strong(_Tp& __e, _Tp __d,
949 memory_order __s, memory_order __f) volatile _NOEXCEPT1510 memory_order __s, memory_order __f) volatile _NOEXCEPT
950 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)1511 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
951 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}1512 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
952 _LIBCPP_INLINE_VISIBILITY1513 _LIBCPP_INLINE_VISIBILITY
953 bool compare_exchange_strong(_Tp& __e, _Tp __d,1514 bool compare_exchange_strong(_Tp& __e, _Tp __d,
954 memory_order __s, memory_order __f) _NOEXCEPT1515 memory_order __s, memory_order __f) _NOEXCEPT
955 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)1516 _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
956 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}1517 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
957 _LIBCPP_INLINE_VISIBILITY1518 _LIBCPP_INLINE_VISIBILITY
958 bool compare_exchange_weak(_Tp& __e, _Tp __d,1519 bool compare_exchange_weak(_Tp& __e, _Tp __d,
959 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1520 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
960 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}1521 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
961 _LIBCPP_INLINE_VISIBILITY1522 _LIBCPP_INLINE_VISIBILITY
962 bool compare_exchange_weak(_Tp& __e, _Tp __d,1523 bool compare_exchange_weak(_Tp& __e, _Tp __d,
963 memory_order __m = memory_order_seq_cst) _NOEXCEPT1524 memory_order __m = memory_order_seq_cst) _NOEXCEPT
964 {return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}1525 {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);}
965 _LIBCPP_INLINE_VISIBILITY1526 _LIBCPP_INLINE_VISIBILITY
966 bool compare_exchange_strong(_Tp& __e, _Tp __d,1527 bool compare_exchange_strong(_Tp& __e, _Tp __d,
967 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1528 memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
968 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}1529 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
969 _LIBCPP_INLINE_VISIBILITY1530 _LIBCPP_INLINE_VISIBILITY
970 bool compare_exchange_strong(_Tp& __e, _Tp __d,1531 bool compare_exchange_strong(_Tp& __e, _Tp __d,
971 memory_order __m = memory_order_seq_cst) _NOEXCEPT1532 memory_order __m = memory_order_seq_cst) _NOEXCEPT
972 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}1533 {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);}
9731534
974 _LIBCPP_INLINE_VISIBILITY1535 _LIBCPP_INLINE_VISIBILITY
975#ifndef _LIBCPP_CXX03_LANG1536 __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT
976 __atomic_base() _NOEXCEPT = default;1537
977#else1538 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
978 __atomic_base() _NOEXCEPT : __a_() {}1539 __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
979#endif // _LIBCPP_CXX03_LANG
9801540
981 _LIBCPP_INLINE_VISIBILITY
982 _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
983#ifndef _LIBCPP_CXX03_LANG1541#ifndef _LIBCPP_CXX03_LANG
984 __atomic_base(const __atomic_base&) = delete;1542 __atomic_base(const __atomic_base&) = delete;
985 __atomic_base& operator=(const __atomic_base&) = delete;1543 __atomic_base& operator=(const __atomic_base&) = delete;
...@@ -1011,34 +1569,34 @@ struct __atomic_base<_Tp, true>...@@ -1011,34 +1569,34 @@ struct __atomic_base<_Tp, true>
10111569
1012 _LIBCPP_INLINE_VISIBILITY1570 _LIBCPP_INLINE_VISIBILITY
1013 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1571 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1014 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}1572 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
1015 _LIBCPP_INLINE_VISIBILITY1573 _LIBCPP_INLINE_VISIBILITY
1016 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1574 _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1017 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}1575 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
1018 _LIBCPP_INLINE_VISIBILITY1576 _LIBCPP_INLINE_VISIBILITY
1019 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1577 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1020 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}1578 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
1021 _LIBCPP_INLINE_VISIBILITY1579 _LIBCPP_INLINE_VISIBILITY
1022 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1580 _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1023 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}1581 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
1024 _LIBCPP_INLINE_VISIBILITY1582 _LIBCPP_INLINE_VISIBILITY
1025 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1583 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1026 {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}1584 {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
1027 _LIBCPP_INLINE_VISIBILITY1585 _LIBCPP_INLINE_VISIBILITY
1028 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1586 _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1029 {return __c11_atomic_fetch_and(&this->__a_, __op, __m);}1587 {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);}
1030 _LIBCPP_INLINE_VISIBILITY1588 _LIBCPP_INLINE_VISIBILITY
1031 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1589 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1032 {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}1590 {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
1033 _LIBCPP_INLINE_VISIBILITY1591 _LIBCPP_INLINE_VISIBILITY
1034 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1592 _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1035 {return __c11_atomic_fetch_or(&this->__a_, __op, __m);}1593 {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);}
1036 _LIBCPP_INLINE_VISIBILITY1594 _LIBCPP_INLINE_VISIBILITY
1037 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT1595 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1038 {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}1596 {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
1039 _LIBCPP_INLINE_VISIBILITY1597 _LIBCPP_INLINE_VISIBILITY
1040 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1598 _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1041 {return __c11_atomic_fetch_xor(&this->__a_, __op, __m);}1599 {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);}
10421600
1043 _LIBCPP_INLINE_VISIBILITY1601 _LIBCPP_INLINE_VISIBILITY
1044 _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}1602 _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));}
...@@ -1120,17 +1678,17 @@ struct atomic<_Tp*>...@@ -1120,17 +1678,17 @@ struct atomic<_Tp*>
1120 _LIBCPP_INLINE_VISIBILITY1678 _LIBCPP_INLINE_VISIBILITY
1121 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)1679 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
1122 volatile _NOEXCEPT1680 volatile _NOEXCEPT
1123 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}1681 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
1124 _LIBCPP_INLINE_VISIBILITY1682 _LIBCPP_INLINE_VISIBILITY
1125 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1683 _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1126 {return __c11_atomic_fetch_add(&this->__a_, __op, __m);}1684 {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);}
1127 _LIBCPP_INLINE_VISIBILITY1685 _LIBCPP_INLINE_VISIBILITY
1128 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)1686 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
1129 volatile _NOEXCEPT1687 volatile _NOEXCEPT
1130 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}1688 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
1131 _LIBCPP_INLINE_VISIBILITY1689 _LIBCPP_INLINE_VISIBILITY
1132 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT1690 _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT
1133 {return __c11_atomic_fetch_sub(&this->__a_, __op, __m);}1691 {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);}
11341692
1135 _LIBCPP_INLINE_VISIBILITY1693 _LIBCPP_INLINE_VISIBILITY
1136 _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);}1694 _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);}
...@@ -1161,7 +1719,7 @@ struct atomic<_Tp*>...@@ -1161,7 +1719,7 @@ struct atomic<_Tp*>
1161// atomic_is_lock_free1719// atomic_is_lock_free
11621720
1163template <class _Tp>1721template <class _Tp>
1164inline _LIBCPP_INLINE_VISIBILITY1722_LIBCPP_INLINE_VISIBILITY
1165bool1723bool
1166atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT1724atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
1167{1725{
...@@ -1169,7 +1727,7 @@ atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT...@@ -1169,7 +1727,7 @@ atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT
1169}1727}
11701728
1171template <class _Tp>1729template <class _Tp>
1172inline _LIBCPP_INLINE_VISIBILITY1730_LIBCPP_INLINE_VISIBILITY
1173bool1731bool
1174atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT1732atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
1175{1733{
...@@ -1179,25 +1737,25 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT...@@ -1179,25 +1737,25 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
1179// atomic_init1737// atomic_init
11801738
1181template <class _Tp>1739template <class _Tp>
1182inline _LIBCPP_INLINE_VISIBILITY1740_LIBCPP_INLINE_VISIBILITY
1183void1741void
1184atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1742atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1185{1743{
1186 __c11_atomic_init(&__o->__a_, __d);1744 __cxx_atomic_init(&__o->__a_, __d);
1187}1745}
11881746
1189template <class _Tp>1747template <class _Tp>
1190inline _LIBCPP_INLINE_VISIBILITY1748_LIBCPP_INLINE_VISIBILITY
1191void1749void
1192atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1750atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1193{1751{
1194 __c11_atomic_init(&__o->__a_, __d);1752 __cxx_atomic_init(&__o->__a_, __d);
1195}1753}
11961754
1197// atomic_store1755// atomic_store
11981756
1199template <class _Tp>1757template <class _Tp>
1200inline _LIBCPP_INLINE_VISIBILITY1758_LIBCPP_INLINE_VISIBILITY
1201void1759void
1202atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1760atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1203{1761{
...@@ -1205,7 +1763,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT...@@ -1205,7 +1763,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1205}1763}
12061764
1207template <class _Tp>1765template <class _Tp>
1208inline _LIBCPP_INLINE_VISIBILITY1766_LIBCPP_INLINE_VISIBILITY
1209void1767void
1210atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1768atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1211{1769{
...@@ -1215,7 +1773,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT...@@ -1215,7 +1773,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1215// atomic_store_explicit1773// atomic_store_explicit
12161774
1217template <class _Tp>1775template <class _Tp>
1218inline _LIBCPP_INLINE_VISIBILITY1776_LIBCPP_INLINE_VISIBILITY
1219void1777void
1220atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT1778atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1221 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)1779 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
...@@ -1224,7 +1782,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE...@@ -1224,7 +1782,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE
1224}1782}
12251783
1226template <class _Tp>1784template <class _Tp>
1227inline _LIBCPP_INLINE_VISIBILITY1785_LIBCPP_INLINE_VISIBILITY
1228void1786void
1229atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT1787atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1230 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)1788 _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
...@@ -1235,7 +1793,7 @@ atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT...@@ -1235,7 +1793,7 @@ atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1235// atomic_load1793// atomic_load
12361794
1237template <class _Tp>1795template <class _Tp>
1238inline _LIBCPP_INLINE_VISIBILITY1796_LIBCPP_INLINE_VISIBILITY
1239_Tp1797_Tp
1240atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT1798atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
1241{1799{
...@@ -1243,7 +1801,7 @@ atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT...@@ -1243,7 +1801,7 @@ atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT
1243}1801}
12441802
1245template <class _Tp>1803template <class _Tp>
1246inline _LIBCPP_INLINE_VISIBILITY1804_LIBCPP_INLINE_VISIBILITY
1247_Tp1805_Tp
1248atomic_load(const atomic<_Tp>* __o) _NOEXCEPT1806atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
1249{1807{
...@@ -1253,7 +1811,7 @@ atomic_load(const atomic<_Tp>* __o) _NOEXCEPT...@@ -1253,7 +1811,7 @@ atomic_load(const atomic<_Tp>* __o) _NOEXCEPT
1253// atomic_load_explicit1811// atomic_load_explicit
12541812
1255template <class _Tp>1813template <class _Tp>
1256inline _LIBCPP_INLINE_VISIBILITY1814_LIBCPP_INLINE_VISIBILITY
1257_Tp1815_Tp
1258atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT1816atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
1259 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)1817 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
...@@ -1262,7 +1820,7 @@ atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEP...@@ -1262,7 +1820,7 @@ atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEP
1262}1820}
12631821
1264template <class _Tp>1822template <class _Tp>
1265inline _LIBCPP_INLINE_VISIBILITY1823_LIBCPP_INLINE_VISIBILITY
1266_Tp1824_Tp
1267atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT1825atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
1268 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)1826 _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
...@@ -1273,7 +1831,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT...@@ -1273,7 +1831,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
1273// atomic_exchange1831// atomic_exchange
12741832
1275template <class _Tp>1833template <class _Tp>
1276inline _LIBCPP_INLINE_VISIBILITY1834_LIBCPP_INLINE_VISIBILITY
1277_Tp1835_Tp
1278atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1836atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1279{1837{
...@@ -1281,7 +1839,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT...@@ -1281,7 +1839,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1281}1839}
12821840
1283template <class _Tp>1841template <class _Tp>
1284inline _LIBCPP_INLINE_VISIBILITY1842_LIBCPP_INLINE_VISIBILITY
1285_Tp1843_Tp
1286atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT1844atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1287{1845{
...@@ -1291,7 +1849,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT...@@ -1291,7 +1849,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
1291// atomic_exchange_explicit1849// atomic_exchange_explicit
12921850
1293template <class _Tp>1851template <class _Tp>
1294inline _LIBCPP_INLINE_VISIBILITY1852_LIBCPP_INLINE_VISIBILITY
1295_Tp1853_Tp
1296atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT1854atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1297{1855{
...@@ -1299,7 +1857,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _...@@ -1299,7 +1857,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _
1299}1857}
13001858
1301template <class _Tp>1859template <class _Tp>
1302inline _LIBCPP_INLINE_VISIBILITY1860_LIBCPP_INLINE_VISIBILITY
1303_Tp1861_Tp
1304atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT1862atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1305{1863{
...@@ -1309,7 +1867,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT...@@ -1309,7 +1867,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
1309// atomic_compare_exchange_weak1867// atomic_compare_exchange_weak
13101868
1311template <class _Tp>1869template <class _Tp>
1312inline _LIBCPP_INLINE_VISIBILITY1870_LIBCPP_INLINE_VISIBILITY
1313bool1871bool
1314atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT1872atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1315{1873{
...@@ -1317,7 +1875,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX...@@ -1317,7 +1875,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX
1317}1875}
13181876
1319template <class _Tp>1877template <class _Tp>
1320inline _LIBCPP_INLINE_VISIBILITY1878_LIBCPP_INLINE_VISIBILITY
1321bool1879bool
1322atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT1880atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1323{1881{
...@@ -1327,7 +1885,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT...@@ -1327,7 +1885,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1327// atomic_compare_exchange_strong1885// atomic_compare_exchange_strong
13281886
1329template <class _Tp>1887template <class _Tp>
1330inline _LIBCPP_INLINE_VISIBILITY1888_LIBCPP_INLINE_VISIBILITY
1331bool1889bool
1332atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT1890atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1333{1891{
...@@ -1335,7 +1893,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO...@@ -1335,7 +1893,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO
1335}1893}
13361894
1337template <class _Tp>1895template <class _Tp>
1338inline _LIBCPP_INLINE_VISIBILITY1896_LIBCPP_INLINE_VISIBILITY
1339bool1897bool
1340atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT1898atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1341{1899{
...@@ -1345,7 +1903,7 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT...@@ -1345,7 +1903,7 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
1345// atomic_compare_exchange_weak_explicit1903// atomic_compare_exchange_weak_explicit
13461904
1347template <class _Tp>1905template <class _Tp>
1348inline _LIBCPP_INLINE_VISIBILITY1906_LIBCPP_INLINE_VISIBILITY
1349bool1907bool
1350atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,1908atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
1351 _Tp __d,1909 _Tp __d,
...@@ -1356,7 +1914,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,...@@ -1356,7 +1914,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
1356}1914}
13571915
1358template <class _Tp>1916template <class _Tp>
1359inline _LIBCPP_INLINE_VISIBILITY1917_LIBCPP_INLINE_VISIBILITY
1360bool1918bool
1361atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,1919atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
1362 memory_order __s, memory_order __f) _NOEXCEPT1920 memory_order __s, memory_order __f) _NOEXCEPT
...@@ -1368,7 +1926,7 @@ atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,...@@ -1368,7 +1926,7 @@ atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
1368// atomic_compare_exchange_strong_explicit1926// atomic_compare_exchange_strong_explicit
13691927
1370template <class _Tp>1928template <class _Tp>
1371inline _LIBCPP_INLINE_VISIBILITY1929_LIBCPP_INLINE_VISIBILITY
1372bool1930bool
1373atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,1931atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
1374 _Tp* __e, _Tp __d,1932 _Tp* __e, _Tp __d,
...@@ -1379,7 +1937,7 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,...@@ -1379,7 +1937,7 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
1379}1937}
13801938
1381template <class _Tp>1939template <class _Tp>
1382inline _LIBCPP_INLINE_VISIBILITY1940_LIBCPP_INLINE_VISIBILITY
1383bool1941bool
1384atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,1942atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
1385 _Tp __d,1943 _Tp __d,
...@@ -1392,7 +1950,7 @@ atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,...@@ -1392,7 +1950,7 @@ atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
1392// atomic_fetch_add1950// atomic_fetch_add
13931951
1394template <class _Tp>1952template <class _Tp>
1395inline _LIBCPP_INLINE_VISIBILITY1953_LIBCPP_INLINE_VISIBILITY
1396typename enable_if1954typename enable_if
1397<1955<
1398 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,1956 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1404,7 +1962,7 @@ atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1404,7 +1962,7 @@ atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1404}1962}
14051963
1406template <class _Tp>1964template <class _Tp>
1407inline _LIBCPP_INLINE_VISIBILITY1965_LIBCPP_INLINE_VISIBILITY
1408typename enable_if1966typename enable_if
1409<1967<
1410 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,1968 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1416,7 +1974,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1416,7 +1974,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1416}1974}
14171975
1418template <class _Tp>1976template <class _Tp>
1419inline _LIBCPP_INLINE_VISIBILITY1977_LIBCPP_INLINE_VISIBILITY
1420_Tp*1978_Tp*
1421atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT1979atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1422{1980{
...@@ -1424,7 +1982,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT...@@ -1424,7 +1982,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1424}1982}
14251983
1426template <class _Tp>1984template <class _Tp>
1427inline _LIBCPP_INLINE_VISIBILITY1985_LIBCPP_INLINE_VISIBILITY
1428_Tp*1986_Tp*
1429atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT1987atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1430{1988{
...@@ -1434,7 +1992,7 @@ atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT...@@ -1434,7 +1992,7 @@ atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1434// atomic_fetch_add_explicit1992// atomic_fetch_add_explicit
14351993
1436template <class _Tp>1994template <class _Tp>
1437inline _LIBCPP_INLINE_VISIBILITY1995_LIBCPP_INLINE_VISIBILITY
1438typename enable_if1996typename enable_if
1439<1997<
1440 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,1998 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1446,7 +2004,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)...@@ -1446,7 +2004,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
1446}2004}
14472005
1448template <class _Tp>2006template <class _Tp>
1449inline _LIBCPP_INLINE_VISIBILITY2007_LIBCPP_INLINE_VISIBILITY
1450typename enable_if2008typename enable_if
1451<2009<
1452 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2010 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1458,7 +2016,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP...@@ -1458,7 +2016,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
1458}2016}
14592017
1460template <class _Tp>2018template <class _Tp>
1461inline _LIBCPP_INLINE_VISIBILITY2019_LIBCPP_INLINE_VISIBILITY
1462_Tp*2020_Tp*
1463atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,2021atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
1464 memory_order __m) _NOEXCEPT2022 memory_order __m) _NOEXCEPT
...@@ -1467,7 +2025,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,...@@ -1467,7 +2025,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
1467}2025}
14682026
1469template <class _Tp>2027template <class _Tp>
1470inline _LIBCPP_INLINE_VISIBILITY2028_LIBCPP_INLINE_VISIBILITY
1471_Tp*2029_Tp*
1472atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT2030atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
1473{2031{
...@@ -1477,7 +2035,7 @@ atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _...@@ -1477,7 +2035,7 @@ atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _
1477// atomic_fetch_sub2035// atomic_fetch_sub
14782036
1479template <class _Tp>2037template <class _Tp>
1480inline _LIBCPP_INLINE_VISIBILITY2038_LIBCPP_INLINE_VISIBILITY
1481typename enable_if2039typename enable_if
1482<2040<
1483 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2041 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1489,7 +2047,7 @@ atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1489,7 +2047,7 @@ atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1489}2047}
14902048
1491template <class _Tp>2049template <class _Tp>
1492inline _LIBCPP_INLINE_VISIBILITY2050_LIBCPP_INLINE_VISIBILITY
1493typename enable_if2051typename enable_if
1494<2052<
1495 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2053 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1501,7 +2059,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1501,7 +2059,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1501}2059}
15022060
1503template <class _Tp>2061template <class _Tp>
1504inline _LIBCPP_INLINE_VISIBILITY2062_LIBCPP_INLINE_VISIBILITY
1505_Tp*2063_Tp*
1506atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT2064atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1507{2065{
...@@ -1509,7 +2067,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT...@@ -1509,7 +2067,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1509}2067}
15102068
1511template <class _Tp>2069template <class _Tp>
1512inline _LIBCPP_INLINE_VISIBILITY2070_LIBCPP_INLINE_VISIBILITY
1513_Tp*2071_Tp*
1514atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT2072atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1515{2073{
...@@ -1519,7 +2077,7 @@ atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT...@@ -1519,7 +2077,7 @@ atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
1519// atomic_fetch_sub_explicit2077// atomic_fetch_sub_explicit
15202078
1521template <class _Tp>2079template <class _Tp>
1522inline _LIBCPP_INLINE_VISIBILITY2080_LIBCPP_INLINE_VISIBILITY
1523typename enable_if2081typename enable_if
1524<2082<
1525 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2083 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1531,7 +2089,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)...@@ -1531,7 +2089,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
1531}2089}
15322090
1533template <class _Tp>2091template <class _Tp>
1534inline _LIBCPP_INLINE_VISIBILITY2092_LIBCPP_INLINE_VISIBILITY
1535typename enable_if2093typename enable_if
1536<2094<
1537 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2095 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1543,7 +2101,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP...@@ -1543,7 +2101,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
1543}2101}
15442102
1545template <class _Tp>2103template <class _Tp>
1546inline _LIBCPP_INLINE_VISIBILITY2104_LIBCPP_INLINE_VISIBILITY
1547_Tp*2105_Tp*
1548atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,2106atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
1549 memory_order __m) _NOEXCEPT2107 memory_order __m) _NOEXCEPT
...@@ -1552,7 +2110,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,...@@ -1552,7 +2110,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
1552}2110}
15532111
1554template <class _Tp>2112template <class _Tp>
1555inline _LIBCPP_INLINE_VISIBILITY2113_LIBCPP_INLINE_VISIBILITY
1556_Tp*2114_Tp*
1557atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT2115atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
1558{2116{
...@@ -1562,7 +2120,7 @@ atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _...@@ -1562,7 +2120,7 @@ atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _
1562// atomic_fetch_and2120// atomic_fetch_and
15632121
1564template <class _Tp>2122template <class _Tp>
1565inline _LIBCPP_INLINE_VISIBILITY2123_LIBCPP_INLINE_VISIBILITY
1566typename enable_if2124typename enable_if
1567<2125<
1568 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2126 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1574,7 +2132,7 @@ atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1574,7 +2132,7 @@ atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1574}2132}
15752133
1576template <class _Tp>2134template <class _Tp>
1577inline _LIBCPP_INLINE_VISIBILITY2135_LIBCPP_INLINE_VISIBILITY
1578typename enable_if2136typename enable_if
1579<2137<
1580 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2138 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1588,7 +2146,7 @@ atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1588,7 +2146,7 @@ atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1588// atomic_fetch_and_explicit2146// atomic_fetch_and_explicit
15892147
1590template <class _Tp>2148template <class _Tp>
1591inline _LIBCPP_INLINE_VISIBILITY2149_LIBCPP_INLINE_VISIBILITY
1592typename enable_if2150typename enable_if
1593<2151<
1594 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2152 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1600,7 +2158,7 @@ atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)...@@ -1600,7 +2158,7 @@ atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
1600}2158}
16012159
1602template <class _Tp>2160template <class _Tp>
1603inline _LIBCPP_INLINE_VISIBILITY2161_LIBCPP_INLINE_VISIBILITY
1604typename enable_if2162typename enable_if
1605<2163<
1606 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2164 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1614,7 +2172,7 @@ atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP...@@ -1614,7 +2172,7 @@ atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
1614// atomic_fetch_or2172// atomic_fetch_or
16152173
1616template <class _Tp>2174template <class _Tp>
1617inline _LIBCPP_INLINE_VISIBILITY2175_LIBCPP_INLINE_VISIBILITY
1618typename enable_if2176typename enable_if
1619<2177<
1620 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2178 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1626,7 +2184,7 @@ atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1626,7 +2184,7 @@ atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1626}2184}
16272185
1628template <class _Tp>2186template <class _Tp>
1629inline _LIBCPP_INLINE_VISIBILITY2187_LIBCPP_INLINE_VISIBILITY
1630typename enable_if2188typename enable_if
1631<2189<
1632 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2190 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1640,7 +2198,7 @@ atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1640,7 +2198,7 @@ atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1640// atomic_fetch_or_explicit2198// atomic_fetch_or_explicit
16412199
1642template <class _Tp>2200template <class _Tp>
1643inline _LIBCPP_INLINE_VISIBILITY2201_LIBCPP_INLINE_VISIBILITY
1644typename enable_if2202typename enable_if
1645<2203<
1646 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2204 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1652,7 +2210,7 @@ atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)...@@ -1652,7 +2210,7 @@ atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
1652}2210}
16532211
1654template <class _Tp>2212template <class _Tp>
1655inline _LIBCPP_INLINE_VISIBILITY2213_LIBCPP_INLINE_VISIBILITY
1656typename enable_if2214typename enable_if
1657<2215<
1658 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2216 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1666,7 +2224,7 @@ atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT...@@ -1666,7 +2224,7 @@ atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
1666// atomic_fetch_xor2224// atomic_fetch_xor
16672225
1668template <class _Tp>2226template <class _Tp>
1669inline _LIBCPP_INLINE_VISIBILITY2227_LIBCPP_INLINE_VISIBILITY
1670typename enable_if2228typename enable_if
1671<2229<
1672 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2230 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1678,7 +2236,7 @@ atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1678,7 +2236,7 @@ atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1678}2236}
16792237
1680template <class _Tp>2238template <class _Tp>
1681inline _LIBCPP_INLINE_VISIBILITY2239_LIBCPP_INLINE_VISIBILITY
1682typename enable_if2240typename enable_if
1683<2241<
1684 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2242 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1692,7 +2250,7 @@ atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT...@@ -1692,7 +2250,7 @@ atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
1692// atomic_fetch_xor_explicit2250// atomic_fetch_xor_explicit
16932251
1694template <class _Tp>2252template <class _Tp>
1695inline _LIBCPP_INLINE_VISIBILITY2253_LIBCPP_INLINE_VISIBILITY
1696typename enable_if2254typename enable_if
1697<2255<
1698 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2256 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1704,7 +2262,7 @@ atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)...@@ -1704,7 +2262,7 @@ atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m)
1704}2262}
17052263
1706template <class _Tp>2264template <class _Tp>
1707inline _LIBCPP_INLINE_VISIBILITY2265_LIBCPP_INLINE_VISIBILITY
1708typename enable_if2266typename enable_if
1709<2267<
1710 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,2268 is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
...@@ -1719,27 +2277,23 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP...@@ -1719,27 +2277,23 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
17192277
1720typedef struct atomic_flag2278typedef struct atomic_flag
1721{2279{
1722 _Atomic(bool) __a_;2280 __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
17232281
1724 _LIBCPP_INLINE_VISIBILITY2282 _LIBCPP_INLINE_VISIBILITY
1725 bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT2283 bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1726 {return __c11_atomic_exchange(&__a_, true, __m);}2284 {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
1727 _LIBCPP_INLINE_VISIBILITY2285 _LIBCPP_INLINE_VISIBILITY
1728 bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT2286 bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT
1729 {return __c11_atomic_exchange(&__a_, true, __m);}2287 {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);}
1730 _LIBCPP_INLINE_VISIBILITY2288 _LIBCPP_INLINE_VISIBILITY
1731 void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT2289 void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
1732 {__c11_atomic_store(&__a_, false, __m);}2290 {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
1733 _LIBCPP_INLINE_VISIBILITY2291 _LIBCPP_INLINE_VISIBILITY
1734 void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT2292 void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT
1735 {__c11_atomic_store(&__a_, false, __m);}2293 {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);}
17362294
1737 _LIBCPP_INLINE_VISIBILITY2295 _LIBCPP_INLINE_VISIBILITY
1738#ifndef _LIBCPP_CXX03_LANG2296 atomic_flag() _NOEXCEPT _LIBCPP_DEFAULT
1739 atomic_flag() _NOEXCEPT = default;
1740#else
1741 atomic_flag() _NOEXCEPT : __a_() {}
1742#endif // _LIBCPP_CXX03_LANG
17432297
1744 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR2298 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
1745 atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION2299 atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
...@@ -1818,14 +2372,14 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -1818,14 +2372,14 @@ inline _LIBCPP_INLINE_VISIBILITY
1818void2372void
1819atomic_thread_fence(memory_order __m) _NOEXCEPT2373atomic_thread_fence(memory_order __m) _NOEXCEPT
1820{2374{
1821 __c11_atomic_thread_fence(__m);2375 __cxx_atomic_thread_fence(__m);
1822}2376}
18232377
1824inline _LIBCPP_INLINE_VISIBILITY2378inline _LIBCPP_INLINE_VISIBILITY
1825void2379void
1826atomic_signal_fence(memory_order __m) _NOEXCEPT2380atomic_signal_fence(memory_order __m) _NOEXCEPT
1827{2381{
1828 __c11_atomic_signal_fence(__m);2382 __cxx_atomic_signal_fence(__m);
1829}2383}
18302384
1831// Atomics for standard typedef types2385// Atomics for standard typedef types
lib/libcxx/include/bit+339-32
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ bit ----------------------------------===//2//===------------------------------ bit ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===---------------------------------------------------------------------===//8//===---------------------------------------------------------------------===//
109
...@@ -16,12 +15,42 @@...@@ -16,12 +15,42 @@
1615
17namespace std {16namespace std {
1817
18 template <class T>
19 constexpr bool ispow2(T x) noexcept; // C++20
20 template <class T>
21 constexpr T ceil2(T x); // C++20
22 template <class T>
23 constexpr T floor2(T x) noexcept; // C++20
24 template <class T>
25 constexpr T log2p1(T x) noexcept; // C++20
26
27 // 23.20.2, rotating
28 template<class T>
29 constexpr T rotl(T x, unsigned int s) noexcept; // C++20
30 template<class T>
31 constexpr T rotr(T x, unsigned int s) noexcept; // C++20
32
33 // 23.20.3, counting
34 template<class T>
35 constexpr int countl_zero(T x) noexcept; // C++20
36 template<class T>
37 constexpr int countl_one(T x) noexcept; // C++20
38 template<class T>
39 constexpr int countr_zero(T x) noexcept; // C++20
40 template<class T>
41 constexpr int countr_one(T x) noexcept; // C++20
42 template<class T>
43 constexpr int popcount(T x) noexcept; // C++20
44
19} // namespace std45} // namespace std
2046
21*/47*/
2248
23#include <__config>49#include <__config>
50#include <limits>
51#include <type_traits>
24#include <version>52#include <version>
53#include <__debug>
2554
26#if defined(__IBMCPP__)55#if defined(__IBMCPP__)
27#include "support/ibm/support.h"56#include "support/ibm/support.h"
...@@ -34,44 +63,47 @@ namespace std {...@@ -34,44 +63,47 @@ namespace std {
34#pragma GCC system_header63#pragma GCC system_header
35#endif64#endif
3665
66_LIBCPP_PUSH_MACROS
67#include <__undef_macros>
68
37_LIBCPP_BEGIN_NAMESPACE_STD69_LIBCPP_BEGIN_NAMESPACE_STD
3870
39#ifndef _LIBCPP_COMPILER_MSVC71#ifndef _LIBCPP_COMPILER_MSVC
4072
41inline _LIBCPP_INLINE_VISIBILITY73inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
42int __ctz(unsigned __x) { return __builtin_ctz(__x); }74int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); }
4375
44inline _LIBCPP_INLINE_VISIBILITY76inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
45int __ctz(unsigned long __x) { return __builtin_ctzl(__x); }77int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); }
4678
47inline _LIBCPP_INLINE_VISIBILITY79inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
48int __ctz(unsigned long long __x) { return __builtin_ctzll(__x); }80int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); }
4981
5082
51inline _LIBCPP_INLINE_VISIBILITY83inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
52int __clz(unsigned __x) { return __builtin_clz(__x); }84int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); }
5385
54inline _LIBCPP_INLINE_VISIBILITY86inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
55int __clz(unsigned long __x) { return __builtin_clzl(__x); }87int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); }
5688
57inline _LIBCPP_INLINE_VISIBILITY89inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
58int __clz(unsigned long long __x) { return __builtin_clzll(__x); }90int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); }
5991
6092
61inline _LIBCPP_INLINE_VISIBILITY93inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
62int __popcount(unsigned __x) { return __builtin_popcount(__x); }94int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
6395
64inline _LIBCPP_INLINE_VISIBILITY96inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
65int __popcount(unsigned long __x) { return __builtin_popcountl(__x); }97int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
6698
67inline _LIBCPP_INLINE_VISIBILITY99inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
68int __popcount(unsigned long long __x) { return __builtin_popcountll(__x); }100int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); }
69101
70#else // _LIBCPP_COMPILER_MSVC102#else // _LIBCPP_COMPILER_MSVC
71103
72// Precondition: __x != 0104// Precondition: __x != 0
73inline _LIBCPP_INLINE_VISIBILITY105inline _LIBCPP_INLINE_VISIBILITY
74int __ctz(unsigned __x) {106int __libcpp_ctz(unsigned __x) {
75 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");107 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
76 static_assert(sizeof(unsigned long) == 4, "");108 static_assert(sizeof(unsigned long) == 4, "");
77 unsigned long __where;109 unsigned long __where;
...@@ -81,13 +113,13 @@ int __ctz(unsigned __x) {...@@ -81,13 +113,13 @@ int __ctz(unsigned __x) {
81}113}
82114
83inline _LIBCPP_INLINE_VISIBILITY115inline _LIBCPP_INLINE_VISIBILITY
84int __ctz(unsigned long __x) {116int __libcpp_ctz(unsigned long __x) {
85 static_assert(sizeof(unsigned long) == sizeof(unsigned), "");117 static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
86 return __ctz(static_cast<unsigned>(__x));118 return __ctz(static_cast<unsigned>(__x));
87}119}
88120
89inline _LIBCPP_INLINE_VISIBILITY121inline _LIBCPP_INLINE_VISIBILITY
90int __ctz(unsigned long long __x) {122int __libcpp_ctz(unsigned long long __x) {
91 unsigned long __where;123 unsigned long __where;
92#if defined(_LIBCPP_HAS_BITSCAN64)124#if defined(_LIBCPP_HAS_BITSCAN64)
93 (defined(_M_AMD64) || defined(__x86_64__))125 (defined(_M_AMD64) || defined(__x86_64__))
...@@ -105,7 +137,7 @@ int __ctz(unsigned long long __x) {...@@ -105,7 +137,7 @@ int __ctz(unsigned long long __x) {
105137
106// Precondition: __x != 0138// Precondition: __x != 0
107inline _LIBCPP_INLINE_VISIBILITY139inline _LIBCPP_INLINE_VISIBILITY
108int __clz(unsigned __x) {140int __libcpp_clz(unsigned __x) {
109 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");141 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
110 static_assert(sizeof(unsigned long) == 4, "");142 static_assert(sizeof(unsigned long) == 4, "");
111 unsigned long __where;143 unsigned long __where;
...@@ -115,13 +147,13 @@ int __clz(unsigned __x) {...@@ -115,13 +147,13 @@ int __clz(unsigned __x) {
115}147}
116148
117inline _LIBCPP_INLINE_VISIBILITY149inline _LIBCPP_INLINE_VISIBILITY
118int __clz(unsigned long __x) {150int __libcpp_clz(unsigned long __x) {
119 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");151 static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
120 return __clz(static_cast<unsigned>(__x));152 return __libcpp_clz(static_cast<unsigned>(__x));
121}153}
122154
123inline _LIBCPP_INLINE_VISIBILITY155inline _LIBCPP_INLINE_VISIBILITY
124int __clz(unsigned long long __x) {156int __libcpp_clz(unsigned long long __x) {
125 unsigned long __where;157 unsigned long __where;
126#if defined(_LIBCPP_HAS_BITSCAN64)158#if defined(_LIBCPP_HAS_BITSCAN64)
127 if (_BitScanReverse64(&__where, __x))159 if (_BitScanReverse64(&__where, __x))
...@@ -136,23 +168,298 @@ int __clz(unsigned long long __x) {...@@ -136,23 +168,298 @@ int __clz(unsigned long long __x) {
136 return 64; // Undefined Behavior.168 return 64; // Undefined Behavior.
137}169}
138170
139inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned __x) {171inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) {
140 static_assert(sizeof(unsigned) == 4, "");172 static_assert(sizeof(unsigned) == 4, "");
141 return __popcnt(__x);173 return __popcnt(__x);
142}174}
143175
144inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long __x) {176inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) {
145 static_assert(sizeof(unsigned long) == 4, "");177 static_assert(sizeof(unsigned long) == 4, "");
146 return __popcnt(__x);178 return __popcnt(__x);
147}179}
148180
149inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long long __x) {181inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) {
150 static_assert(sizeof(unsigned long long) == 8, "");182 static_assert(sizeof(unsigned long long) == 8, "");
151 return __popcnt64(__x);183 return __popcnt64(__x);
152}184}
153185
154#endif // _LIBCPP_COMPILER_MSVC186#endif // _LIBCPP_COMPILER_MSVC
155187
188template <class _Tp>
189using __bitop_unsigned_integer _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
190 is_integral<_Tp>::value &&
191 is_unsigned<_Tp>::value &&
192 _IsNotSame<typename remove_cv<_Tp>::type, bool>::value &&
193 _IsNotSame<typename remove_cv<_Tp>::type, signed char>::value &&
194 _IsNotSame<typename remove_cv<_Tp>::type, wchar_t>::value &&
195 _IsNotSame<typename remove_cv<_Tp>::type, char16_t>::value &&
196 _IsNotSame<typename remove_cv<_Tp>::type, char32_t>::value
197 >;
198
199
200template<class _Tp>
201_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
202_Tp __rotl(_Tp __t, unsigned int __cnt) _NOEXCEPT
203{
204 static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotl requires unsigned");
205 const unsigned int __dig = numeric_limits<_Tp>::digits;
206 if ((__cnt % __dig) == 0)
207 return __t;
208 return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig)));
209}
210
211
212template<class _Tp>
213_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
214_Tp __rotr(_Tp __t, unsigned int __cnt) _NOEXCEPT
215{
216 static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotr requires unsigned");
217 const unsigned int __dig = numeric_limits<_Tp>::digits;
218 if ((__cnt % __dig) == 0)
219 return __t;
220 return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig)));
221}
222
223
224
225template<class _Tp>
226_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
227int __countr_zero(_Tp __t) _NOEXCEPT
228{
229 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned");
230 if (__t == 0)
231 return numeric_limits<_Tp>::digits;
232
233 if (sizeof(_Tp) <= sizeof(unsigned int))
234 return __libcpp_ctz(static_cast<unsigned int>(__t));
235 else if (sizeof(_Tp) <= sizeof(unsigned long))
236 return __libcpp_ctz(static_cast<unsigned long>(__t));
237 else if (sizeof(_Tp) <= sizeof(unsigned long long))
238 return __libcpp_ctz(static_cast<unsigned long long>(__t));
239 else
240 {
241 int __ret = 0;
242 int __iter = 0;
243 const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
244 while ((__iter = __libcpp_ctz(static_cast<unsigned long long>(__t))) == __ulldigits)
245 {
246 __ret += __iter;
247 __t >>= __ulldigits;
248 }
249 return __ret + __iter;
250 }
251}
252
253template<class _Tp>
254_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
255int __countl_zero(_Tp __t) _NOEXCEPT
256{
257 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned");
258 if (__t == 0)
259 return numeric_limits<_Tp>::digits;
260
261 if (sizeof(_Tp) <= sizeof(unsigned int))
262 return __libcpp_clz(static_cast<unsigned int>(__t))
263 - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits);
264 else if (sizeof(_Tp) <= sizeof(unsigned long))
265 return __libcpp_clz(static_cast<unsigned long>(__t))
266 - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits);
267 else if (sizeof(_Tp) <= sizeof(unsigned long long))
268 return __libcpp_clz(static_cast<unsigned long long>(__t))
269 - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits);
270 else
271 {
272 int __ret = 0;
273 int __iter = 0;
274 const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits;
275 while (true) {
276 __t = __rotr(__t, __ulldigits);
277 if ((__iter = __countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits)
278 break;
279 __ret += __iter;
280 }
281 return __ret + __iter;
282 }
283}
284
285template<class _Tp>
286_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
287int __countl_one(_Tp __t) _NOEXCEPT
288{
289 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_one requires unsigned");
290 return __t != numeric_limits<_Tp>::max()
291 ? __countl_zero(static_cast<_Tp>(~__t))
292 : numeric_limits<_Tp>::digits;
293}
294
295
296template<class _Tp>
297_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
298int __countr_one(_Tp __t) _NOEXCEPT
299{
300 static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_one requires unsigned");
301 return __t != numeric_limits<_Tp>::max()
302 ? __countr_zero(static_cast<_Tp>(~__t))
303 : numeric_limits<_Tp>::digits;
304}
305
306
307template<class _Tp>
308_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
309int
310__popcount(_Tp __t) _NOEXCEPT
311{
312 static_assert(__bitop_unsigned_integer<_Tp>::value, "__libcpp_popcount requires unsigned");
313 if (sizeof(_Tp) <= sizeof(unsigned int))
314 return __libcpp_popcount(static_cast<unsigned int>(__t));
315 else if (sizeof(_Tp) <= sizeof(unsigned long))
316 return __libcpp_popcount(static_cast<unsigned long>(__t));
317 else if (sizeof(_Tp) <= sizeof(unsigned long long))
318 return __libcpp_popcount(static_cast<unsigned long long>(__t));
319 else
320 {
321 int __ret = 0;
322 while (__t != 0)
323 {
324 __ret += __libcpp_popcount(static_cast<unsigned long long>(__t));
325 __t >>= numeric_limits<unsigned long long>::digits;
326 }
327 return __ret;
328 }
329}
330
331
332// integral log base 2
333template<class _Tp>
334_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
335unsigned __bit_log2(_Tp __t) _NOEXCEPT
336{
337 static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
338 return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
339}
340
341template <class _Tp>
342_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
343bool __ispow2(_Tp __t) _NOEXCEPT
344{
345 static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
346 return __t != 0 && (((__t & (__t - 1)) == 0));
347}
348
349
350#if _LIBCPP_STD_VER > 17
351
352template<class _Tp>
353_LIBCPP_INLINE_VISIBILITY constexpr
354enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
355rotl(_Tp __t, unsigned int __cnt) noexcept
356{
357 return __rotl(__t, __cnt);
358}
359
360
361// rotr
362template<class _Tp>
363_LIBCPP_INLINE_VISIBILITY constexpr
364enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
365rotr(_Tp __t, unsigned int __cnt) noexcept
366{
367 return __rotr(__t, __cnt);
368}
369
370
371template<class _Tp>
372_LIBCPP_INLINE_VISIBILITY constexpr
373enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
374countl_zero(_Tp __t) noexcept
375{
376 return __countl_zero(__t);
377}
378
379
380template<class _Tp>
381_LIBCPP_INLINE_VISIBILITY constexpr
382enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
383countl_one(_Tp __t) noexcept
384{
385 return __countl_one(__t);
386}
387
388
389template<class _Tp>
390_LIBCPP_INLINE_VISIBILITY constexpr
391enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
392countr_zero(_Tp __t) noexcept
393{
394 return __countr_zero(__t);
395}
396
397
398template<class _Tp>
399_LIBCPP_INLINE_VISIBILITY constexpr
400enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
401countr_one(_Tp __t) noexcept
402{
403 return __countr_one(__t);
404}
405
406
407template<class _Tp>
408_LIBCPP_INLINE_VISIBILITY constexpr
409enable_if_t<__bitop_unsigned_integer<_Tp>::value, int>
410popcount(_Tp __t) noexcept
411{
412 return __popcount(__t);
413}
414
415
416template <class _Tp>
417_LIBCPP_INLINE_VISIBILITY constexpr
418enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
419ispow2(_Tp __t) noexcept
420{
421 return __ispow2(__t);
422}
423
424template <class _Tp>
425_LIBCPP_INLINE_VISIBILITY constexpr
426enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
427floor2(_Tp __t) noexcept
428{
429 return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
430}
431
432template <class _Tp>
433_LIBCPP_INLINE_VISIBILITY constexpr
434enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
435ceil2(_Tp __t) noexcept
436{
437 if (__t < 2) return 1;
438 const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u));
439 _LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2");
440
441 if constexpr (sizeof(_Tp) >= sizeof(unsigned))
442 return _Tp{1} << __n;
443 else
444 {
445 const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
446 const unsigned __retVal = 1u << (__n + __extra);
447 return (_Tp) (__retVal >> __extra);
448 }
449}
450
451template <class _Tp>
452_LIBCPP_INLINE_VISIBILITY constexpr
453enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
454log2p1(_Tp __t) noexcept
455{
456 return __t == 0 ? 0 : __bit_log2(__t) + 1;
457}
458
459#endif // _LIBCPP_STD_VER > 17
460
156_LIBCPP_END_NAMESPACE_STD461_LIBCPP_END_NAMESPACE_STD
157462
463_LIBCPP_POP_MACROS
464
158#endif // _LIBCPP_BIT465#endif // _LIBCPP_BIT
lib/libcxx/include/bitset+5-6
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- bitset ----------------------------------===//2//===---------------------------- bitset ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -680,7 +679,7 @@ public:...@@ -680,7 +679,7 @@ public:
680 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}679 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
681 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR680 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
682 bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}681 bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
683 template<class _CharT>682 template<class _CharT, class = _EnableIf<_IsCharLikeType<_CharT>::value> >
684 explicit bitset(const _CharT* __str,683 explicit bitset(const _CharT* __str,
685 typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,684 typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
686 _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));685 _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
...@@ -761,7 +760,7 @@ private:...@@ -761,7 +760,7 @@ private:
761};760};
762761
763template <size_t _Size>762template <size_t _Size>
764template<class _CharT>763template<class _CharT, class>
765bitset<_Size>::bitset(const _CharT* __str,764bitset<_Size>::bitset(const _CharT* __str,
766 typename basic_string<_CharT>::size_type __n,765 typename basic_string<_CharT>::size_type __n,
767 _CharT __zero, _CharT __one)766 _CharT __zero, _CharT __one)
lib/libcxx/include/cassert+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- cassert -----------------------------------===//2//===-------------------------- cassert -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ccomplex+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- ccomplex ---------------------------------===//2//===--------------------------- ccomplex ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cctype+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- cctype ----------------------------------===//2//===---------------------------- cctype ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cerrno+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- cerrno ------------------------------------===//2//===-------------------------- cerrno ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cfenv+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- cfenv -----------------------------------===//2//===---------------------------- cfenv -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cfloat+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cfloat -----------------------------------===//2//===--------------------------- cfloat -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/charconv+21-22
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ charconv ------------------------------===//2//===------------------------------ charconv ------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -97,7 +96,7 @@ _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);...@@ -97,7 +96,7 @@ _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);
97_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);96_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);
98}97}
9998
100#if _LIBCPP_STD_VER > 1199#ifndef _LIBCPP_CXX03_LANG
101100
102enum class _LIBCPP_ENUM_VIS chars_format101enum class _LIBCPP_ENUM_VIS chars_format
103{102{
...@@ -125,7 +124,7 @@ void from_chars(const char*, const char*, bool, int = 10) = delete;...@@ -125,7 +124,7 @@ void from_chars(const char*, const char*, bool, int = 10) = delete;
125namespace __itoa124namespace __itoa
126{125{
127126
128static constexpr uint64_t __pow10_64[] = {127static _LIBCPP_CONSTEXPR uint64_t __pow10_64[] = {
129 UINT64_C(0),128 UINT64_C(0),
130 UINT64_C(10),129 UINT64_C(10),
131 UINT64_C(100),130 UINT64_C(100),
...@@ -148,7 +147,7 @@ static constexpr uint64_t __pow10_64[] = {...@@ -148,7 +147,7 @@ static constexpr uint64_t __pow10_64[] = {
148 UINT64_C(10000000000000000000),147 UINT64_C(10000000000000000000),
149};148};
150149
151static constexpr uint32_t __pow10_32[] = {150static _LIBCPP_CONSTEXPR uint32_t __pow10_32[] = {
152 UINT32_C(0), UINT32_C(10), UINT32_C(100),151 UINT32_C(0), UINT32_C(10), UINT32_C(100),
153 UINT32_C(1000), UINT32_C(10000), UINT32_C(100000),152 UINT32_C(1000), UINT32_C(10000), UINT32_C(100000),
154 UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000),153 UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000),
...@@ -173,7 +172,7 @@ struct _LIBCPP_HIDDEN __traits_base...@@ -173,7 +172,7 @@ struct _LIBCPP_HIDDEN __traits_base
173 return __u64toa(__v, __p);172 return __u64toa(__v, __p);
174 }173 }
175174
176 static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_64; }175 static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_64)& __pow() { return __pow10_64; }
177};176};
178177
179template <typename _Tp>178template <typename _Tp>
...@@ -195,7 +194,7 @@ struct _LIBCPP_HIDDEN...@@ -195,7 +194,7 @@ struct _LIBCPP_HIDDEN
195 return __u32toa(__v, __p);194 return __u32toa(__v, __p);
196 }195 }
197196
198 static _LIBCPP_INLINE_VISIBILITY auto& __pow() { return __pow10_32; }197 static _LIBCPP_INLINE_VISIBILITY decltype(__pow10_32)& __pow() { return __pow10_32; }
199};198};
200199
201template <typename _Tp>200template <typename _Tp>
...@@ -240,7 +239,7 @@ __mul_overflowed(_Tp __a, _Up __b, _Tp& __r)...@@ -240,7 +239,7 @@ __mul_overflowed(_Tp __a, _Up __b, _Tp& __r)
240template <typename _Tp>239template <typename _Tp>
241struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>240struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp>
242{241{
243 static constexpr int digits = numeric_limits<_Tp>::digits10 + 1;242 static _LIBCPP_CONSTEXPR int digits = numeric_limits<_Tp>::digits10 + 1;
244 using __traits_base<_Tp>::__pow;243 using __traits_base<_Tp>::__pow;
245 using typename __traits_base<_Tp>::type;244 using typename __traits_base<_Tp>::type;
246245
...@@ -286,10 +285,10 @@ __complement(_Tp __x)...@@ -286,10 +285,10 @@ __complement(_Tp __x)
286}285}
287286
288template <typename _Tp>287template <typename _Tp>
289inline _LIBCPP_INLINE_VISIBILITY auto288inline _LIBCPP_INLINE_VISIBILITY typename make_unsigned<_Tp>::type
290__to_unsigned(_Tp __x)289__to_unsigned(_Tp __x)
291{290{
292 return static_cast<make_unsigned_t<_Tp>>(__x);291 return static_cast<typename make_unsigned<_Tp>::type>(__x);
293}292}
294293
295template <typename _Tp>294template <typename _Tp>
...@@ -315,7 +314,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)...@@ -315,7 +314,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
315314
316#if !defined(_LIBCPP_COMPILER_MSVC)315#if !defined(_LIBCPP_COMPILER_MSVC)
317 if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)316 if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
318 return {__tx::__convert(__value, __first), {}};317 return {__tx::__convert(__value, __first), errc(0)};
319 else318 else
320 return {__last, errc::value_too_large};319 return {__last, errc::value_too_large};
321#else320#else
...@@ -380,14 +379,14 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,...@@ -380,14 +379,14 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
380 }379 }
381}380}
382381
383template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>382template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
384inline _LIBCPP_INLINE_VISIBILITY to_chars_result383inline _LIBCPP_INLINE_VISIBILITY to_chars_result
385to_chars(char* __first, char* __last, _Tp __value)384to_chars(char* __first, char* __last, _Tp __value)
386{385{
387 return __to_chars_itoa(__first, __last, __value, is_signed<_Tp>());386 return __to_chars_itoa(__first, __last, __value, is_signed<_Tp>());
388}387}
389388
390template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>389template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
391inline _LIBCPP_INLINE_VISIBILITY to_chars_result390inline _LIBCPP_INLINE_VISIBILITY to_chars_result
392to_chars(char* __first, char* __last, _Tp __value, int __base)391to_chars(char* __first, char* __last, _Tp __value, int __base)
393{392{
...@@ -502,7 +501,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f,...@@ -502,7 +501,7 @@ __subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f,
502 return __r;501 return __r;
503}502}
504503
505template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>504template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
506inline _LIBCPP_INLINE_VISIBILITY from_chars_result505inline _LIBCPP_INLINE_VISIBILITY from_chars_result
507__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)506__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
508{507{
...@@ -528,7 +527,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)...@@ -528,7 +527,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
528 });527 });
529}528}
530529
531template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>530template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
532inline _LIBCPP_INLINE_VISIBILITY from_chars_result531inline _LIBCPP_INLINE_VISIBILITY from_chars_result
533__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)532__from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
534{533{
...@@ -536,7 +535,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)...@@ -536,7 +535,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
536 return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);535 return __sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
537}536}
538537
539template <typename _Tp, enable_if_t<is_unsigned<_Tp>::value, int> = 0>538template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0>
540inline _LIBCPP_INLINE_VISIBILITY from_chars_result539inline _LIBCPP_INLINE_VISIBILITY from_chars_result
541__from_chars_integral(const char* __first, const char* __last, _Tp& __value,540__from_chars_integral(const char* __first, const char* __last, _Tp& __value,
542 int __base)541 int __base)
...@@ -583,7 +582,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,...@@ -583,7 +582,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
583 __base);582 __base);
584}583}
585584
586template <typename _Tp, enable_if_t<is_signed<_Tp>::value, int> = 0>585template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0>
587inline _LIBCPP_INLINE_VISIBILITY from_chars_result586inline _LIBCPP_INLINE_VISIBILITY from_chars_result
588__from_chars_integral(const char* __first, const char* __last, _Tp& __value,587__from_chars_integral(const char* __first, const char* __last, _Tp& __value,
589 int __base)588 int __base)
...@@ -593,14 +592,14 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,...@@ -593,14 +592,14 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
593 __from_chars_integral<__t>, __base);592 __from_chars_integral<__t>, __base);
594}593}
595594
596template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>595template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
597inline _LIBCPP_INLINE_VISIBILITY from_chars_result596inline _LIBCPP_INLINE_VISIBILITY from_chars_result
598from_chars(const char* __first, const char* __last, _Tp& __value)597from_chars(const char* __first, const char* __last, _Tp& __value)
599{598{
600 return __from_chars_atoi(__first, __last, __value);599 return __from_chars_atoi(__first, __last, __value);
601}600}
602601
603template <typename _Tp, enable_if_t<is_integral<_Tp>::value, int> = 0>602template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
604inline _LIBCPP_INLINE_VISIBILITY from_chars_result603inline _LIBCPP_INLINE_VISIBILITY from_chars_result
605from_chars(const char* __first, const char* __last, _Tp& __value, int __base)604from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
606{605{
...@@ -608,7 +607,7 @@ from_chars(const char* __first, const char* __last, _Tp& __value, int __base)...@@ -608,7 +607,7 @@ from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
608 return __from_chars_integral(__first, __last, __value, __base);607 return __from_chars_integral(__first, __last, __value, __base);
609}608}
610609
611#endif // _LIBCPP_STD_VER > 11610#endif // _LIBCPP_CXX03_LANG
612611
613_LIBCPP_END_NAMESPACE_STD612_LIBCPP_END_NAMESPACE_STD
614613
lib/libcxx/include/chrono+47-62
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- chrono ----------------------------------===//2//===---------------------------- chrono ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -1263,34 +1262,15 @@ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)...@@ -1263,34 +1262,15 @@ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
12631262
1264// Duration /1263// Duration /
12651264
1266template <class _Duration, class _Rep, bool = __is_duration<_Rep>::value>
1267struct __duration_divide_result
1268{
1269};
1270
1271template <class _Duration, class _Rep2,
1272 bool = is_convertible<_Rep2,
1273 typename common_type<typename _Duration::rep, _Rep2>::type>::value>
1274struct __duration_divide_imp
1275{
1276};
1277
1278template <class _Rep1, class _Period, class _Rep2>
1279struct __duration_divide_imp<duration<_Rep1, _Period>, _Rep2, true>
1280{
1281 typedef duration<typename common_type<_Rep1, _Rep2>::type, _Period> type;
1282};
1283
1284template <class _Rep1, class _Period, class _Rep2>
1285struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
1286 : __duration_divide_imp<duration<_Rep1, _Period>, _Rep2>
1287{
1288};
1289
1290template <class _Rep1, class _Period, class _Rep2>1265template <class _Rep1, class _Period, class _Rep2>
1291inline _LIBCPP_INLINE_VISIBILITY1266inline _LIBCPP_INLINE_VISIBILITY
1292_LIBCPP_CONSTEXPR1267_LIBCPP_CONSTEXPR
1293typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type1268typename enable_if
1269<
1270 !__is_duration<_Rep2>::value &&
1271 is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
1272 duration<typename common_type<_Rep1, _Rep2>::type, _Period>
1273>::type
1294operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)1274operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
1295{1275{
1296 typedef typename common_type<_Rep1, _Rep2>::type _Cr;1276 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
...@@ -1313,7 +1293,12 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2...@@ -1313,7 +1293,12 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
1313template <class _Rep1, class _Period, class _Rep2>1293template <class _Rep1, class _Period, class _Rep2>
1314inline _LIBCPP_INLINE_VISIBILITY1294inline _LIBCPP_INLINE_VISIBILITY
1315_LIBCPP_CONSTEXPR1295_LIBCPP_CONSTEXPR
1316typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type1296typename enable_if
1297<
1298 !__is_duration<_Rep2>::value &&
1299 is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
1300 duration<typename common_type<_Rep1, _Rep2>::type, _Period>
1301>::type
1317operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)1302operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
1318{1303{
1319 typedef typename common_type<_Rep1, _Rep2>::type _Cr;1304 typedef typename common_type<_Rep1, _Rep2>::type _Cr;
...@@ -1605,9 +1590,9 @@ using local_seconds = local_time<seconds>;...@@ -1605,9 +1590,9 @@ using local_seconds = local_time<seconds>;
1605using local_days = local_time<days>;1590using local_days = local_time<days>;
16061591
16071592
1608struct _LIBCPP_TYPE_VIS last_spec { explicit last_spec() = default; };1593struct last_spec { explicit last_spec() = default; };
16091594
1610class _LIBCPP_TYPE_VIS day {1595class day {
1611private:1596private:
1612 unsigned char __d;1597 unsigned char __d;
1613public:1598public:
...@@ -1672,7 +1657,7 @@ inline constexpr day& day::operator-=(const days& __dd) noexcept...@@ -1672,7 +1657,7 @@ inline constexpr day& day::operator-=(const days& __dd) noexcept
1672{ *this = *this - __dd; return *this; }1657{ *this = *this - __dd; return *this; }
16731658
16741659
1675class _LIBCPP_TYPE_VIS month {1660class month {
1676private:1661private:
1677 unsigned char __m;1662 unsigned char __m;
1678public:1663public:
...@@ -1743,21 +1728,21 @@ inline constexpr month& month::operator-=(const months& __dm) noexcept...@@ -1743,21 +1728,21 @@ inline constexpr month& month::operator-=(const months& __dm) noexcept
1743{ *this = *this - __dm; return *this; }1728{ *this = *this - __dm; return *this; }
17441729
17451730
1746class _LIBCPP_TYPE_VIS year {1731class year {
1747private:1732private:
1748 short __y;1733 short __y;
1749public:1734public:
1750 year() = default;1735 year() = default;
1751 explicit inline constexpr year(int __val) noexcept : __y(static_cast<short>(__val)) {}1736 explicit inline constexpr year(int __val) noexcept : __y(static_cast<short>(__val)) {}
17521737
1753 inline constexpr year& operator++() noexcept { ++__y; return *this; };1738 inline constexpr year& operator++() noexcept { ++__y; return *this; }
1754 inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; };1739 inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; }
1755 inline constexpr year& operator--() noexcept { --__y; return *this; };1740 inline constexpr year& operator--() noexcept { --__y; return *this; }
1756 inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; };1741 inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; }
1757 constexpr year& operator+=(const years& __dy) noexcept;1742 constexpr year& operator+=(const years& __dy) noexcept;
1758 constexpr year& operator-=(const years& __dy) noexcept;1743 constexpr year& operator-=(const years& __dy) noexcept;
1759 inline constexpr year operator+() const noexcept { return *this; }1744 inline constexpr year operator+() const noexcept { return *this; }
1760 inline constexpr year operator-() const noexcept { return year{-__y}; };1745 inline constexpr year operator-() const noexcept { return year{-__y}; }
17611746
1762 inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); }1747 inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); }
1763 explicit inline constexpr operator int() const noexcept { return __y; }1748 explicit inline constexpr operator int() const noexcept { return __y; }
...@@ -1817,10 +1802,10 @@ inline constexpr year& year::operator-=(const years& __dy) noexcept...@@ -1817,10 +1802,10 @@ inline constexpr year& year::operator-=(const years& __dy) noexcept
1817inline constexpr bool year::ok() const noexcept1802inline constexpr bool year::ok() const noexcept
1818{ return static_cast<int>(min()) <= __y && __y <= static_cast<int>(max()); }1803{ return static_cast<int>(min()) <= __y && __y <= static_cast<int>(max()); }
18191804
1820class _LIBCPP_TYPE_VIS weekday_indexed;1805class weekday_indexed;
1821class _LIBCPP_TYPE_VIS weekday_last;1806class weekday_last;
18221807
1823class _LIBCPP_TYPE_VIS weekday {1808class weekday {
1824private:1809private:
1825 unsigned char __wd;1810 unsigned char __wd;
1826public:1811public:
...@@ -1906,7 +1891,7 @@ inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept...@@ -1906,7 +1891,7 @@ inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept
1906{ *this = *this - __dd; return *this; }1891{ *this = *this - __dd; return *this; }
19071892
19081893
1909class _LIBCPP_TYPE_VIS weekday_indexed {1894class weekday_indexed {
1910private:1895private:
1911 _VSTD::chrono::weekday __wd;1896 _VSTD::chrono::weekday __wd;
1912 unsigned char __idx;1897 unsigned char __idx;
...@@ -1928,7 +1913,7 @@ bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noex...@@ -1928,7 +1913,7 @@ bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noex
1928{ return !(__lhs == __rhs); }1913{ return !(__lhs == __rhs); }
19291914
19301915
1931class _LIBCPP_TYPE_VIS weekday_last {1916class weekday_last {
1932private:1917private:
1933 _VSTD::chrono::weekday __wd;1918 _VSTD::chrono::weekday __wd;
1934public:1919public:
...@@ -1949,7 +1934,7 @@ bool operator!=(const weekday_last& __lhs, const weekday_last& __rhs) noexcept...@@ -1949,7 +1934,7 @@ bool operator!=(const weekday_last& __lhs, const weekday_last& __rhs) noexcept
1949inline constexpr1934inline constexpr
1950weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }1935weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; }
19511936
1952inline constexpr 1937inline constexpr
1953weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }1938weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; }
19541939
19551940
...@@ -1976,7 +1961,7 @@ inline constexpr month November{11};...@@ -1976,7 +1961,7 @@ inline constexpr month November{11};
1976inline constexpr month December{12};1961inline constexpr month December{12};
19771962
19781963
1979class _LIBCPP_TYPE_VIS month_day {1964class month_day {
1980private:1965private:
1981 chrono::month __m;1966 chrono::month __m;
1982 chrono::day __d;1967 chrono::day __d;
...@@ -2051,7 +2036,7 @@ bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept...@@ -2051,7 +2036,7 @@ bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept
20512036
20522037
20532038
2054class _LIBCPP_TYPE_VIS month_day_last {2039class month_day_last {
2055private:2040private:
2056 chrono::month __m;2041 chrono::month __m;
2057public:2042public:
...@@ -2102,7 +2087,7 @@ month_day_last operator/(last_spec, int __rhs) noexcept...@@ -2102,7 +2087,7 @@ month_day_last operator/(last_spec, int __rhs) noexcept
2102{ return month_day_last{month(__rhs)}; }2087{ return month_day_last{month(__rhs)}; }
21032088
21042089
2105class _LIBCPP_TYPE_VIS month_weekday {2090class month_weekday {
2106private:2091private:
2107 chrono::month __m;2092 chrono::month __m;
2108 chrono::weekday_indexed __wdi;2093 chrono::weekday_indexed __wdi;
...@@ -2140,7 +2125,7 @@ month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept...@@ -2140,7 +2125,7 @@ month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept
2140{ return month_weekday{month(__rhs), __lhs}; }2125{ return month_weekday{month(__rhs), __lhs}; }
21412126
21422127
2143class _LIBCPP_TYPE_VIS month_weekday_last {2128class month_weekday_last {
2144 chrono::month __m;2129 chrono::month __m;
2145 chrono::weekday_last __wdl;2130 chrono::weekday_last __wdl;
2146 public:2131 public:
...@@ -2177,7 +2162,7 @@ month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept...@@ -2177,7 +2162,7 @@ month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept
2177{ return month_weekday_last{month(__rhs), __lhs}; }2162{ return month_weekday_last{month(__rhs), __lhs}; }
21782163
21792164
2180class _LIBCPP_TYPE_VIS year_month {2165class year_month {
2181 chrono::year __y;2166 chrono::year __y;
2182 chrono::month __m;2167 chrono::month __m;
2183public:2168public:
...@@ -2251,7 +2236,7 @@ constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noex...@@ -2251,7 +2236,7 @@ constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noex
22512236
2252class year_month_day_last;2237class year_month_day_last;
22532238
2254class _LIBCPP_TYPE_VIS year_month_day {2239class year_month_day {
2255private:2240private:
2256 chrono::year __y;2241 chrono::year __y;
2257 chrono::month __m;2242 chrono::month __m;
...@@ -2260,7 +2245,7 @@ public:...@@ -2260,7 +2245,7 @@ public:
2260 year_month_day() = default;2245 year_month_day() = default;
2261 inline constexpr year_month_day(2246 inline constexpr year_month_day(
2262 const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept2247 const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
2263 : __y{__yval}, __m{__mval}, __d{__dval} {} 2248 : __y{__yval}, __m{__mval}, __d{__dval} {}
2264 constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;2249 constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
2265 inline constexpr year_month_day(const sys_days& __sysd) noexcept2250 inline constexpr year_month_day(const sys_days& __sysd) noexcept
2266 : year_month_day(__from_days(__sysd.time_since_epoch())) {}2251 : year_month_day(__from_days(__sysd.time_since_epoch())) {}
...@@ -2405,7 +2390,7 @@ inline constexpr year_month_day& year_month_day::operator-=(const months& __dm)...@@ -2405,7 +2390,7 @@ inline constexpr year_month_day& year_month_day::operator-=(const months& __dm)
2405inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }2390inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
2406inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }2391inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
24072392
2408class _LIBCPP_TYPE_VIS year_month_day_last {2393class year_month_day_last {
2409private:2394private:
2410 chrono::year __y;2395 chrono::year __y;
2411 chrono::month_day_last __mdl;2396 chrono::month_day_last __mdl;
...@@ -2515,7 +2500,7 @@ inline constexpr year_month_day_last& year_month_day_last::operator+=(const year...@@ -2515,7 +2500,7 @@ inline constexpr year_month_day_last& year_month_day_last::operator+=(const year
2515inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }2500inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
25162501
2517inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept2502inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
2518 : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {} 2503 : __y{__ymdl.year()}, __m{__ymdl.month()}, __d{__ymdl.day()} {}
25192504
2520inline constexpr bool year_month_day::ok() const noexcept2505inline constexpr bool year_month_day::ok() const noexcept
2521{2506{
...@@ -2523,7 +2508,7 @@ inline constexpr bool year_month_day::ok() const noexcept...@@ -2523,7 +2508,7 @@ inline constexpr bool year_month_day::ok() const noexcept
2523 return chrono::day{1} <= __d && __d <= (__y / __m / last).day();2508 return chrono::day{1} <= __d && __d <= (__y / __m / last).day();
2524}2509}
25252510
2526class _LIBCPP_TYPE_VIS year_month_weekday {2511class year_month_weekday {
2527 chrono::year __y;2512 chrono::year __y;
2528 chrono::month __m;2513 chrono::month __m;
2529 chrono::weekday_indexed __wdi;2514 chrono::weekday_indexed __wdi;
...@@ -2566,7 +2551,7 @@ year_month_weekday year_month_weekday::__from_days(days __d) noexcept...@@ -2566,7 +2551,7 @@ year_month_weekday year_month_weekday::__from_days(days __d) noexcept
2566 const sys_days __sysd{__d};2551 const sys_days __sysd{__d};
2567 const chrono::weekday __wd = chrono::weekday(__sysd);2552 const chrono::weekday __wd = chrono::weekday(__sysd);
2568 const year_month_day __ymd = year_month_day(__sysd);2553 const year_month_day __ymd = year_month_day(__sysd);
2569 return year_month_weekday{__ymd.year(), __ymd.month(), 2554 return year_month_weekday{__ymd.year(), __ymd.month(),
2570 __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};2555 __wd[(static_cast<unsigned>(__ymd.day())-1)/7+1]};
2571}2556}
25722557
...@@ -2637,7 +2622,7 @@ inline constexpr year_month_weekday& year_month_weekday::operator-=(const months...@@ -2637,7 +2622,7 @@ inline constexpr year_month_weekday& year_month_weekday::operator-=(const months
2637inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }2622inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; }
2638inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }2623inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; }
26392624
2640class _LIBCPP_TYPE_VIS year_month_weekday_last {2625class year_month_weekday_last {
2641private:2626private:
2642 chrono::year __y;2627 chrono::year __y;
2643 chrono::month __m;2628 chrono::month __m;
...@@ -2658,9 +2643,9 @@ public:...@@ -2658,9 +2643,9 @@ public:
2658 inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }2643 inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
2659 inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }2644 inline explicit constexpr operator local_days() const noexcept { return local_days{__to_days()}; }
2660 inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); }2645 inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); }
2661 2646
2662 constexpr days __to_days() const noexcept;2647 constexpr days __to_days() const noexcept;
2663 2648
2664};2649};
26652650
2666inline constexpr2651inline constexpr
...@@ -2698,7 +2683,7 @@ year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& _...@@ -2698,7 +2683,7 @@ year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& _
26982683
2699inline constexpr2684inline constexpr
2700year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept2685year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept
2701{ return year(__rhs) / __lhs; } 2686{ return year(__rhs) / __lhs; }
27022687
27032688
2704inline constexpr2689inline constexpr
...@@ -2810,7 +2795,7 @@ inline namespace literals...@@ -2810,7 +2795,7 @@ inline namespace literals
2810 {2795 {
2811 return chrono::day(static_cast<unsigned>(__d));2796 return chrono::day(static_cast<unsigned>(__d));
2812 }2797 }
2813 2798
2814 constexpr chrono::year operator ""y(unsigned long long __y) noexcept2799 constexpr chrono::year operator ""y(unsigned long long __y) noexcept
2815 {2800 {
2816 return chrono::year(static_cast<int>(__y));2801 return chrono::year(static_cast<int>(__y));
...@@ -2842,7 +2827,7 @@ struct _FilesystemClock {...@@ -2842,7 +2827,7 @@ struct _FilesystemClock {
28422827
2843 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;2828 static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
28442829
2845 _LIBCPP_FUNC_VIS static time_point now() noexcept;2830 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept;
28462831
2847 _LIBCPP_INLINE_VISIBILITY2832 _LIBCPP_INLINE_VISIBILITY
2848 static time_t to_time_t(const time_point& __t) noexcept {2833 static time_t to_time_t(const time_point& __t) noexcept {
lib/libcxx/include/cinttypes+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cinttypes --------------------------------===//2//===--------------------------- cinttypes --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ciso646+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- ciso646 ----------------------------------===//2//===--------------------------- ciso646 ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/climits+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- climits ----------------------------------===//2//===--------------------------- climits ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/clocale+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- clocale ----------------------------------===//2//===--------------------------- clocale ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cmath+30-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- cmath -----------------------------------===//2//===---------------------------- cmath -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -530,7 +529,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y...@@ -530,7 +529,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y
530529
531template <class _A1, class _A2, class _A3>530template <class _A1, class _A2, class _A3>
532inline _LIBCPP_INLINE_VISIBILITY531inline _LIBCPP_INLINE_VISIBILITY
533typename __lazy_enable_if532typename _EnableIf
534<533<
535 is_arithmetic<_A1>::value &&534 is_arithmetic<_A1>::value &&
536 is_arithmetic<_A2>::value &&535 is_arithmetic<_A2>::value &&
...@@ -607,6 +606,32 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT...@@ -607,6 +606,32 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
607 return isfinite(__lcpp_x);606 return isfinite(__lcpp_x);
608}607}
609608
609#if _LIBCPP_STD_VER > 17
610template <typename _Fp>
611constexpr
612_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
613 if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
614 return __t * __b + (1 - __t) * __a;
615
616 if (__t == 1) return __b;
617 const _Fp __x = __a + __t * (__b - __a);
618 if (__t > 1 == __b > __a)
619 return __b < __x ? __x : __b;
620 else
621 return __x < __b ? __x : __b;
622}
623
624constexpr float
625lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
626
627constexpr double
628lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
629
630constexpr long double
631lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
632
633#endif // _LIBCPP_STD_VER > 17
634
610_LIBCPP_END_NAMESPACE_STD635_LIBCPP_END_NAMESPACE_STD
611636
612#endif // _LIBCPP_CMATH637#endif // _LIBCPP_CMATH
lib/libcxx/include/codecvt+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- codecvt -----------------------------------===//2//===-------------------------- codecvt -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/compare+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- compare -----------------------------------===//2//===-------------------------- compare -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/complex+5-6
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- complex ----------------------------------===//2//===--------------------------- complex ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -1450,10 +1449,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)...@@ -1450,10 +1449,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
1450 return __os << __s.str();1449 return __os << __s.str();
1451}1450}
14521451
1453#if _LIBCPP_STD_VER > 11 1452#if _LIBCPP_STD_VER > 11
1454// Literal suffix for complex number literals [complex.literals]1453// Literal suffix for complex number literals [complex.literals]
1455inline namespace literals1454inline namespace literals
1456{ 1455{
1457 inline namespace complex_literals1456 inline namespace complex_literals
1458 {1457 {
1459 constexpr complex<long double> operator""il(long double __im)1458 constexpr complex<long double> operator""il(long double __im)
lib/libcxx/include/complex.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- complex.h --------------------------------===//2//===--------------------------- complex.h --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/condition_variable+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------- condition_variable ----------------------------===//2//===---------------------- condition_variable ----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/csetjmp+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- csetjmp ----------------------------------===//2//===--------------------------- csetjmp ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/csignal+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- csignal ----------------------------------===//2//===--------------------------- csignal ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdarg+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstdarg ----------------------------------===//2//===--------------------------- cstdarg ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdbool+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstdbool ---------------------------------===//2//===--------------------------- cstdbool ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstddef+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstddef ----------------------------------===//2//===--------------------------- cstddef ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdint+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstdint ----------------------------------===//2//===--------------------------- cstdint ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdio+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- cstdio ----------------------------------===//2//===---------------------------- cstdio ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstdlib+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstdlib ----------------------------------===//2//===--------------------------- cstdlib ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cstring+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cstring ----------------------------------===//2//===--------------------------- cstring ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctgmath+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- ctgmath -----------------------------------===//2//===-------------------------- ctgmath -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctime+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- ctime -----------------------------------===//2//===---------------------------- ctime -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ctype.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- ctype.h ---------------------------------===//2//===---------------------------- ctype.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cwchar+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cwchar -----------------------------------===//2//===--------------------------- cwchar -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/cwctype+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- cwctype ----------------------------------===//2//===--------------------------- cwctype ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/deque+15-16
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- deque -----------------------------------===//2//===---------------------------- deque -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -1331,21 +1330,21 @@ public:...@@ -1331,21 +1330,21 @@ public:
13311330
1332 // element access:1331 // element access:
1333 _LIBCPP_INLINE_VISIBILITY1332 _LIBCPP_INLINE_VISIBILITY
1334 reference operator[](size_type __i);1333 reference operator[](size_type __i) _NOEXCEPT;
1335 _LIBCPP_INLINE_VISIBILITY1334 _LIBCPP_INLINE_VISIBILITY
1336 const_reference operator[](size_type __i) const;1335 const_reference operator[](size_type __i) const _NOEXCEPT;
1337 _LIBCPP_INLINE_VISIBILITY1336 _LIBCPP_INLINE_VISIBILITY
1338 reference at(size_type __i);1337 reference at(size_type __i);
1339 _LIBCPP_INLINE_VISIBILITY1338 _LIBCPP_INLINE_VISIBILITY
1340 const_reference at(size_type __i) const;1339 const_reference at(size_type __i) const;
1341 _LIBCPP_INLINE_VISIBILITY1340 _LIBCPP_INLINE_VISIBILITY
1342 reference front();1341 reference front() _NOEXCEPT;
1343 _LIBCPP_INLINE_VISIBILITY1342 _LIBCPP_INLINE_VISIBILITY
1344 const_reference front() const;1343 const_reference front() const _NOEXCEPT;
1345 _LIBCPP_INLINE_VISIBILITY1344 _LIBCPP_INLINE_VISIBILITY
1346 reference back();1345 reference back() _NOEXCEPT;
1347 _LIBCPP_INLINE_VISIBILITY1346 _LIBCPP_INLINE_VISIBILITY
1348 const_reference back() const;1347 const_reference back() const _NOEXCEPT;
13491348
1350 // 23.2.2.3 modifiers:1349 // 23.2.2.3 modifiers:
1351 void push_front(const value_type& __v);1350 void push_front(const value_type& __v);
...@@ -1746,7 +1745,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT...@@ -1746,7 +1745,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
1746template <class _Tp, class _Allocator>1745template <class _Tp, class _Allocator>
1747inline1746inline
1748typename deque<_Tp, _Allocator>::reference1747typename deque<_Tp, _Allocator>::reference
1749deque<_Tp, _Allocator>::operator[](size_type __i)1748deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT
1750{1749{
1751 size_type __p = __base::__start_ + __i;1750 size_type __p = __base::__start_ + __i;
1752 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);1751 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
...@@ -1755,7 +1754,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)...@@ -1755,7 +1754,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
1755template <class _Tp, class _Allocator>1754template <class _Tp, class _Allocator>
1756inline1755inline
1757typename deque<_Tp, _Allocator>::const_reference1756typename deque<_Tp, _Allocator>::const_reference
1758deque<_Tp, _Allocator>::operator[](size_type __i) const1757deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT
1759{1758{
1760 size_type __p = __base::__start_ + __i;1759 size_type __p = __base::__start_ + __i;
1761 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);1760 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
...@@ -1786,7 +1785,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const...@@ -1786,7 +1785,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
1786template <class _Tp, class _Allocator>1785template <class _Tp, class _Allocator>
1787inline1786inline
1788typename deque<_Tp, _Allocator>::reference1787typename deque<_Tp, _Allocator>::reference
1789deque<_Tp, _Allocator>::front()1788deque<_Tp, _Allocator>::front() _NOEXCEPT
1790{1789{
1791 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)1790 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
1792 + __base::__start_ % __base::__block_size);1791 + __base::__start_ % __base::__block_size);
...@@ -1795,7 +1794,7 @@ deque<_Tp, _Allocator>::front()...@@ -1795,7 +1794,7 @@ deque<_Tp, _Allocator>::front()
1795template <class _Tp, class _Allocator>1794template <class _Tp, class _Allocator>
1796inline1795inline
1797typename deque<_Tp, _Allocator>::const_reference1796typename deque<_Tp, _Allocator>::const_reference
1798deque<_Tp, _Allocator>::front() const1797deque<_Tp, _Allocator>::front() const _NOEXCEPT
1799{1798{
1800 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)1799 return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size)
1801 + __base::__start_ % __base::__block_size);1800 + __base::__start_ % __base::__block_size);
...@@ -1804,7 +1803,7 @@ deque<_Tp, _Allocator>::front() const...@@ -1804,7 +1803,7 @@ deque<_Tp, _Allocator>::front() const
1804template <class _Tp, class _Allocator>1803template <class _Tp, class _Allocator>
1805inline1804inline
1806typename deque<_Tp, _Allocator>::reference1805typename deque<_Tp, _Allocator>::reference
1807deque<_Tp, _Allocator>::back()1806deque<_Tp, _Allocator>::back() _NOEXCEPT
1808{1807{
1809 size_type __p = __base::size() + __base::__start_ - 1;1808 size_type __p = __base::size() + __base::__start_ - 1;
1810 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);1809 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
...@@ -1813,7 +1812,7 @@ deque<_Tp, _Allocator>::back()...@@ -1813,7 +1812,7 @@ deque<_Tp, _Allocator>::back()
1813template <class _Tp, class _Allocator>1812template <class _Tp, class _Allocator>
1814inline1813inline
1815typename deque<_Tp, _Allocator>::const_reference1814typename deque<_Tp, _Allocator>::const_reference
1816deque<_Tp, _Allocator>::back() const1815deque<_Tp, _Allocator>::back() const _NOEXCEPT
1817{1816{
1818 size_type __p = __base::size() + __base::__start_ - 1;1817 size_type __p = __base::size() + __base::__start_ - 1;
1819 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);1818 return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
lib/libcxx/include/errno.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- errno.h -----------------------------------===//2//===-------------------------- errno.h -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/exception+6-15
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- exception ---------------------------------===//2//===-------------------------- exception ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -83,7 +82,7 @@ template <class E> void rethrow_if_nested(const E& e);...@@ -83,7 +82,7 @@ template <class E> void rethrow_if_nested(const E& e);
83#include <type_traits>82#include <type_traits>
84#include <version>83#include <version>
8584
86#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)85#if defined(_LIBCPP_ABI_VCRUNTIME)
87#include <vcruntime_exception.h>86#include <vcruntime_exception.h>
88#endif87#endif
8988
...@@ -94,7 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);...@@ -94,7 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
94namespace std // purposefully not using versioning namespace93namespace std // purposefully not using versioning namespace
95{94{
9695
97#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)96#if !defined(_LIBCPP_ABI_VCRUNTIME)
98class _LIBCPP_EXCEPTION_ABI exception97class _LIBCPP_EXCEPTION_ABI exception
99{98{
100public:99public:
...@@ -111,7 +110,7 @@ public:...@@ -111,7 +110,7 @@ public:
111 virtual ~bad_exception() _NOEXCEPT;110 virtual ~bad_exception() _NOEXCEPT;
112 virtual const char* what() const _NOEXCEPT;111 virtual const char* what() const _NOEXCEPT;
113};112};
114#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME113#endif // !_LIBCPP_ABI_VCRUNTIME
115114
116#if _LIBCPP_STD_VER <= 14 \115#if _LIBCPP_STD_VER <= 14 \
117 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \116 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
...@@ -261,11 +260,7 @@ struct __throw_with_nested;...@@ -261,11 +260,7 @@ struct __throw_with_nested;
261template <class _Tp, class _Up>260template <class _Tp, class _Up>
262struct __throw_with_nested<_Tp, _Up, true> {261struct __throw_with_nested<_Tp, _Up, true> {
263 _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void262 _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void
264#ifndef _LIBCPP_CXX03_LANG
265 __do_throw(_Tp&& __t)263 __do_throw(_Tp&& __t)
266#else
267 __do_throw (_Tp& __t)
268#endif // _LIBCPP_CXX03_LANG
269 {264 {
270 throw __nested<_Up>(_VSTD::forward<_Tp>(__t));265 throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
271 }266 }
...@@ -288,11 +283,7 @@ struct __throw_with_nested<_Tp, _Up, false> {...@@ -288,11 +283,7 @@ struct __throw_with_nested<_Tp, _Up, false> {
288template <class _Tp>283template <class _Tp>
289_LIBCPP_NORETURN284_LIBCPP_NORETURN
290void285void
291#ifndef _LIBCPP_CXX03_LANG
292throw_with_nested(_Tp&& __t)286throw_with_nested(_Tp&& __t)
293#else
294throw_with_nested (_Tp& __t)
295#endif // _LIBCPP_CXX03_LANG
296{287{
297#ifndef _LIBCPP_NO_EXCEPTIONS288#ifndef _LIBCPP_NO_EXCEPTIONS
298 typedef typename decay<_Tp>::type _Up;289 typedef typename decay<_Tp>::type _Up;
lib/libcxx/include/experimental/__config+10-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- __config ---------------------------------===//2//===--------------------------- __config ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -37,8 +36,14 @@...@@ -37,8 +36,14 @@
37 namespace chrono { namespace experimental { inline namespace fundamentals_v1 {36 namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
38#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }37#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
3938
39#if defined(_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM)
40# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM /* nothing */
41#else
42# define _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM __attribute__((deprecated("std::experimental::filesystem has now been deprecated in favor of C++17's std::filesystem. Please stop using it and start using std::filesystem. This experimental version will be removed in LLVM 11. You can remove this warning by defining the _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM macro.")))
43#endif
44
40#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM \45#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
41 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem { \46 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace filesystem _LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM { \
42 inline namespace v1 {47 inline namespace v1 {
4348
44#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \49#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
lib/libcxx/include/experimental/__memory+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------------------------------------------------===//2//===----------------------------------------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/algorithm+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- algorithm ---------------------------------===//2//===-------------------------- algorithm ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/any deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===------------------------------- any ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_ANY
11#define _LIBCPP_EXPERIMENTAL_ANY
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/any> has been removed. Use <any> instead.")
17#else
18# warning "<experimental/any> has been removed. Use <any> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_ANY
lib/libcxx/include/experimental/chrono deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===---------------------------- chrono ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
11#define _LIBCPP_EXPERIMENTAL_CHRONO
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/chrono> has been removed. Use <chrono> instead.")
17#else
18# warning "<experimental/chrono> has been removed. Use <chrono> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_CHRONO
lib/libcxx/include/experimental/coroutine+6-7
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- coroutine -----------------------------===//2//===----------------------------- coroutine -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -82,7 +81,7 @@ struct __coroutine_traits_sfinae<...@@ -82,7 +81,7 @@ struct __coroutine_traits_sfinae<
82};81};
8382
84template <typename _Ret, typename... _Args>83template <typename _Ret, typename... _Args>
85struct _LIBCPP_TEMPLATE_VIS coroutine_traits84struct coroutine_traits
86 : public __coroutine_traits_sfinae<_Ret>85 : public __coroutine_traits_sfinae<_Ret>
87{86{
88};87};
...@@ -299,7 +298,7 @@ noop_coroutine_handle noop_coroutine() _NOEXCEPT {...@@ -299,7 +298,7 @@ noop_coroutine_handle noop_coroutine() _NOEXCEPT {
299}298}
300#endif // __has_builtin(__builtin_coro_noop)299#endif // __has_builtin(__builtin_coro_noop)
301300
302struct _LIBCPP_TYPE_VIS suspend_never {301struct suspend_never {
303 _LIBCPP_INLINE_VISIBILITY302 _LIBCPP_INLINE_VISIBILITY
304 bool await_ready() const _NOEXCEPT { return true; }303 bool await_ready() const _NOEXCEPT { return true; }
305 _LIBCPP_INLINE_VISIBILITY304 _LIBCPP_INLINE_VISIBILITY
...@@ -308,7 +307,7 @@ struct _LIBCPP_TYPE_VIS suspend_never {...@@ -308,7 +307,7 @@ struct _LIBCPP_TYPE_VIS suspend_never {
308 void await_resume() const _NOEXCEPT {}307 void await_resume() const _NOEXCEPT {}
309};308};
310309
311struct _LIBCPP_TYPE_VIS suspend_always {310struct suspend_always {
312 _LIBCPP_INLINE_VISIBILITY311 _LIBCPP_INLINE_VISIBILITY
313 bool await_ready() const _NOEXCEPT { return false; }312 bool await_ready() const _NOEXCEPT { return false; }
314 _LIBCPP_INLINE_VISIBILITY313 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/experimental/deque+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- deque ------------------------------------===//2//===--------------------------- deque ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/filesystem+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- filesystem -------------------------------===//2//===--------------------------- filesystem -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM9#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM
lib/libcxx/include/experimental/forward_list+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- forward_list -----------------------------===//2//===--------------------------- forward_list -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/functional+6-10
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- functional --------------------------------===//2//===-------------------------- functional --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -110,8 +109,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS...@@ -110,8 +109,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
110#if _LIBCPP_STD_VER > 11109#if _LIBCPP_STD_VER > 11
111// default searcher110// default searcher
112template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>111template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
113_LIBCPP_TYPE_VIS112class _LIBCPP_TYPE_VIS default_searcher {
114class default_searcher {
115public:113public:
116 _LIBCPP_INLINE_VISIBILITY114 _LIBCPP_INLINE_VISIBILITY
117 default_searcher(_ForwardIterator __f, _ForwardIterator __l, 115 default_searcher(_ForwardIterator __f, _ForwardIterator __l,
...@@ -209,8 +207,7 @@ public:...@@ -209,8 +207,7 @@ public:
209template <class _RandomAccessIterator1, 207template <class _RandomAccessIterator1,
210 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 208 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
211 class _BinaryPredicate = equal_to<>>209 class _BinaryPredicate = equal_to<>>
212_LIBCPP_TYPE_VIS210class _LIBCPP_TYPE_VIS boyer_moore_searcher {
213class boyer_moore_searcher {
214private:211private:
215 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;212 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
216 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;213 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
...@@ -361,8 +358,7 @@ make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,...@@ -361,8 +358,7 @@ make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
361template <class _RandomAccessIterator1, 358template <class _RandomAccessIterator1,
362 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, 359 class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
363 class _BinaryPredicate = equal_to<>>360 class _BinaryPredicate = equal_to<>>
364_LIBCPP_TYPE_VIS361class _LIBCPP_TYPE_VIS boyer_moore_horspool_searcher {
365class boyer_moore_horspool_searcher {
366private:362private:
367 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;363 typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
368 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;364 typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
lib/libcxx/include/experimental/iterator+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- iterator -------------------------------===//2//===----------------------------- iterator -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/list+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- list ------------------------------------===//2//===--------------------------- list ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/map+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- map ------------------------------------===//2//===----------------------------- map ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/memory_resource+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ memory_resource -----------------------------===//2//===------------------------ memory_resource -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/numeric deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===--------------------------- numeric ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC
11#define _LIBCPP_EXPERIMENTAL_NUMERIC
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/numeric> has been removed. Use <numeric> instead.")
17#else
18# warning "<experimental/numeric> has been removed. Use <numeric> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_NUMERIC
lib/libcxx/include/experimental/optional deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===-------------------------- optional ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
11#define _LIBCPP_EXPERIMENTAL_OPTIONAL
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/optional> has been removed. Use <optional> instead.")
17#else
18# warning "<experimental/optional> has been removed. Use <optional> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
lib/libcxx/include/experimental/propagate_const+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ propagate_const -----------------------------===//2//===------------------------ propagate_const -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/ratio deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===----------------------------- ratio ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_RATIO
11#define _LIBCPP_EXPERIMENTAL_RATIO
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/ratio> has been removed. Use <ratio> instead.")
17#else
18# warning "<experimental/ratio> has been removed. Use <ratio> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_RATIO
lib/libcxx/include/experimental/regex+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- regex ----------------------------------===//2//===----------------------------- regex ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/set+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- list ------------------------------------===//2//===--------------------------- list ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/simd+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------- simd ---------------------------------===//2//===------------------------------- simd ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_SIMD9#ifndef _LIBCPP_EXPERIMENTAL_SIMD
lib/libcxx/include/experimental/string+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- string ----------------------------------===//2//===--------------------------- string ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/string_view deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===------------------------ string_view ---------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_STRING_VIEW
11#define _LIBCPP_EXPERIMENTAL_STRING_VIEW
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/string_view> has been removed. Use <string_view> instead.")
17#else
18# warning "<experimental/string_view> has been removed. Use <string_view> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_STRING_VIEW
lib/libcxx/include/experimental/system_error deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===-------------------------- system_error ------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
11#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/system_error> has been removed. Use <system_error> instead.")
17#else
18# warning "<experimental/system_error> has been removed. Use <system_error> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
lib/libcxx/include/experimental/tuple deleted-21
...@@ -1,21 +0,0 @@
1// -*- C++ -*-
2//===----------------------------- tuple ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
11#define _LIBCPP_EXPERIMENTAL_TUPLE
12
13#include <__config>
14
15#ifdef _LIBCPP_WARNING
16_LIBCPP_WARNING("<experimental/tuple> has been removed. Use <tuple> instead.")
17#else
18# warning "<experimental/tuple> has been removed. Use <tuple> instead."
19#endif
20
21#endif // _LIBCPP_EXPERIMENTAL_TUPLE
lib/libcxx/include/experimental/type_traits+8-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- type_traits -------------------------------===//2//===-------------------------- type_traits -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -73,6 +72,7 @@ inline namespace fundamentals_v1 {...@@ -73,6 +72,7 @@ inline namespace fundamentals_v1 {
7372
74#if _LIBCPP_STD_VER > 1173#if _LIBCPP_STD_VER > 11
7574
75#include <initializer_list>
76#include <type_traits>76#include <type_traits>
7777
78#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)78#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
...@@ -105,11 +105,10 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;...@@ -105,11 +105,10 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
105// 3.3.4, Detection idiom105// 3.3.4, Detection idiom
106template <class...> using void_t = void;106template <class...> using void_t = void;
107107
108struct nonesuch {108struct nonesuch : private _VSTD::__nat { // make nonesuch "not an aggregate"
109 nonesuch() = delete;109 ~nonesuch() = delete;
110 ~nonesuch() = delete;110 nonesuch (nonesuch const&) = delete;
111 nonesuch (nonesuch const&) = delete;111 void operator=(nonesuch const&) = delete;
112 void operator=(nonesuch const&) = delete;
113 };112 };
114113
115template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>114template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
lib/libcxx/include/experimental/unordered_map+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- unordered_map ------------------------------===//2//===------------------------- unordered_map ------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/unordered_set+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- unordered_set ------------------------------===//2//===------------------------- unordered_set ------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/utility+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- utility ----------------------------------===//2//===-------------------------- utility ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/experimental/vector+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- vector ------------------------------------===//2//===--------------------------- vector ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/ext/__hash+16-18
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- hash_set ------------------------------------===//2//===------------------------- hash_set ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -17,32 +16,31 @@...@@ -17,32 +16,31 @@
17#include <cstring>16#include <cstring>
1817
19namespace __gnu_cxx {18namespace __gnu_cxx {
20using namespace std;
2119
22template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };20template <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
2321
24template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>22template <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
25 : public unary_function<const char*, size_t>23 : public std::unary_function<const char*, size_t>
26{24{
27 _LIBCPP_INLINE_VISIBILITY25 _LIBCPP_INLINE_VISIBILITY
28 size_t operator()(const char *__c) const _NOEXCEPT26 size_t operator()(const char *__c) const _NOEXCEPT
29 {27 {
30 return __do_string_hash(__c, __c + strlen(__c));28 return std::__do_string_hash(__c, __c + strlen(__c));
31 }29 }
32};30};
3331
34template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>32template <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
35 : public unary_function<char*, size_t>33 : public std::unary_function<char*, size_t>
36{34{
37 _LIBCPP_INLINE_VISIBILITY35 _LIBCPP_INLINE_VISIBILITY
38 size_t operator()(char *__c) const _NOEXCEPT36 size_t operator()(char *__c) const _NOEXCEPT
39 {37 {
40 return __do_string_hash<const char *>(__c, __c + strlen(__c));38 return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
41 }39 }
42};40};
4341
44template <> struct _LIBCPP_TEMPLATE_VIS hash<char>42template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
45 : public unary_function<char, size_t>43 : public std::unary_function<char, size_t>
46{44{
47 _LIBCPP_INLINE_VISIBILITY45 _LIBCPP_INLINE_VISIBILITY
48 size_t operator()(char __c) const _NOEXCEPT46 size_t operator()(char __c) const _NOEXCEPT
...@@ -52,7 +50,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char>...@@ -52,7 +50,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<char>
52};50};
5351
54template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>52template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
55 : public unary_function<signed char, size_t>53 : public std::unary_function<signed char, size_t>
56{54{
57 _LIBCPP_INLINE_VISIBILITY55 _LIBCPP_INLINE_VISIBILITY
58 size_t operator()(signed char __c) const _NOEXCEPT56 size_t operator()(signed char __c) const _NOEXCEPT
...@@ -62,7 +60,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>...@@ -62,7 +60,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
62};60};
6361
64template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>62template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
65 : public unary_function<unsigned char, size_t>63 : public std::unary_function<unsigned char, size_t>
66{64{
67 _LIBCPP_INLINE_VISIBILITY65 _LIBCPP_INLINE_VISIBILITY
68 size_t operator()(unsigned char __c) const _NOEXCEPT66 size_t operator()(unsigned char __c) const _NOEXCEPT
...@@ -72,7 +70,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>...@@ -72,7 +70,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
72};70};
7371
74template <> struct _LIBCPP_TEMPLATE_VIS hash<short>72template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
75 : public unary_function<short, size_t>73 : public std::unary_function<short, size_t>
76{74{
77 _LIBCPP_INLINE_VISIBILITY75 _LIBCPP_INLINE_VISIBILITY
78 size_t operator()(short __c) const _NOEXCEPT76 size_t operator()(short __c) const _NOEXCEPT
...@@ -82,7 +80,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<short>...@@ -82,7 +80,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<short>
82};80};
8381
84template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>82template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
85 : public unary_function<unsigned short, size_t>83 : public std::unary_function<unsigned short, size_t>
86{84{
87 _LIBCPP_INLINE_VISIBILITY85 _LIBCPP_INLINE_VISIBILITY
88 size_t operator()(unsigned short __c) const _NOEXCEPT86 size_t operator()(unsigned short __c) const _NOEXCEPT
...@@ -92,7 +90,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>...@@ -92,7 +90,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
92};90};
9391
94template <> struct _LIBCPP_TEMPLATE_VIS hash<int>92template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
95 : public unary_function<int, size_t>93 : public std::unary_function<int, size_t>
96{94{
97 _LIBCPP_INLINE_VISIBILITY95 _LIBCPP_INLINE_VISIBILITY
98 size_t operator()(int __c) const _NOEXCEPT96 size_t operator()(int __c) const _NOEXCEPT
...@@ -102,7 +100,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<int>...@@ -102,7 +100,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<int>
102};100};
103101
104template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>102template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
105 : public unary_function<unsigned int, size_t>103 : public std::unary_function<unsigned int, size_t>
106{104{
107 _LIBCPP_INLINE_VISIBILITY105 _LIBCPP_INLINE_VISIBILITY
108 size_t operator()(unsigned int __c) const _NOEXCEPT106 size_t operator()(unsigned int __c) const _NOEXCEPT
...@@ -112,7 +110,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>...@@ -112,7 +110,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
112};110};
113111
114template <> struct _LIBCPP_TEMPLATE_VIS hash<long>112template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
115 : public unary_function<long, size_t>113 : public std::unary_function<long, size_t>
116{114{
117 _LIBCPP_INLINE_VISIBILITY115 _LIBCPP_INLINE_VISIBILITY
118 size_t operator()(long __c) const _NOEXCEPT116 size_t operator()(long __c) const _NOEXCEPT
...@@ -122,7 +120,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<long>...@@ -122,7 +120,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<long>
122};120};
123121
124template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>122template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
125 : public unary_function<unsigned long, size_t>123 : public std::unary_function<unsigned long, size_t>
126{124{
127 _LIBCPP_INLINE_VISIBILITY125 _LIBCPP_INLINE_VISIBILITY
128 size_t operator()(unsigned long __c) const _NOEXCEPT126 size_t operator()(unsigned long __c) const _NOEXCEPT
lib/libcxx/include/ext/hash_map+38-40
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- hash_map ----------------------------------===//2//===-------------------------- hash_map ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -220,10 +219,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>...@@ -220,10 +219,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
220219
221namespace __gnu_cxx {220namespace __gnu_cxx {
222221
223using namespace std;
224
225template <class _Tp, class _Hash,222template <class _Tp, class _Hash,
226 bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value223 bool = std::is_empty<_Hash>::value && !std::__libcpp_is_final<_Hash>::value
227 >224 >
228class __hash_map_hasher225class __hash_map_hasher
229 : private _Hash226 : private _Hash
...@@ -257,7 +254,7 @@ public:...@@ -257,7 +254,7 @@ public:
257};254};
258255
259template <class _Tp, class _Pred,256template <class _Tp, class _Pred,
260 bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value257 bool = std::is_empty<_Pred>::value && !std::__libcpp_is_final<_Pred>::value
261 >258 >
262class __hash_map_equal259class __hash_map_equal
263 : private _Pred260 : private _Pred
...@@ -308,7 +305,7 @@ template <class _Alloc>...@@ -308,7 +305,7 @@ template <class _Alloc>
308class __hash_map_node_destructor305class __hash_map_node_destructor
309{306{
310 typedef _Alloc allocator_type;307 typedef _Alloc allocator_type;
311 typedef allocator_traits<allocator_type> __alloc_traits;308 typedef std::allocator_traits<allocator_type> __alloc_traits;
312 typedef typename __alloc_traits::value_type::__node_value_type value_type;309 typedef typename __alloc_traits::value_type::__node_value_type value_type;
313public:310public:
314 typedef typename __alloc_traits::pointer pointer;311 typedef typename __alloc_traits::pointer pointer;
...@@ -333,7 +330,7 @@ public:...@@ -333,7 +330,7 @@ public:
333330
334#ifndef _LIBCPP_CXX03_LANG331#ifndef _LIBCPP_CXX03_LANG
335 _LIBCPP_INLINE_VISIBILITY332 _LIBCPP_INLINE_VISIBILITY
336 __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)333 __hash_map_node_destructor(std::__hash_node_destructor<allocator_type>&& __x)
337 : __na_(__x.__na_),334 : __na_(__x.__na_),
338 __first_constructed(__x.__value_constructed),335 __first_constructed(__x.__value_constructed),
339 __second_constructed(__x.__value_constructed)336 __second_constructed(__x.__value_constructed)
...@@ -342,7 +339,7 @@ public:...@@ -342,7 +339,7 @@ public:
342 }339 }
343#else // _LIBCPP_CXX03_LANG340#else // _LIBCPP_CXX03_LANG
344 _LIBCPP_INLINE_VISIBILITY341 _LIBCPP_INLINE_VISIBILITY
345 __hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)342 __hash_map_node_destructor(const std::__hash_node_destructor<allocator_type>& __x)
346 : __na_(__x.__na_),343 : __na_(__x.__na_),
347 __first_constructed(__x.__value_constructed),344 __first_constructed(__x.__value_constructed),
348 __second_constructed(__x.__value_constructed)345 __second_constructed(__x.__value_constructed)
...@@ -371,11 +368,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_iterator...@@ -371,11 +368,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_iterator
371 typedef const typename _HashIterator::value_type::first_type key_type;368 typedef const typename _HashIterator::value_type::first_type key_type;
372 typedef typename _HashIterator::value_type::second_type mapped_type;369 typedef typename _HashIterator::value_type::second_type mapped_type;
373public:370public:
374 typedef forward_iterator_tag iterator_category;371 typedef std::forward_iterator_tag iterator_category;
375 typedef pair<key_type, mapped_type> value_type;372 typedef std::pair<key_type, mapped_type> value_type;
376 typedef typename _HashIterator::difference_type difference_type;373 typedef typename _HashIterator::difference_type difference_type;
377 typedef value_type& reference;374 typedef value_type& reference;
378 typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type375 typedef typename std::__rebind_pointer<typename _HashIterator::pointer, value_type>::type
379 pointer;376 pointer;
380377
381 _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}378 _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
...@@ -416,11 +413,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator...@@ -416,11 +413,11 @@ class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator
416 typedef const typename _HashIterator::value_type::first_type key_type;413 typedef const typename _HashIterator::value_type::first_type key_type;
417 typedef typename _HashIterator::value_type::second_type mapped_type;414 typedef typename _HashIterator::value_type::second_type mapped_type;
418public:415public:
419 typedef forward_iterator_tag iterator_category;416 typedef std::forward_iterator_tag iterator_category;
420 typedef pair<key_type, mapped_type> value_type;417 typedef std::pair<key_type, mapped_type> value_type;
421 typedef typename _HashIterator::difference_type difference_type;418 typedef typename _HashIterator::difference_type difference_type;
422 typedef const value_type& reference;419 typedef const value_type& reference;
423 typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type420 typedef typename std::__rebind_pointer<typename _HashIterator::pointer, const value_type>::type
424 pointer;421 pointer;
425422
426 _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}423 _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
...@@ -460,8 +457,8 @@ public:...@@ -460,8 +457,8 @@ public:
460 template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;457 template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
461};458};
462459
463template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,460template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
464 class _Alloc = allocator<pair<const _Key, _Tp> > >461 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
465class _LIBCPP_TEMPLATE_VIS hash_map462class _LIBCPP_TEMPLATE_VIS hash_map
466{463{
467public:464public:
...@@ -472,17 +469,18 @@ public:...@@ -472,17 +469,18 @@ public:
472 typedef _Hash hasher;469 typedef _Hash hasher;
473 typedef _Pred key_equal;470 typedef _Pred key_equal;
474 typedef _Alloc allocator_type;471 typedef _Alloc allocator_type;
475 typedef pair<const key_type, mapped_type> value_type;472 typedef std::pair<const key_type, mapped_type> value_type;
476 typedef value_type& reference;473 typedef value_type& reference;
477 typedef const value_type& const_reference;474 typedef const value_type& const_reference;
478475
479private:476private:
480 typedef pair<key_type, mapped_type> __value_type;477 typedef std::pair<key_type, mapped_type> __value_type;
481 typedef __hash_map_hasher<__value_type, hasher> __hasher;478 typedef __hash_map_hasher<__value_type, hasher> __hasher;
482 typedef __hash_map_equal<__value_type, key_equal> __key_equal;479 typedef __hash_map_equal<__value_type, key_equal> __key_equal;
483 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;480 typedef typename std::__rebind_alloc_helper<
481 std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
484482
485 typedef __hash_table<__value_type, __hasher,483 typedef std::__hash_table<__value_type, __hasher,
486 __key_equal, __allocator_type> __table;484 __key_equal, __allocator_type> __table;
487485
488 __table __table_;486 __table __table_;
...@@ -493,8 +491,8 @@ private:...@@ -493,8 +491,8 @@ private:
493 typedef typename __table::__node_allocator __node_allocator;491 typedef typename __table::__node_allocator __node_allocator;
494 typedef typename __table::__node __node;492 typedef typename __table::__node __node;
495 typedef __hash_map_node_destructor<__node_allocator> _Dp;493 typedef __hash_map_node_destructor<__node_allocator> _Dp;
496 typedef unique_ptr<__node, _Dp> __node_holder;494 typedef std::unique_ptr<__node, _Dp> __node_holder;
497 typedef allocator_traits<allocator_type> __alloc_traits;495 typedef std::allocator_traits<allocator_type> __alloc_traits;
498public:496public:
499 typedef typename __alloc_traits::pointer pointer;497 typedef typename __alloc_traits::pointer pointer;
500 typedef typename __alloc_traits::const_pointer const_pointer;498 typedef typename __alloc_traits::const_pointer const_pointer;
...@@ -544,7 +542,7 @@ public:...@@ -544,7 +542,7 @@ public:
544 const_iterator end() const {return __table_.end();}542 const_iterator end() const {return __table_.end();}
545543
546 _LIBCPP_INLINE_VISIBILITY544 _LIBCPP_INLINE_VISIBILITY
547 pair<iterator, bool> insert(const value_type& __x)545 std::pair<iterator, bool> insert(const value_type& __x)
548 {return __table_.__insert_unique(__x);}546 {return __table_.__insert_unique(__x);}
549 _LIBCPP_INLINE_VISIBILITY547 _LIBCPP_INLINE_VISIBILITY
550 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}548 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
...@@ -579,10 +577,10 @@ public:...@@ -579,10 +577,10 @@ public:
579 _LIBCPP_INLINE_VISIBILITY577 _LIBCPP_INLINE_VISIBILITY
580 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}578 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
581 _LIBCPP_INLINE_VISIBILITY579 _LIBCPP_INLINE_VISIBILITY
582 pair<iterator, iterator> equal_range(const key_type& __k)580 std::pair<iterator, iterator> equal_range(const key_type& __k)
583 {return __table_.__equal_range_unique(__k);}581 {return __table_.__equal_range_unique(__k);}
584 _LIBCPP_INLINE_VISIBILITY582 _LIBCPP_INLINE_VISIBILITY
585 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const583 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
586 {return __table_.__equal_range_unique(__k);}584 {return __table_.__equal_range_unique(__k);}
587585
588 mapped_type& operator[](const key_type& __k);586 mapped_type& operator[](const key_type& __k);
...@@ -692,7 +690,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)...@@ -692,7 +690,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
692 if (__i != end())690 if (__i != end())
693 return __i->second;691 return __i->second;
694 __node_holder __h = __construct_node(__k);692 __node_holder __h = __construct_node(__k);
695 pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());693 std::pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
696 __h.release();694 __h.release();
697 return __r.first->second;695 return __r.first->second;
698}696}
...@@ -734,8 +732,8 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,...@@ -734,8 +732,8 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
734 return !(__x == __y);732 return !(__x == __y);
735}733}
736734
737template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,735template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>,
738 class _Alloc = allocator<pair<const _Key, _Tp> > >736 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
739class _LIBCPP_TEMPLATE_VIS hash_multimap737class _LIBCPP_TEMPLATE_VIS hash_multimap
740{738{
741public:739public:
...@@ -746,17 +744,17 @@ public:...@@ -746,17 +744,17 @@ public:
746 typedef _Hash hasher;744 typedef _Hash hasher;
747 typedef _Pred key_equal;745 typedef _Pred key_equal;
748 typedef _Alloc allocator_type;746 typedef _Alloc allocator_type;
749 typedef pair<const key_type, mapped_type> value_type;747 typedef std::pair<const key_type, mapped_type> value_type;
750 typedef value_type& reference;748 typedef value_type& reference;
751 typedef const value_type& const_reference;749 typedef const value_type& const_reference;
752750
753private:751private:
754 typedef pair<key_type, mapped_type> __value_type;752 typedef std::pair<key_type, mapped_type> __value_type;
755 typedef __hash_map_hasher<__value_type, hasher> __hasher;753 typedef __hash_map_hasher<__value_type, hasher> __hasher;
756 typedef __hash_map_equal<__value_type, key_equal> __key_equal;754 typedef __hash_map_equal<__value_type, key_equal> __key_equal;
757 typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;755 typedef typename std::__rebind_alloc_helper<std::allocator_traits<allocator_type>, __value_type>::type __allocator_type;
758756
759 typedef __hash_table<__value_type, __hasher,757 typedef std::__hash_table<__value_type, __hasher,
760 __key_equal, __allocator_type> __table;758 __key_equal, __allocator_type> __table;
761759
762 __table __table_;760 __table __table_;
...@@ -765,8 +763,8 @@ private:...@@ -765,8 +763,8 @@ private:
765 typedef typename __table::__node_allocator __node_allocator;763 typedef typename __table::__node_allocator __node_allocator;
766 typedef typename __table::__node __node;764 typedef typename __table::__node __node;
767 typedef __hash_map_node_destructor<__node_allocator> _Dp;765 typedef __hash_map_node_destructor<__node_allocator> _Dp;
768 typedef unique_ptr<__node, _Dp> __node_holder;766 typedef std::unique_ptr<__node, _Dp> __node_holder;
769 typedef allocator_traits<allocator_type> __alloc_traits;767 typedef std::allocator_traits<allocator_type> __alloc_traits;
770public:768public:
771 typedef typename __alloc_traits::pointer pointer;769 typedef typename __alloc_traits::pointer pointer;
772 typedef typename __alloc_traits::const_pointer const_pointer;770 typedef typename __alloc_traits::const_pointer const_pointer;
...@@ -851,10 +849,10 @@ public:...@@ -851,10 +849,10 @@ public:
851 _LIBCPP_INLINE_VISIBILITY849 _LIBCPP_INLINE_VISIBILITY
852 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}850 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
853 _LIBCPP_INLINE_VISIBILITY851 _LIBCPP_INLINE_VISIBILITY
854 pair<iterator, iterator> equal_range(const key_type& __k)852 std::pair<iterator, iterator> equal_range(const key_type& __k)
855 {return __table_.__equal_range_multi(__k);}853 {return __table_.__equal_range_multi(__k);}
856 _LIBCPP_INLINE_VISIBILITY854 _LIBCPP_INLINE_VISIBILITY
857 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const855 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
858 {return __table_.__equal_range_multi(__k);}856 {return __table_.__equal_range_multi(__k);}
859857
860 _LIBCPP_INLINE_VISIBILITY858 _LIBCPP_INLINE_VISIBILITY
...@@ -956,7 +954,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,...@@ -956,7 +954,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
956 return false;954 return false;
957 typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator955 typedef typename hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator
958 const_iterator;956 const_iterator;
959 typedef pair<const_iterator, const_iterator> _EqRng;957 typedef std::pair<const_iterator, const_iterator> _EqRng;
960 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)958 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
961 {959 {
962 _EqRng __xeq = __x.equal_range(__i->first);960 _EqRng __xeq = __x.equal_range(__i->first);
lib/libcxx/include/ext/hash_set+16-18
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- hash_set ------------------------------------===//2//===------------------------- hash_set ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -208,10 +207,9 @@ template <class Value, class Hash, class Pred, class Alloc>...@@ -208,10 +207,9 @@ template <class Value, class Hash, class Pred, class Alloc>
208207
209namespace __gnu_cxx {208namespace __gnu_cxx {
210209
211using namespace std;
212210
213template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,211template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
214 class _Alloc = allocator<_Value> >212 class _Alloc = std::allocator<_Value> >
215class _LIBCPP_TEMPLATE_VIS hash_set213class _LIBCPP_TEMPLATE_VIS hash_set
216{214{
217public:215public:
...@@ -225,7 +223,7 @@ public:...@@ -225,7 +223,7 @@ public:
225 typedef const value_type& const_reference;223 typedef const value_type& const_reference;
226224
227private:225private:
228 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;226 typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
229227
230 __table __table_;228 __table __table_;
231229
...@@ -277,7 +275,7 @@ public:...@@ -277,7 +275,7 @@ public:
277 const_iterator end() const {return __table_.end();}275 const_iterator end() const {return __table_.end();}
278276
279 _LIBCPP_INLINE_VISIBILITY277 _LIBCPP_INLINE_VISIBILITY
280 pair<iterator, bool> insert(const value_type& __x)278 std::pair<iterator, bool> insert(const value_type& __x)
281 {return __table_.__insert_unique(__x);}279 {return __table_.__insert_unique(__x);}
282 _LIBCPP_INLINE_VISIBILITY280 _LIBCPP_INLINE_VISIBILITY
283 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}281 iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
...@@ -310,10 +308,10 @@ public:...@@ -310,10 +308,10 @@ public:
310 _LIBCPP_INLINE_VISIBILITY308 _LIBCPP_INLINE_VISIBILITY
311 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}309 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
312 _LIBCPP_INLINE_VISIBILITY310 _LIBCPP_INLINE_VISIBILITY
313 pair<iterator, iterator> equal_range(const key_type& __k)311 std::pair<iterator, iterator> equal_range(const key_type& __k)
314 {return __table_.__equal_range_unique(__k);}312 {return __table_.__equal_range_unique(__k);}
315 _LIBCPP_INLINE_VISIBILITY313 _LIBCPP_INLINE_VISIBILITY
316 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const314 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
317 {return __table_.__equal_range_unique(__k);}315 {return __table_.__equal_range_unique(__k);}
318316
319 _LIBCPP_INLINE_VISIBILITY317 _LIBCPP_INLINE_VISIBILITY
...@@ -432,8 +430,8 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,...@@ -432,8 +430,8 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
432 return !(__x == __y);430 return !(__x == __y);
433}431}
434432
435template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,433template <class _Value, class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>,
436 class _Alloc = allocator<_Value> >434 class _Alloc = std::allocator<_Value> >
437class _LIBCPP_TEMPLATE_VIS hash_multiset435class _LIBCPP_TEMPLATE_VIS hash_multiset
438{436{
439public:437public:
...@@ -447,7 +445,7 @@ public:...@@ -447,7 +445,7 @@ public:
447 typedef const value_type& const_reference;445 typedef const value_type& const_reference;
448446
449private:447private:
450 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;448 typedef std::__hash_table<value_type, hasher, key_equal, allocator_type> __table;
451449
452 __table __table_;450 __table __table_;
453451
...@@ -531,10 +529,10 @@ public:...@@ -531,10 +529,10 @@ public:
531 _LIBCPP_INLINE_VISIBILITY529 _LIBCPP_INLINE_VISIBILITY
532 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}530 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
533 _LIBCPP_INLINE_VISIBILITY531 _LIBCPP_INLINE_VISIBILITY
534 pair<iterator, iterator> equal_range(const key_type& __k)532 std::pair<iterator, iterator> equal_range(const key_type& __k)
535 {return __table_.__equal_range_multi(__k);}533 {return __table_.__equal_range_multi(__k);}
536 _LIBCPP_INLINE_VISIBILITY534 _LIBCPP_INLINE_VISIBILITY
537 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const535 std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
538 {return __table_.__equal_range_multi(__k);}536 {return __table_.__equal_range_multi(__k);}
539537
540 _LIBCPP_INLINE_VISIBILITY538 _LIBCPP_INLINE_VISIBILITY
...@@ -611,7 +609,7 @@ template <class _InputIterator>...@@ -611,7 +609,7 @@ template <class _InputIterator>
611inline609inline
612void610void
613hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,611hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
614 _InputIterator __last)612 _InputIterator __last)
615{613{
616 for (; __first != __last; ++__first)614 for (; __first != __last; ++__first)
617 __table_.__insert_multi(*__first);615 __table_.__insert_multi(*__first);
...@@ -635,7 +633,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,...@@ -635,7 +633,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
635 return false;633 return false;
636 typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator634 typedef typename hash_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
637 const_iterator;635 const_iterator;
638 typedef pair<const_iterator, const_iterator> _EqRng;636 typedef std::pair<const_iterator, const_iterator> _EqRng;
639 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)637 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
640 {638 {
641 _EqRng __xeq = __x.equal_range(*__i);639 _EqRng __xeq = __x.equal_range(*__i);
lib/libcxx/include/fenv.h created+116
...@@ -0,0 +1,116 @@
1// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FENV_H
11#define _LIBCPP_FENV_H
12
13
14/*
15 fenv.h synopsis
16
17This entire header is C99 / C++0X
18
19Macros:
20
21 FE_DIVBYZERO
22 FE_INEXACT
23 FE_INVALID
24 FE_OVERFLOW
25 FE_UNDERFLOW
26 FE_ALL_EXCEPT
27 FE_DOWNWARD
28 FE_TONEAREST
29 FE_TOWARDZERO
30 FE_UPWARD
31 FE_DFL_ENV
32
33Types:
34
35 fenv_t
36 fexcept_t
37
38int feclearexcept(int excepts);
39int fegetexceptflag(fexcept_t* flagp, int excepts);
40int feraiseexcept(int excepts);
41int fesetexceptflag(const fexcept_t* flagp, int excepts);
42int fetestexcept(int excepts);
43int fegetround();
44int fesetround(int round);
45int fegetenv(fenv_t* envp);
46int feholdexcept(fenv_t* envp);
47int fesetenv(const fenv_t* envp);
48int feupdateenv(const fenv_t* envp);
49
50
51*/
52
53#include <__config>
54
55#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
56#pragma GCC system_header
57#endif
58
59#include_next <fenv.h>
60
61#ifdef __cplusplus
62
63extern "C++" {
64
65#ifdef feclearexcept
66#undef feclearexcept
67#endif
68
69#ifdef fegetexceptflag
70#undef fegetexceptflag
71#endif
72
73
74#ifdef feraiseexcept
75#undef feraiseexcept
76#endif
77
78#ifdef fesetexceptflag
79#undef fesetexceptflag
80#endif
81
82
83#ifdef fetestexcept
84#undef fetestexcept
85#endif
86
87#ifdef fegetround
88#undef fegetround
89#endif
90
91#ifdef fesetround
92#undef fesetround
93#endif
94
95#ifdef fegetenv
96#undef fegetenv
97#endif
98
99#ifdef feholdexcept
100#undef feholdexcept
101#endif
102
103
104#ifdef fesetenv
105#undef fesetenv
106#endif
107
108#ifdef feupdateenv
109#undef feupdateenv
110#endif
111
112} // extern "C++"
113
114#endif // defined(__cplusplus)
115
116#endif // _LIBCPP_FENV_H
lib/libcxx/include/filesystem+19-13
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- filesystem -------------------------------===//2//===--------------------------- filesystem -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_FILESYSTEM9#ifndef _LIBCPP_FILESYSTEM
...@@ -259,6 +258,8 @@ _LIBCPP_PUSH_MACROS...@@ -259,6 +258,8 @@ _LIBCPP_PUSH_MACROS
259258
260_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM259_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
261260
261_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
262
262typedef chrono::time_point<_FilesystemClock> file_time_type;263typedef chrono::time_point<_FilesystemClock> file_time_type;
263264
264struct _LIBCPP_TYPE_VIS space_info {265struct _LIBCPP_TYPE_VIS space_info {
...@@ -1311,7 +1312,11 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs,...@@ -1311,7 +1312,11 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs,
1311 return !(__lhs == __rhs);1312 return !(__lhs == __rhs);
1312}1313}
13131314
1314class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {1315// TODO(ldionne): We need to pop the pragma and push it again after
1316// filesystem_error to work around PR41078.
1317_LIBCPP_AVAILABILITY_FILESYSTEM_POP
1318
1319class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
1315public:1320public:
1316 _LIBCPP_INLINE_VISIBILITY1321 _LIBCPP_INLINE_VISIBILITY
1317 filesystem_error(const string& __what, error_code __ec)1322 filesystem_error(const string& __what, error_code __ec)
...@@ -1348,11 +1353,10 @@ public:...@@ -1348,11 +1353,10 @@ public:
1348 return __storage_->__what_.c_str();1353 return __storage_->__what_.c_str();
1349 }1354 }
13501355
1351 _LIBCPP_FUNC_VIS
1352 void __create_what(int __num_paths);1356 void __create_what(int __num_paths);
13531357
1354private:1358private:
1355 struct _Storage {1359 struct _LIBCPP_HIDDEN _Storage {
1356 _LIBCPP_INLINE_VISIBILITY1360 _LIBCPP_INLINE_VISIBILITY
1357 _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}1361 _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
13581362
...@@ -1363,16 +1367,16 @@ private:...@@ -1363,16 +1367,16 @@ private:
1363 shared_ptr<_Storage> __storage_;1367 shared_ptr<_Storage> __storage_;
1364};1368};
13651369
1370_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
1371
1366template <class... _Args>1372template <class... _Args>
1367_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY1373_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
1368#ifndef _LIBCPP_NO_EXCEPTIONS1374#ifndef _LIBCPP_NO_EXCEPTIONS
1369 void1375void __throw_filesystem_error(_Args&&... __args) {
1370 __throw_filesystem_error(_Args&&... __args) {
1371 throw filesystem_error(std::forward<_Args>(__args)...);1376 throw filesystem_error(std::forward<_Args>(__args)...);
1372}1377}
1373#else1378#else
1374 void1379void __throw_filesystem_error(_Args&&...) {
1375 __throw_filesystem_error(_Args&&...) {
1376 _VSTD::abort();1380 _VSTD::abort();
1377}1381}
1378#endif1382#endif
...@@ -1938,7 +1942,7 @@ inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p,...@@ -1938,7 +1942,7 @@ inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p,
19381942
1939class directory_iterator;1943class directory_iterator;
1940class recursive_directory_iterator;1944class recursive_directory_iterator;
1941class __dir_stream;1945class _LIBCPP_HIDDEN __dir_stream;
19421946
1943class directory_entry {1947class directory_entry {
1944 typedef _VSTD_FS::path _Path;1948 typedef _VSTD_FS::path _Path;
...@@ -2601,7 +2605,7 @@ private:...@@ -2601,7 +2605,7 @@ private:
2601 operator==(const recursive_directory_iterator&,2605 operator==(const recursive_directory_iterator&,
2602 const recursive_directory_iterator&) noexcept;2606 const recursive_directory_iterator&) noexcept;
26032607
2604 struct __shared_imp;2608 struct _LIBCPP_HIDDEN __shared_imp;
2605 shared_ptr<__shared_imp> __imp_;2609 shared_ptr<__shared_imp> __imp_;
2606 bool __rec_;2610 bool __rec_;
2607}; // class recursive_directory_iterator2611}; // class recursive_directory_iterator
...@@ -2628,6 +2632,8 @@ end(const recursive_directory_iterator&) noexcept {...@@ -2628,6 +2632,8 @@ end(const recursive_directory_iterator&) noexcept {
2628 return recursive_directory_iterator();2632 return recursive_directory_iterator();
2629}2633}
26302634
2635_LIBCPP_AVAILABILITY_FILESYSTEM_POP
2636
2631_LIBCPP_END_NAMESPACE_FILESYSTEM2637_LIBCPP_END_NAMESPACE_FILESYSTEM
26322638
2633#endif // !_LIBCPP_CXX03_LANG2639#endif // !_LIBCPP_CXX03_LANG
lib/libcxx/include/float.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- float.h ----------------------------------===//2//===--------------------------- float.h ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/forward_list+45-32
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------- forward_list ---------------------------------===//2//===----------------------- forward_list ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -121,10 +120,12 @@ public:...@@ -121,10 +120,12 @@ public:
121 const_iterator first, const_iterator last);120 const_iterator first, const_iterator last);
122 void splice_after(const_iterator p, forward_list&& x,121 void splice_after(const_iterator p, forward_list&& x,
123 const_iterator first, const_iterator last);122 const_iterator first, const_iterator last);
124 void remove(const value_type& v);123 size_type remove(const value_type& v); // void before C++20
125 template <class Predicate> void remove_if(Predicate pred);124 template <class Predicate>
126 void unique();125 size_type remove_if(Predicate pred); // void before C++20
127 template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);126 size_type unique(); // void before C++20
127 template <class BinaryPredicate>
128 size_type unique(BinaryPredicate binary_pred); // void before C++20
128 void merge(forward_list& x);129 void merge(forward_list& x);
129 void merge(forward_list&& x);130 void merge(forward_list&& x);
130 template <class Compare> void merge(forward_list& x, Compare comp);131 template <class Compare> void merge(forward_list& x, Compare comp);
...@@ -531,7 +532,7 @@ public:...@@ -531,7 +532,7 @@ public:
531#if _LIBCPP_STD_VER >= 14532#if _LIBCPP_STD_VER >= 14
532 _NOEXCEPT;533 _NOEXCEPT;
533#else534#else
534 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 535 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
535 __is_nothrow_swappable<__node_allocator>::value);536 __is_nothrow_swappable<__node_allocator>::value);
536#endif537#endif
537protected:538protected:
...@@ -596,11 +597,11 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)...@@ -596,11 +597,11 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
596#if _LIBCPP_STD_VER >= 14597#if _LIBCPP_STD_VER >= 14
597 _NOEXCEPT598 _NOEXCEPT
598#else599#else
599 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value || 600 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
600 __is_nothrow_swappable<__node_allocator>::value)601 __is_nothrow_swappable<__node_allocator>::value)
601#endif602#endif
602{603{
603 __swap_allocator(__alloc(), __x.__alloc(), 604 __swap_allocator(__alloc(), __x.__alloc(),
604 integral_constant<bool, __node_traits::propagate_on_container_swap::value>());605 integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
605 using _VSTD::swap;606 using _VSTD::swap;
606 swap(__before_begin()->__next_, __x.__before_begin()->__next_);607 swap(__before_begin()->__next_, __x.__before_begin()->__next_);
...@@ -648,6 +649,11 @@ public:...@@ -648,6 +649,11 @@ public:
648649
649 typedef typename base::iterator iterator;650 typedef typename base::iterator iterator;
650 typedef typename base::const_iterator const_iterator;651 typedef typename base::const_iterator const_iterator;
652#if _LIBCPP_STD_VER > 17
653 typedef size_type __remove_return_type;
654#else
655 typedef void __remove_return_type;
656#endif
651657
652 _LIBCPP_INLINE_VISIBILITY658 _LIBCPP_INLINE_VISIBILITY
653 forward_list()659 forward_list()
...@@ -809,7 +815,6 @@ public:...@@ -809,7 +815,6 @@ public:
809 _LIBCPP_INLINE_VISIBILITY815 _LIBCPP_INLINE_VISIBILITY
810 void clear() _NOEXCEPT {base::clear();}816 void clear() _NOEXCEPT {base::clear();}
811817
812#ifndef _LIBCPP_CXX03_LANG
813 _LIBCPP_INLINE_VISIBILITY818 _LIBCPP_INLINE_VISIBILITY
814 void splice_after(const_iterator __p, forward_list&& __x);819 void splice_after(const_iterator __p, forward_list&& __x);
815 _LIBCPP_INLINE_VISIBILITY820 _LIBCPP_INLINE_VISIBILITY
...@@ -817,16 +822,15 @@ public:...@@ -817,16 +822,15 @@ public:
817 _LIBCPP_INLINE_VISIBILITY822 _LIBCPP_INLINE_VISIBILITY
818 void splice_after(const_iterator __p, forward_list&& __x,823 void splice_after(const_iterator __p, forward_list&& __x,
819 const_iterator __f, const_iterator __l);824 const_iterator __f, const_iterator __l);
820#endif // _LIBCPP_CXX03_LANG
821 void splice_after(const_iterator __p, forward_list& __x);825 void splice_after(const_iterator __p, forward_list& __x);
822 void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);826 void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
823 void splice_after(const_iterator __p, forward_list& __x,827 void splice_after(const_iterator __p, forward_list& __x,
824 const_iterator __f, const_iterator __l);828 const_iterator __f, const_iterator __l);
825 void remove(const value_type& __v);829 __remove_return_type remove(const value_type& __v);
826 template <class _Predicate> void remove_if(_Predicate __pred);830 template <class _Predicate> __remove_return_type remove_if(_Predicate __pred);
827 _LIBCPP_INLINE_VISIBILITY831 _LIBCPP_INLINE_VISIBILITY
828 void unique() {unique(__equal_to<value_type>());}832 __remove_return_type unique() {return unique(__equal_to<value_type>());}
829 template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);833 template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred);
830#ifndef _LIBCPP_CXX03_LANG834#ifndef _LIBCPP_CXX03_LANG
831 _LIBCPP_INLINE_VISIBILITY835 _LIBCPP_INLINE_VISIBILITY
832 void merge(forward_list&& __x) {merge(__x, __less<value_type>());}836 void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
...@@ -1469,8 +1473,6 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,...@@ -1469,8 +1473,6 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
1469 }1473 }
1470}1474}
14711475
1472#ifndef _LIBCPP_CXX03_LANG
1473
1474template <class _Tp, class _Alloc>1476template <class _Tp, class _Alloc>
1475inline _LIBCPP_INLINE_VISIBILITY1477inline _LIBCPP_INLINE_VISIBILITY
1476void1478void
...@@ -1500,21 +1502,21 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,...@@ -1500,21 +1502,21 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
1500 splice_after(__p, __x, __f, __l);1502 splice_after(__p, __x, __f, __l);
1501}1503}
15021504
1503#endif // _LIBCPP_CXX03_LANG
1504
1505template <class _Tp, class _Alloc>1505template <class _Tp, class _Alloc>
1506void1506typename forward_list<_Tp, _Alloc>::__remove_return_type
1507forward_list<_Tp, _Alloc>::remove(const value_type& __v)1507forward_list<_Tp, _Alloc>::remove(const value_type& __v)
1508{1508{
1509 forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing1509 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1510 iterator __e = end();1510 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
1511 const iterator __e = end();
1511 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)1512 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
1512 {1513 {
1513 if (__i.__get_begin()->__next_->__value_ == __v)1514 if (__i.__get_begin()->__next_->__value_ == __v)
1514 {1515 {
1516 ++__count_removed;
1515 iterator __j = _VSTD::next(__i, 2);1517 iterator __j = _VSTD::next(__i, 2);
1516 for (; __j != __e && *__j == __v; ++__j)1518 for (; __j != __e && *__j == __v; ++__j)
1517 ;1519 ++__count_removed;
1518 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);1520 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
1519 if (__j == __e)1521 if (__j == __e)
1520 break;1522 break;
...@@ -1523,22 +1525,27 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)...@@ -1523,22 +1525,27 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
1523 else1525 else
1524 ++__i;1526 ++__i;
1525 }1527 }
1528
1529 return (__remove_return_type) __count_removed;
1526}1530}
15271531
1528template <class _Tp, class _Alloc>1532template <class _Tp, class _Alloc>
1529template <class _Predicate>1533template <class _Predicate>
1530void1534typename forward_list<_Tp, _Alloc>::__remove_return_type
1531forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)1535forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
1532{1536{
1533 iterator __e = end();1537 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1538 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
1539 const iterator __e = end();
1534 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)1540 for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;)
1535 {1541 {
1536 if (__pred(__i.__get_begin()->__next_->__value_))1542 if (__pred(__i.__get_begin()->__next_->__value_))
1537 {1543 {
1544 ++__count_removed;
1538 iterator __j = _VSTD::next(__i, 2);1545 iterator __j = _VSTD::next(__i, 2);
1539 for (; __j != __e && __pred(*__j); ++__j)1546 for (; __j != __e && __pred(*__j); ++__j)
1540 ;1547 ++__count_removed;
1541 erase_after(__i, __j);1548 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
1542 if (__j == __e)1549 if (__j == __e)
1543 break;1550 break;
1544 __i = __j;1551 __i = __j;
...@@ -1546,22 +1553,28 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)...@@ -1546,22 +1553,28 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
1546 else1553 else
1547 ++__i;1554 ++__i;
1548 }1555 }
1556
1557 return (__remove_return_type) __count_removed;
1549}1558}
15501559
1551template <class _Tp, class _Alloc>1560template <class _Tp, class _Alloc>
1552template <class _BinaryPredicate>1561template <class _BinaryPredicate>
1553void1562typename forward_list<_Tp, _Alloc>::__remove_return_type
1554forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)1563forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
1555{1564{
1565 forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
1566 typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0;
1556 for (iterator __i = begin(), __e = end(); __i != __e;)1567 for (iterator __i = begin(), __e = end(); __i != __e;)
1557 {1568 {
1558 iterator __j = _VSTD::next(__i);1569 iterator __j = _VSTD::next(__i);
1559 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)1570 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
1560 ;1571 ++__count_removed;
1561 if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())1572 if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer())
1562 erase_after(__i, __j);1573 __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
1563 __i = __j;1574 __i = __j;
1564 }1575 }
1576
1577 return (__remove_return_type) __count_removed;
1565}1578}
15661579
1567template <class _Tp, class _Alloc>1580template <class _Tp, class _Alloc>
lib/libcxx/include/fstream+11-12
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- fstream ------------------------------------===//2//===------------------------- fstream ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -236,7 +235,7 @@ public:...@@ -236,7 +235,7 @@ public:
236 basic_filebuf* open(const string& __s, ios_base::openmode __mode);235 basic_filebuf* open(const string& __s, ios_base::openmode __mode);
237236
238#if _LIBCPP_STD_VER >= 17237#if _LIBCPP_STD_VER >= 17
239 _LIBCPP_INLINE_VISIBILITY238 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
240 basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {239 basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {
241 return open(__p.c_str(), __mode);240 return open(__p.c_str(), __mode);
242 }241 }
...@@ -758,7 +757,7 @@ basic_filebuf<_CharT, _Traits>::underflow()...@@ -758,7 +757,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
758 this->eback() + __ibs_, __inext);757 this->eback() + __ibs_, __inext);
759 if (__r == codecvt_base::noconv)758 if (__r == codecvt_base::noconv)
760 {759 {
761 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, 760 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
762 (char_type*)const_cast<char *>(__extbufend_));761 (char_type*)const_cast<char *>(__extbufend_));
763 __c = traits_type::to_int_type(*this->gptr());762 __c = traits_type::to_int_type(*this->gptr());
764 }763 }
...@@ -1152,7 +1151,7 @@ public:...@@ -1152,7 +1151,7 @@ public:
1152 _LIBCPP_INLINE_VISIBILITY1151 _LIBCPP_INLINE_VISIBILITY
1153 explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);1152 explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
1154#if _LIBCPP_STD_VER >= 171153#if _LIBCPP_STD_VER >= 17
1155 _LIBCPP_INLINE_VISIBILITY1154 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1156 explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)1155 explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
1157 : basic_ifstream(__p.c_str(), __mode) {}1156 : basic_ifstream(__p.c_str(), __mode) {}
1158#endif // _LIBCPP_STD_VER >= 171157#endif // _LIBCPP_STD_VER >= 17
...@@ -1178,7 +1177,7 @@ public:...@@ -1178,7 +1177,7 @@ public:
1178#endif1177#endif
1179 void open(const string& __s, ios_base::openmode __mode = ios_base::in);1178 void open(const string& __s, ios_base::openmode __mode = ios_base::in);
1180#if _LIBCPP_STD_VER >= 171179#if _LIBCPP_STD_VER >= 17
1181 _LIBCPP_INLINE_VISIBILITY1180 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1182 void open(const filesystem::path& __p,1181 void open(const filesystem::path& __p,
1183 ios_base::openmode __mode = ios_base::in) {1182 ios_base::openmode __mode = ios_base::in) {
1184 return open(__p.c_str(), __mode);1183 return open(__p.c_str(), __mode);
...@@ -1366,7 +1365,7 @@ public:...@@ -1366,7 +1365,7 @@ public:
1366 explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);1365 explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
13671366
1368#if _LIBCPP_STD_VER >= 171367#if _LIBCPP_STD_VER >= 17
1369 _LIBCPP_INLINE_VISIBILITY1368 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1370 explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)1369 explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
1371 : basic_ofstream(__p.c_str(), __mode) {}1370 : basic_ofstream(__p.c_str(), __mode) {}
1372#endif // _LIBCPP_STD_VER >= 171371#endif // _LIBCPP_STD_VER >= 17
...@@ -1393,7 +1392,7 @@ public:...@@ -1393,7 +1392,7 @@ public:
1393 void open(const string& __s, ios_base::openmode __mode = ios_base::out);1392 void open(const string& __s, ios_base::openmode __mode = ios_base::out);
13941393
1395#if _LIBCPP_STD_VER >= 171394#if _LIBCPP_STD_VER >= 17
1396 _LIBCPP_INLINE_VISIBILITY1395 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1397 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)1396 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
1398 { return open(__p.c_str(), __mode); }1397 { return open(__p.c_str(), __mode); }
1399#endif // _LIBCPP_STD_VER >= 171398#endif // _LIBCPP_STD_VER >= 17
...@@ -1580,7 +1579,7 @@ public:...@@ -1580,7 +1579,7 @@ public:
1580 explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);1579 explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
15811580
1582#if _LIBCPP_STD_VER >= 171581#if _LIBCPP_STD_VER >= 17
1583 _LIBCPP_INLINE_VISIBILITY1582 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1584 explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)1583 explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
1585 : basic_fstream(__p.c_str(), __mode) {}1584 : basic_fstream(__p.c_str(), __mode) {}
1586#endif // _LIBCPP_STD_VER >= 171585#endif // _LIBCPP_STD_VER >= 17
...@@ -1608,7 +1607,7 @@ public:...@@ -1608,7 +1607,7 @@ public:
1608 void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);1607 void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
16091608
1610#if _LIBCPP_STD_VER >= 171609#if _LIBCPP_STD_VER >= 17
1611 _LIBCPP_INLINE_VISIBILITY1610 _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
1612 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)1611 void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
1613 { return open(__p.c_str(), __mode); }1612 { return open(__p.c_str(), __mode); }
1614#endif // _LIBCPP_STD_VER >= 171613#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/functional+106-34
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ functional ----------------------------------===//2//===------------------------ functional ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -231,6 +230,10 @@ template<class Fn, class... BoundArgs>...@@ -231,6 +230,10 @@ template<class Fn, class... BoundArgs>
231template<class R, class Fn, class... BoundArgs>230template<class R, class Fn, class... BoundArgs>
232 unspecified bind(Fn&&, BoundArgs&&...);231 unspecified bind(Fn&&, BoundArgs&&...);
233232
233template<class F, class... Args>
234 invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17
235 noexcept(is_nothrow_invocable_v<F, Args...>);
236
234namespace placeholders {237namespace placeholders {
235 // M is the implementation-defined number of placeholders238 // M is the implementation-defined number of placeholders
236 extern unspecified _1;239 extern unspecified _1;
...@@ -1476,6 +1479,8 @@ namespace __function {...@@ -1476,6 +1479,8 @@ namespace __function {
1476// __alloc_func holds a functor and an allocator.1479// __alloc_func holds a functor and an allocator.
14771480
1478template <class _Fp, class _Ap, class _FB> class __alloc_func;1481template <class _Fp, class _Ap, class _FB> class __alloc_func;
1482template <class _Fp, class _FB>
1483class __default_alloc_func;
14791484
1480template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>1485template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
1481class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>1486class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
...@@ -1483,14 +1488,15 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>...@@ -1483,14 +1488,15 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
1483 __compressed_pair<_Fp, _Ap> __f_;1488 __compressed_pair<_Fp, _Ap> __f_;
14841489
1485 public:1490 public:
1486 typedef _Fp _Target;1491 typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
1487 typedef _Ap _Alloc;1492 typedef _LIBCPP_NODEBUG_TYPE _Ap _Alloc;
14881493
1489 _LIBCPP_INLINE_VISIBILITY1494 _LIBCPP_INLINE_VISIBILITY
1490 const _Target& __target() const { return __f_.first(); }1495 const _Target& __target() const { return __f_.first(); }
14911496
1497 // WIN32 APIs may define __allocator, so use __get_allocator instead.
1492 _LIBCPP_INLINE_VISIBILITY1498 _LIBCPP_INLINE_VISIBILITY
1493 const _Alloc& __allocator() const { return __f_.second(); }1499 const _Alloc& __get_allocator() const { return __f_.second(); }
14941500
1495 _LIBCPP_INLINE_VISIBILITY1501 _LIBCPP_INLINE_VISIBILITY
1496 explicit __alloc_func(_Target&& __f)1502 explicit __alloc_func(_Target&& __f)
...@@ -1544,6 +1550,56 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>...@@ -1544,6 +1550,56 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)>
15441550
1545 _LIBCPP_INLINE_VISIBILITY1551 _LIBCPP_INLINE_VISIBILITY
1546 void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }1552 void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
1553
1554 static void __destroy_and_delete(__alloc_func* __f) {
1555 typedef allocator_traits<_Alloc> __alloc_traits;
1556 typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type
1557 _FunAlloc;
1558 _FunAlloc __a(__f->__get_allocator());
1559 __f->destroy();
1560 __a.deallocate(__f, 1);
1561 }
1562};
1563
1564template <class _Fp, class _Rp, class... _ArgTypes>
1565class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
1566 _Fp __f_;
1567
1568public:
1569 typedef _LIBCPP_NODEBUG_TYPE _Fp _Target;
1570
1571 _LIBCPP_INLINE_VISIBILITY
1572 const _Target& __target() const { return __f_; }
1573
1574 _LIBCPP_INLINE_VISIBILITY
1575 explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
1576
1577 _LIBCPP_INLINE_VISIBILITY
1578 explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
1579
1580 _LIBCPP_INLINE_VISIBILITY
1581 _Rp operator()(_ArgTypes&&... __arg) {
1582 typedef __invoke_void_return_wrapper<_Rp> _Invoker;
1583 return _Invoker::__call(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
1584 }
1585
1586 _LIBCPP_INLINE_VISIBILITY
1587 __default_alloc_func* __clone() const {
1588 __builtin_new_allocator::__holder_t __hold =
1589 __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
1590 __default_alloc_func* __res =
1591 ::new (__hold.get()) __default_alloc_func(__f_);
1592 (void)__hold.release();
1593 return __res;
1594 }
1595
1596 _LIBCPP_INLINE_VISIBILITY
1597 void destroy() _NOEXCEPT { __f_.~_Target(); }
1598
1599 static void __destroy_and_delete(__default_alloc_func* __f) {
1600 __f->destroy();
1601 __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
1602 }
1547};1603};
15481604
1549// __base provides an abstract interface for copyable functors.1605// __base provides an abstract interface for copyable functors.
...@@ -1612,7 +1668,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const...@@ -1612,7 +1668,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
1612{1668{
1613 typedef allocator_traits<_Alloc> __alloc_traits;1669 typedef allocator_traits<_Alloc> __alloc_traits;
1614 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;1670 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
1615 _Ap __a(__f_.__allocator());1671 _Ap __a(__f_.__get_allocator());
1616 typedef __allocator_destructor<_Ap> _Dp;1672 typedef __allocator_destructor<_Ap> _Dp;
1617 unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));1673 unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
1618 ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));1674 ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
...@@ -1623,7 +1679,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>...@@ -1623,7 +1679,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
1623void1679void
1624__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const1680__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
1625{1681{
1626 ::new (__p) __func(__f_.__target(), __f_.__allocator());1682 ::new (__p) __func(__f_.__target(), __f_.__get_allocator());
1627}1683}
16281684
1629template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>1685template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
...@@ -1639,7 +1695,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT...@@ -1639,7 +1695,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
1639{1695{
1640 typedef allocator_traits<_Alloc> __alloc_traits;1696 typedef allocator_traits<_Alloc> __alloc_traits;
1641 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;1697 typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
1642 _Ap __a(__f_.__allocator());1698 _Ap __a(__f_.__get_allocator());
1643 __f_.destroy();1699 __f_.destroy();
1644 __a.deallocate(this, 1);1700 __a.deallocate(this, 1);
1645}1701}
...@@ -1692,7 +1748,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>...@@ -1692,7 +1748,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
1692 __value_func() _NOEXCEPT : __f_(0) {}1748 __value_func() _NOEXCEPT : __f_(0) {}
16931749
1694 template <class _Fp, class _Alloc>1750 template <class _Fp, class _Alloc>
1695 _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc __a)1751 _LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
1696 : __f_(0)1752 : __f_(0)
1697 {1753 {
1698 typedef allocator_traits<_Alloc> __alloc_traits;1754 typedef allocator_traits<_Alloc> __alloc_traits;
...@@ -1720,6 +1776,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>...@@ -1720,6 +1776,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
1720 }1776 }
1721 }1777 }
17221778
1779 template <class _Fp,
1780 class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
1781 _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f)
1782 : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
1783
1723 _LIBCPP_INLINE_VISIBILITY1784 _LIBCPP_INLINE_VISIBILITY
1724 __value_func(const __value_func& __f)1785 __value_func(const __value_func& __f)
1725 {1786 {
...@@ -1919,29 +1980,22 @@ struct __policy...@@ -1919,29 +1980,22 @@ struct __policy
1919 return __f->__clone();1980 return __f->__clone();
1920 }1981 }
19211982
1922 template <typename _Fun> static void __large_destroy(void* __s)1983 template <typename _Fun>
1923 {1984 static void __large_destroy(void* __s) {
1924 typedef allocator_traits<typename _Fun::_Alloc> __alloc_traits;1985 _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
1925 typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type
1926 _FunAlloc;
1927 _Fun* __f = static_cast<_Fun*>(__s);
1928 _FunAlloc __a(__f->__allocator());
1929 __f->destroy();
1930 __a.deallocate(__f, 1);
1931 }1986 }
19321987
1933 template <typename _Fun>1988 template <typename _Fun>
1934 _LIBCPP_INLINE_VISIBILITY static const __policy*1989 _LIBCPP_INLINE_VISIBILITY static const __policy*
1935 __choose_policy(/* is_small = */ false_type)1990 __choose_policy(/* is_small = */ false_type) {
1936 {1991 static const _LIBCPP_CONSTEXPR __policy __policy_ = {
1937 static const _LIBCPP_CONSTEXPR __policy __policy_ = {1992 &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
1938 &__large_clone<_Fun>, &__large_destroy<_Fun>, false,
1939#ifndef _LIBCPP_NO_RTTI1993#ifndef _LIBCPP_NO_RTTI
1940 &typeid(typename _Fun::_Target)1994 &typeid(typename _Fun::_Target)
1941#else1995#else
1942 nullptr1996 nullptr
1943#endif1997#endif
1944 };1998 };
1945 return &__policy_;1999 return &__policy_;
1946 }2000 }
19472001
...@@ -2066,6 +2120,25 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>...@@ -2066,6 +2120,25 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
2066 }2120 }
2067 }2121 }
20682122
2123 template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type>
2124 _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f)
2125 : __policy_(__policy::__create_empty()) {
2126 typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
2127
2128 if (__function::__not_null(__f)) {
2129 __invoker_ = __invoker::template __create<_Fun>();
2130 __policy_ = __policy::__create<_Fun>();
2131 if (__use_small_storage<_Fun>()) {
2132 ::new ((void*)&__buf_.__small) _Fun(_VSTD::move(__f));
2133 } else {
2134 __builtin_new_allocator::__holder_t __hold =
2135 __builtin_new_allocator::__allocate_type<_Fun>(1);
2136 __buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f));
2137 (void)__hold.release();
2138 }
2139 }
2140 }
2141
2069 _LIBCPP_INLINE_VISIBILITY2142 _LIBCPP_INLINE_VISIBILITY
2070 __policy_func(const __policy_func& __f)2143 __policy_func(const __policy_func& __f)
2071 : __buf_(__f.__buf_), __invoker_(__f.__invoker_),2144 : __buf_(__f.__buf_), __invoker_(__f.__invoker_),
...@@ -2173,8 +2246,8 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>...@@ -2173,8 +2246,8 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
21732246
2174 __func __f_;2247 __func __f_;
21752248
2176 template <class _Fp, bool = __lazy_and<2249 template <class _Fp, bool = _And<
2177 integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,2250 _IsNotSame<__uncvref_t<_Fp>, function>,
2178 __invokable<_Fp&, _ArgTypes...>2251 __invokable<_Fp&, _ArgTypes...>
2179 >::value>2252 >::value>
2180 struct __callable;2253 struct __callable;
...@@ -2286,8 +2359,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,...@@ -2286,8 +2359,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
22862359
2287template <class _Rp, class... _ArgTypes>2360template <class _Rp, class... _ArgTypes>
2288template <class _Fp, class>2361template <class _Fp, class>
2289function<_Rp(_ArgTypes...)>::function(_Fp __f)2362function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(_VSTD::move(__f)) {}
2290 : __f_(_VSTD::move(__f), allocator<_Fp>()) {}
22912363
2292#if _LIBCPP_STD_VER <= 142364#if _LIBCPP_STD_VER <= 14
2293template <class _Rp, class... _ArgTypes>2365template <class _Rp, class... _ArgTypes>
...@@ -2484,7 +2556,7 @@ __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)...@@ -2484,7 +2556,7 @@ __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
24842556
2485template <class _Ti, class ..._Uj>2557template <class _Ti, class ..._Uj>
2486inline _LIBCPP_INLINE_VISIBILITY2558inline _LIBCPP_INLINE_VISIBILITY
2487typename __lazy_enable_if2559typename _EnableIf
2488<2560<
2489 is_bind_expression<_Ti>::value,2561 is_bind_expression<_Ti>::value,
2490 __invoke_of<_Ti&, _Uj...>2562 __invoke_of<_Ti&, _Uj...>
...@@ -2769,9 +2841,9 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)...@@ -2769,9 +2841,9 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)
2769#if _LIBCPP_STD_VER > 142841#if _LIBCPP_STD_VER > 14
27702842
2771template <class _Fn, class ..._Args>2843template <class _Fn, class ..._Args>
2772result_of_t<_Fn&&(_Args&&...)>2844invoke_result_t<_Fn, _Args...>
2773invoke(_Fn&& __f, _Args&&... __args)2845invoke(_Fn&& __f, _Args&&... __args)
2774 noexcept(noexcept(_VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...)))2846 noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
2775{2847{
2776 return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);2848 return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
2777}2849}
lib/libcxx/include/future+8-13
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- future -----------------------------------===//2//===--------------------------- future -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -409,11 +408,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)...@@ -409,11 +408,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
409408
410#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS409#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
411410
412#ifdef _LIBCPP_UNDERLYING_TYPE
413typedef underlying_type<launch>::type __launch_underlying_type;411typedef underlying_type<launch>::type __launch_underlying_type;
414#else
415typedef int __launch_underlying_type;
416#endif
417412
418inline _LIBCPP_INLINE_VISIBILITY413inline _LIBCPP_INLINE_VISIBILITY
419_LIBCPP_CONSTEXPR414_LIBCPP_CONSTEXPR
...@@ -2016,7 +2011,7 @@ public:...@@ -2016,7 +2011,7 @@ public:
2016 class = typename enable_if2011 class = typename enable_if
2017 <2012 <
2018 !is_same<2013 !is_same<
2019 typename __uncvref<_Fp>::type, 2014 typename __uncvref<_Fp>::type,
2020 packaged_task2015 packaged_task
2021 >::value2016 >::value
2022 >::type2017 >::type
...@@ -2027,7 +2022,7 @@ public:...@@ -2027,7 +2022,7 @@ public:
2027 class = typename enable_if2022 class = typename enable_if
2028 <2023 <
2029 !is_same<2024 !is_same<
2030 typename __uncvref<_Fp>::type, 2025 typename __uncvref<_Fp>::type,
2031 packaged_task2026 packaged_task
2032 >::value2027 >::value
2033 >::type2028 >::type
...@@ -2145,7 +2140,7 @@ public:...@@ -2145,7 +2140,7 @@ public:
2145 class = typename enable_if2140 class = typename enable_if
2146 <2141 <
2147 !is_same<2142 !is_same<
2148 typename __uncvref<_Fp>::type, 2143 typename __uncvref<_Fp>::type,
2149 packaged_task2144 packaged_task
2150 >::value2145 >::value
2151 >::type2146 >::type
...@@ -2156,11 +2151,11 @@ public:...@@ -2156,11 +2151,11 @@ public:
2156 class = typename enable_if2151 class = typename enable_if
2157 <2152 <
2158 !is_same<2153 !is_same<
2159 typename __uncvref<_Fp>::type, 2154 typename __uncvref<_Fp>::type,
2160 packaged_task2155 packaged_task
2161 >::value2156 >::value
2162 >::type2157 >::type
2163 > 2158 >
2164 _LIBCPP_INLINE_VISIBILITY2159 _LIBCPP_INLINE_VISIBILITY
2165 packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)2160 packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
2166 : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),2161 : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
lib/libcxx/include/initializer_list+4-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------- initializer_list -----------------------------===//2//===----------------------- initializer_list -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -83,7 +82,7 @@ public:...@@ -83,7 +82,7 @@ public:
83 _LIBCPP_INLINE_VISIBILITY82 _LIBCPP_INLINE_VISIBILITY
84 _LIBCPP_CONSTEXPR_AFTER_CXX1183 _LIBCPP_CONSTEXPR_AFTER_CXX11
85 size_t size() const _NOEXCEPT {return __size_;}84 size_t size() const _NOEXCEPT {return __size_;}
86 85
87 _LIBCPP_INLINE_VISIBILITY86 _LIBCPP_INLINE_VISIBILITY
88 _LIBCPP_CONSTEXPR_AFTER_CXX1187 _LIBCPP_CONSTEXPR_AFTER_CXX11
89 const _Ep* begin() const _NOEXCEPT {return __begin_;}88 const _Ep* begin() const _NOEXCEPT {return __begin_;}
lib/libcxx/include/inttypes.h+8-4
...@@ -1,15 +1,19 @@...@@ -1,15 +1,19 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- inttypes.h -------------------------------===//2//===--------------------------- inttypes.h -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
11#ifndef _LIBCPP_INTTYPES_H10#ifndef _LIBCPP_INTTYPES_H
11// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
12// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
13// case the header guard macro is defined.
14#if !defined(_AIX) || !defined(_STD_TYPES_T)
12#define _LIBCPP_INTTYPES_H15#define _LIBCPP_INTTYPES_H
16#endif // _STD_TYPES_T
1317
14/*18/*
15 inttypes.h synopsis19 inttypes.h synopsis
lib/libcxx/include/iomanip+8-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- iomanip ----------------------------------===//2//===--------------------------- iomanip ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -516,7 +515,7 @@ put_time(const tm* __tm, const _CharT* __fmt)...@@ -516,7 +515,7 @@ put_time(const tm* __tm, const _CharT* __fmt)
516515
517template <class _CharT, class _Traits, class _ForwardIterator>516template <class _CharT, class _Traits, class _ForwardIterator>
518std::basic_ostream<_CharT, _Traits> &517std::basic_ostream<_CharT, _Traits> &
519__quoted_output ( basic_ostream<_CharT, _Traits> &__os, 518__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
520 _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )519 _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
521{520{
522 _VSTD::basic_string<_CharT, _Traits> __str;521 _VSTD::basic_string<_CharT, _Traits> __str;
...@@ -571,7 +570,7 @@ __quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _Char...@@ -571,7 +570,7 @@ __quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _Char
571570
572template <class _CharT, class _Traits, class _Iter>571template <class _CharT, class _Traits, class _Iter>
573basic_ostream<_CharT, _Traits>& operator<<(572basic_ostream<_CharT, _Traits>& operator<<(
574 basic_ostream<_CharT, _Traits>& __os, 573 basic_ostream<_CharT, _Traits>& __os,
575 const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)574 const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
576{575{
577 return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);576 return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
...@@ -591,7 +590,7 @@ struct __quoted_proxy...@@ -591,7 +590,7 @@ struct __quoted_proxy
591template <class _CharT, class _Traits, class _Allocator>590template <class _CharT, class _Traits, class _Allocator>
592_LIBCPP_INLINE_VISIBILITY591_LIBCPP_INLINE_VISIBILITY
593basic_ostream<_CharT, _Traits>& operator<<(592basic_ostream<_CharT, _Traits>& operator<<(
594 basic_ostream<_CharT, _Traits>& __os, 593 basic_ostream<_CharT, _Traits>& __os,
595 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)594 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
596{595{
597 return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);596 return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
...@@ -601,7 +600,7 @@ basic_ostream<_CharT, _Traits>& operator<<(...@@ -601,7 +600,7 @@ basic_ostream<_CharT, _Traits>& operator<<(
601template <class _CharT, class _Traits, class _Allocator>600template <class _CharT, class _Traits, class _Allocator>
602_LIBCPP_INLINE_VISIBILITY601_LIBCPP_INLINE_VISIBILITY
603basic_istream<_CharT, _Traits>& operator>>(602basic_istream<_CharT, _Traits>& operator>>(
604 basic_istream<_CharT, _Traits>& __is, 603 basic_istream<_CharT, _Traits>& __is,
605 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)604 const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
606{605{
607 return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );606 return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
...@@ -661,7 +660,7 @@ __quoted_output_proxy<_CharT, const _CharT *, _Traits>...@@ -661,7 +660,7 @@ __quoted_output_proxy<_CharT, const _CharT *, _Traits>
661quoted (basic_string_view <_CharT, _Traits> __sv,660quoted (basic_string_view <_CharT, _Traits> __sv,
662 _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))661 _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
663{662{
664 return __quoted_output_proxy<_CharT, const _CharT *, _Traits> 663 return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
665 ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );664 ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
666}665}
667#endif666#endif
lib/libcxx/include/ios+37-19
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- ios -------------------------------------===//2//===---------------------------- ios -------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -203,8 +202,8 @@ enum class io_errc...@@ -203,8 +202,8 @@ enum class io_errc
203};202};
204203
205concept_map ErrorCodeEnum<io_errc> { };204concept_map ErrorCodeEnum<io_errc> { };
206error_code make_error_code(io_errc e) noexcept; 205error_code make_error_code(io_errc e) noexcept;
207error_condition make_error_condition(io_errc e) noexcept; 206error_condition make_error_condition(io_errc e) noexcept;
208storage-class-specifier const error_category& iostream_category() noexcept;207storage-class-specifier const error_category& iostream_category() noexcept;
209208
210} // std209} // std
...@@ -331,6 +330,15 @@ public:...@@ -331,6 +330,15 @@ public:
331 void __set_badbit_and_consider_rethrow();330 void __set_badbit_and_consider_rethrow();
332 void __set_failbit_and_consider_rethrow();331 void __set_failbit_and_consider_rethrow();
333332
333 _LIBCPP_INLINE_VISIBILITY
334 void __setstate_nothrow(iostate __state)
335 {
336 if (__rdbuf_)
337 __rdstate_ |= __state;
338 else
339 __rdstate_ |= __state | ios_base::badbit;
340 }
341
334protected:342protected:
335 _LIBCPP_INLINE_VISIBILITY343 _LIBCPP_INLINE_VISIBILITY
336 ios_base() {// purposefully does no initialization344 ios_base() {// purposefully does no initialization
...@@ -426,6 +434,16 @@ public:...@@ -426,6 +434,16 @@ public:
426 virtual ~failure() throw();434 virtual ~failure() throw();
427};435};
428436
437_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
438void __throw_failure(char const* __msg) {
439#ifndef _LIBCPP_NO_EXCEPTIONS
440 throw ios_base::failure(__msg);
441#else
442 ((void)__msg);
443 _VSTD::abort();
444#endif
445}
446
429class _LIBCPP_TYPE_VIS ios_base::Init447class _LIBCPP_TYPE_VIS ios_base::Init
430{448{
431public:449public:
...@@ -626,47 +644,47 @@ public:...@@ -626,47 +644,47 @@ public:
626 virtual ~basic_ios();644 virtual ~basic_ios();
627645
628 // 27.5.4.2 Members:646 // 27.5.4.2 Members:
629 _LIBCPP_INLINE_VISIBILITY 647 _LIBCPP_INLINE_VISIBILITY
630 basic_ostream<char_type, traits_type>* tie() const;648 basic_ostream<char_type, traits_type>* tie() const;
631 _LIBCPP_INLINE_VISIBILITY 649 _LIBCPP_INLINE_VISIBILITY
632 basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);650 basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
633651
634 _LIBCPP_INLINE_VISIBILITY 652 _LIBCPP_INLINE_VISIBILITY
635 basic_streambuf<char_type, traits_type>* rdbuf() const;653 basic_streambuf<char_type, traits_type>* rdbuf() const;
636 _LIBCPP_INLINE_VISIBILITY 654 _LIBCPP_INLINE_VISIBILITY
637 basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);655 basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
638656
639 basic_ios& copyfmt(const basic_ios& __rhs);657 basic_ios& copyfmt(const basic_ios& __rhs);
640658
641 _LIBCPP_INLINE_VISIBILITY 659 _LIBCPP_INLINE_VISIBILITY
642 char_type fill() const;660 char_type fill() const;
643 _LIBCPP_INLINE_VISIBILITY 661 _LIBCPP_INLINE_VISIBILITY
644 char_type fill(char_type __ch);662 char_type fill(char_type __ch);
645663
646 _LIBCPP_INLINE_VISIBILITY 664 _LIBCPP_INLINE_VISIBILITY
647 locale imbue(const locale& __loc);665 locale imbue(const locale& __loc);
648666
649 _LIBCPP_INLINE_VISIBILITY 667 _LIBCPP_INLINE_VISIBILITY
650 char narrow(char_type __c, char __dfault) const;668 char narrow(char_type __c, char __dfault) const;
651 _LIBCPP_INLINE_VISIBILITY 669 _LIBCPP_INLINE_VISIBILITY
652 char_type widen(char __c) const;670 char_type widen(char __c) const;
653671
654protected:672protected:
655 _LIBCPP_INLINE_VISIBILITY673 _LIBCPP_INLINE_VISIBILITY
656 basic_ios() {// purposefully does no initialization674 basic_ios() {// purposefully does no initialization
657 }675 }
658 _LIBCPP_INLINE_VISIBILITY 676 _LIBCPP_INLINE_VISIBILITY
659 void init(basic_streambuf<char_type, traits_type>* __sb);677 void init(basic_streambuf<char_type, traits_type>* __sb);
660678
661 _LIBCPP_INLINE_VISIBILITY 679 _LIBCPP_INLINE_VISIBILITY
662 void move(basic_ios& __rhs);680 void move(basic_ios& __rhs);
663#ifndef _LIBCPP_CXX03_LANG681#ifndef _LIBCPP_CXX03_LANG
664 _LIBCPP_INLINE_VISIBILITY682 _LIBCPP_INLINE_VISIBILITY
665 void move(basic_ios&& __rhs) {move(__rhs);}683 void move(basic_ios&& __rhs) {move(__rhs);}
666#endif684#endif
667 _LIBCPP_INLINE_VISIBILITY 685 _LIBCPP_INLINE_VISIBILITY
668 void swap(basic_ios& __rhs) _NOEXCEPT;686 void swap(basic_ios& __rhs) _NOEXCEPT;
669 _LIBCPP_INLINE_VISIBILITY 687 _LIBCPP_INLINE_VISIBILITY
670 void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);688 void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
671private:689private:
672 basic_ostream<char_type, traits_type>* __tie_;690 basic_ostream<char_type, traits_type>* __tie_;
lib/libcxx/include/iosfwd+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- iosfwd -----------------------------------===//2//===--------------------------- iosfwd -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/iostream+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- iostream ---------------------------------===//2//===--------------------------- iostream ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/istream+514-381
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- istream ----------------------------------===//2//===--------------------------- istream ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -363,26 +362,31 @@ template <class _Tp, class _CharT, class _Traits>...@@ -363,26 +362,31 @@ template <class _Tp, class _CharT, class _Traits>
363_LIBCPP_INLINE_VISIBILITY362_LIBCPP_INLINE_VISIBILITY
364basic_istream<_CharT, _Traits>&363basic_istream<_CharT, _Traits>&
365__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {364__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
366#ifndef _LIBCPP_NO_EXCEPTIONS365 ios_base::iostate __state = ios_base::goodbit;
367 try366 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
367 if (__s)
368 {368 {
369#endif // _LIBCPP_NO_EXCEPTIONS369#ifndef _LIBCPP_NO_EXCEPTIONS
370 typename basic_istream<_CharT, _Traits>::sentry __s(__is);370 try
371 if (__s)
372 {371 {
372#endif // _LIBCPP_NO_EXCEPTIONS
373 typedef istreambuf_iterator<_CharT, _Traits> _Ip;373 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
374 typedef num_get<_CharT, _Ip> _Fp;374 typedef num_get<_CharT, _Ip> _Fp;
375 ios_base::iostate __err = ios_base::goodbit;375 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
376 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __n);
377 __is.setstate(__err);
378 }
379#ifndef _LIBCPP_NO_EXCEPTIONS376#ifndef _LIBCPP_NO_EXCEPTIONS
377 }
378 catch (...)
379 {
380 __state |= ios_base::badbit;
381 __is.__setstate_nothrow(__state);
382 if (__is.exceptions() & ios_base::badbit)
383 {
384 throw;
385 }
386 }
387#endif
388 __is.setstate(__state);
380 }389 }
381 catch (...)
382 {
383 __is.__set_badbit_and_consider_rethrow();
384 }
385#endif // _LIBCPP_NO_EXCEPTIONS
386 return __is;390 return __is;
387}391}
388392
...@@ -467,39 +471,46 @@ template <class _Tp, class _CharT, class _Traits>...@@ -467,39 +471,46 @@ template <class _Tp, class _CharT, class _Traits>
467_LIBCPP_INLINE_VISIBILITY471_LIBCPP_INLINE_VISIBILITY
468basic_istream<_CharT, _Traits>&472basic_istream<_CharT, _Traits>&
469__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {473__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
470#ifndef _LIBCPP_NO_EXCEPTIONS474 ios_base::iostate __state = ios_base::goodbit;
471 try475 typename basic_istream<_CharT, _Traits>::sentry __s(__is);
476 if (__s)
472 {477 {
473#endif // _LIBCPP_NO_EXCEPTIONS478#ifndef _LIBCPP_NO_EXCEPTIONS
474 typename basic_istream<_CharT, _Traits>::sentry __s(__is);479 try
475 if (__s)
476 {480 {
481#endif // _LIBCPP_NO_EXCEPTIONS
477 typedef istreambuf_iterator<_CharT, _Traits> _Ip;482 typedef istreambuf_iterator<_CharT, _Traits> _Ip;
478 typedef num_get<_CharT, _Ip> _Fp;483 typedef num_get<_CharT, _Ip> _Fp;
479 ios_base::iostate __err = ios_base::goodbit;
480 long __temp;484 long __temp;
481 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __temp);485 use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp);
482 if (__temp < numeric_limits<_Tp>::min())486 if (__temp < numeric_limits<_Tp>::min())
483 {487 {
484 __err |= ios_base::failbit;488 __state |= ios_base::failbit;
485 __n = numeric_limits<_Tp>::min();489 __n = numeric_limits<_Tp>::min();
486 }490 }
487 else if (__temp > numeric_limits<_Tp>::max())491 else if (__temp > numeric_limits<_Tp>::max())
488 {492 {
489 __err |= ios_base::failbit;493 __state |= ios_base::failbit;
490 __n = numeric_limits<_Tp>::max();494 __n = numeric_limits<_Tp>::max();
491 }495 }
492 else496 else
497 {
493 __n = static_cast<_Tp>(__temp);498 __n = static_cast<_Tp>(__temp);
494 __is.setstate(__err);499 }
495 }
496#ifndef _LIBCPP_NO_EXCEPTIONS500#ifndef _LIBCPP_NO_EXCEPTIONS
497 }501 }
498 catch (...)502 catch (...)
499 {503 {
500 __is.__set_badbit_and_consider_rethrow();504 __state |= ios_base::badbit;
501 }505 __is.__setstate_nothrow(__state);
506 if (__is.exceptions() & ios_base::badbit)
507 {
508 throw;
509 }
510 }
502#endif // _LIBCPP_NO_EXCEPTIONS511#endif // _LIBCPP_NO_EXCEPTIONS
512 __is.setstate(__state);
513 }
503 return __is;514 return __is;
504}515}
505516
...@@ -522,22 +533,22 @@ _LIBCPP_INLINE_VISIBILITY...@@ -522,22 +533,22 @@ _LIBCPP_INLINE_VISIBILITY
522basic_istream<_CharT, _Traits>&533basic_istream<_CharT, _Traits>&
523__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)534__input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
524{535{
525#ifndef _LIBCPP_NO_EXCEPTIONS536 ios_base::iostate __state = ios_base::goodbit;
526 try537 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
538 if (__sen)
527 {539 {
528#endif // _LIBCPP_NO_EXCEPTIONS540#ifndef _LIBCPP_NO_EXCEPTIONS
529 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);541 try
530 if (__sen)
531 {542 {
532 auto __s = __p;543#endif
544 _CharT* __s = __p;
533 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());545 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
534 ios_base::iostate __err = ios_base::goodbit;
535 while (__s != __p + (__n-1))546 while (__s != __p + (__n-1))
536 {547 {
537 typename _Traits::int_type __i = __is.rdbuf()->sgetc();548 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
538 if (_Traits::eq_int_type(__i, _Traits::eof()))549 if (_Traits::eq_int_type(__i, _Traits::eof()))
539 {550 {
540 __err |= ios_base::eofbit;551 __state |= ios_base::eofbit;
541 break;552 break;
542 }553 }
543 _CharT __ch = _Traits::to_char_type(__i);554 _CharT __ch = _Traits::to_char_type(__i);
...@@ -549,16 +560,21 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)...@@ -549,16 +560,21 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
549 *__s = _CharT();560 *__s = _CharT();
550 __is.width(0);561 __is.width(0);
551 if (__s == __p)562 if (__s == __p)
552 __err |= ios_base::failbit;563 __state |= ios_base::failbit;
553 __is.setstate(__err);
554 }
555#ifndef _LIBCPP_NO_EXCEPTIONS564#ifndef _LIBCPP_NO_EXCEPTIONS
565 }
566 catch (...)
567 {
568 __state |= ios_base::badbit;
569 __is.__setstate_nothrow(__state);
570 if (__is.exceptions() & ios_base::badbit)
571 {
572 throw;
573 }
574 }
575#endif
576 __is.setstate(__state);
556 }577 }
557 catch (...)
558 {
559 __is.__set_badbit_and_consider_rethrow();
560 }
561#endif // _LIBCPP_NO_EXCEPTIONS
562 return __is;578 return __is;
563}579}
564580
...@@ -569,7 +585,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -569,7 +585,7 @@ inline _LIBCPP_INLINE_VISIBILITY
569basic_istream<_CharT, _Traits>&585basic_istream<_CharT, _Traits>&
570operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])586operator>>(basic_istream<_CharT, _Traits>& __is, _CharT (&__buf)[_Np])
571{587{
572 auto __n = _Np;588 size_t __n = _Np;
573 if (__is.width() > 0)589 if (__is.width() > 0)
574 __n = _VSTD::min(size_t(__is.width()), _Np);590 __n = _VSTD::min(size_t(__is.width()), _Np);
575 return _VSTD::__input_c_string(__is, __buf, __n);591 return _VSTD::__input_c_string(__is, __buf, __n);
...@@ -626,26 +642,33 @@ template<class _CharT, class _Traits>...@@ -626,26 +642,33 @@ template<class _CharT, class _Traits>
626basic_istream<_CharT, _Traits>&642basic_istream<_CharT, _Traits>&
627operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)643operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
628{644{
629#ifndef _LIBCPP_NO_EXCEPTIONS645 ios_base::iostate __state = ios_base::goodbit;
630 try646 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
647 if (__sen)
631 {648 {
632#endif // _LIBCPP_NO_EXCEPTIONS649#ifndef _LIBCPP_NO_EXCEPTIONS
633 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);650 try
634 if (__sen)
635 {651 {
652#endif
636 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();653 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
637 if (_Traits::eq_int_type(__i, _Traits::eof()))654 if (_Traits::eq_int_type(__i, _Traits::eof()))
638 __is.setstate(ios_base::eofbit | ios_base::failbit);655 __state |= ios_base::eofbit | ios_base::failbit;
639 else656 else
640 __c = _Traits::to_char_type(__i);657 __c = _Traits::to_char_type(__i);
641 }
642#ifndef _LIBCPP_NO_EXCEPTIONS658#ifndef _LIBCPP_NO_EXCEPTIONS
659 }
660 catch (...)
661 {
662 __state |= ios_base::badbit;
663 __is.__setstate_nothrow(__state);
664 if (__is.exceptions() & ios_base::badbit)
665 {
666 throw;
667 }
668 }
669#endif
670 __is.setstate(__state);
643 }671 }
644 catch (...)
645 {
646 __is.__set_badbit_and_consider_rethrow();
647 }
648#endif // _LIBCPP_NO_EXCEPTIONS
649 return __is;672 return __is;
650}673}
651674
...@@ -669,58 +692,56 @@ template<class _CharT, class _Traits>...@@ -669,58 +692,56 @@ template<class _CharT, class _Traits>
669basic_istream<_CharT, _Traits>&692basic_istream<_CharT, _Traits>&
670basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)693basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb)
671{694{
695 ios_base::iostate __state = ios_base::goodbit;
672 __gc_ = 0;696 __gc_ = 0;
673#ifndef _LIBCPP_NO_EXCEPTIONS697 sentry __s(*this, true);
674 try698 if (__s)
675 {699 {
676#endif // _LIBCPP_NO_EXCEPTIONS700 if (__sb)
677 sentry __s(*this, true);
678 if (__s)
679 {701 {
680 if (__sb)
681 {
682#ifndef _LIBCPP_NO_EXCEPTIONS702#ifndef _LIBCPP_NO_EXCEPTIONS
683 try703 try
704 {
705#endif // _LIBCPP_NO_EXCEPTIONS
706 while (true)
684 {707 {
685#endif // _LIBCPP_NO_EXCEPTIONS708 typename traits_type::int_type __i = this->rdbuf()->sgetc();
686 ios_base::iostate __err = ios_base::goodbit;709 if (traits_type::eq_int_type(__i, _Traits::eof()))
687 while (true)
688 {710 {
689 typename traits_type::int_type __i = this->rdbuf()->sgetc();711 __state |= ios_base::eofbit;
690 if (traits_type::eq_int_type(__i, _Traits::eof()))712 break;
691 {
692 __err |= ios_base::eofbit;
693 break;
694 }
695 if (traits_type::eq_int_type(
696 __sb->sputc(traits_type::to_char_type(__i)),
697 traits_type::eof()))
698 break;
699 ++__gc_;
700 this->rdbuf()->sbumpc();
701 }713 }
702 if (__gc_ == 0)714 if (traits_type::eq_int_type(
703 __err |= ios_base::failbit;715 __sb->sputc(traits_type::to_char_type(__i)),
704 this->setstate(__err);716 traits_type::eof()))
705#ifndef _LIBCPP_NO_EXCEPTIONS717 break;
718 ++__gc_;
719 this->rdbuf()->sbumpc();
706 }720 }
707 catch (...)721 if (__gc_ == 0)
722 __state |= ios_base::failbit;
723#ifndef _LIBCPP_NO_EXCEPTIONS
724 }
725 catch (...)
726 {
727 __state |= ios_base::badbit;
728 if (__gc_ == 0)
729 __state |= ios_base::failbit;
730
731 this->__setstate_nothrow(__state);
732 if (this->exceptions() & ios_base::failbit || this->exceptions() & ios_base::badbit)
708 {733 {
709 if (__gc_ == 0)734 throw;
710 this->__set_failbit_and_consider_rethrow();
711 }735 }
712#endif // _LIBCPP_NO_EXCEPTIONS
713 }736 }
714 else737#endif // _LIBCPP_NO_EXCEPTIONS
715 this->setstate(ios_base::failbit);
716 }738 }
717#ifndef _LIBCPP_NO_EXCEPTIONS739 else
718 }740 {
719 catch (...)741 __state |= ios_base::failbit;
720 {742 }
721 this->__set_badbit_and_consider_rethrow();743 this->setstate(__state);
722 }744 }
723#endif // _LIBCPP_NO_EXCEPTIONS
724 return *this;745 return *this;
725}746}
726747
...@@ -728,28 +749,34 @@ template<class _CharT, class _Traits>...@@ -728,28 +749,34 @@ template<class _CharT, class _Traits>
728typename basic_istream<_CharT, _Traits>::int_type749typename basic_istream<_CharT, _Traits>::int_type
729basic_istream<_CharT, _Traits>::get()750basic_istream<_CharT, _Traits>::get()
730{751{
752 ios_base::iostate __state = ios_base::goodbit;
731 __gc_ = 0;753 __gc_ = 0;
732 int_type __r = traits_type::eof();754 int_type __r = traits_type::eof();
733#ifndef _LIBCPP_NO_EXCEPTIONS755 sentry __s(*this, true);
734 try756 if (__s)
735 {757 {
736#endif // _LIBCPP_NO_EXCEPTIONS758#ifndef _LIBCPP_NO_EXCEPTIONS
737 sentry __s(*this, true);759 try
738 if (__s)
739 {760 {
761#endif
740 __r = this->rdbuf()->sbumpc();762 __r = this->rdbuf()->sbumpc();
741 if (traits_type::eq_int_type(__r, traits_type::eof()))763 if (traits_type::eq_int_type(__r, traits_type::eof()))
742 this->setstate(ios_base::failbit | ios_base::eofbit);764 __state |= ios_base::failbit | ios_base::eofbit;
743 else765 else
744 __gc_ = 1;766 __gc_ = 1;
745 }
746#ifndef _LIBCPP_NO_EXCEPTIONS767#ifndef _LIBCPP_NO_EXCEPTIONS
768 }
769 catch (...)
770 {
771 this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
772 if (this->exceptions() & ios_base::badbit)
773 {
774 throw;
775 }
776 }
777#endif
778 this->setstate(__state);
747 }779 }
748 catch (...)
749 {
750 this->__set_badbit_and_consider_rethrow();
751 }
752#endif // _LIBCPP_NO_EXCEPTIONS
753 return __r;780 return __r;
754}781}
755782
...@@ -757,23 +784,23 @@ template<class _CharT, class _Traits>...@@ -757,23 +784,23 @@ template<class _CharT, class _Traits>
757basic_istream<_CharT, _Traits>&784basic_istream<_CharT, _Traits>&
758basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)785basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm)
759{786{
787 ios_base::iostate __state = ios_base::goodbit;
760 __gc_ = 0;788 __gc_ = 0;
761#ifndef _LIBCPP_NO_EXCEPTIONS789 sentry __sen(*this, true);
762 try790 if (__sen)
763 {791 {
764#endif // _LIBCPP_NO_EXCEPTIONS792 if (__n > 0)
765 sentry __sen(*this, true);
766 if (__sen)
767 {793 {
768 if (__n > 0)794#ifndef _LIBCPP_NO_EXCEPTIONS
795 try
769 {796 {
770 ios_base::iostate __err = ios_base::goodbit;797#endif
771 while (__gc_ < __n-1)798 while (__gc_ < __n-1)
772 {799 {
773 int_type __i = this->rdbuf()->sgetc();800 int_type __i = this->rdbuf()->sgetc();
774 if (traits_type::eq_int_type(__i, traits_type::eof()))801 if (traits_type::eq_int_type(__i, traits_type::eof()))
775 {802 {
776 __err |= ios_base::eofbit;803 __state |= ios_base::eofbit;
777 break;804 break;
778 }805 }
779 char_type __ch = traits_type::to_char_type(__i);806 char_type __ch = traits_type::to_char_type(__i);
...@@ -784,23 +811,33 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __...@@ -784,23 +811,33 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
784 this->rdbuf()->sbumpc();811 this->rdbuf()->sbumpc();
785 }812 }
786 if (__gc_ == 0)813 if (__gc_ == 0)
787 __err |= ios_base::failbit;814 __state |= ios_base::failbit;
788 this->setstate(__err);815#ifndef _LIBCPP_NO_EXCEPTIONS
789 }816 }
790 else817 catch (...)
791 this->setstate(ios_base::failbit);818 {
819 __state |= ios_base::badbit;
820 this->__setstate_nothrow(__state);
821 if (this->exceptions() & ios_base::badbit)
822 {
823 if (__n > 0)
824 *__s = char_type();
825 throw;
826 }
827 }
828#endif
792 }829 }
830 else
831 {
832 __state |= ios_base::failbit;
833 }
834
793 if (__n > 0)835 if (__n > 0)
794 *__s = char_type();836 *__s = char_type();
795#ifndef _LIBCPP_NO_EXCEPTIONS837 this->setstate(__state);
796 }
797 catch (...)
798 {
799 if (__n > 0)
800 *__s = char_type();
801 this->__set_badbit_and_consider_rethrow();
802 }838 }
803#endif // _LIBCPP_NO_EXCEPTIONS839 if (__n > 0)
840 *__s = char_type();
804 return *this;841 return *this;
805}842}
806843
...@@ -809,52 +846,43 @@ basic_istream<_CharT, _Traits>&...@@ -809,52 +846,43 @@ basic_istream<_CharT, _Traits>&
809basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,846basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb,
810 char_type __dlm)847 char_type __dlm)
811{848{
849 ios_base::iostate __state = ios_base::goodbit;
812 __gc_ = 0;850 __gc_ = 0;
813#ifndef _LIBCPP_NO_EXCEPTIONS851 sentry __sen(*this, true);
814 try852 if (__sen)
815 {853 {
816#endif // _LIBCPP_NO_EXCEPTIONS
817 sentry __sen(*this, true);
818 if (__sen)
819 {
820 ios_base::iostate __err = ios_base::goodbit;
821#ifndef _LIBCPP_NO_EXCEPTIONS854#ifndef _LIBCPP_NO_EXCEPTIONS
822 try855 try
823 {856 {
824#endif // _LIBCPP_NO_EXCEPTIONS857#endif // _LIBCPP_NO_EXCEPTIONS
825 while (true)858 while (true)
859 {
860 typename traits_type::int_type __i = this->rdbuf()->sgetc();
861 if (traits_type::eq_int_type(__i, traits_type::eof()))
826 {862 {
827 typename traits_type::int_type __i = this->rdbuf()->sgetc();863 __state |= ios_base::eofbit;
828 if (traits_type::eq_int_type(__i, traits_type::eof()))864 break;
829 {
830 __err |= ios_base::eofbit;
831 break;
832 }
833 char_type __ch = traits_type::to_char_type(__i);
834 if (traits_type::eq(__ch, __dlm))
835 break;
836 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
837 break;
838 ++__gc_;
839 this->rdbuf()->sbumpc();
840 }865 }
841#ifndef _LIBCPP_NO_EXCEPTIONS866 char_type __ch = traits_type::to_char_type(__i);
842 }867 if (traits_type::eq(__ch, __dlm))
843 catch (...)868 break;
844 {869 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
870 break;
871 ++__gc_;
872 this->rdbuf()->sbumpc();
845 }873 }
846#endif // _LIBCPP_NO_EXCEPTIONS
847 if (__gc_ == 0)
848 __err |= ios_base::failbit;
849 this->setstate(__err);
850 }
851#ifndef _LIBCPP_NO_EXCEPTIONS874#ifndef _LIBCPP_NO_EXCEPTIONS
852 }875 }
853 catch (...)876 catch (...)
854 {877 {
855 this->__set_badbit_and_consider_rethrow();878 __state |= ios_base::badbit;
856 }879 // according to the spec, exceptions here are caught but not rethrown
880 }
857#endif // _LIBCPP_NO_EXCEPTIONS881#endif // _LIBCPP_NO_EXCEPTIONS
882 if (__gc_ == 0)
883 __state |= ios_base::failbit;
884 this->setstate(__state);
885 }
858 return *this;886 return *this;
859}887}
860888
...@@ -862,21 +890,21 @@ template<class _CharT, class _Traits>...@@ -862,21 +890,21 @@ template<class _CharT, class _Traits>
862basic_istream<_CharT, _Traits>&890basic_istream<_CharT, _Traits>&
863basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)891basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm)
864{892{
893 ios_base::iostate __state = ios_base::goodbit;
865 __gc_ = 0;894 __gc_ = 0;
866#ifndef _LIBCPP_NO_EXCEPTIONS895 sentry __sen(*this, true);
867 try896 if (__sen)
868 {897 {
869#endif // _LIBCPP_NO_EXCEPTIONS898#ifndef _LIBCPP_NO_EXCEPTIONS
870 sentry __sen(*this, true);899 try
871 if (__sen)
872 {900 {
873 ios_base::iostate __err = ios_base::goodbit;901#endif // _LIBCPP_NO_EXCEPTIONS
874 while (true)902 while (true)
875 {903 {
876 typename traits_type::int_type __i = this->rdbuf()->sgetc();904 typename traits_type::int_type __i = this->rdbuf()->sgetc();
877 if (traits_type::eq_int_type(__i, traits_type::eof()))905 if (traits_type::eq_int_type(__i, traits_type::eof()))
878 {906 {
879 __err |= ios_base::eofbit;907 __state |= ios_base::eofbit;
880 break;908 break;
881 }909 }
882 char_type __ch = traits_type::to_char_type(__i);910 char_type __ch = traits_type::to_char_type(__i);
...@@ -888,28 +916,35 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ...@@ -888,28 +916,35 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
888 }916 }
889 if (__gc_ >= __n-1)917 if (__gc_ >= __n-1)
890 {918 {
891 __err |= ios_base::failbit;919 __state |= ios_base::failbit;
892 break;920 break;
893 }921 }
894 *__s++ = __ch;922 *__s++ = __ch;
895 this->rdbuf()->sbumpc();923 this->rdbuf()->sbumpc();
896 ++__gc_;924 ++__gc_;
897 }925 }
898 if (__gc_ == 0)
899 __err |= ios_base::failbit;
900 this->setstate(__err);
901 }
902 if (__n > 0)
903 *__s = char_type();
904#ifndef _LIBCPP_NO_EXCEPTIONS926#ifndef _LIBCPP_NO_EXCEPTIONS
905 }927 }
906 catch (...)928 catch (...)
907 {929 {
908 if (__n > 0)930 __state |= ios_base::badbit;
909 *__s = char_type();931 this->__setstate_nothrow(__state);
910 this->__set_badbit_and_consider_rethrow();932 if (this->exceptions() & ios_base::badbit)
911 }933 {
934 if (__n > 0)
935 *__s = char_type();
936 if (__gc_ == 0)
937 __state |= ios_base::failbit;
938 throw;
939 }
940 }
912#endif // _LIBCPP_NO_EXCEPTIONS941#endif // _LIBCPP_NO_EXCEPTIONS
942 }
943 if (__n > 0)
944 *__s = char_type();
945 if (__gc_ == 0)
946 __state |= ios_base::failbit;
947 this->setstate(__state);
913 return *this;948 return *this;
914}949}
915950
...@@ -917,15 +952,15 @@ template<class _CharT, class _Traits>...@@ -917,15 +952,15 @@ template<class _CharT, class _Traits>
917basic_istream<_CharT, _Traits>&952basic_istream<_CharT, _Traits>&
918basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)953basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
919{954{
955 ios_base::iostate __state = ios_base::goodbit;
920 __gc_ = 0;956 __gc_ = 0;
921#ifndef _LIBCPP_NO_EXCEPTIONS957 sentry __sen(*this, true);
922 try958 if (__sen)
923 {959 {
924#endif // _LIBCPP_NO_EXCEPTIONS960#ifndef _LIBCPP_NO_EXCEPTIONS
925 sentry __sen(*this, true);961 try
926 if (__sen)
927 {962 {
928 ios_base::iostate __err = ios_base::goodbit;963#endif // _LIBCPP_NO_EXCEPTIONS
929 if (__n == numeric_limits<streamsize>::max())964 if (__n == numeric_limits<streamsize>::max())
930 {965 {
931 while (true)966 while (true)
...@@ -933,7 +968,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)...@@ -933,7 +968,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
933 typename traits_type::int_type __i = this->rdbuf()->sbumpc();968 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
934 if (traits_type::eq_int_type(__i, traits_type::eof()))969 if (traits_type::eq_int_type(__i, traits_type::eof()))
935 {970 {
936 __err |= ios_base::eofbit;971 __state |= ios_base::eofbit;
937 break;972 break;
938 }973 }
939 ++__gc_;974 ++__gc_;
...@@ -948,7 +983,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)...@@ -948,7 +983,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
948 typename traits_type::int_type __i = this->rdbuf()->sbumpc();983 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
949 if (traits_type::eq_int_type(__i, traits_type::eof()))984 if (traits_type::eq_int_type(__i, traits_type::eof()))
950 {985 {
951 __err |= ios_base::eofbit;986 __state |= ios_base::eofbit;
952 break;987 break;
953 }988 }
954 ++__gc_;989 ++__gc_;
...@@ -956,15 +991,20 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)...@@ -956,15 +991,20 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
956 break;991 break;
957 }992 }
958 }993 }
959 this->setstate(__err);
960 }
961#ifndef _LIBCPP_NO_EXCEPTIONS994#ifndef _LIBCPP_NO_EXCEPTIONS
962 }995 }
963 catch (...)996 catch (...)
964 {997 {
965 this->__set_badbit_and_consider_rethrow();998 __state |= ios_base::badbit;
966 }999 this->__setstate_nothrow(__state);
1000 if (this->exceptions() & ios_base::badbit)
1001 {
1002 throw;
1003 }
1004 }
967#endif // _LIBCPP_NO_EXCEPTIONS1005#endif // _LIBCPP_NO_EXCEPTIONS
1006 this->setstate(__state);
1007 }
968 return *this;1008 return *this;
969}1009}
9701010
...@@ -972,26 +1012,33 @@ template<class _CharT, class _Traits>...@@ -972,26 +1012,33 @@ template<class _CharT, class _Traits>
972typename basic_istream<_CharT, _Traits>::int_type1012typename basic_istream<_CharT, _Traits>::int_type
973basic_istream<_CharT, _Traits>::peek()1013basic_istream<_CharT, _Traits>::peek()
974{1014{
1015 ios_base::iostate __state = ios_base::goodbit;
975 __gc_ = 0;1016 __gc_ = 0;
976 int_type __r = traits_type::eof();1017 int_type __r = traits_type::eof();
977#ifndef _LIBCPP_NO_EXCEPTIONS1018 sentry __sen(*this, true);
978 try1019 if (__sen)
979 {1020 {
980#endif // _LIBCPP_NO_EXCEPTIONS1021#ifndef _LIBCPP_NO_EXCEPTIONS
981 sentry __sen(*this, true);1022 try
982 if (__sen)
983 {1023 {
1024#endif // _LIBCPP_NO_EXCEPTIONS
984 __r = this->rdbuf()->sgetc();1025 __r = this->rdbuf()->sgetc();
985 if (traits_type::eq_int_type(__r, traits_type::eof()))1026 if (traits_type::eq_int_type(__r, traits_type::eof()))
986 this->setstate(ios_base::eofbit);1027 __state |= ios_base::eofbit;
987 }
988#ifndef _LIBCPP_NO_EXCEPTIONS1028#ifndef _LIBCPP_NO_EXCEPTIONS
989 }1029 }
990 catch (...)1030 catch (...)
991 {1031 {
992 this->__set_badbit_and_consider_rethrow();1032 __state |= ios_base::badbit;
993 }1033 this->__setstate_nothrow(__state);
1034 if (this->exceptions() & ios_base::badbit)
1035 {
1036 throw;
1037 }
1038 }
994#endif // _LIBCPP_NO_EXCEPTIONS1039#endif // _LIBCPP_NO_EXCEPTIONS
1040 this->setstate(__state);
1041 }
995 return __r;1042 return __r;
996}1043}
9971044
...@@ -999,27 +1046,36 @@ template<class _CharT, class _Traits>...@@ -999,27 +1046,36 @@ template<class _CharT, class _Traits>
999basic_istream<_CharT, _Traits>&1046basic_istream<_CharT, _Traits>&
1000basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)1047basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
1001{1048{
1049 ios_base::iostate __state = ios_base::goodbit;
1002 __gc_ = 0;1050 __gc_ = 0;
1003#ifndef _LIBCPP_NO_EXCEPTIONS1051 sentry __sen(*this, true);
1004 try1052 if (__sen)
1005 {1053 {
1006#endif // _LIBCPP_NO_EXCEPTIONS1054#ifndef _LIBCPP_NO_EXCEPTIONS
1007 sentry __sen(*this, true);1055 try
1008 if (__sen)
1009 {1056 {
1057#endif // _LIBCPP_NO_EXCEPTIONS
1010 __gc_ = this->rdbuf()->sgetn(__s, __n);1058 __gc_ = this->rdbuf()->sgetn(__s, __n);
1011 if (__gc_ != __n)1059 if (__gc_ != __n)
1012 this->setstate(ios_base::failbit | ios_base::eofbit);1060 __state |= ios_base::failbit | ios_base::eofbit;
1013 }
1014 else
1015 this->setstate(ios_base::failbit);
1016#ifndef _LIBCPP_NO_EXCEPTIONS1061#ifndef _LIBCPP_NO_EXCEPTIONS
1062 }
1063 catch (...)
1064 {
1065 __state |= ios_base::badbit;
1066 this->__setstate_nothrow(__state);
1067 if (this->exceptions() & ios_base::badbit)
1068 {
1069 throw;
1070 }
1071 }
1072#endif // _LIBCPP_NO_EXCEPTIONS
1017 }1073 }
1018 catch (...)1074 else
1019 {1075 {
1020 this->__set_badbit_and_consider_rethrow();1076 __state |= ios_base::failbit;
1021 }1077 }
1022#endif // _LIBCPP_NO_EXCEPTIONS1078 this->setstate(__state);
1023 return *this;1079 return *this;
1024}1080}
10251081
...@@ -1027,36 +1083,48 @@ template<class _CharT, class _Traits>...@@ -1027,36 +1083,48 @@ template<class _CharT, class _Traits>
1027streamsize1083streamsize
1028basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)1084basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
1029{1085{
1086 ios_base::iostate __state = ios_base::goodbit;
1030 __gc_ = 0;1087 __gc_ = 0;
1031#ifndef _LIBCPP_NO_EXCEPTIONS1088 sentry __sen(*this, true);
1032 try1089 if (__sen)
1033 {1090 {
1034#endif // _LIBCPP_NO_EXCEPTIONS1091#ifndef _LIBCPP_NO_EXCEPTIONS
1035 sentry __sen(*this, true);1092 try
1036 if (__sen)
1037 {1093 {
1094#endif // _LIBCPP_NO_EXCEPTIONS
1038 streamsize __c = this->rdbuf()->in_avail();1095 streamsize __c = this->rdbuf()->in_avail();
1039 switch (__c)1096 switch (__c)
1040 {1097 {
1041 case -1:1098 case -1:
1042 this->setstate(ios_base::eofbit);1099 __state |= ios_base::eofbit;
1043 break;1100 break;
1044 case 0:1101 case 0:
1045 break;1102 break;
1046 default:1103 default:
1047 read(__s, _VSTD::min(__c, __n));1104 __n = _VSTD::min(__c, __n);
1105 __gc_ = this->rdbuf()->sgetn(__s, __n);
1106 if (__gc_ != __n)
1107 __state |= ios_base::failbit | ios_base::eofbit;
1048 break;1108 break;
1049 }1109 }
1050 }
1051 else
1052 this->setstate(ios_base::failbit);
1053#ifndef _LIBCPP_NO_EXCEPTIONS1110#ifndef _LIBCPP_NO_EXCEPTIONS
1111 }
1112 catch (...)
1113 {
1114 __state |= ios_base::badbit;
1115 this->__setstate_nothrow(__state);
1116 if (this->exceptions() & ios_base::badbit)
1117 {
1118 throw;
1119 }
1120 }
1121#endif // _LIBCPP_NO_EXCEPTIONS
1054 }1122 }
1055 catch (...)1123 else
1056 {1124 {
1057 this->__set_badbit_and_consider_rethrow();1125 __state |= ios_base::failbit;
1058 }1126 }
1059#endif // _LIBCPP_NO_EXCEPTIONS1127 this->setstate(__state);
1060 return __gc_;1128 return __gc_;
1061}1129}
10621130
...@@ -1064,27 +1132,36 @@ template<class _CharT, class _Traits>...@@ -1064,27 +1132,36 @@ template<class _CharT, class _Traits>
1064basic_istream<_CharT, _Traits>&1132basic_istream<_CharT, _Traits>&
1065basic_istream<_CharT, _Traits>::putback(char_type __c)1133basic_istream<_CharT, _Traits>::putback(char_type __c)
1066{1134{
1135 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1067 __gc_ = 0;1136 __gc_ = 0;
1068#ifndef _LIBCPP_NO_EXCEPTIONS1137 this->clear(__state);
1069 try1138 sentry __sen(*this, true);
1139 if (__sen)
1070 {1140 {
1071#endif // _LIBCPP_NO_EXCEPTIONS1141#ifndef _LIBCPP_NO_EXCEPTIONS
1072 this->clear(this->rdstate() & ~ios_base::eofbit);1142 try
1073 sentry __sen(*this, true);
1074 if (__sen)
1075 {1143 {
1144#endif // _LIBCPP_NO_EXCEPTIONS
1076 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())1145 if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
1077 this->setstate(ios_base::badbit);1146 __state |= ios_base::badbit;
1078 }
1079 else
1080 this->setstate(ios_base::failbit);
1081#ifndef _LIBCPP_NO_EXCEPTIONS1147#ifndef _LIBCPP_NO_EXCEPTIONS
1148 }
1149 catch (...)
1150 {
1151 __state |= ios_base::badbit;
1152 this->__setstate_nothrow(__state);
1153 if (this->exceptions() & ios_base::badbit)
1154 {
1155 throw;
1156 }
1157 }
1158#endif // _LIBCPP_NO_EXCEPTIONS
1082 }1159 }
1083 catch (...)1160 else
1084 {1161 {
1085 this->__set_badbit_and_consider_rethrow();1162 __state |= ios_base::failbit;
1086 }1163 }
1087#endif // _LIBCPP_NO_EXCEPTIONS1164 this->setstate(__state);
1088 return *this;1165 return *this;
1089}1166}
10901167
...@@ -1092,27 +1169,36 @@ template<class _CharT, class _Traits>...@@ -1092,27 +1169,36 @@ template<class _CharT, class _Traits>
1092basic_istream<_CharT, _Traits>&1169basic_istream<_CharT, _Traits>&
1093basic_istream<_CharT, _Traits>::unget()1170basic_istream<_CharT, _Traits>::unget()
1094{1171{
1172 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1095 __gc_ = 0;1173 __gc_ = 0;
1096#ifndef _LIBCPP_NO_EXCEPTIONS1174 this->clear(__state);
1097 try1175 sentry __sen(*this, true);
1176 if (__sen)
1098 {1177 {
1099#endif // _LIBCPP_NO_EXCEPTIONS1178#ifndef _LIBCPP_NO_EXCEPTIONS
1100 this->clear(this->rdstate() & ~ios_base::eofbit);1179 try
1101 sentry __sen(*this, true);
1102 if (__sen)
1103 {1180 {
1181#endif // _LIBCPP_NO_EXCEPTIONS
1104 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())1182 if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
1105 this->setstate(ios_base::badbit);1183 __state |= ios_base::badbit;
1106 }
1107 else
1108 this->setstate(ios_base::failbit);
1109#ifndef _LIBCPP_NO_EXCEPTIONS1184#ifndef _LIBCPP_NO_EXCEPTIONS
1185 }
1186 catch (...)
1187 {
1188 __state |= ios_base::badbit;
1189 this->__setstate_nothrow(__state);
1190 if (this->exceptions() & ios_base::badbit)
1191 {
1192 throw;
1193 }
1194 }
1195#endif // _LIBCPP_NO_EXCEPTIONS
1110 }1196 }
1111 catch (...)1197 else
1112 {1198 {
1113 this->__set_badbit_and_consider_rethrow();1199 __state |= ios_base::failbit;
1114 }1200 }
1115#endif // _LIBCPP_NO_EXCEPTIONS1201 this->setstate(__state);
1116 return *this;1202 return *this;
1117}1203}
11181204
...@@ -1120,29 +1206,36 @@ template<class _CharT, class _Traits>...@@ -1120,29 +1206,36 @@ template<class _CharT, class _Traits>
1120int1206int
1121basic_istream<_CharT, _Traits>::sync()1207basic_istream<_CharT, _Traits>::sync()
1122{1208{
1209 ios_base::iostate __state = ios_base::goodbit;
1123 int __r = 0;1210 int __r = 0;
1124#ifndef _LIBCPP_NO_EXCEPTIONS1211 sentry __sen(*this, true);
1125 try1212 if (__sen)
1126 {1213 {
1127#endif // _LIBCPP_NO_EXCEPTIONS1214#ifndef _LIBCPP_NO_EXCEPTIONS
1128 sentry __sen(*this, true);1215 try
1129 if (__sen)
1130 {1216 {
1217#endif // _LIBCPP_NO_EXCEPTIONS
1131 if (this->rdbuf() == 0)1218 if (this->rdbuf() == 0)
1132 return -1;1219 return -1;
1133 if (this->rdbuf()->pubsync() == -1)1220 if (this->rdbuf()->pubsync() == -1)
1134 {1221 {
1135 this->setstate(ios_base::badbit);1222 __state |= ios_base::badbit;
1136 return -1;1223 return -1;
1137 }1224 }
1138 }
1139#ifndef _LIBCPP_NO_EXCEPTIONS1225#ifndef _LIBCPP_NO_EXCEPTIONS
1140 }1226 }
1141 catch (...)1227 catch (...)
1142 {1228 {
1143 this->__set_badbit_and_consider_rethrow();1229 __state |= ios_base::badbit;
1144 }1230 this->__setstate_nothrow(__state);
1231 if (this->exceptions() & ios_base::badbit)
1232 {
1233 throw;
1234 }
1235 }
1145#endif // _LIBCPP_NO_EXCEPTIONS1236#endif // _LIBCPP_NO_EXCEPTIONS
1237 this->setstate(__state);
1238 }
1146 return __r;1239 return __r;
1147}1240}
11481241
...@@ -1150,21 +1243,30 @@ template<class _CharT, class _Traits>...@@ -1150,21 +1243,30 @@ template<class _CharT, class _Traits>
1150typename basic_istream<_CharT, _Traits>::pos_type1243typename basic_istream<_CharT, _Traits>::pos_type
1151basic_istream<_CharT, _Traits>::tellg()1244basic_istream<_CharT, _Traits>::tellg()
1152{1245{
1246 ios_base::iostate __state = ios_base::goodbit;
1153 pos_type __r(-1);1247 pos_type __r(-1);
1154#ifndef _LIBCPP_NO_EXCEPTIONS1248 sentry __sen(*this, true);
1155 try1249 if (__sen)
1156 {1250 {
1251#ifndef _LIBCPP_NO_EXCEPTIONS
1252 try
1253 {
1157#endif // _LIBCPP_NO_EXCEPTIONS1254#endif // _LIBCPP_NO_EXCEPTIONS
1158 sentry __sen(*this, true);1255 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1159 if (__sen)
1160 __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
1161#ifndef _LIBCPP_NO_EXCEPTIONS1256#ifndef _LIBCPP_NO_EXCEPTIONS
1162 }1257 }
1163 catch (...)1258 catch (...)
1164 {1259 {
1165 this->__set_badbit_and_consider_rethrow();1260 __state |= ios_base::badbit;
1166 }1261 this->__setstate_nothrow(__state);
1262 if (this->exceptions() & ios_base::badbit)
1263 {
1264 throw;
1265 }
1266 }
1167#endif // _LIBCPP_NO_EXCEPTIONS1267#endif // _LIBCPP_NO_EXCEPTIONS
1268 this->setstate(__state);
1269 }
1168 return __r;1270 return __r;
1169}1271}
11701272
...@@ -1172,24 +1274,31 @@ template<class _CharT, class _Traits>...@@ -1172,24 +1274,31 @@ template<class _CharT, class _Traits>
1172basic_istream<_CharT, _Traits>&1274basic_istream<_CharT, _Traits>&
1173basic_istream<_CharT, _Traits>::seekg(pos_type __pos)1275basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
1174{1276{
1175#ifndef _LIBCPP_NO_EXCEPTIONS1277 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1176 try1278 this->clear(__state);
1279 sentry __sen(*this, true);
1280 if (__sen)
1177 {1281 {
1178#endif // _LIBCPP_NO_EXCEPTIONS1282#ifndef _LIBCPP_NO_EXCEPTIONS
1179 this->clear(this->rdstate() & ~ios_base::eofbit);1283 try
1180 sentry __sen(*this, true);
1181 if (__sen)
1182 {1284 {
1285#endif // _LIBCPP_NO_EXCEPTIONS
1183 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))1286 if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
1184 this->setstate(ios_base::failbit);1287 __state |= ios_base::failbit;
1185 }
1186#ifndef _LIBCPP_NO_EXCEPTIONS1288#ifndef _LIBCPP_NO_EXCEPTIONS
1187 }1289 }
1188 catch (...)1290 catch (...)
1189 {1291 {
1190 this->__set_badbit_and_consider_rethrow();1292 __state |= ios_base::badbit;
1191 }1293 this->__setstate_nothrow(__state);
1294 if (this->exceptions() & ios_base::badbit)
1295 {
1296 throw;
1297 }
1298 }
1192#endif // _LIBCPP_NO_EXCEPTIONS1299#endif // _LIBCPP_NO_EXCEPTIONS
1300 this->setstate(__state);
1301 }
1193 return *this;1302 return *this;
1194}1303}
11951304
...@@ -1197,24 +1306,31 @@ template<class _CharT, class _Traits>...@@ -1197,24 +1306,31 @@ template<class _CharT, class _Traits>
1197basic_istream<_CharT, _Traits>&1306basic_istream<_CharT, _Traits>&
1198basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)1307basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
1199{1308{
1200#ifndef _LIBCPP_NO_EXCEPTIONS1309 ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit;
1201 try1310 this->clear(__state);
1311 sentry __sen(*this, true);
1312 if (__sen)
1202 {1313 {
1203#endif // _LIBCPP_NO_EXCEPTIONS1314#ifndef _LIBCPP_NO_EXCEPTIONS
1204 this->clear(this->rdstate() & ~ios_base::eofbit);1315 try
1205 sentry __sen(*this, true);
1206 if (__sen)
1207 {1316 {
1317#endif // _LIBCPP_NO_EXCEPTIONS
1208 if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))1318 if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
1209 this->setstate(ios_base::failbit);1319 __state |= ios_base::failbit;
1210 }
1211#ifndef _LIBCPP_NO_EXCEPTIONS1320#ifndef _LIBCPP_NO_EXCEPTIONS
1212 }1321 }
1213 catch (...)1322 catch (...)
1214 {1323 {
1215 this->__set_badbit_and_consider_rethrow();1324 __state |= ios_base::badbit;
1216 }1325 this->__setstate_nothrow(__state);
1326 if (this->exceptions() & ios_base::badbit)
1327 {
1328 throw;
1329 }
1330 }
1217#endif // _LIBCPP_NO_EXCEPTIONS1331#endif // _LIBCPP_NO_EXCEPTIONS
1332 this->setstate(__state);
1333 }
1218 return *this;1334 return *this;
1219}1335}
12201336
...@@ -1222,34 +1338,41 @@ template <class _CharT, class _Traits>...@@ -1222,34 +1338,41 @@ template <class _CharT, class _Traits>
1222basic_istream<_CharT, _Traits>&1338basic_istream<_CharT, _Traits>&
1223ws(basic_istream<_CharT, _Traits>& __is)1339ws(basic_istream<_CharT, _Traits>& __is)
1224{1340{
1225#ifndef _LIBCPP_NO_EXCEPTIONS1341 ios_base::iostate __state = ios_base::goodbit;
1226 try1342 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1343 if (__sen)
1227 {1344 {
1228#endif // _LIBCPP_NO_EXCEPTIONS1345#ifndef _LIBCPP_NO_EXCEPTIONS
1229 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);1346 try
1230 if (__sen)
1231 {1347 {
1348#endif // _LIBCPP_NO_EXCEPTIONS
1232 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());1349 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1233 while (true)1350 while (true)
1234 {1351 {
1235 typename _Traits::int_type __i = __is.rdbuf()->sgetc();1352 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1236 if (_Traits::eq_int_type(__i, _Traits::eof()))1353 if (_Traits::eq_int_type(__i, _Traits::eof()))
1237 {1354 {
1238 __is.setstate(ios_base::eofbit);1355 __state |= ios_base::eofbit;
1239 break;1356 break;
1240 }1357 }
1241 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))1358 if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
1242 break;1359 break;
1243 __is.rdbuf()->sbumpc();1360 __is.rdbuf()->sbumpc();
1244 }1361 }
1245 }
1246#ifndef _LIBCPP_NO_EXCEPTIONS1362#ifndef _LIBCPP_NO_EXCEPTIONS
1247 }1363 }
1248 catch (...)1364 catch (...)
1249 {1365 {
1250 __is.__set_badbit_and_consider_rethrow();1366 __state |= ios_base::badbit;
1251 }1367 __is.__setstate_nothrow(__state);
1368 if (__is.exceptions() & ios_base::badbit)
1369 {
1370 throw;
1371 }
1372 }
1252#endif // _LIBCPP_NO_EXCEPTIONS1373#endif // _LIBCPP_NO_EXCEPTIONS
1374 __is.setstate(__state);
1375 }
1253 return __is;1376 return __is;
1254}1377}
12551378
...@@ -1298,7 +1421,6 @@ protected:...@@ -1298,7 +1421,6 @@ protected:
1298 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V11421 inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
1299 void swap(basic_iostream& __rhs)1422 void swap(basic_iostream& __rhs)
1300 { basic_istream<char_type, traits_type>::swap(__rhs); }1423 { basic_istream<char_type, traits_type>::swap(__rhs); }
1301public:
1302};1424};
13031425
1304#ifndef _LIBCPP_CXX03_LANG1426#ifndef _LIBCPP_CXX03_LANG
...@@ -1329,13 +1451,14 @@ basic_istream<_CharT, _Traits>&...@@ -1329,13 +1451,14 @@ basic_istream<_CharT, _Traits>&
1329operator>>(basic_istream<_CharT, _Traits>& __is,1451operator>>(basic_istream<_CharT, _Traits>& __is,
1330 basic_string<_CharT, _Traits, _Allocator>& __str)1452 basic_string<_CharT, _Traits, _Allocator>& __str)
1331{1453{
1332#ifndef _LIBCPP_NO_EXCEPTIONS1454 ios_base::iostate __state = ios_base::goodbit;
1333 try1455 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1456 if (__sen)
1334 {1457 {
1335#endif // _LIBCPP_NO_EXCEPTIONS1458#ifndef _LIBCPP_NO_EXCEPTIONS
1336 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);1459 try
1337 if (__sen)
1338 {1460 {
1461#endif
1339 __str.clear();1462 __str.clear();
1340 streamsize __n = __is.width();1463 streamsize __n = __is.width();
1341 if (__n <= 0)1464 if (__n <= 0)
...@@ -1344,13 +1467,12 @@ operator>>(basic_istream<_CharT, _Traits>& __is,...@@ -1344,13 +1467,12 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
1344 __n = numeric_limits<streamsize>::max();1467 __n = numeric_limits<streamsize>::max();
1345 streamsize __c = 0;1468 streamsize __c = 0;
1346 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());1469 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1347 ios_base::iostate __err = ios_base::goodbit;
1348 while (__c < __n)1470 while (__c < __n)
1349 {1471 {
1350 typename _Traits::int_type __i = __is.rdbuf()->sgetc();1472 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1351 if (_Traits::eq_int_type(__i, _Traits::eof()))1473 if (_Traits::eq_int_type(__i, _Traits::eof()))
1352 {1474 {
1353 __err |= ios_base::eofbit;1475 __state |= ios_base::eofbit;
1354 break;1476 break;
1355 }1477 }
1356 _CharT __ch = _Traits::to_char_type(__i);1478 _CharT __ch = _Traits::to_char_type(__i);
...@@ -1362,18 +1484,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is,...@@ -1362,18 +1484,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
1362 }1484 }
1363 __is.width(0);1485 __is.width(0);
1364 if (__c == 0)1486 if (__c == 0)
1365 __err |= ios_base::failbit;1487 __state |= ios_base::failbit;
1366 __is.setstate(__err);
1367 }
1368 else
1369 __is.setstate(ios_base::failbit);
1370#ifndef _LIBCPP_NO_EXCEPTIONS1488#ifndef _LIBCPP_NO_EXCEPTIONS
1489 }
1490 catch (...)
1491 {
1492 __state |= ios_base::badbit;
1493 __is.__setstate_nothrow(__state);
1494 if (__is.exceptions() & ios_base::badbit)
1495 {
1496 throw;
1497 }
1498 }
1499#endif
1500 __is.setstate(__state);
1371 }1501 }
1372 catch (...)
1373 {
1374 __is.__set_badbit_and_consider_rethrow();
1375 }
1376#endif // _LIBCPP_NO_EXCEPTIONS
1377 return __is;1502 return __is;
1378}1503}
13791504
...@@ -1382,22 +1507,22 @@ basic_istream<_CharT, _Traits>&...@@ -1382,22 +1507,22 @@ basic_istream<_CharT, _Traits>&
1382getline(basic_istream<_CharT, _Traits>& __is,1507getline(basic_istream<_CharT, _Traits>& __is,
1383 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)1508 basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
1384{1509{
1385#ifndef _LIBCPP_NO_EXCEPTIONS1510 ios_base::iostate __state = ios_base::goodbit;
1386 try1511 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
1512 if (__sen)
1387 {1513 {
1388#endif // _LIBCPP_NO_EXCEPTIONS1514#ifndef _LIBCPP_NO_EXCEPTIONS
1389 typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);1515 try
1390 if (__sen)
1391 {1516 {
1517#endif
1392 __str.clear();1518 __str.clear();
1393 ios_base::iostate __err = ios_base::goodbit;
1394 streamsize __extr = 0;1519 streamsize __extr = 0;
1395 while (true)1520 while (true)
1396 {1521 {
1397 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();1522 typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
1398 if (_Traits::eq_int_type(__i, _Traits::eof()))1523 if (_Traits::eq_int_type(__i, _Traits::eof()))
1399 {1524 {
1400 __err |= ios_base::eofbit;1525 __state |= ios_base::eofbit;
1401 break;1526 break;
1402 }1527 }
1403 ++__extr;1528 ++__extr;
...@@ -1407,21 +1532,26 @@ getline(basic_istream<_CharT, _Traits>& __is,...@@ -1407,21 +1532,26 @@ getline(basic_istream<_CharT, _Traits>& __is,
1407 __str.push_back(__ch);1532 __str.push_back(__ch);
1408 if (__str.size() == __str.max_size())1533 if (__str.size() == __str.max_size())
1409 {1534 {
1410 __err |= ios_base::failbit;1535 __state |= ios_base::failbit;
1411 break;1536 break;
1412 }1537 }
1413 }1538 }
1414 if (__extr == 0)1539 if (__extr == 0)
1415 __err |= ios_base::failbit;1540 __state |= ios_base::failbit;
1416 __is.setstate(__err);
1417 }
1418#ifndef _LIBCPP_NO_EXCEPTIONS1541#ifndef _LIBCPP_NO_EXCEPTIONS
1542 }
1543 catch (...)
1544 {
1545 __state |= ios_base::badbit;
1546 __is.__setstate_nothrow(__state);
1547 if (__is.exceptions() & ios_base::badbit)
1548 {
1549 throw;
1550 }
1551 }
1552#endif
1553 __is.setstate(__state);
1419 }1554 }
1420 catch (...)
1421 {
1422 __is.__set_badbit_and_consider_rethrow();
1423 }
1424#endif // _LIBCPP_NO_EXCEPTIONS
1425 return __is;1555 return __is;
1426}1556}
14271557
...@@ -1460,17 +1590,17 @@ template <class _CharT, class _Traits, size_t _Size>...@@ -1460,17 +1590,17 @@ template <class _CharT, class _Traits, size_t _Size>
1460basic_istream<_CharT, _Traits>&1590basic_istream<_CharT, _Traits>&
1461operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)1591operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1462{1592{
1463#ifndef _LIBCPP_NO_EXCEPTIONS1593 ios_base::iostate __state = ios_base::goodbit;
1464 try1594 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
1595 if (__sen)
1465 {1596 {
1466#endif // _LIBCPP_NO_EXCEPTIONS1597#ifndef _LIBCPP_NO_EXCEPTIONS
1467 typename basic_istream<_CharT, _Traits>::sentry __sen(__is);1598 try
1468 if (__sen)
1469 {1599 {
1600#endif
1470 basic_string<_CharT, _Traits> __str;1601 basic_string<_CharT, _Traits> __str;
1471 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());1602 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
1472 size_t __c = 0;1603 size_t __c = 0;
1473 ios_base::iostate __err = ios_base::goodbit;
1474 _CharT __zero = __ct.widen('0');1604 _CharT __zero = __ct.widen('0');
1475 _CharT __one = __ct.widen('1');1605 _CharT __one = __ct.widen('1');
1476 while (__c < _Size)1606 while (__c < _Size)
...@@ -1478,7 +1608,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)...@@ -1478,7 +1608,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1478 typename _Traits::int_type __i = __is.rdbuf()->sgetc();1608 typename _Traits::int_type __i = __is.rdbuf()->sgetc();
1479 if (_Traits::eq_int_type(__i, _Traits::eof()))1609 if (_Traits::eq_int_type(__i, _Traits::eof()))
1480 {1610 {
1481 __err |= ios_base::eofbit;1611 __state |= ios_base::eofbit;
1482 break;1612 break;
1483 }1613 }
1484 _CharT __ch = _Traits::to_char_type(__i);1614 _CharT __ch = _Traits::to_char_type(__i);
...@@ -1490,18 +1620,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)...@@ -1490,18 +1620,21 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
1490 }1620 }
1491 __x = bitset<_Size>(__str);1621 __x = bitset<_Size>(__str);
1492 if (__c == 0)1622 if (__c == 0)
1493 __err |= ios_base::failbit;1623 __state |= ios_base::failbit;
1494 __is.setstate(__err);
1495 }
1496 else
1497 __is.setstate(ios_base::failbit);
1498#ifndef _LIBCPP_NO_EXCEPTIONS1624#ifndef _LIBCPP_NO_EXCEPTIONS
1625 }
1626 catch (...)
1627 {
1628 __state |= ios_base::badbit;
1629 __is.__setstate_nothrow(__state);
1630 if (__is.exceptions() & ios_base::badbit)
1631 {
1632 throw;
1633 }
1634 }
1635#endif
1636 __is.setstate(__state);
1499 }1637 }
1500 catch (...)
1501 {
1502 __is.__set_badbit_and_consider_rethrow();
1503 }
1504#endif // _LIBCPP_NO_EXCEPTIONS
1505 return __is;1638 return __is;
1506}1639}
15071640
lib/libcxx/include/iterator+141-106
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- iterator ----------------------------------===//2//===-------------------------- iterator ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -70,7 +69,7 @@ typename iterator_traits<InputIterator>::difference_type n = 1);...@@ -70,7 +69,7 @@ typename iterator_traits<InputIterator>::difference_type n = 1);
7069
71template <class BidirectionalIterator> // constexpr in C++1770template <class BidirectionalIterator> // constexpr in C++17
72 constexpr BidirectionalIterator prev(BidirectionalIterator x,71 constexpr BidirectionalIterator prev(BidirectionalIterator x,
73 typename iterator_traits<BidirectionalIterator>::difference_type n = 1); 72 typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
7473
75template <class Iterator>74template <class Iterator>
76class reverse_iterator75class reverse_iterator
...@@ -137,7 +136,7 @@ operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2...@@ -137,7 +136,7 @@ operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2
137136
138template <class Iterator>137template <class Iterator>
139constexpr reverse_iterator<Iterator>138constexpr reverse_iterator<Iterator>
140operator+(typename reverse_iterator<Iterator>::difference_type n, 139operator+(typename reverse_iterator<Iterator>::difference_type n,
141 const reverse_iterator<Iterator>& x); // constexpr in C++17140 const reverse_iterator<Iterator>& x); // constexpr in C++17
142141
143template <class Iterator>142template <class Iterator>
...@@ -217,7 +216,7 @@ public:...@@ -217,7 +216,7 @@ public:
217 typedef typename iterator_traits<Iterator>::value_type value_type;216 typedef typename iterator_traits<Iterator>::value_type value_type;
218 typedef typename iterator_traits<Iterator>::iterator_category iterator_category;217 typedef typename iterator_traits<Iterator>::iterator_category iterator_category;
219 typedef value_type&& reference;218 typedef value_type&& reference;
220 219
221 constexpr move_iterator(); // all the constexprs are in C++17220 constexpr move_iterator(); // all the constexprs are in C++17
222 constexpr explicit move_iterator(Iterator i);221 constexpr explicit move_iterator(Iterator i);
223 template <class U>222 template <class U>
...@@ -231,10 +230,10 @@ public:...@@ -231,10 +230,10 @@ public:
231 constexpr move_iterator operator++(int);230 constexpr move_iterator operator++(int);
232 constexpr move_iterator& operator--();231 constexpr move_iterator& operator--();
233 constexpr move_iterator operator--(int);232 constexpr move_iterator operator--(int);
234 constexpr move_iterator operator+(difference_type n) const; 233 constexpr move_iterator operator+(difference_type n) const;
235 constexpr move_iterator& operator+=(difference_type n); 234 constexpr move_iterator& operator+=(difference_type n);
236 constexpr move_iterator operator-(difference_type n) const; 235 constexpr move_iterator operator-(difference_type n) const;
237 constexpr move_iterator& operator-=(difference_type n); 236 constexpr move_iterator& operator-=(difference_type n);
238 constexpr unspecified operator[](difference_type n) const;237 constexpr unspecified operator[](difference_type n) const;
239private:238private:
240 Iterator current; // exposition only239 Iterator current; // exposition only
...@@ -271,7 +270,7 @@ operator-(const move_iterator<Iterator1>& x,...@@ -271,7 +270,7 @@ operator-(const move_iterator<Iterator1>& x,
271270
272template <class Iterator>271template <class Iterator>
273constexpr move_iterator<Iterator> operator+( // constexpr in C++17272constexpr move_iterator<Iterator> operator+( // constexpr in C++17
274 typename move_iterator<Iterator>::difference_type n, 273 typename move_iterator<Iterator>::difference_type n,
275 const move_iterator<Iterator>& x);274 const move_iterator<Iterator>& x);
276275
277template <class Iterator> // constexpr in C++17276template <class Iterator> // constexpr in C++17
...@@ -400,6 +399,11 @@ template <class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));...@@ -400,6 +399,11 @@ template <class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
400// 24.8, container access:399// 24.8, container access:
401template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17400template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17
402template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17401template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
402
403template <class C> constexpr auto ssize(const C& c)
404 -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>; // C++20
405template <class T, ptrdiff_t> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20
406
403template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17407template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17
404template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17408template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17
405template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17409template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17
...@@ -530,10 +534,26 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_...@@ -530,10 +534,26 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
530534
531template <class _Tp>535template <class _Tp>
532struct __is_exactly_input_iterator536struct __is_exactly_input_iterator
533 : public integral_constant<bool, 537 : public integral_constant<bool,
534 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && 538 __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
535 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};539 !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
536540
541#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
542template<class _InputIterator>
543using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;
544
545template<class _InputIterator>
546using __iter_key_type = remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;
547
548template<class _InputIterator>
549using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type;
550
551template<class _InputIterator>
552using __iter_to_alloc_type = pair<
553 add_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>,
554 typename iterator_traits<_InputIterator>::value_type::second_type>;
555#endif
556
537template<class _Category, class _Tp, class _Distance = ptrdiff_t,557template<class _Category, class _Tp, class _Distance = ptrdiff_t,
538 class _Pointer = _Tp*, class _Reference = _Tp&>558 class _Pointer = _Tp*, class _Reference = _Tp&>
539struct _LIBCPP_TEMPLATE_VIS iterator559struct _LIBCPP_TEMPLATE_VIS iterator
...@@ -580,6 +600,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14...@@ -580,6 +600,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
580void advance(_InputIter& __i,600void advance(_InputIter& __i,
581 typename iterator_traits<_InputIter>::difference_type __n)601 typename iterator_traits<_InputIter>::difference_type __n)
582{602{
603 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
604 "Attempt to advance(it, -n) on a non-bidi iterator");
583 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());605 __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
584}606}
585607
...@@ -614,26 +636,31 @@ template <class _InputIter>...@@ -614,26 +636,31 @@ template <class _InputIter>
614inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14636inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
615typename enable_if637typename enable_if
616<638<
617 __is_input_iterator<_InputIter>::value, 639 __is_input_iterator<_InputIter>::value,
618 _InputIter640 _InputIter
619>::type641>::type
620next(_InputIter __x,642next(_InputIter __x,
621 typename iterator_traits<_InputIter>::difference_type __n = 1)643 typename iterator_traits<_InputIter>::difference_type __n = 1)
622{644{
645 _LIBCPP_ASSERT(__n >= 0 || __is_bidirectional_iterator<_InputIter>::value,
646 "Attempt to next(it, -n) on a non-bidi iterator");
647
623 _VSTD::advance(__x, __n);648 _VSTD::advance(__x, __n);
624 return __x;649 return __x;
625}650}
626651
627template <class _BidirectionalIter>652template <class _InputIter>
628inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14653inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
629typename enable_if654typename enable_if
630<655<
631 __is_bidirectional_iterator<_BidirectionalIter>::value, 656 __is_input_iterator<_InputIter>::value,
632 _BidirectionalIter657 _InputIter
633>::type658>::type
634prev(_BidirectionalIter __x,659prev(_InputIter __x,
635 typename iterator_traits<_BidirectionalIter>::difference_type __n = 1)660 typename iterator_traits<_InputIter>::difference_type __n = 1)
636{661{
662 _LIBCPP_ASSERT(__n <= 0 || __is_bidirectional_iterator<_InputIter>::value,
663 "Attempt to prev(it, +n) on a non-bidi iterator");
637 _VSTD::advance(__x, -__n);664 _VSTD::advance(__x, -__n);
638 return __x;665 return __x;
639}666}
...@@ -1079,10 +1106,6 @@ public:...@@ -1079,10 +1106,6 @@ public:
1079 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}1106 _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
1080 _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}1107 _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
10811108
1082#if !defined(__APPLE__) || \
1083 (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
1084 (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
1085
1086 template <class _Ch, class _Tr>1109 template <class _Ch, class _Tr>
1087 friend1110 friend
1088 _LIBCPP_HIDDEN1111 _LIBCPP_HIDDEN
...@@ -1090,7 +1113,6 @@ public:...@@ -1090,7 +1113,6 @@ public:
1090 __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,1113 __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
1091 const _Ch* __ob, const _Ch* __op, const _Ch* __oe,1114 const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
1092 ios_base& __iob, _Ch __fl);1115 ios_base& __iob, _Ch __fl);
1093#endif
1094};1116};
10951117
1096template <class _Iter>1118template <class _Iter>
...@@ -1123,7 +1145,7 @@ public:...@@ -1123,7 +1145,7 @@ public:
1123 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141145 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1124 move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {}1146 move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {}
1125 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;}1147 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;}
1126 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 1148 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1127 reference operator*() const { return static_cast<reference>(*__i); }1149 reference operator*() const { return static_cast<reference>(*__i); }
1128 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141150 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1129 pointer operator->() const { return __i;}1151 pointer operator->() const { return __i;}
...@@ -1237,50 +1259,50 @@ template <class _Iter> class __wrap_iter;...@@ -1237,50 +1259,50 @@ template <class _Iter> class __wrap_iter;
1237template <class _Iter1, class _Iter2>1259template <class _Iter1, class _Iter2>
1238_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1260_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1239bool1261bool
1240operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1262operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12411263
1242template <class _Iter1, class _Iter2>1264template <class _Iter1, class _Iter2>
1243_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1265_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1244bool1266bool
1245operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1267operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12461268
1247template <class _Iter1, class _Iter2>1269template <class _Iter1, class _Iter2>
1248_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1270_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1249bool1271bool
1250operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1272operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12511273
1252template <class _Iter1, class _Iter2>1274template <class _Iter1, class _Iter2>
1253_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1275_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1254bool1276bool
1255operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1277operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12561278
1257template <class _Iter1, class _Iter2>1279template <class _Iter1, class _Iter2>
1258_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1280_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1259bool1281bool
1260operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1282operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12611283
1262template <class _Iter1, class _Iter2>1284template <class _Iter1, class _Iter2>
1263_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1285_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1264bool1286bool
1265operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1287operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
12661288
1267#ifndef _LIBCPP_CXX03_LANG1289#ifndef _LIBCPP_CXX03_LANG
1268template <class _Iter1, class _Iter2>1290template <class _Iter1, class _Iter2>
1269_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1291_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1270auto1292auto
1271operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1293operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1272-> decltype(__x.base() - __y.base());1294-> decltype(__x.base() - __y.base());
1273#else1295#else
1274template <class _Iter1, class _Iter2>1296template <class _Iter1, class _Iter2>
1275_LIBCPP_INLINE_VISIBILITY1297_LIBCPP_INLINE_VISIBILITY
1276typename __wrap_iter<_Iter1>::difference_type1298typename __wrap_iter<_Iter1>::difference_type
1277operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1299operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
1278#endif1300#endif
12791301
1280template <class _Iter>1302template <class _Iter>
1281_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1303_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1282__wrap_iter<_Iter>1304__wrap_iter<_Iter>
1283operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;1305operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
12841306
1285template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);1307template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
1286template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);1308template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
...@@ -1324,7 +1346,7 @@ public:...@@ -1324,7 +1346,7 @@ public:
1324private:1346private:
1325 iterator_type __i;1347 iterator_type __i;
1326public:1348public:
1327 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT_DEBUG1349 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT
1328#if _LIBCPP_STD_VER > 111350#if _LIBCPP_STD_VER > 11
1329 : __i{}1351 : __i{}
1330#endif1352#endif
...@@ -1335,7 +1357,7 @@ public:...@@ -1335,7 +1357,7 @@ public:
1335 }1357 }
1336 template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1358 template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1337 __wrap_iter(const __wrap_iter<_Up>& __u,1359 __wrap_iter(const __wrap_iter<_Up>& __u,
1338 typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT_DEBUG1360 typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
1339 : __i(__u.base())1361 : __i(__u.base())
1340 {1362 {
1341#if _LIBCPP_DEBUG_LEVEL >= 21363#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1365,7 +1387,7 @@ public:...@@ -1365,7 +1387,7 @@ public:
1365 __get_db()->__erase_i(this);1387 __get_db()->__erase_i(this);
1366 }1388 }
1367#endif1389#endif
1368 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT_DEBUG1390 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT
1369 {1391 {
1370#if _LIBCPP_DEBUG_LEVEL >= 21392#if _LIBCPP_DEBUG_LEVEL >= 2
1371 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),1393 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
...@@ -1373,7 +1395,7 @@ public:...@@ -1373,7 +1395,7 @@ public:
1373#endif1395#endif
1374 return *__i;1396 return *__i;
1375 }1397 }
1376 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT_DEBUG1398 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT
1377 {1399 {
1378#if _LIBCPP_DEBUG_LEVEL >= 21400#if _LIBCPP_DEBUG_LEVEL >= 2
1379 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),1401 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
...@@ -1381,7 +1403,7 @@ public:...@@ -1381,7 +1403,7 @@ public:
1381#endif1403#endif
1382 return (pointer)_VSTD::addressof(*__i);1404 return (pointer)_VSTD::addressof(*__i);
1383 }1405 }
1384 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT_DEBUG1406 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT
1385 {1407 {
1386#if _LIBCPP_DEBUG_LEVEL >= 21408#if _LIBCPP_DEBUG_LEVEL >= 2
1387 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),1409 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
...@@ -1390,10 +1412,10 @@ public:...@@ -1390,10 +1412,10 @@ public:
1390 ++__i;1412 ++__i;
1391 return *this;1413 return *this;
1392 }1414 }
1393 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT_DEBUG1415 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT
1394 {__wrap_iter __tmp(*this); ++(*this); return __tmp;}1416 {__wrap_iter __tmp(*this); ++(*this); return __tmp;}
13951417
1396 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT_DEBUG1418 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT
1397 {1419 {
1398#if _LIBCPP_DEBUG_LEVEL >= 21420#if _LIBCPP_DEBUG_LEVEL >= 2
1399 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),1421 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
...@@ -1402,11 +1424,11 @@ public:...@@ -1402,11 +1424,11 @@ public:
1402 --__i;1424 --__i;
1403 return *this;1425 return *this;
1404 }1426 }
1405 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT_DEBUG1427 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT
1406 {__wrap_iter __tmp(*this); --(*this); return __tmp;}1428 {__wrap_iter __tmp(*this); --(*this); return __tmp;}
1407 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT_DEBUG1429 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
1408 {__wrap_iter __w(*this); __w += __n; return __w;}1430 {__wrap_iter __w(*this); __w += __n; return __w;}
1409 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG1431 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
1410 {1432 {
1411#if _LIBCPP_DEBUG_LEVEL >= 21433#if _LIBCPP_DEBUG_LEVEL >= 2
1412 _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),1434 _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
...@@ -1415,11 +1437,11 @@ public:...@@ -1415,11 +1437,11 @@ public:
1415 __i += __n;1437 __i += __n;
1416 return *this;1438 return *this;
1417 }1439 }
1418 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT_DEBUG1440 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT
1419 {return *this + (-__n);}1441 {return *this + (-__n);}
1420 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG1442 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
1421 {*this += -__n; return *this;}1443 {*this += -__n; return *this;}
1422 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT_DEBUG1444 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT
1423 {1445 {
1424#if _LIBCPP_DEBUG_LEVEL >= 21446#if _LIBCPP_DEBUG_LEVEL >= 2
1425 _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),1447 _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
...@@ -1428,7 +1450,7 @@ public:...@@ -1428,7 +1450,7 @@ public:
1428 return __i[__n];1450 return __i[__n];
1429 }1451 }
14301452
1431 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT_DEBUG {return __i;}1453 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;}
14321454
1433private:1455private:
1434#if _LIBCPP_DEBUG_LEVEL >= 21456#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1437,61 +1459,61 @@ private:...@@ -1437,61 +1459,61 @@ private:
1437 __get_db()->__insert_ic(this, __p);1459 __get_db()->__insert_ic(this, __p);
1438 }1460 }
1439#else1461#else
1440 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {}1462 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
1441#endif1463#endif
14421464
1443 template <class _Up> friend class __wrap_iter;1465 template <class _Up> friend class __wrap_iter;
1444 template <class _CharT, class _Traits, class _Alloc> friend class basic_string;1466 template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
1445 template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;1467 template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector;
1446 template <class _Tp, ptrdiff_t> friend class _LIBCPP_TEMPLATE_VIS span;1468 template <class _Tp, size_t> friend class _LIBCPP_TEMPLATE_VIS span;
14471469
1448 template <class _Iter1, class _Iter2>1470 template <class _Iter1, class _Iter2>
1449 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1471 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1450 bool1472 bool
1451 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1473 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14521474
1453 template <class _Iter1, class _Iter2>1475 template <class _Iter1, class _Iter2>
1454 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1476 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1455 bool1477 bool
1456 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1478 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14571479
1458 template <class _Iter1, class _Iter2>1480 template <class _Iter1, class _Iter2>
1459 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1481 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1460 bool1482 bool
1461 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1483 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14621484
1463 template <class _Iter1, class _Iter2>1485 template <class _Iter1, class _Iter2>
1464 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1486 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1465 bool1487 bool
1466 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1488 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14671489
1468 template <class _Iter1, class _Iter2>1490 template <class _Iter1, class _Iter2>
1469 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1491 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1470 bool1492 bool
1471 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1493 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14721494
1473 template <class _Iter1, class _Iter2>1495 template <class _Iter1, class _Iter2>
1474 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1496 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1475 bool1497 bool
1476 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1498 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
14771499
1478#ifndef _LIBCPP_CXX03_LANG1500#ifndef _LIBCPP_CXX03_LANG
1479 template <class _Iter1, class _Iter2>1501 template <class _Iter1, class _Iter2>
1480 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1502 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1481 auto1503 auto
1482 operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1504 operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1483 -> decltype(__x.base() - __y.base());1505 -> decltype(__x.base() - __y.base());
1484#else1506#else
1485 template <class _Iter1, class _Iter2>1507 template <class _Iter1, class _Iter2>
1486 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1508 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1487 typename __wrap_iter<_Iter1>::difference_type1509 typename __wrap_iter<_Iter1>::difference_type
1488 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;1510 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
1489#endif1511#endif
14901512
1491 template <class _Iter1>1513 template <class _Iter1>
1492 _LIBCPP_CONSTEXPR_IF_NODEBUG friend1514 _LIBCPP_CONSTEXPR_IF_NODEBUG friend
1493 __wrap_iter<_Iter1>1515 __wrap_iter<_Iter1>
1494 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT_DEBUG;1516 operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
14951517
1496 template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);1518 template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
1497 template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);1519 template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
...@@ -1522,7 +1544,7 @@ private:...@@ -1522,7 +1544,7 @@ private:
1522template <class _Iter1, class _Iter2>1544template <class _Iter1, class _Iter2>
1523inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1545inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1524bool1546bool
1525operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1547operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1526{1548{
1527 return __x.base() == __y.base();1549 return __x.base() == __y.base();
1528}1550}
...@@ -1530,7 +1552,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX...@@ -1530,7 +1552,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
1530template <class _Iter1, class _Iter2>1552template <class _Iter1, class _Iter2>
1531inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1553inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1532bool1554bool
1533operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1555operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1534{1556{
1535#if _LIBCPP_DEBUG_LEVEL >= 21557#if _LIBCPP_DEBUG_LEVEL >= 2
1536 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),1558 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
...@@ -1542,7 +1564,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC...@@ -1542,7 +1564,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
1542template <class _Iter1, class _Iter2>1564template <class _Iter1, class _Iter2>
1543inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1565inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1544bool1566bool
1545operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1567operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1546{1568{
1547 return !(__x == __y);1569 return !(__x == __y);
1548}1570}
...@@ -1550,7 +1572,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX...@@ -1550,7 +1572,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
1550template <class _Iter1, class _Iter2>1572template <class _Iter1, class _Iter2>
1551inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1573inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1552bool1574bool
1553operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1575operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1554{1576{
1555 return __y < __x;1577 return __y < __x;
1556}1578}
...@@ -1558,7 +1580,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC...@@ -1558,7 +1580,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
1558template <class _Iter1, class _Iter2>1580template <class _Iter1, class _Iter2>
1559inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1581inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1560bool1582bool
1561operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1583operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1562{1584{
1563 return !(__x < __y);1585 return !(__x < __y);
1564}1586}
...@@ -1566,7 +1588,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX...@@ -1566,7 +1588,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
1566template <class _Iter1, class _Iter2>1588template <class _Iter1, class _Iter2>
1567inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1589inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1568bool1590bool
1569operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1591operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1570{1592{
1571 return !(__y < __x);1593 return !(__y < __x);
1572}1594}
...@@ -1574,7 +1596,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX...@@ -1574,7 +1596,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
1574template <class _Iter1>1596template <class _Iter1>
1575inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1597inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1576bool1598bool
1577operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG1599operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
1578{1600{
1579 return !(__x == __y);1601 return !(__x == __y);
1580}1602}
...@@ -1582,7 +1604,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX...@@ -1582,7 +1604,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
1582template <class _Iter1>1604template <class _Iter1>
1583inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1605inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1584bool1606bool
1585operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG1607operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
1586{1608{
1587 return __y < __x;1609 return __y < __x;
1588}1610}
...@@ -1590,7 +1612,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXC...@@ -1590,7 +1612,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXC
1590template <class _Iter1>1612template <class _Iter1>
1591inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1613inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1592bool1614bool
1593operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG1615operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
1594{1616{
1595 return !(__x < __y);1617 return !(__x < __y);
1596}1618}
...@@ -1598,7 +1620,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX...@@ -1598,7 +1620,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
1598template <class _Iter1>1620template <class _Iter1>
1599inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1621inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1600bool1622bool
1601operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG1623operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
1602{1624{
1603 return !(__y < __x);1625 return !(__y < __x);
1604}1626}
...@@ -1607,7 +1629,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX...@@ -1607,7 +1629,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
1607template <class _Iter1, class _Iter2>1629template <class _Iter1, class _Iter2>
1608inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1630inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1609auto1631auto
1610operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1632operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1611-> decltype(__x.base() - __y.base())1633-> decltype(__x.base() - __y.base())
1612{1634{
1613#if _LIBCPP_DEBUG_LEVEL >= 21635#if _LIBCPP_DEBUG_LEVEL >= 2
...@@ -1620,7 +1642,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC...@@ -1620,7 +1642,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
1620template <class _Iter1, class _Iter2>1642template <class _Iter1, class _Iter2>
1621inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1643inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1622typename __wrap_iter<_Iter1>::difference_type1644typename __wrap_iter<_Iter1>::difference_type
1623operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG1645operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
1624{1646{
1625#if _LIBCPP_DEBUG_LEVEL >= 21647#if _LIBCPP_DEBUG_LEVEL >= 2
1626 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),1648 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
...@@ -1634,7 +1656,7 @@ template <class _Iter>...@@ -1634,7 +1656,7 @@ template <class _Iter>
1634inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG1656inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
1635__wrap_iter<_Iter>1657__wrap_iter<_Iter>
1636operator+(typename __wrap_iter<_Iter>::difference_type __n,1658operator+(typename __wrap_iter<_Iter>::difference_type __n,
1637 __wrap_iter<_Iter> __x) _NOEXCEPT_DEBUG1659 __wrap_iter<_Iter> __x) _NOEXCEPT
1638{1660{
1639 __x += __n;1661 __x += __n;
1640 return __x;1662 return __x;
...@@ -1643,7 +1665,7 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,...@@ -1643,7 +1665,7 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
1643template <class _Iter>1665template <class _Iter>
1644struct __libcpp_is_trivial_iterator1666struct __libcpp_is_trivial_iterator
1645 : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {};1667 : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {};
1646 1668
1647template <class _Iter>1669template <class _Iter>
1648struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >1670struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
1649 : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};1671 : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
...@@ -1658,7 +1680,7 @@ struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >...@@ -1658,7 +1680,7 @@ struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
16581680
16591681
1660template <class _Tp, size_t _Np>1682template <class _Tp, size_t _Np>
1661inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX111683_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1662_Tp*1684_Tp*
1663begin(_Tp (&__array)[_Np])1685begin(_Tp (&__array)[_Np])
1664{1686{
...@@ -1666,7 +1688,7 @@ begin(_Tp (&__array)[_Np])...@@ -1666,7 +1688,7 @@ begin(_Tp (&__array)[_Np])
1666}1688}
16671689
1668template <class _Tp, size_t _Np>1690template <class _Tp, size_t _Np>
1669inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX111691_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1670_Tp*1692_Tp*
1671end(_Tp (&__array)[_Np])1693end(_Tp (&__array)[_Np])
1672{1694{
...@@ -1676,7 +1698,7 @@ end(_Tp (&__array)[_Np])...@@ -1676,7 +1698,7 @@ end(_Tp (&__array)[_Np])
1676#if !defined(_LIBCPP_CXX03_LANG)1698#if !defined(_LIBCPP_CXX03_LANG)
16771699
1678template <class _Cp>1700template <class _Cp>
1679inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141701_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1680auto1702auto
1681begin(_Cp& __c) -> decltype(__c.begin())1703begin(_Cp& __c) -> decltype(__c.begin())
1682{1704{
...@@ -1684,7 +1706,7 @@ begin(_Cp& __c) -> decltype(__c.begin())...@@ -1684,7 +1706,7 @@ begin(_Cp& __c) -> decltype(__c.begin())
1684}1706}
16851707
1686template <class _Cp>1708template <class _Cp>
1687inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141709_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1688auto1710auto
1689begin(const _Cp& __c) -> decltype(__c.begin())1711begin(const _Cp& __c) -> decltype(__c.begin())
1690{1712{
...@@ -1692,7 +1714,7 @@ begin(const _Cp& __c) -> decltype(__c.begin())...@@ -1692,7 +1714,7 @@ begin(const _Cp& __c) -> decltype(__c.begin())
1692}1714}
16931715
1694template <class _Cp>1716template <class _Cp>
1695inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141717_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1696auto1718auto
1697end(_Cp& __c) -> decltype(__c.end())1719end(_Cp& __c) -> decltype(__c.end())
1698{1720{
...@@ -1700,7 +1722,7 @@ end(_Cp& __c) -> decltype(__c.end())...@@ -1700,7 +1722,7 @@ end(_Cp& __c) -> decltype(__c.end())
1700}1722}
17011723
1702template <class _Cp>1724template <class _Cp>
1703inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141725_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1704auto1726auto
1705end(const _Cp& __c) -> decltype(__c.end())1727end(const _Cp& __c) -> decltype(__c.end())
1706{1728{
...@@ -1710,84 +1732,84 @@ end(const _Cp& __c) -> decltype(__c.end())...@@ -1710,84 +1732,84 @@ end(const _Cp& __c) -> decltype(__c.end())
1710#if _LIBCPP_STD_VER > 111732#if _LIBCPP_STD_VER > 11
17111733
1712template <class _Tp, size_t _Np>1734template <class _Tp, size_t _Np>
1713inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141735_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1714reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])1736reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
1715{1737{
1716 return reverse_iterator<_Tp*>(__array + _Np);1738 return reverse_iterator<_Tp*>(__array + _Np);
1717}1739}
17181740
1719template <class _Tp, size_t _Np>1741template <class _Tp, size_t _Np>
1720inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141742_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1721reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])1743reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
1722{1744{
1723 return reverse_iterator<_Tp*>(__array);1745 return reverse_iterator<_Tp*>(__array);
1724}1746}
17251747
1726template <class _Ep>1748template <class _Ep>
1727inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141749_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1728reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)1750reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
1729{1751{
1730 return reverse_iterator<const _Ep*>(__il.end());1752 return reverse_iterator<const _Ep*>(__il.end());
1731}1753}
17321754
1733template <class _Ep>1755template <class _Ep>
1734inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141756_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1735reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)1757reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
1736{1758{
1737 return reverse_iterator<const _Ep*>(__il.begin());1759 return reverse_iterator<const _Ep*>(__il.begin());
1738}1760}
17391761
1740template <class _Cp>1762template <class _Cp>
1741inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX111763_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1742auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c))1764auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c))
1743{1765{
1744 return _VSTD::begin(__c);1766 return _VSTD::begin(__c);
1745}1767}
17461768
1747template <class _Cp>1769template <class _Cp>
1748inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX111770_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1749auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c))1771auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c))
1750{1772{
1751 return _VSTD::end(__c);1773 return _VSTD::end(__c);
1752}1774}
17531775
1754template <class _Cp>1776template <class _Cp>
1755inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141777_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1756auto rbegin(_Cp& __c) -> decltype(__c.rbegin())1778auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
1757{1779{
1758 return __c.rbegin();1780 return __c.rbegin();
1759}1781}
17601782
1761template <class _Cp>1783template <class _Cp>
1762inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141784_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1763auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())1785auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
1764{1786{
1765 return __c.rbegin();1787 return __c.rbegin();
1766}1788}
17671789
1768template <class _Cp>1790template <class _Cp>
1769inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141791_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1770auto rend(_Cp& __c) -> decltype(__c.rend())1792auto rend(_Cp& __c) -> decltype(__c.rend())
1771{1793{
1772 return __c.rend();1794 return __c.rend();
1773}1795}
17741796
1775template <class _Cp>1797template <class _Cp>
1776inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141798_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1777auto rend(const _Cp& __c) -> decltype(__c.rend())1799auto rend(const _Cp& __c) -> decltype(__c.rend())
1778{1800{
1779 return __c.rend();1801 return __c.rend();
1780}1802}
17811803
1782template <class _Cp>1804template <class _Cp>
1783inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141805_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1784auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))1806auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c))
1785{1807{
1786 return _VSTD::rbegin(__c);1808 return _VSTD::rbegin(__c);
1787}1809}
17881810
1789template <class _Cp>1811template <class _Cp>
1790inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX141812_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
1791auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))1813auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
1792{1814{
1793 return _VSTD::rend(__c);1815 return _VSTD::rend(__c);
...@@ -1799,7 +1821,7 @@ auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))...@@ -1799,7 +1821,7 @@ auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c))
1799#else // defined(_LIBCPP_CXX03_LANG)1821#else // defined(_LIBCPP_CXX03_LANG)
18001822
1801template <class _Cp>1823template <class _Cp>
1802inline _LIBCPP_INLINE_VISIBILITY1824_LIBCPP_INLINE_VISIBILITY
1803typename _Cp::iterator1825typename _Cp::iterator
1804begin(_Cp& __c)1826begin(_Cp& __c)
1805{1827{
...@@ -1807,7 +1829,7 @@ begin(_Cp& __c)...@@ -1807,7 +1829,7 @@ begin(_Cp& __c)
1807}1829}
18081830
1809template <class _Cp>1831template <class _Cp>
1810inline _LIBCPP_INLINE_VISIBILITY1832_LIBCPP_INLINE_VISIBILITY
1811typename _Cp::const_iterator1833typename _Cp::const_iterator
1812begin(const _Cp& __c)1834begin(const _Cp& __c)
1813{1835{
...@@ -1815,7 +1837,7 @@ begin(const _Cp& __c)...@@ -1815,7 +1837,7 @@ begin(const _Cp& __c)
1815}1837}
18161838
1817template <class _Cp>1839template <class _Cp>
1818inline _LIBCPP_INLINE_VISIBILITY1840_LIBCPP_INLINE_VISIBILITY
1819typename _Cp::iterator1841typename _Cp::iterator
1820end(_Cp& __c)1842end(_Cp& __c)
1821{1843{
...@@ -1823,7 +1845,7 @@ end(_Cp& __c)...@@ -1823,7 +1845,7 @@ end(_Cp& __c)
1823}1845}
18241846
1825template <class _Cp>1847template <class _Cp>
1826inline _LIBCPP_INLINE_VISIBILITY1848_LIBCPP_INLINE_VISIBILITY
1827typename _Cp::const_iterator1849typename _Cp::const_iterator
1828end(const _Cp& __c)1850end(const _Cp& __c)
1829{1851{
...@@ -1849,51 +1871,64 @@ end(const _Cp& __c)...@@ -1849,51 +1871,64 @@ end(const _Cp& __c)
1849// #endif1871// #endif
18501872
1851template <class _Cont>1873template <class _Cont>
1852inline _LIBCPP_INLINE_VISIBILITY1874_LIBCPP_INLINE_VISIBILITY
1853constexpr auto size(const _Cont& __c)1875constexpr auto size(const _Cont& __c)
1854_NOEXCEPT_(noexcept(__c.size()))1876_NOEXCEPT_(noexcept(__c.size()))
1855-> decltype (__c.size())1877-> decltype (__c.size())
1856{ return __c.size(); }1878{ return __c.size(); }
18571879
1858template <class _Tp, size_t _Sz>1880template <class _Tp, size_t _Sz>
1859inline _LIBCPP_INLINE_VISIBILITY1881_LIBCPP_INLINE_VISIBILITY
1860constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }1882constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
18611883
1884#if _LIBCPP_STD_VER > 17
1862template <class _Cont>1885template <class _Cont>
1863_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY1886_LIBCPP_INLINE_VISIBILITY
1887constexpr auto ssize(const _Cont& __c)
1888_NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
1889-> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>
1890{ return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size()); }
1891
1892template <class _Tp, ptrdiff_t _Sz>
1893_LIBCPP_INLINE_VISIBILITY
1894constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept { return _Sz; }
1895#endif
1896
1897template <class _Cont>
1898_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1864constexpr auto empty(const _Cont& __c)1899constexpr auto empty(const _Cont& __c)
1865_NOEXCEPT_(noexcept(__c.empty()))1900_NOEXCEPT_(noexcept(__c.empty()))
1866-> decltype (__c.empty())1901-> decltype (__c.empty())
1867{ return __c.empty(); }1902{ return __c.empty(); }
18681903
1869template <class _Tp, size_t _Sz>1904template <class _Tp, size_t _Sz>
1870_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY1905_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1871constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }1906constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
18721907
1873template <class _Ep>1908template <class _Ep>
1874_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY1909_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1875constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }1910constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
18761911
1877template <class _Cont> constexpr1912template <class _Cont> constexpr
1878inline _LIBCPP_INLINE_VISIBILITY1913_LIBCPP_INLINE_VISIBILITY
1879auto data(_Cont& __c)1914auto data(_Cont& __c)
1880_NOEXCEPT_(noexcept(__c.data()))1915_NOEXCEPT_(noexcept(__c.data()))
1881-> decltype (__c.data())1916-> decltype (__c.data())
1882{ return __c.data(); }1917{ return __c.data(); }
18831918
1884template <class _Cont> constexpr1919template <class _Cont> constexpr
1885inline _LIBCPP_INLINE_VISIBILITY1920_LIBCPP_INLINE_VISIBILITY
1886auto data(const _Cont& __c)1921auto data(const _Cont& __c)
1887_NOEXCEPT_(noexcept(__c.data()))1922_NOEXCEPT_(noexcept(__c.data()))
1888-> decltype (__c.data()) 1923-> decltype (__c.data())
1889{ return __c.data(); }1924{ return __c.data(); }
18901925
1891template <class _Tp, size_t _Sz>1926template <class _Tp, size_t _Sz>
1892inline _LIBCPP_INLINE_VISIBILITY1927_LIBCPP_INLINE_VISIBILITY
1893constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }1928constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
18941929
1895template <class _Ep>1930template <class _Ep>
1896inline _LIBCPP_INLINE_VISIBILITY1931_LIBCPP_INLINE_VISIBILITY
1897constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }1932constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
1898#endif1933#endif
18991934
lib/libcxx/include/limits+4-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- limits ----------------------------------===//2//===---------------------------- limits ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -410,7 +409,7 @@ protected:...@@ -410,7 +409,7 @@ protected:
410 static _LIBCPP_CONSTEXPR const bool is_exact = false;409 static _LIBCPP_CONSTEXPR const bool is_exact = false;
411 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;410 static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
412 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}411 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
413 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}412 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
414413
415 static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;414 static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
416 static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;415 static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
lib/libcxx/include/limits.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- limits.h ---------------------------------===//2//===--------------------------- limits.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/list+86-72
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- list ------------------------------------===//2//===---------------------------- list ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -130,11 +129,12 @@ public:...@@ -130,11 +129,12 @@ public:
130 void splice(const_iterator position, list&& x, const_iterator first,129 void splice(const_iterator position, list&& x, const_iterator first,
131 const_iterator last);130 const_iterator last);
132131
133 void remove(const value_type& value);132 size_type remove(const value_type& value); // void before C++20
134 template <class Pred> void remove_if(Pred pred);133 template <class Pred>
135 void unique();134 size_type remove_if(Pred pred); // void before C++20
135 size_type unique(); // void before C++20
136 template <class BinaryPredicate>136 template <class BinaryPredicate>
137 void unique(BinaryPredicate binary_pred);137 size_type unique(BinaryPredicate binary_pred); // void before C++20
138 void merge(list& x);138 void merge(list& x);
139 void merge(list&& x);139 void merge(list&& x);
140 template <class Compare>140 template <class Compare>
...@@ -648,9 +648,9 @@ protected:...@@ -648,9 +648,9 @@ protected:
648648
649 void swap(__list_imp& __c)649 void swap(__list_imp& __c)
650#if _LIBCPP_STD_VER >= 14650#if _LIBCPP_STD_VER >= 14
651 _NOEXCEPT_DEBUG;651 _NOEXCEPT;
652#else652#else
653 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||653 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
654 __is_nothrow_swappable<allocator_type>::value);654 __is_nothrow_swappable<allocator_type>::value);
655#endif655#endif
656656
...@@ -770,9 +770,9 @@ template <class _Tp, class _Alloc>...@@ -770,9 +770,9 @@ template <class _Tp, class _Alloc>
770void770void
771__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)771__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
772#if _LIBCPP_STD_VER >= 14772#if _LIBCPP_STD_VER >= 14
773 _NOEXCEPT_DEBUG773 _NOEXCEPT
774#else774#else
775 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||775 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
776 __is_nothrow_swappable<allocator_type>::value)776 __is_nothrow_swappable<allocator_type>::value)
777#endif777#endif
778{778{
...@@ -858,6 +858,11 @@ public:...@@ -858,6 +858,11 @@ public:
858 typedef typename base::const_iterator const_iterator;858 typedef typename base::const_iterator const_iterator;
859 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;859 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
860 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;860 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
861#if _LIBCPP_STD_VER > 17
862 typedef size_type __remove_return_type;
863#else
864 typedef void __remove_return_type;
865#endif
861866
862 _LIBCPP_INLINE_VISIBILITY867 _LIBCPP_INLINE_VISIBILITY
863 list()868 list()
...@@ -1039,9 +1044,9 @@ public:...@@ -1039,9 +1044,9 @@ public:
1039 _LIBCPP_INLINE_VISIBILITY1044 _LIBCPP_INLINE_VISIBILITY
1040 void swap(list& __c)1045 void swap(list& __c)
1041#if _LIBCPP_STD_VER >= 141046#if _LIBCPP_STD_VER >= 14
1042 _NOEXCEPT_DEBUG1047 _NOEXCEPT
1043#else1048#else
1044 _NOEXCEPT_DEBUG_(!__node_alloc_traits::propagate_on_container_swap::value ||1049 _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
1045 __is_nothrow_swappable<__node_allocator>::value)1050 __is_nothrow_swappable<__node_allocator>::value)
1046#endif1051#endif
1047 {base::swap(__c);}1052 {base::swap(__c);}
...@@ -1071,12 +1076,12 @@ public:...@@ -1071,12 +1076,12 @@ public:
1071 void splice(const_iterator __p, list& __c, const_iterator __i);1076 void splice(const_iterator __p, list& __c, const_iterator __i);
1072 void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);1077 void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
10731078
1074 void remove(const value_type& __x);1079 __remove_return_type remove(const value_type& __x);
1075 template <class _Pred> void remove_if(_Pred __pred);1080 template <class _Pred> __remove_return_type remove_if(_Pred __pred);
1076 _LIBCPP_INLINE_VISIBILITY1081 _LIBCPP_INLINE_VISIBILITY
1077 void unique();1082 __remove_return_type unique() { return unique(__equal_to<value_type>()); }
1078 template <class _BinaryPred>1083 template <class _BinaryPred>
1079 void unique(_BinaryPred __binary_pred);1084 __remove_return_type unique(_BinaryPred __binary_pred);
1080 _LIBCPP_INLINE_VISIBILITY1085 _LIBCPP_INLINE_VISIBILITY
1081 void merge(list& __c);1086 void merge(list& __c);
1082#ifndef _LIBCPP_CXX03_LANG1087#ifndef _LIBCPP_CXX03_LANG
...@@ -2014,22 +2019,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)...@@ -2014,22 +2019,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
2014 base::__sz() += __c.__sz();2019 base::__sz() += __c.__sz();
2015 __c.__sz() = 0;2020 __c.__sz() = 0;
2016#if _LIBCPP_DEBUG_LEVEL >= 22021#if _LIBCPP_DEBUG_LEVEL >= 2
2017 __libcpp_db* __db = __get_db();2022 if (&__c != this) {
2018 __c_node* __cn1 = __db->__find_c_and_lock(this);2023 __libcpp_db* __db = __get_db();
2019 __c_node* __cn2 = __db->__find_c(&__c);2024 __c_node* __cn1 = __db->__find_c_and_lock(this);
2020 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)2025 __c_node* __cn2 = __db->__find_c(&__c);
2021 {2026 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2022 --__ip;
2023 iterator* __i = static_cast<iterator*>((*__ip)->__i_);
2024 if (__i->__ptr_ != __c.__end_as_link())
2025 {2027 {
2026 __cn1->__add(*__ip);2028 --__ip;
2027 (*__ip)->__c_ = __cn1;2029 iterator* __i = static_cast<iterator*>((*__ip)->__i_);
2028 if (--__cn2->end_ != __ip)2030 if (__i->__ptr_ != __c.__end_as_link())
2029 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));2031 {
2032 __cn1->__add(*__ip);
2033 (*__ip)->__c_ = __cn1;
2034 if (--__cn2->end_ != __ip)
2035 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2036 }
2030 }2037 }
2038 __db->unlock();
2031 }2039 }
2032 __db->unlock();
2033#endif2040#endif
2034 }2041 }
2035}2042}
...@@ -2057,22 +2064,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)...@@ -2057,22 +2064,24 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
2057 --__c.__sz();2064 --__c.__sz();
2058 ++base::__sz();2065 ++base::__sz();
2059#if _LIBCPP_DEBUG_LEVEL >= 22066#if _LIBCPP_DEBUG_LEVEL >= 2
2060 __libcpp_db* __db = __get_db();2067 if (&__c != this) {
2061 __c_node* __cn1 = __db->__find_c_and_lock(this);2068 __libcpp_db* __db = __get_db();
2062 __c_node* __cn2 = __db->__find_c(&__c);2069 __c_node* __cn1 = __db->__find_c_and_lock(this);
2063 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)2070 __c_node* __cn2 = __db->__find_c(&__c);
2064 {2071 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2065 --__ip;
2066 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2067 if (__j->__ptr_ == __f)
2068 {2072 {
2069 __cn1->__add(*__ip);2073 --__ip;
2070 (*__ip)->__c_ = __cn1;2074 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2071 if (--__cn2->end_ != __ip)2075 if (__j->__ptr_ == __f)
2072 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));2076 {
2077 __cn1->__add(*__ip);
2078 (*__ip)->__c_ = __cn1;
2079 if (--__cn2->end_ != __ip)
2080 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2081 }
2073 }2082 }
2083 __db->unlock();
2074 }2084 }
2075 __db->unlock();
2076#endif2085#endif
2077 }2086 }
2078}2087}
...@@ -2111,32 +2120,34 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con...@@ -2111,32 +2120,34 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
2111 base::__unlink_nodes(__first, __last);2120 base::__unlink_nodes(__first, __last);
2112 __link_nodes(__p.__ptr_, __first, __last);2121 __link_nodes(__p.__ptr_, __first, __last);
2113#if _LIBCPP_DEBUG_LEVEL >= 22122#if _LIBCPP_DEBUG_LEVEL >= 2
2114 __libcpp_db* __db = __get_db();2123 if (&__c != this) {
2115 __c_node* __cn1 = __db->__find_c_and_lock(this);2124 __libcpp_db* __db = __get_db();
2116 __c_node* __cn2 = __db->__find_c(&__c);2125 __c_node* __cn1 = __db->__find_c_and_lock(this);
2117 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)2126 __c_node* __cn2 = __db->__find_c(&__c);
2118 {2127 for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
2119 --__ip;
2120 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2121 for (__link_pointer __k = __f.__ptr_;
2122 __k != __l.__ptr_; __k = __k->__next_)
2123 {2128 {
2124 if (__j->__ptr_ == __k)2129 --__ip;
2130 iterator* __j = static_cast<iterator*>((*__ip)->__i_);
2131 for (__link_pointer __k = __f.__ptr_;
2132 __k != __l.__ptr_; __k = __k->__next_)
2125 {2133 {
2126 __cn1->__add(*__ip);2134 if (__j->__ptr_ == __k)
2127 (*__ip)->__c_ = __cn1;2135 {
2128 if (--__cn2->end_ != __ip)2136 __cn1->__add(*__ip);
2129 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));2137 (*__ip)->__c_ = __cn1;
2138 if (--__cn2->end_ != __ip)
2139 memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
2140 }
2130 }2141 }
2131 }2142 }
2143 __db->unlock();
2132 }2144 }
2133 __db->unlock();
2134#endif2145#endif
2135 }2146 }
2136}2147}
21372148
2138template <class _Tp, class _Alloc>2149template <class _Tp, class _Alloc>
2139void2150typename list<_Tp, _Alloc>::__remove_return_type
2140list<_Tp, _Alloc>::remove(const value_type& __x)2151list<_Tp, _Alloc>::remove(const value_type& __x)
2141{2152{
2142 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing2153 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
...@@ -2155,13 +2166,16 @@ list<_Tp, _Alloc>::remove(const value_type& __x)...@@ -2155,13 +2166,16 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
2155 else2166 else
2156 ++__i;2167 ++__i;
2157 }2168 }
2169
2170 return (__remove_return_type) __deleted_nodes.size();
2158}2171}
21592172
2160template <class _Tp, class _Alloc>2173template <class _Tp, class _Alloc>
2161template <class _Pred>2174template <class _Pred>
2162void2175typename list<_Tp, _Alloc>::__remove_return_type
2163list<_Tp, _Alloc>::remove_if(_Pred __pred)2176list<_Tp, _Alloc>::remove_if(_Pred __pred)
2164{2177{
2178 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
2165 for (iterator __i = begin(), __e = end(); __i != __e;)2179 for (iterator __i = begin(), __e = end(); __i != __e;)
2166 {2180 {
2167 if (__pred(*__i))2181 if (__pred(*__i))
...@@ -2169,36 +2183,36 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)...@@ -2169,36 +2183,36 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
2169 iterator __j = _VSTD::next(__i);2183 iterator __j = _VSTD::next(__i);
2170 for (; __j != __e && __pred(*__j); ++__j)2184 for (; __j != __e && __pred(*__j); ++__j)
2171 ;2185 ;
2172 __i = erase(__i, __j);2186 __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
2187 __i = __j;
2173 if (__i != __e)2188 if (__i != __e)
2174 ++__i;2189 ++__i;
2175 }2190 }
2176 else2191 else
2177 ++__i;2192 ++__i;
2178 }2193 }
2179}
21802194
2181template <class _Tp, class _Alloc>2195 return (__remove_return_type) __deleted_nodes.size();
2182inline
2183void
2184list<_Tp, _Alloc>::unique()
2185{
2186 unique(__equal_to<value_type>());
2187}2196}
21882197
2189template <class _Tp, class _Alloc>2198template <class _Tp, class _Alloc>
2190template <class _BinaryPred>2199template <class _BinaryPred>
2191void2200typename list<_Tp, _Alloc>::__remove_return_type
2192list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)2201list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
2193{2202{
2203 list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing
2194 for (iterator __i = begin(), __e = end(); __i != __e;)2204 for (iterator __i = begin(), __e = end(); __i != __e;)
2195 {2205 {
2196 iterator __j = _VSTD::next(__i);2206 iterator __j = _VSTD::next(__i);
2197 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)2207 for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
2198 ;2208 ;
2199 if (++__i != __j)2209 if (++__i != __j) {
2200 __i = erase(__i, __j);2210 __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j);
2211 __i = __j;
2212 }
2201 }2213 }
2214
2215 return (__remove_return_type) __deleted_nodes.size();
2202}2216}
22032217
2204template <class _Tp, class _Alloc>2218template <class _Tp, class _Alloc>
lib/libcxx/include/locale+7-14
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- locale ------------------------------------===//2//===-------------------------- locale ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -127,7 +126,7 @@ public:...@@ -127,7 +126,7 @@ public:
127 wbuffer_convert(const wbuffer_convert&) = delete; // C++14126 wbuffer_convert(const wbuffer_convert&) = delete; // C++14
128 wbuffer_convert & operator=(const wbuffer_convert &) = delete; // C++14127 wbuffer_convert & operator=(const wbuffer_convert &) = delete; // C++14
129 ~wbuffer_convert(); // C++14128 ~wbuffer_convert(); // C++14
130 129
131 streambuf* rdbuf() const;130 streambuf* rdbuf() const;
132 streambuf* rdbuf(streambuf* bytebuf);131 streambuf* rdbuf(streambuf* bytebuf);
133132
...@@ -547,7 +546,7 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex...@@ -547,7 +546,7 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
547 __exp = 'P';546 __exp = 'P';
548 else if ((__x & 0x5F) == __exp)547 else if ((__x & 0x5F) == __exp)
549 {548 {
550 __exp |= 0x80;549 __exp |= (char) 0x80;
551 if (__in_units)550 if (__in_units)
552 {551 {
553 __in_units = false;552 __in_units = false;
...@@ -1373,10 +1372,6 @@ __pad_and_output(_OutputIterator __s,...@@ -1373,10 +1372,6 @@ __pad_and_output(_OutputIterator __s,
1373 return __s;1372 return __s;
1374}1373}
13751374
1376#if !defined(__APPLE__) || \
1377 (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
1378 (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
1379
1380template <class _CharT, class _Traits>1375template <class _CharT, class _Traits>
1381_LIBCPP_HIDDEN1376_LIBCPP_HIDDEN
1382ostreambuf_iterator<_CharT, _Traits>1377ostreambuf_iterator<_CharT, _Traits>
...@@ -1423,8 +1418,6 @@ __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,...@@ -1423,8 +1418,6 @@ __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
1423 return __s;1418 return __s;
1424}1419}
14251420
1426#endif
1427
1428template <class _CharT, class _OutputIterator>1421template <class _CharT, class _OutputIterator>
1429_OutputIterator1422_OutputIterator
1430num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,1423num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
...@@ -3930,7 +3923,7 @@ private:...@@ -3930,7 +3923,7 @@ private:
3930 wbuffer_convert(const wbuffer_convert&);3923 wbuffer_convert(const wbuffer_convert&);
3931 wbuffer_convert& operator=(const wbuffer_convert&);3924 wbuffer_convert& operator=(const wbuffer_convert&);
3932public:3925public:
3933 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0, 3926 _LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
3934 _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());3927 _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
3935 ~wbuffer_convert();3928 ~wbuffer_convert();
39363929
...@@ -4045,7 +4038,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()...@@ -4045,7 +4038,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
4045 this->egptr(), __inext);4038 this->egptr(), __inext);
4046 if (__r == codecvt_base::noconv)4039 if (__r == codecvt_base::noconv)
4047 {4040 {
4048 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, 4041 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
4049 (char_type*) const_cast<char *>(__extbufend_));4042 (char_type*) const_cast<char *>(__extbufend_));
4050 __c = *this->gptr();4043 __c = *this->gptr();
4051 }4044 }
lib/libcxx/include/locale.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- locale.h --------------------------------===//2//===---------------------------- locale.h --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/map+86-18
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- map ------------------------------------===//2//===----------------------------- map ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -194,8 +193,8 @@ public:...@@ -194,8 +193,8 @@ public:
194 const_iterator find(const K& x) const; // C++14193 const_iterator find(const K& x) const; // C++14
195 template<typename K>194 template<typename K>
196 size_type count(const K& x) const; // C++14195 size_type count(const K& x) const; // C++14
197
198 size_type count(const key_type& k) const;196 size_type count(const key_type& k) const;
197 bool contains(const key_type& x) const; // C++20
199 iterator lower_bound(const key_type& k);198 iterator lower_bound(const key_type& k);
200 const_iterator lower_bound(const key_type& k) const;199 const_iterator lower_bound(const key_type& k) const;
201 template<typename K>200 template<typename K>
...@@ -408,8 +407,8 @@ public:...@@ -408,8 +407,8 @@ public:
408 const_iterator find(const K& x) const; // C++14407 const_iterator find(const K& x) const; // C++14
409 template<typename K>408 template<typename K>
410 size_type count(const K& x) const; // C++14409 size_type count(const K& x) const; // C++14
411
412 size_type count(const key_type& k) const;410 size_type count(const key_type& k) const;
411 bool contains(const key_type& x) const; // C++20
413 iterator lower_bound(const key_type& k);412 iterator lower_bound(const key_type& k);
414 const_iterator lower_bound(const key_type& k) const;413 const_iterator lower_bound(const key_type& k) const;
415 template<typename K>414 template<typename K>
...@@ -903,12 +902,11 @@ public:...@@ -903,12 +902,11 @@ public:
903 typedef _Key key_type;902 typedef _Key key_type;
904 typedef _Tp mapped_type;903 typedef _Tp mapped_type;
905 typedef pair<const key_type, mapped_type> value_type;904 typedef pair<const key_type, mapped_type> value_type;
906 typedef _Compare key_compare;905 typedef typename __identity<_Compare>::type key_compare;
907 typedef _Allocator allocator_type;906 typedef typename __identity<_Allocator>::type allocator_type;
908 typedef value_type& reference;907 typedef value_type& reference;
909 typedef const value_type& const_reference;908 typedef const value_type& const_reference;
910909
911 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
912 static_assert((is_same<typename allocator_type::value_type, value_type>::value),910 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
913 "Allocator::value_type must be same type as value_type");911 "Allocator::value_type must be same type as value_type");
914912
...@@ -1086,6 +1084,11 @@ public:...@@ -1086,6 +1084,11 @@ public:
1086 insert(__m.begin(), __m.end());1084 insert(__m.begin(), __m.end());
1087 }1085 }
10881086
1087 _LIBCPP_INLINE_VISIBILITY
1088 ~map() {
1089 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1090 }
1091
1089 _LIBCPP_INLINE_VISIBILITY1092 _LIBCPP_INLINE_VISIBILITY
1090 iterator begin() _NOEXCEPT {return __tree_.begin();}1093 iterator begin() _NOEXCEPT {return __tree_.begin();}
1091 _LIBCPP_INLINE_VISIBILITY1094 _LIBCPP_INLINE_VISIBILITY
...@@ -1395,6 +1398,12 @@ public:...@@ -1395,6 +1398,12 @@ public:
1395 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type1398 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
1396 count(const _K2& __k) const {return __tree_.__count_multi(__k);}1399 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
1397#endif1400#endif
1401
1402#if _LIBCPP_STD_VER > 17
1403 _LIBCPP_INLINE_VISIBILITY
1404 bool contains(const key_type& __k) const {return find(__k) != end();}
1405#endif // _LIBCPP_STD_VER > 17
1406
1398 _LIBCPP_INLINE_VISIBILITY1407 _LIBCPP_INLINE_VISIBILITY
1399 iterator lower_bound(const key_type& __k)1408 iterator lower_bound(const key_type& __k)
1400 {return __tree_.lower_bound(__k);}1409 {return __tree_.lower_bound(__k);}
...@@ -1462,6 +1471,32 @@ private:...@@ -1462,6 +1471,32 @@ private:
1462#endif1471#endif
1463};1472};
14641473
1474#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1475template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
1476 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1477 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1478 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1479map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1480 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
1481
1482template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
1483 class _Allocator = allocator<pair<const _Key, _Tp>>,
1484 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
1485 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1486map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
1487 -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
1488
1489template<class _InputIterator, class _Allocator,
1490 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1491map(_InputIterator, _InputIterator, _Allocator)
1492 -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1493 less<__iter_key_type<_InputIterator>>, _Allocator>;
1494
1495template<class _Key, class _Tp, class _Allocator,
1496 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
1497map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1498 -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
1499#endif
14651500
1466#ifndef _LIBCPP_CXX03_LANG1501#ifndef _LIBCPP_CXX03_LANG
1467template <class _Key, class _Tp, class _Compare, class _Allocator>1502template <class _Key, class _Tp, class _Compare, class _Allocator>
...@@ -1536,10 +1571,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)...@@ -1536,10 +1571,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
1536{1571{
1537 __parent_pointer __parent;1572 __parent_pointer __parent;
1538 __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);1573 __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1539#ifndef _LIBCPP_NO_EXCEPTIONS
1540 if (__child == nullptr)1574 if (__child == nullptr)
1541 throw out_of_range("map::at: key not found");1575 __throw_out_of_range("map::at: key not found");
1542#endif // _LIBCPP_NO_EXCEPTIONS
1543 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;1576 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
1544}1577}
15451578
...@@ -1549,10 +1582,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const...@@ -1549,10 +1582,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
1549{1582{
1550 __parent_pointer __parent;1583 __parent_pointer __parent;
1551 __node_base_pointer __child = __tree_.__find_equal(__parent, __k);1584 __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
1552#ifndef _LIBCPP_NO_EXCEPTIONS
1553 if (__child == nullptr)1585 if (__child == nullptr)
1554 throw out_of_range("map::at: key not found");1586 __throw_out_of_range("map::at: key not found");
1555#endif // _LIBCPP_NO_EXCEPTIONS
1556 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;1587 return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
1557}1588}
15581589
...@@ -1638,12 +1669,11 @@ public:...@@ -1638,12 +1669,11 @@ public:
1638 typedef _Key key_type;1669 typedef _Key key_type;
1639 typedef _Tp mapped_type;1670 typedef _Tp mapped_type;
1640 typedef pair<const key_type, mapped_type> value_type;1671 typedef pair<const key_type, mapped_type> value_type;
1641 typedef _Compare key_compare;1672 typedef typename __identity<_Compare>::type key_compare;
1642 typedef _Allocator allocator_type;1673 typedef typename __identity<_Allocator>::type allocator_type;
1643 typedef value_type& reference;1674 typedef value_type& reference;
1644 typedef const value_type& const_reference;1675 typedef const value_type& const_reference;
16451676
1646 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1647 static_assert((is_same<typename allocator_type::value_type, value_type>::value),1677 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
1648 "Allocator::value_type must be same type as value_type");1678 "Allocator::value_type must be same type as value_type");
16491679
...@@ -1822,6 +1852,11 @@ public:...@@ -1822,6 +1852,11 @@ public:
1822 insert(__m.begin(), __m.end());1852 insert(__m.begin(), __m.end());
1823 }1853 }
18241854
1855 _LIBCPP_INLINE_VISIBILITY
1856 ~multimap() {
1857 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1858 }
1859
1825 _LIBCPP_INLINE_VISIBILITY1860 _LIBCPP_INLINE_VISIBILITY
1826 iterator begin() _NOEXCEPT {return __tree_.begin();}1861 iterator begin() _NOEXCEPT {return __tree_.begin();}
1827 _LIBCPP_INLINE_VISIBILITY1862 _LIBCPP_INLINE_VISIBILITY
...@@ -2026,6 +2061,12 @@ public:...@@ -2026,6 +2061,12 @@ public:
2026 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type2061 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
2027 count(const _K2& __k) const {return __tree_.__count_multi(__k);}2062 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
2028#endif2063#endif
2064
2065#if _LIBCPP_STD_VER > 17
2066 _LIBCPP_INLINE_VISIBILITY
2067 bool contains(const key_type& __k) const {return find(__k) != end();}
2068#endif // _LIBCPP_STD_VER > 17
2069
2029 _LIBCPP_INLINE_VISIBILITY2070 _LIBCPP_INLINE_VISIBILITY
2030 iterator lower_bound(const key_type& __k)2071 iterator lower_bound(const key_type& __k)
2031 {return __tree_.lower_bound(__k);}2072 {return __tree_.lower_bound(__k);}
...@@ -2087,6 +2128,33 @@ private:...@@ -2087,6 +2128,33 @@ private:
2087 typedef unique_ptr<__node, _Dp> __node_holder;2128 typedef unique_ptr<__node, _Dp> __node_holder;
2088};2129};
20892130
2131#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2132template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
2133 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2134 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2135 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2136multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
2137 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
2138
2139template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
2140 class _Allocator = allocator<pair<const _Key, _Tp>>,
2141 class = enable_if_t<!__is_allocator<_Compare>::value, void>,
2142 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2143multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
2144 -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
2145
2146template<class _InputIterator, class _Allocator,
2147 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2148multimap(_InputIterator, _InputIterator, _Allocator)
2149 -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2150 less<__iter_key_type<_InputIterator>>, _Allocator>;
2151
2152template<class _Key, class _Tp, class _Allocator,
2153 class = enable_if_t<__is_allocator<_Allocator>::value, void>>
2154multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2155 -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
2156#endif
2157
2090#ifndef _LIBCPP_CXX03_LANG2158#ifndef _LIBCPP_CXX03_LANG
2091template <class _Key, class _Tp, class _Compare, class _Allocator>2159template <class _Key, class _Tp, class _Compare, class _Allocator>
2092multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)2160multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
lib/libcxx/include/math.h+93-50
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//2//===---------------------------- math.h ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -298,6 +297,9 @@ long double truncl(long double x);...@@ -298,6 +297,9 @@ long double truncl(long double x);
298#pragma GCC system_header297#pragma GCC system_header
299#endif298#endif
300299
300#define _LIBCPP_STDLIB_INCLUDE_NEXT
301#include <stdlib.h>
302
301#include_next <math.h>303#include_next <math.h>
302304
303#ifdef __cplusplus305#ifdef __cplusplus
...@@ -755,20 +757,61 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT...@@ -755,20 +757,61 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
755757
756// abs758// abs
757759
760#undef abs
761#undef labs
762#ifndef _LIBCPP_HAS_NO_LONG_LONG
763#undef llabs
764#endif
765
766// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
767#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
768inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
769 return ::labs(__x);
770}
771#ifndef _LIBCPP_HAS_NO_LONG_LONG
772inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
773 return ::llabs(__x);
774}
775#endif // _LIBCPP_HAS_NO_LONG_LONG
776#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
777
778
758#if !(defined(_AIX) || defined(__sun__))779#if !(defined(_AIX) || defined(__sun__))
759inline _LIBCPP_INLINE_VISIBILITY780inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
760float781 return ::fabsf(__lcpp_x);
761abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}782}
762783
763inline _LIBCPP_INLINE_VISIBILITY784inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
764double785 return ::fabs(__lcpp_x);
765abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}786}
766787
767inline _LIBCPP_INLINE_VISIBILITY788inline _LIBCPP_INLINE_VISIBILITY long double
768long double789abs(long double __lcpp_x) _NOEXCEPT {
769abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}790 return ::fabsl(__lcpp_x);
791}
770#endif // !(defined(_AIX) || defined(__sun__))792#endif // !(defined(_AIX) || defined(__sun__))
771793
794// div
795
796#undef div
797#undef ldiv
798#ifndef _LIBCPP_HAS_NO_LONG_LONG
799#undef lldiv
800#endif
801
802// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
803#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
804inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
805 return ::ldiv(__x, __y);
806}
807#ifndef _LIBCPP_HAS_NO_LONG_LONG
808inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
809 long long __y) _NOEXCEPT {
810 return ::lldiv(__x, __y);
811}
812#endif // _LIBCPP_HAS_NO_LONG_LONG
813#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
814
772// acos815// acos
773816
774#if !(defined(_AIX) || defined(__sun__))817#if !(defined(_AIX) || defined(__sun__))
...@@ -814,7 +857,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long do...@@ -814,7 +857,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long do
814857
815template <class _A1, class _A2>858template <class _A1, class _A2>
816inline _LIBCPP_INLINE_VISIBILITY859inline _LIBCPP_INLINE_VISIBILITY
817typename std::__lazy_enable_if860typename std::_EnableIf
818<861<
819 std::is_arithmetic<_A1>::value &&862 std::is_arithmetic<_A1>::value &&
820 std::is_arithmetic<_A2>::value,863 std::is_arithmetic<_A2>::value,
...@@ -823,8 +866,8 @@ typename std::__lazy_enable_if...@@ -823,8 +866,8 @@ typename std::__lazy_enable_if
823atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT866atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
824{867{
825 typedef typename std::__promote<_A1, _A2>::type __result_type;868 typedef typename std::__promote<_A1, _A2>::type __result_type;
826 static_assert((!(std::is_same<_A1, __result_type>::value &&869 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
827 std::is_same<_A2, __result_type>::value)), "");870 std::_IsSame<_A2, __result_type>::value)), "");
828 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);871 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
829}872}
830873
...@@ -909,7 +952,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long dou...@@ -909,7 +952,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long dou
909952
910template <class _A1, class _A2>953template <class _A1, class _A2>
911inline _LIBCPP_INLINE_VISIBILITY954inline _LIBCPP_INLINE_VISIBILITY
912typename std::__lazy_enable_if955typename std::_EnableIf
913<956<
914 std::is_arithmetic<_A1>::value &&957 std::is_arithmetic<_A1>::value &&
915 std::is_arithmetic<_A2>::value,958 std::is_arithmetic<_A2>::value,
...@@ -918,8 +961,8 @@ typename std::__lazy_enable_if...@@ -918,8 +961,8 @@ typename std::__lazy_enable_if
918fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT961fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
919{962{
920 typedef typename std::__promote<_A1, _A2>::type __result_type;963 typedef typename std::__promote<_A1, _A2>::type __result_type;
921 static_assert((!(std::is_same<_A1, __result_type>::value &&964 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
922 std::is_same<_A2, __result_type>::value)), "");965 std::_IsSame<_A2, __result_type>::value)), "");
923 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);966 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
924}967}
925968
...@@ -987,7 +1030,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long doub...@@ -987,7 +1030,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long doub
9871030
988template <class _A1, class _A2>1031template <class _A1, class _A2>
989inline _LIBCPP_INLINE_VISIBILITY1032inline _LIBCPP_INLINE_VISIBILITY
990typename std::__lazy_enable_if1033typename std::_EnableIf
991<1034<
992 std::is_arithmetic<_A1>::value &&1035 std::is_arithmetic<_A1>::value &&
993 std::is_arithmetic<_A2>::value,1036 std::is_arithmetic<_A2>::value,
...@@ -996,8 +1039,8 @@ typename std::__lazy_enable_if...@@ -996,8 +1039,8 @@ typename std::__lazy_enable_if
996pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1039pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
997{1040{
998 typedef typename std::__promote<_A1, _A2>::type __result_type;1041 typedef typename std::__promote<_A1, _A2>::type __result_type;
999 static_assert((!(std::is_same<_A1, __result_type>::value &&1042 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1000 std::is_same<_A2, __result_type>::value)), "");1043 std::_IsSame<_A2, __result_type>::value)), "");
1001 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);1044 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1002}1045}
10031046
...@@ -1114,7 +1157,7 @@ copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {...@@ -1114,7 +1157,7 @@ copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
11141157
1115template <class _A1, class _A2>1158template <class _A1, class _A2>
1116inline _LIBCPP_INLINE_VISIBILITY1159inline _LIBCPP_INLINE_VISIBILITY
1117typename std::__lazy_enable_if1160typename std::_EnableIf
1118<1161<
1119 std::is_arithmetic<_A1>::value &&1162 std::is_arithmetic<_A1>::value &&
1120 std::is_arithmetic<_A2>::value,1163 std::is_arithmetic<_A2>::value,
...@@ -1123,8 +1166,8 @@ typename std::__lazy_enable_if...@@ -1123,8 +1166,8 @@ typename std::__lazy_enable_if
1123copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1166copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1124{1167{
1125 typedef typename std::__promote<_A1, _A2>::type __result_type;1168 typedef typename std::__promote<_A1, _A2>::type __result_type;
1126 static_assert((!(std::is_same<_A1, __result_type>::value &&1169 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1127 std::is_same<_A2, __result_type>::value)), "");1170 std::_IsSame<_A2, __result_type>::value)), "");
1128 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);1171 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1129}1172}
11301173
...@@ -1175,7 +1218,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long dou...@@ -1175,7 +1218,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long dou
11751218
1176template <class _A1, class _A2>1219template <class _A1, class _A2>
1177inline _LIBCPP_INLINE_VISIBILITY1220inline _LIBCPP_INLINE_VISIBILITY
1178typename std::__lazy_enable_if1221typename std::_EnableIf
1179<1222<
1180 std::is_arithmetic<_A1>::value &&1223 std::is_arithmetic<_A1>::value &&
1181 std::is_arithmetic<_A2>::value,1224 std::is_arithmetic<_A2>::value,
...@@ -1184,8 +1227,8 @@ typename std::__lazy_enable_if...@@ -1184,8 +1227,8 @@ typename std::__lazy_enable_if
1184fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1227fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1185{1228{
1186 typedef typename std::__promote<_A1, _A2>::type __result_type;1229 typedef typename std::__promote<_A1, _A2>::type __result_type;
1187 static_assert((!(std::is_same<_A1, __result_type>::value &&1230 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1188 std::is_same<_A2, __result_type>::value)), "");1231 std::_IsSame<_A2, __result_type>::value)), "");
1189 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);1232 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1190}1233}
11911234
...@@ -1196,7 +1239,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long doub...@@ -1196,7 +1239,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long doub
11961239
1197template <class _A1, class _A2, class _A3>1240template <class _A1, class _A2, class _A3>
1198inline _LIBCPP_INLINE_VISIBILITY1241inline _LIBCPP_INLINE_VISIBILITY
1199typename std::__lazy_enable_if1242typename std::_EnableIf
1200<1243<
1201 std::is_arithmetic<_A1>::value &&1244 std::is_arithmetic<_A1>::value &&
1202 std::is_arithmetic<_A2>::value &&1245 std::is_arithmetic<_A2>::value &&
...@@ -1206,9 +1249,9 @@ typename std::__lazy_enable_if...@@ -1206,9 +1249,9 @@ typename std::__lazy_enable_if
1206fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT1249fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1207{1250{
1208 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;1251 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1209 static_assert((!(std::is_same<_A1, __result_type>::value &&1252 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1210 std::is_same<_A2, __result_type>::value &&1253 std::_IsSame<_A2, __result_type>::value &&
1211 std::is_same<_A3, __result_type>::value)), "");1254 std::_IsSame<_A3, __result_type>::value)), "");
1212 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);1255 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1213}1256}
12141257
...@@ -1219,7 +1262,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long dou...@@ -1219,7 +1262,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long dou
12191262
1220template <class _A1, class _A2>1263template <class _A1, class _A2>
1221inline _LIBCPP_INLINE_VISIBILITY1264inline _LIBCPP_INLINE_VISIBILITY
1222typename std::__lazy_enable_if1265typename std::_EnableIf
1223<1266<
1224 std::is_arithmetic<_A1>::value &&1267 std::is_arithmetic<_A1>::value &&
1225 std::is_arithmetic<_A2>::value,1268 std::is_arithmetic<_A2>::value,
...@@ -1228,8 +1271,8 @@ typename std::__lazy_enable_if...@@ -1228,8 +1271,8 @@ typename std::__lazy_enable_if
1228fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1271fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1229{1272{
1230 typedef typename std::__promote<_A1, _A2>::type __result_type;1273 typedef typename std::__promote<_A1, _A2>::type __result_type;
1231 static_assert((!(std::is_same<_A1, __result_type>::value &&1274 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1232 std::is_same<_A2, __result_type>::value)), "");1275 std::_IsSame<_A2, __result_type>::value)), "");
1233 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);1276 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1234}1277}
12351278
...@@ -1240,7 +1283,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long dou...@@ -1240,7 +1283,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long dou
12401283
1241template <class _A1, class _A2>1284template <class _A1, class _A2>
1242inline _LIBCPP_INLINE_VISIBILITY1285inline _LIBCPP_INLINE_VISIBILITY
1243typename std::__lazy_enable_if1286typename std::_EnableIf
1244<1287<
1245 std::is_arithmetic<_A1>::value &&1288 std::is_arithmetic<_A1>::value &&
1246 std::is_arithmetic<_A2>::value,1289 std::is_arithmetic<_A2>::value,
...@@ -1249,8 +1292,8 @@ typename std::__lazy_enable_if...@@ -1249,8 +1292,8 @@ typename std::__lazy_enable_if
1249fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1292fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1250{1293{
1251 typedef typename std::__promote<_A1, _A2>::type __result_type;1294 typedef typename std::__promote<_A1, _A2>::type __result_type;
1252 static_assert((!(std::is_same<_A1, __result_type>::value &&1295 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1253 std::is_same<_A2, __result_type>::value)), "");1296 std::_IsSame<_A2, __result_type>::value)), "");
1254 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);1297 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1255}1298}
12561299
...@@ -1261,7 +1304,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long do...@@ -1261,7 +1304,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long do
12611304
1262template <class _A1, class _A2>1305template <class _A1, class _A2>
1263inline _LIBCPP_INLINE_VISIBILITY1306inline _LIBCPP_INLINE_VISIBILITY
1264typename std::__lazy_enable_if1307typename std::_EnableIf
1265<1308<
1266 std::is_arithmetic<_A1>::value &&1309 std::is_arithmetic<_A1>::value &&
1267 std::is_arithmetic<_A2>::value,1310 std::is_arithmetic<_A2>::value,
...@@ -1270,8 +1313,8 @@ typename std::__lazy_enable_if...@@ -1270,8 +1313,8 @@ typename std::__lazy_enable_if
1270hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1313hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1271{1314{
1272 typedef typename std::__promote<_A1, _A2>::type __result_type;1315 typedef typename std::__promote<_A1, _A2>::type __result_type;
1273 static_assert((!(std::is_same<_A1, __result_type>::value &&1316 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1274 std::is_same<_A2, __result_type>::value)), "");1317 std::_IsSame<_A2, __result_type>::value)), "");
1275 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);1318 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1276}1319}
12771320
...@@ -1384,7 +1427,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, lon...@@ -1384,7 +1427,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, lon
13841427
1385template <class _A1, class _A2>1428template <class _A1, class _A2>
1386inline _LIBCPP_INLINE_VISIBILITY1429inline _LIBCPP_INLINE_VISIBILITY
1387typename std::__lazy_enable_if1430typename std::_EnableIf
1388<1431<
1389 std::is_arithmetic<_A1>::value &&1432 std::is_arithmetic<_A1>::value &&
1390 std::is_arithmetic<_A2>::value,1433 std::is_arithmetic<_A2>::value,
...@@ -1393,8 +1436,8 @@ typename std::__lazy_enable_if...@@ -1393,8 +1436,8 @@ typename std::__lazy_enable_if
1393nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1436nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1394{1437{
1395 typedef typename std::__promote<_A1, _A2>::type __result_type;1438 typedef typename std::__promote<_A1, _A2>::type __result_type;
1396 static_assert((!(std::is_same<_A1, __result_type>::value &&1439 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1397 std::is_same<_A2, __result_type>::value)), "");1440 std::_IsSame<_A2, __result_type>::value)), "");
1398 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);1441 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1399}1442}
14001443
...@@ -1415,7 +1458,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, lon...@@ -1415,7 +1458,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, lon
14151458
1416template <class _A1, class _A2>1459template <class _A1, class _A2>
1417inline _LIBCPP_INLINE_VISIBILITY1460inline _LIBCPP_INLINE_VISIBILITY
1418typename std::__lazy_enable_if1461typename std::_EnableIf
1419<1462<
1420 std::is_arithmetic<_A1>::value &&1463 std::is_arithmetic<_A1>::value &&
1421 std::is_arithmetic<_A2>::value,1464 std::is_arithmetic<_A2>::value,
...@@ -1424,8 +1467,8 @@ typename std::__lazy_enable_if...@@ -1424,8 +1467,8 @@ typename std::__lazy_enable_if
1424remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT1467remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1425{1468{
1426 typedef typename std::__promote<_A1, _A2>::type __result_type;1469 typedef typename std::__promote<_A1, _A2>::type __result_type;
1427 static_assert((!(std::is_same<_A1, __result_type>::value &&1470 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1428 std::is_same<_A2, __result_type>::value)), "");1471 std::_IsSame<_A2, __result_type>::value)), "");
1429 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);1472 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1430}1473}
14311474
...@@ -1436,7 +1479,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long d...@@ -1436,7 +1479,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long d
14361479
1437template <class _A1, class _A2>1480template <class _A1, class _A2>
1438inline _LIBCPP_INLINE_VISIBILITY1481inline _LIBCPP_INLINE_VISIBILITY
1439typename std::__lazy_enable_if1482typename std::_EnableIf
1440<1483<
1441 std::is_arithmetic<_A1>::value &&1484 std::is_arithmetic<_A1>::value &&
1442 std::is_arithmetic<_A2>::value,1485 std::is_arithmetic<_A2>::value,
...@@ -1445,8 +1488,8 @@ typename std::__lazy_enable_if...@@ -1445,8 +1488,8 @@ typename std::__lazy_enable_if
1445remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT1488remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1446{1489{
1447 typedef typename std::__promote<_A1, _A2>::type __result_type;1490 typedef typename std::__promote<_A1, _A2>::type __result_type;
1448 static_assert((!(std::is_same<_A1, __result_type>::value &&1491 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1449 std::is_same<_A2, __result_type>::value)), "");1492 std::_IsSame<_A2, __result_type>::value)), "");
1450 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);1493 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
1451}1494}
14521495
lib/libcxx/include/memory+160-243
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- memory ------------------------------------===//2//===-------------------------- memory ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -549,7 +548,7 @@ template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;...@@ -549,7 +548,7 @@ template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
549template<class T> struct owner_less;548template<class T> struct owner_less;
550549
551template<class T>550template<class T>
552struct owner_less<shared_ptr<T>>551struct owner_less<shared_ptr<T> >
553 : binary_function<shared_ptr<T>, shared_ptr<T>, bool>552 : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
554{553{
555 typedef bool result_type;554 typedef bool result_type;
...@@ -559,7 +558,7 @@ struct owner_less<shared_ptr<T>>...@@ -559,7 +558,7 @@ struct owner_less<shared_ptr<T>>
559};558};
560559
561template<class T>560template<class T>
562struct owner_less<weak_ptr<T>>561struct owner_less<weak_ptr<T> >
563 : binary_function<weak_ptr<T>, weak_ptr<T>, bool>562 : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
564{563{
565 typedef bool result_type;564 typedef bool result_type;
...@@ -684,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -684,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY
684_ValueType __libcpp_relaxed_load(_ValueType const* __value) {683_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
685#if !defined(_LIBCPP_HAS_NO_THREADS) && \684#if !defined(_LIBCPP_HAS_NO_THREADS) && \
686 defined(__ATOMIC_RELAXED) && \685 defined(__ATOMIC_RELAXED) && \
687 (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)686 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
688 return __atomic_load_n(__value, __ATOMIC_RELAXED);687 return __atomic_load_n(__value, __ATOMIC_RELAXED);
689#else688#else
690 return *__value;689 return *__value;
...@@ -696,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -696,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY
696_ValueType __libcpp_acquire_load(_ValueType const* __value) {695_ValueType __libcpp_acquire_load(_ValueType const* __value) {
697#if !defined(_LIBCPP_HAS_NO_THREADS) && \696#if !defined(_LIBCPP_HAS_NO_THREADS) && \
698 defined(__ATOMIC_ACQUIRE) && \697 defined(__ATOMIC_ACQUIRE) && \
699 (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)698 (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
700 return __atomic_load_n(__value, __ATOMIC_ACQUIRE);699 return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
701#else700#else
702 return *__value;701 return *__value;
...@@ -744,7 +743,7 @@ struct __pointer_traits_element_type;...@@ -744,7 +743,7 @@ struct __pointer_traits_element_type;
744template <class _Ptr>743template <class _Ptr>
745struct __pointer_traits_element_type<_Ptr, true>744struct __pointer_traits_element_type<_Ptr, true>
746{745{
747 typedef typename _Ptr::element_type type;746 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
748};747};
749748
750#ifndef _LIBCPP_HAS_NO_VARIADICS749#ifndef _LIBCPP_HAS_NO_VARIADICS
...@@ -752,13 +751,13 @@ struct __pointer_traits_element_type<_Ptr, true>...@@ -752,13 +751,13 @@ struct __pointer_traits_element_type<_Ptr, true>
752template <template <class, class...> class _Sp, class _Tp, class ..._Args>751template <template <class, class...> class _Sp, class _Tp, class ..._Args>
753struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>752struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
754{753{
755 typedef typename _Sp<_Tp, _Args...>::element_type type;754 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
756};755};
757756
758template <template <class, class...> class _Sp, class _Tp, class ..._Args>757template <template <class, class...> class _Sp, class _Tp, class ..._Args>
759struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>758struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
760{759{
761 typedef _Tp type;760 typedef _LIBCPP_NODEBUG_TYPE _Tp type;
762};761};
763762
764#else // _LIBCPP_HAS_NO_VARIADICS763#else // _LIBCPP_HAS_NO_VARIADICS
...@@ -825,13 +824,13 @@ struct __has_difference_type<_Tp,...@@ -825,13 +824,13 @@ struct __has_difference_type<_Tp,
825template <class _Ptr, bool = __has_difference_type<_Ptr>::value>824template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
826struct __pointer_traits_difference_type825struct __pointer_traits_difference_type
827{826{
828 typedef ptrdiff_t type;827 typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
829};828};
830829
831template <class _Ptr>830template <class _Ptr>
832struct __pointer_traits_difference_type<_Ptr, true>831struct __pointer_traits_difference_type<_Ptr, true>
833{832{
834 typedef typename _Ptr::difference_type type;833 typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
835};834};
836835
837template <class _Tp, class _Up>836template <class _Tp, class _Up>
...@@ -849,9 +848,9 @@ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>...@@ -849,9 +848,9 @@ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
849struct __pointer_traits_rebind848struct __pointer_traits_rebind
850{849{
851#ifndef _LIBCPP_CXX03_LANG850#ifndef _LIBCPP_CXX03_LANG
852 typedef typename _Tp::template rebind<_Up> type;851 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
853#else852#else
854 typedef typename _Tp::template rebind<_Up>::other type;853 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
855#endif854#endif
856};855};
857856
...@@ -861,9 +860,9 @@ template <template <class, class...> class _Sp, class _Tp, class ..._Args, class...@@ -861,9 +860,9 @@ template <template <class, class...> class _Sp, class _Tp, class ..._Args, class
861struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>860struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
862{861{
863#ifndef _LIBCPP_CXX03_LANG862#ifndef _LIBCPP_CXX03_LANG
864 typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type;863 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
865#else864#else
866 typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;865 typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
867#endif866#endif
868};867};
869868
...@@ -1014,13 +1013,13 @@ namespace __pointer_type_imp...@@ -1014,13 +1013,13 @@ namespace __pointer_type_imp
1014template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>1013template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
1015struct __pointer_type1014struct __pointer_type
1016{1015{
1017 typedef typename _Dp::pointer type;1016 typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
1018};1017};
10191018
1020template <class _Tp, class _Dp>1019template <class _Tp, class _Dp>
1021struct __pointer_type<_Tp, _Dp, false>1020struct __pointer_type<_Tp, _Dp, false>
1022{1021{
1023 typedef _Tp* type;1022 typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
1024};1023};
10251024
1026} // __pointer_type_imp1025} // __pointer_type_imp
...@@ -1028,7 +1027,7 @@ struct __pointer_type<_Tp, _Dp, false>...@@ -1028,7 +1027,7 @@ struct __pointer_type<_Tp, _Dp, false>
1028template <class _Tp, class _Dp>1027template <class _Tp, class _Dp>
1029struct __pointer_type1028struct __pointer_type
1030{1029{
1031 typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;1030 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
1032};1031};
10331032
1034template <class _Tp, class = void>1033template <class _Tp, class = void>
...@@ -1041,14 +1040,14 @@ struct __has_const_pointer<_Tp,...@@ -1041,14 +1040,14 @@ struct __has_const_pointer<_Tp,
1041template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>1040template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
1042struct __const_pointer1041struct __const_pointer
1043{1042{
1044 typedef typename _Alloc::const_pointer type;1043 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
1045};1044};
10461045
1047template <class _Tp, class _Ptr, class _Alloc>1046template <class _Tp, class _Ptr, class _Alloc>
1048struct __const_pointer<_Tp, _Ptr, _Alloc, false>1047struct __const_pointer<_Tp, _Ptr, _Alloc, false>
1049{1048{
1050#ifndef _LIBCPP_CXX03_LANG1049#ifndef _LIBCPP_CXX03_LANG
1051 typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type;1050 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
1052#else1051#else
1053 typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;1052 typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
1054#endif1053#endif
...@@ -1064,16 +1063,16 @@ struct __has_void_pointer<_Tp,...@@ -1064,16 +1063,16 @@ struct __has_void_pointer<_Tp,
1064template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>1063template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
1065struct __void_pointer1064struct __void_pointer
1066{1065{
1067 typedef typename _Alloc::void_pointer type;1066 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
1068};1067};
10691068
1070template <class _Ptr, class _Alloc>1069template <class _Ptr, class _Alloc>
1071struct __void_pointer<_Ptr, _Alloc, false>1070struct __void_pointer<_Ptr, _Alloc, false>
1072{1071{
1073#ifndef _LIBCPP_CXX03_LANG1072#ifndef _LIBCPP_CXX03_LANG
1074 typedef typename pointer_traits<_Ptr>::template rebind<void> type;1073 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
1075#else1074#else
1076 typedef typename pointer_traits<_Ptr>::template rebind<void>::other type;1075 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
1077#endif1076#endif
1078};1077};
10791078
...@@ -1087,16 +1086,16 @@ struct __has_const_void_pointer<_Tp,...@@ -1087,16 +1086,16 @@ struct __has_const_void_pointer<_Tp,
1087template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>1086template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
1088struct __const_void_pointer1087struct __const_void_pointer
1089{1088{
1090 typedef typename _Alloc::const_void_pointer type;1089 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
1091};1090};
10921091
1093template <class _Ptr, class _Alloc>1092template <class _Ptr, class _Alloc>
1094struct __const_void_pointer<_Ptr, _Alloc, false>1093struct __const_void_pointer<_Ptr, _Alloc, false>
1095{1094{
1096#ifndef _LIBCPP_CXX03_LANG1095#ifndef _LIBCPP_CXX03_LANG
1097 typedef typename pointer_traits<_Ptr>::template rebind<const void> type;1096 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
1098#else1097#else
1099 typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type;1098 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
1100#endif1099#endif
1101};1100};
11021101
...@@ -1162,13 +1161,13 @@ struct __has_size_type<_Tp,...@@ -1162,13 +1161,13 @@ struct __has_size_type<_Tp,
1162template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>1161template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
1163struct __size_type1162struct __size_type
1164{1163{
1165 typedef typename make_unsigned<_DiffType>::type type;1164 typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
1166};1165};
11671166
1168template <class _Alloc, class _DiffType>1167template <class _Alloc, class _DiffType>
1169struct __size_type<_Alloc, _DiffType, true>1168struct __size_type<_Alloc, _DiffType, true>
1170{1169{
1171 typedef typename _Alloc::size_type type;1170 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
1172};1171};
11731172
1174template <class _Tp, class = void>1173template <class _Tp, class = void>
...@@ -1182,13 +1181,13 @@ struct __has_propagate_on_container_copy_assignment<_Tp,...@@ -1182,13 +1181,13 @@ struct __has_propagate_on_container_copy_assignment<_Tp,
1182template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>1181template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
1183struct __propagate_on_container_copy_assignment1182struct __propagate_on_container_copy_assignment
1184{1183{
1185 typedef false_type type;1184 typedef _LIBCPP_NODEBUG_TYPE false_type type;
1186};1185};
11871186
1188template <class _Alloc>1187template <class _Alloc>
1189struct __propagate_on_container_copy_assignment<_Alloc, true>1188struct __propagate_on_container_copy_assignment<_Alloc, true>
1190{1189{
1191 typedef typename _Alloc::propagate_on_container_copy_assignment type;1190 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
1192};1191};
11931192
1194template <class _Tp, class = void>1193template <class _Tp, class = void>
...@@ -1208,7 +1207,7 @@ struct __propagate_on_container_move_assignment...@@ -1208,7 +1207,7 @@ struct __propagate_on_container_move_assignment
1208template <class _Alloc>1207template <class _Alloc>
1209struct __propagate_on_container_move_assignment<_Alloc, true>1208struct __propagate_on_container_move_assignment<_Alloc, true>
1210{1209{
1211 typedef typename _Alloc::propagate_on_container_move_assignment type;1210 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
1212};1211};
12131212
1214template <class _Tp, class = void>1213template <class _Tp, class = void>
...@@ -1228,7 +1227,7 @@ struct __propagate_on_container_swap...@@ -1228,7 +1227,7 @@ struct __propagate_on_container_swap
1228template <class _Alloc>1227template <class _Alloc>
1229struct __propagate_on_container_swap<_Alloc, true>1228struct __propagate_on_container_swap<_Alloc, true>
1230{1229{
1231 typedef typename _Alloc::propagate_on_container_swap type;1230 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
1232};1231};
12331232
1234template <class _Tp, class = void>1233template <class _Tp, class = void>
...@@ -1242,13 +1241,13 @@ struct __has_is_always_equal<_Tp,...@@ -1242,13 +1241,13 @@ struct __has_is_always_equal<_Tp,
1242template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>1241template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
1243struct __is_always_equal1242struct __is_always_equal
1244{1243{
1245 typedef typename _VSTD::is_empty<_Alloc>::type type;1244 typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
1246};1245};
12471246
1248template <class _Alloc>1247template <class _Alloc>
1249struct __is_always_equal<_Alloc, true>1248struct __is_always_equal<_Alloc, true>
1250{1249{
1251 typedef typename _Alloc::is_always_equal type;1250 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
1252};1251};
12531252
1254template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>1253template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
...@@ -1271,7 +1270,7 @@ struct __has_rebind_other<_Tp, _Up, false>...@@ -1271,7 +1270,7 @@ struct __has_rebind_other<_Tp, _Up, false>
1271template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>1270template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
1272struct __allocator_traits_rebind1271struct __allocator_traits_rebind
1273{1272{
1274 typedef typename _Tp::template rebind<_Up>::other type;1273 typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
1275};1274};
12761275
1277#ifndef _LIBCPP_HAS_NO_VARIADICS1276#ifndef _LIBCPP_HAS_NO_VARIADICS
...@@ -1279,13 +1278,13 @@ struct __allocator_traits_rebind...@@ -1279,13 +1278,13 @@ struct __allocator_traits_rebind
1279template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>1278template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
1280struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>1279struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
1281{1280{
1282 typedef typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;1281 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
1283};1282};
12841283
1285template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>1284template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
1286struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>1285struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
1287{1286{
1288 typedef _Alloc<_Up, _Args...> type;1287 typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
1289};1288};
12901289
1291#else // _LIBCPP_HAS_NO_VARIADICS1290#else // _LIBCPP_HAS_NO_VARIADICS
...@@ -1493,13 +1492,13 @@ struct __has_select_on_container_copy_construction...@@ -1493,13 +1492,13 @@ struct __has_select_on_container_copy_construction
1493template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>1492template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
1494struct __alloc_traits_difference_type1493struct __alloc_traits_difference_type
1495{1494{
1496 typedef typename pointer_traits<_Ptr>::difference_type type;1495 typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type;
1497};1496};
14981497
1499template <class _Alloc, class _Ptr>1498template <class _Alloc, class _Ptr>
1500struct __alloc_traits_difference_type<_Alloc, _Ptr, true>1499struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
1501{1500{
1502 typedef typename _Alloc::difference_type type;1501 typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
1503};1502};
15041503
1505template <class _Tp>1504template <class _Tp>
...@@ -1534,7 +1533,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits...@@ -1534,7 +1533,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
1534#ifndef _LIBCPP_CXX03_LANG1533#ifndef _LIBCPP_CXX03_LANG
1535 template <class _Tp> using rebind_alloc =1534 template <class _Tp> using rebind_alloc =
1536 typename __allocator_traits_rebind<allocator_type, _Tp>::type;1535 typename __allocator_traits_rebind<allocator_type, _Tp>::type;
1537 template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;1536 template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
1538#else // _LIBCPP_CXX03_LANG1537#else // _LIBCPP_CXX03_LANG
1539 template <class _Tp> struct rebind_alloc1538 template <class _Tp> struct rebind_alloc
1540 {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};1539 {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
...@@ -1769,7 +1768,7 @@ template <class _Traits, class _Tp>...@@ -1769,7 +1768,7 @@ template <class _Traits, class _Tp>
1769struct __rebind_alloc_helper1768struct __rebind_alloc_helper
1770{1769{
1771#ifndef _LIBCPP_CXX03_LANG1770#ifndef _LIBCPP_CXX03_LANG
1772 typedef typename _Traits::template rebind_alloc<_Tp> type;1771 typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type;
1773#else1772#else
1774 typedef typename _Traits::template rebind_alloc<_Tp>::other type;1773 typedef typename _Traits::template rebind_alloc<_Tp>::other type;
1775#endif1774#endif
...@@ -2210,8 +2209,8 @@ struct __second_tag {};...@@ -2210,8 +2209,8 @@ struct __second_tag {};
2210template <class _T1, class _T2>2209template <class _T1, class _T2>
2211class __compressed_pair : private __compressed_pair_elem<_T1, 0>,2210class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
2212 private __compressed_pair_elem<_T2, 1> {2211 private __compressed_pair_elem<_T2, 1> {
2213 typedef __compressed_pair_elem<_T1, 0> _Base1;2212 typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T1, 0> _Base1;
2214 typedef __compressed_pair_elem<_T2, 1> _Base2;2213 typedef _LIBCPP_NODEBUG_TYPE __compressed_pair_elem<_T2, 1> _Base2;
22152214
2216 // NOTE: This static assert should never fire because __compressed_pair2215 // NOTE: This static assert should never fire because __compressed_pair
2217 // is *almost never* used in a scenario where it's possible for T1 == T2.2216 // is *almost never* used in a scenario where it's possible for T1 == T2.
...@@ -2321,7 +2320,7 @@ struct _LIBCPP_TEMPLATE_VIS default_delete {...@@ -2321,7 +2320,7 @@ struct _LIBCPP_TEMPLATE_VIS default_delete {
2321 static_assert(!is_function<_Tp>::value,2320 static_assert(!is_function<_Tp>::value,
2322 "default_delete cannot be instantiated for function types");2321 "default_delete cannot be instantiated for function types");
2323#ifndef _LIBCPP_CXX03_LANG2322#ifndef _LIBCPP_CXX03_LANG
2324 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;2323 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
2325#else2324#else
2326 _LIBCPP_INLINE_VISIBILITY default_delete() {}2325 _LIBCPP_INLINE_VISIBILITY default_delete() {}
2327#endif2326#endif
...@@ -2349,7 +2348,7 @@ private:...@@ -2349,7 +2348,7 @@ private:
23492348
2350public:2349public:
2351#ifndef _LIBCPP_CXX03_LANG2350#ifndef _LIBCPP_CXX03_LANG
2352 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;2351 _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default;
2353#else2352#else
2354 _LIBCPP_INLINE_VISIBILITY default_delete() {}2353 _LIBCPP_INLINE_VISIBILITY default_delete() {}
2355#endif2354#endif
...@@ -2371,9 +2370,6 @@ public:...@@ -2371,9 +2370,6 @@ public:
2371 }2370 }
2372};2371};
23732372
2374
2375
2376#ifndef _LIBCPP_CXX03_LANG
2377template <class _Deleter>2373template <class _Deleter>
2378struct __unique_ptr_deleter_sfinae {2374struct __unique_ptr_deleter_sfinae {
2379 static_assert(!is_reference<_Deleter>::value, "incorrect specialization");2375 static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
...@@ -2395,14 +2391,13 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {...@@ -2395,14 +2391,13 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {
2395 typedef _Deleter&& __bad_rval_ref_type;2391 typedef _Deleter&& __bad_rval_ref_type;
2396 typedef false_type __enable_rval_overload;2392 typedef false_type __enable_rval_overload;
2397};2393};
2398#endif // !defined(_LIBCPP_CXX03_LANG)
23992394
2400template <class _Tp, class _Dp = default_delete<_Tp> >2395template <class _Tp, class _Dp = default_delete<_Tp> >
2401class _LIBCPP_TEMPLATE_VIS unique_ptr {2396class _LIBCPP_TEMPLATE_VIS unique_ptr {
2402public:2397public:
2403 typedef _Tp element_type;2398 typedef _Tp element_type;
2404 typedef _Dp deleter_type;2399 typedef _Dp deleter_type;
2405 typedef typename __pointer_type<_Tp, deleter_type>::type pointer;2400 typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type<_Tp, deleter_type>::type pointer;
24062401
2407 static_assert(!is_rvalue_reference<deleter_type>::value,2402 static_assert(!is_rvalue_reference<deleter_type>::value,
2408 "the specified deleter type cannot be an rvalue reference");2403 "the specified deleter type cannot be an rvalue reference");
...@@ -2412,39 +2407,38 @@ private:...@@ -2412,39 +2407,38 @@ private:
24122407
2413 struct __nat { int __for_bool_; };2408 struct __nat { int __for_bool_; };
24142409
2415#ifndef _LIBCPP_CXX03_LANG2410 typedef _LIBCPP_NODEBUG_TYPE __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
2416 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
24172411
2418 template <bool _Dummy>2412 template <bool _Dummy>
2419 using _LValRefType =2413 using _LValRefType _LIBCPP_NODEBUG_TYPE =
2420 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;2414 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
24212415
2422 template <bool _Dummy>2416 template <bool _Dummy>
2423 using _GoodRValRefType =2417 using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
2424 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;2418 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
24252419
2426 template <bool _Dummy>2420 template <bool _Dummy>
2427 using _BadRValRefType =2421 using _BadRValRefType _LIBCPP_NODEBUG_TYPE =
2428 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;2422 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
24292423
2430 template <bool _Dummy, class _Deleter = typename __dependent_type<2424 template <bool _Dummy, class _Deleter = typename __dependent_type<
2431 __identity<deleter_type>, _Dummy>::type>2425 __identity<deleter_type>, _Dummy>::type>
2432 using _EnableIfDeleterDefaultConstructible =2426 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE =
2433 typename enable_if<is_default_constructible<_Deleter>::value &&2427 typename enable_if<is_default_constructible<_Deleter>::value &&
2434 !is_pointer<_Deleter>::value>::type;2428 !is_pointer<_Deleter>::value>::type;
24352429
2436 template <class _ArgType>2430 template <class _ArgType>
2437 using _EnableIfDeleterConstructible =2431 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE =
2438 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;2432 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
24392433
2440 template <class _UPtr, class _Up>2434 template <class _UPtr, class _Up>
2441 using _EnableIfMoveConvertible = typename enable_if<2435 using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
2442 is_convertible<typename _UPtr::pointer, pointer>::value &&2436 is_convertible<typename _UPtr::pointer, pointer>::value &&
2443 !is_array<_Up>::value2437 !is_array<_Up>::value
2444 >::type;2438 >::type;
24452439
2446 template <class _UDel>2440 template <class _UDel>
2447 using _EnableIfDeleterConvertible = typename enable_if<2441 using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
2448 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||2442 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
2449 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)2443 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
2450 >::type;2444 >::type;
...@@ -2456,42 +2450,42 @@ private:...@@ -2456,42 +2450,42 @@ private:
24562450
2457public:2451public:
2458 template <bool _Dummy = true,2452 template <bool _Dummy = true,
2459 class = _EnableIfDeleterDefaultConstructible<_Dummy>>2453 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2460 _LIBCPP_INLINE_VISIBILITY2454 _LIBCPP_INLINE_VISIBILITY
2461 constexpr unique_ptr() noexcept : __ptr_(pointer()) {}2455 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
24622456
2463 template <bool _Dummy = true,2457 template <bool _Dummy = true,
2464 class = _EnableIfDeleterDefaultConstructible<_Dummy>>2458 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2465 _LIBCPP_INLINE_VISIBILITY2459 _LIBCPP_INLINE_VISIBILITY
2466 constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}2460 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
24672461
2468 template <bool _Dummy = true,2462 template <bool _Dummy = true,
2469 class = _EnableIfDeleterDefaultConstructible<_Dummy>>2463 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2470 _LIBCPP_INLINE_VISIBILITY2464 _LIBCPP_INLINE_VISIBILITY
2471 explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {}2465 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p) {}
24722466
2473 template <bool _Dummy = true,2467 template <bool _Dummy = true,
2474 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>2468 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
2475 _LIBCPP_INLINE_VISIBILITY2469 _LIBCPP_INLINE_VISIBILITY
2476 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept2470 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
2477 : __ptr_(__p, __d) {}2471 : __ptr_(__p, __d) {}
24782472
2479 template <bool _Dummy = true,2473 template <bool _Dummy = true,
2480 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>2474 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
2481 _LIBCPP_INLINE_VISIBILITY2475 _LIBCPP_INLINE_VISIBILITY
2482 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept2476 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
2483 : __ptr_(__p, _VSTD::move(__d)) {2477 : __ptr_(__p, _VSTD::move(__d)) {
2484 static_assert(!is_reference<deleter_type>::value,2478 static_assert(!is_reference<deleter_type>::value,
2485 "rvalue deleter bound to reference");2479 "rvalue deleter bound to reference");
2486 }2480 }
24872481
2488 template <bool _Dummy = true,2482 template <bool _Dummy = true,
2489 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>>2483 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
2490 _LIBCPP_INLINE_VISIBILITY2484 _LIBCPP_INLINE_VISIBILITY
2491 unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;2485 unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
24922486
2493 _LIBCPP_INLINE_VISIBILITY2487 _LIBCPP_INLINE_VISIBILITY
2494 unique_ptr(unique_ptr&& __u) noexcept2488 unique_ptr(unique_ptr&& __u) _NOEXCEPT
2495 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {2489 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
2496 }2490 }
24972491
...@@ -2508,7 +2502,7 @@ public:...@@ -2508,7 +2502,7 @@ public:
2508 _LIBCPP_INLINE_VISIBILITY2502 _LIBCPP_INLINE_VISIBILITY
2509 unique_ptr(auto_ptr<_Up>&& __p,2503 unique_ptr(auto_ptr<_Up>&& __p,
2510 typename enable_if<is_convertible<_Up*, _Tp*>::value &&2504 typename enable_if<is_convertible<_Up*, _Tp*>::value &&
2511 is_same<_Dp, default_delete<_Tp>>::value,2505 is_same<_Dp, default_delete<_Tp> >::value,
2512 __nat>::type = __nat()) _NOEXCEPT2506 __nat>::type = __nat()) _NOEXCEPT
2513 : __ptr_(__p.release()) {}2507 : __ptr_(__p.release()) {}
2514#endif2508#endif
...@@ -2531,65 +2525,6 @@ public:...@@ -2531,65 +2525,6 @@ public:
2531 return *this;2525 return *this;
2532 }2526 }
25332527
2534#else // _LIBCPP_CXX03_LANG
2535private:
2536 unique_ptr(unique_ptr&);
2537 template <class _Up, class _Ep> unique_ptr(unique_ptr<_Up, _Ep>&);
2538
2539 unique_ptr& operator=(unique_ptr&);
2540 template <class _Up, class _Ep> unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
2541
2542public:
2543 _LIBCPP_INLINE_VISIBILITY
2544 unique_ptr() : __ptr_(pointer())
2545 {
2546 static_assert(!is_pointer<deleter_type>::value,
2547 "unique_ptr constructed with null function pointer deleter");
2548 static_assert(is_default_constructible<deleter_type>::value,
2549 "unique_ptr::deleter_type is not default constructible");
2550 }
2551 _LIBCPP_INLINE_VISIBILITY
2552 unique_ptr(nullptr_t) : __ptr_(pointer())
2553 {
2554 static_assert(!is_pointer<deleter_type>::value,
2555 "unique_ptr constructed with null function pointer deleter");
2556 }
2557 _LIBCPP_INLINE_VISIBILITY
2558 explicit unique_ptr(pointer __p)
2559 : __ptr_(_VSTD::move(__p)) {
2560 static_assert(!is_pointer<deleter_type>::value,
2561 "unique_ptr constructed with null function pointer deleter");
2562 }
2563
2564 _LIBCPP_INLINE_VISIBILITY
2565 operator __rv<unique_ptr>() {
2566 return __rv<unique_ptr>(*this);
2567 }
2568
2569 _LIBCPP_INLINE_VISIBILITY
2570 unique_ptr(__rv<unique_ptr> __u)
2571 : __ptr_(__u->release(),
2572 _VSTD::forward<deleter_type>(__u->get_deleter())) {}
2573
2574 template <class _Up, class _Ep>
2575 _LIBCPP_INLINE_VISIBILITY
2576 typename enable_if<
2577 !is_array<_Up>::value &&
2578 is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
2579 pointer>::value &&
2580 is_assignable<deleter_type&, _Ep&>::value,
2581 unique_ptr&>::type
2582 operator=(unique_ptr<_Up, _Ep> __u) {
2583 reset(__u.release());
2584 __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
2585 return *this;
2586 }
2587
2588 _LIBCPP_INLINE_VISIBILITY
2589 unique_ptr(pointer __p, deleter_type __d)
2590 : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
2591#endif // _LIBCPP_CXX03_LANG
2592
2593#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)2528#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
2594 template <class _Up>2529 template <class _Up>
2595 _LIBCPP_INLINE_VISIBILITY2530 _LIBCPP_INLINE_VISIBILITY
...@@ -2602,6 +2537,12 @@ public:...@@ -2602,6 +2537,12 @@ public:
2602 }2537 }
2603#endif2538#endif
26042539
2540#ifdef _LIBCPP_CXX03_LANG
2541 unique_ptr(unique_ptr const&) = delete;
2542 unique_ptr& operator=(unique_ptr const&) = delete;
2543#endif
2544
2545
2605 _LIBCPP_INLINE_VISIBILITY2546 _LIBCPP_INLINE_VISIBILITY
2606 ~unique_ptr() { reset(); }2547 ~unique_ptr() { reset(); }
26072548
...@@ -2681,39 +2622,38 @@ private:...@@ -2681,39 +2622,38 @@ private:
2681 >2622 >
2682 {};2623 {};
26832624
2684#ifndef _LIBCPP_CXX03_LANG
2685 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;2625 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
26862626
2687 template <bool _Dummy>2627 template <bool _Dummy>
2688 using _LValRefType =2628 using _LValRefType _LIBCPP_NODEBUG_TYPE =
2689 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;2629 typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
26902630
2691 template <bool _Dummy>2631 template <bool _Dummy>
2692 using _GoodRValRefType =2632 using _GoodRValRefType _LIBCPP_NODEBUG_TYPE =
2693 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;2633 typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
26942634
2695 template <bool _Dummy>2635 template <bool _Dummy>
2696 using _BadRValRefType =2636 using _BadRValRefType _LIBCPP_NODEBUG_TYPE =
2697 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;2637 typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
26982638
2699 template <bool _Dummy, class _Deleter = typename __dependent_type<2639 template <bool _Dummy, class _Deleter = typename __dependent_type<
2700 __identity<deleter_type>, _Dummy>::type>2640 __identity<deleter_type>, _Dummy>::type>
2701 using _EnableIfDeleterDefaultConstructible =2641 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG_TYPE =
2702 typename enable_if<is_default_constructible<_Deleter>::value &&2642 typename enable_if<is_default_constructible<_Deleter>::value &&
2703 !is_pointer<_Deleter>::value>::type;2643 !is_pointer<_Deleter>::value>::type;
27042644
2705 template <class _ArgType>2645 template <class _ArgType>
2706 using _EnableIfDeleterConstructible =2646 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG_TYPE =
2707 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;2647 typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
27082648
2709 template <class _Pp>2649 template <class _Pp>
2710 using _EnableIfPointerConvertible = typename enable_if<2650 using _EnableIfPointerConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
2711 _CheckArrayPointerConversion<_Pp>::value2651 _CheckArrayPointerConversion<_Pp>::value
2712 >::type;2652 >::type;
27132653
2714 template <class _UPtr, class _Up,2654 template <class _UPtr, class _Up,
2715 class _ElemT = typename _UPtr::element_type>2655 class _ElemT = typename _UPtr::element_type>
2716 using _EnableIfMoveConvertible = typename enable_if<2656 using _EnableIfMoveConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
2717 is_array<_Up>::value &&2657 is_array<_Up>::value &&
2718 is_same<pointer, element_type*>::value &&2658 is_same<pointer, element_type*>::value &&
2719 is_same<typename _UPtr::pointer, _ElemT*>::value &&2659 is_same<typename _UPtr::pointer, _ElemT*>::value &&
...@@ -2721,79 +2661,79 @@ private:...@@ -2721,79 +2661,79 @@ private:
2721 >::type;2661 >::type;
27222662
2723 template <class _UDel>2663 template <class _UDel>
2724 using _EnableIfDeleterConvertible = typename enable_if<2664 using _EnableIfDeleterConvertible _LIBCPP_NODEBUG_TYPE = typename enable_if<
2725 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||2665 (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
2726 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)2666 (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
2727 >::type;2667 >::type;
27282668
2729 template <class _UDel>2669 template <class _UDel>
2730 using _EnableIfDeleterAssignable = typename enable_if<2670 using _EnableIfDeleterAssignable _LIBCPP_NODEBUG_TYPE = typename enable_if<
2731 is_assignable<_Dp&, _UDel&&>::value2671 is_assignable<_Dp&, _UDel&&>::value
2732 >::type;2672 >::type;
27332673
2734public:2674public:
2735 template <bool _Dummy = true,2675 template <bool _Dummy = true,
2736 class = _EnableIfDeleterDefaultConstructible<_Dummy>>2676 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2737 _LIBCPP_INLINE_VISIBILITY2677 _LIBCPP_INLINE_VISIBILITY
2738 constexpr unique_ptr() noexcept : __ptr_(pointer()) {}2678 _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer()) {}
27392679
2740 template <bool _Dummy = true,2680 template <bool _Dummy = true,
2741 class = _EnableIfDeleterDefaultConstructible<_Dummy>>2681 class = _EnableIfDeleterDefaultConstructible<_Dummy> >
2742 _LIBCPP_INLINE_VISIBILITY2682 _LIBCPP_INLINE_VISIBILITY
2743 constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}2683 _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer()) {}
27442684
2745 template <class _Pp, bool _Dummy = true,2685 template <class _Pp, bool _Dummy = true,
2746 class = _EnableIfDeleterDefaultConstructible<_Dummy>,2686 class = _EnableIfDeleterDefaultConstructible<_Dummy>,
2747 class = _EnableIfPointerConvertible<_Pp>>2687 class = _EnableIfPointerConvertible<_Pp> >
2748 _LIBCPP_INLINE_VISIBILITY2688 _LIBCPP_INLINE_VISIBILITY
2749 explicit unique_ptr(_Pp __p) noexcept2689 explicit unique_ptr(_Pp __p) _NOEXCEPT
2750 : __ptr_(__p) {}2690 : __ptr_(__p) {}
27512691
2752 template <class _Pp, bool _Dummy = true,2692 template <class _Pp, bool _Dummy = true,
2753 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>,2693 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
2754 class = _EnableIfPointerConvertible<_Pp>>2694 class = _EnableIfPointerConvertible<_Pp> >
2755 _LIBCPP_INLINE_VISIBILITY2695 _LIBCPP_INLINE_VISIBILITY
2756 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept2696 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT
2757 : __ptr_(__p, __d) {}2697 : __ptr_(__p, __d) {}
27582698
2759 template <bool _Dummy = true,2699 template <bool _Dummy = true,
2760 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>2700 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
2761 _LIBCPP_INLINE_VISIBILITY2701 _LIBCPP_INLINE_VISIBILITY
2762 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept2702 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT
2763 : __ptr_(nullptr, __d) {}2703 : __ptr_(nullptr, __d) {}
27642704
2765 template <class _Pp, bool _Dummy = true,2705 template <class _Pp, bool _Dummy = true,
2766 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>,2706 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >,
2767 class = _EnableIfPointerConvertible<_Pp>>2707 class = _EnableIfPointerConvertible<_Pp> >
2768 _LIBCPP_INLINE_VISIBILITY2708 _LIBCPP_INLINE_VISIBILITY
2769 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept2709 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
2770 : __ptr_(__p, _VSTD::move(__d)) {2710 : __ptr_(__p, _VSTD::move(__d)) {
2771 static_assert(!is_reference<deleter_type>::value,2711 static_assert(!is_reference<deleter_type>::value,
2772 "rvalue deleter bound to reference");2712 "rvalue deleter bound to reference");
2773 }2713 }
27742714
2775 template <bool _Dummy = true,2715 template <bool _Dummy = true,
2776 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>2716 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
2777 _LIBCPP_INLINE_VISIBILITY2717 _LIBCPP_INLINE_VISIBILITY
2778 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept2718 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
2779 : __ptr_(nullptr, _VSTD::move(__d)) {2719 : __ptr_(nullptr, _VSTD::move(__d)) {
2780 static_assert(!is_reference<deleter_type>::value,2720 static_assert(!is_reference<deleter_type>::value,
2781 "rvalue deleter bound to reference");2721 "rvalue deleter bound to reference");
2782 }2722 }
27832723
2784 template <class _Pp, bool _Dummy = true,2724 template <class _Pp, bool _Dummy = true,
2785 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>,2725 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
2786 class = _EnableIfPointerConvertible<_Pp>>2726 class = _EnableIfPointerConvertible<_Pp> >
2787 _LIBCPP_INLINE_VISIBILITY2727 _LIBCPP_INLINE_VISIBILITY
2788 unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;2728 unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
27892729
2790 _LIBCPP_INLINE_VISIBILITY2730 _LIBCPP_INLINE_VISIBILITY
2791 unique_ptr(unique_ptr&& __u) noexcept2731 unique_ptr(unique_ptr&& __u) _NOEXCEPT
2792 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {2732 : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
2793 }2733 }
27942734
2795 _LIBCPP_INLINE_VISIBILITY2735 _LIBCPP_INLINE_VISIBILITY
2796 unique_ptr& operator=(unique_ptr&& __u) noexcept {2736 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
2797 reset(__u.release());2737 reset(__u.release());
2798 __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());2738 __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
2799 return *this;2739 return *this;
...@@ -2804,7 +2744,7 @@ public:...@@ -2804,7 +2744,7 @@ public:
2804 class = _EnableIfDeleterConvertible<_Ep>2744 class = _EnableIfDeleterConvertible<_Ep>
2805 >2745 >
2806 _LIBCPP_INLINE_VISIBILITY2746 _LIBCPP_INLINE_VISIBILITY
2807 unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept2747 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
2808 : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {2748 : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {
2809 }2749 }
28102750
...@@ -2814,73 +2754,16 @@ public:...@@ -2814,73 +2754,16 @@ public:
2814 >2754 >
2815 _LIBCPP_INLINE_VISIBILITY2755 _LIBCPP_INLINE_VISIBILITY
2816 unique_ptr&2756 unique_ptr&
2817 operator=(unique_ptr<_Up, _Ep>&& __u) noexcept {2757 operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
2818 reset(__u.release());2758 reset(__u.release());
2819 __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());2759 __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
2820 return *this;2760 return *this;
2821 }2761 }
28222762
2823#else // _LIBCPP_CXX03_LANG2763#ifdef _LIBCPP_CXX03_LANG
2824private:2764 unique_ptr(unique_ptr const&) = delete;
2825 template <class _Up> explicit unique_ptr(_Up);2765 unique_ptr& operator=(unique_ptr const&) = delete;
28262766#endif
2827 unique_ptr(unique_ptr&);
2828 template <class _Up> unique_ptr(unique_ptr<_Up>&);
2829
2830 unique_ptr& operator=(unique_ptr&);
2831 template <class _Up> unique_ptr& operator=(unique_ptr<_Up>&);
2832
2833 template <class _Up>
2834 unique_ptr(_Up __u,
2835 typename conditional<
2836 is_reference<deleter_type>::value, deleter_type,
2837 typename add_lvalue_reference<const deleter_type>::type>::type,
2838 typename enable_if<is_convertible<_Up, pointer>::value,
2839 __nat>::type = __nat());
2840public:
2841 _LIBCPP_INLINE_VISIBILITY
2842 unique_ptr() : __ptr_(pointer()) {
2843 static_assert(!is_pointer<deleter_type>::value,
2844 "unique_ptr constructed with null function pointer deleter");
2845 }
2846 _LIBCPP_INLINE_VISIBILITY
2847 unique_ptr(nullptr_t) : __ptr_(pointer()) {
2848 static_assert(!is_pointer<deleter_type>::value,
2849 "unique_ptr constructed with null function pointer deleter");
2850 }
2851
2852 _LIBCPP_INLINE_VISIBILITY
2853 explicit unique_ptr(pointer __p) : __ptr_(__p) {
2854 static_assert(!is_pointer<deleter_type>::value,
2855 "unique_ptr constructed with null function pointer deleter");
2856 }
2857
2858 _LIBCPP_INLINE_VISIBILITY
2859 unique_ptr(pointer __p, deleter_type __d)
2860 : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
2861
2862 _LIBCPP_INLINE_VISIBILITY
2863 unique_ptr(nullptr_t, deleter_type __d)
2864 : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
2865
2866 _LIBCPP_INLINE_VISIBILITY
2867 operator __rv<unique_ptr>() {
2868 return __rv<unique_ptr>(*this);
2869 }
2870
2871 _LIBCPP_INLINE_VISIBILITY
2872 unique_ptr(__rv<unique_ptr> __u)
2873 : __ptr_(__u->release(),
2874 _VSTD::forward<deleter_type>(__u->get_deleter())) {}
2875
2876 _LIBCPP_INLINE_VISIBILITY
2877 unique_ptr& operator=(__rv<unique_ptr> __u) {
2878 reset(__u->release());
2879 __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
2880 return *this;
2881 }
2882
2883#endif // _LIBCPP_CXX03_LANG
28842767
2885public:2768public:
2886 _LIBCPP_INLINE_VISIBILITY2769 _LIBCPP_INLINE_VISIBILITY
...@@ -3092,18 +2975,6 @@ operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)...@@ -3092,18 +2975,6 @@ operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
3092 return !(nullptr < __x);2975 return !(nullptr < __x);
3093}2976}
30942977
3095#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3096
3097template <class _Tp, class _Dp>
3098inline _LIBCPP_INLINE_VISIBILITY
3099unique_ptr<_Tp, _Dp>
3100move(unique_ptr<_Tp, _Dp>& __t)
3101{
3102 return unique_ptr<_Tp, _Dp>(__rv<unique_ptr<_Tp, _Dp> >(__t));
3103}
3104
3105#endif
3106
3107#if _LIBCPP_STD_VER > 112978#if _LIBCPP_STD_VER > 11
31082979
3109template<class _Tp>2980template<class _Tp>
...@@ -3152,7 +3023,7 @@ template <class _Tp, class _Dp>...@@ -3152,7 +3023,7 @@ template <class _Tp, class _Dp>
3152struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >3023struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
3153#else3024#else
3154struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<3025struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
3155 unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer>>3026 unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> >
3156#endif3027#endif
3157{3028{
3158 typedef unique_ptr<_Tp, _Dp> argument_type;3029 typedef unique_ptr<_Tp, _Dp> argument_type;
...@@ -3207,10 +3078,10 @@ public:...@@ -3207,10 +3078,10 @@ public:
3207template <class _Alloc>3078template <class _Alloc>
3208class __allocator_destructor3079class __allocator_destructor
3209{3080{
3210 typedef allocator_traits<_Alloc> __alloc_traits;3081 typedef _LIBCPP_NODEBUG_TYPE allocator_traits<_Alloc> __alloc_traits;
3211public:3082public:
3212 typedef typename __alloc_traits::pointer pointer;3083 typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::pointer pointer;
3213 typedef typename __alloc_traits::size_type size_type;3084 typedef _LIBCPP_NODEBUG_TYPE typename __alloc_traits::size_type size_type;
3214private:3085private:
3215 _Alloc& __alloc_;3086 _Alloc& __alloc_;
3216 size_type __s_;3087 size_type __s_;
...@@ -3467,7 +3338,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {...@@ -3467,7 +3338,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {
3467 && defined(__ATOMIC_RELAXED) \3338 && defined(__ATOMIC_RELAXED) \
3468 && defined(__ATOMIC_ACQ_REL)3339 && defined(__ATOMIC_ACQ_REL)
3469# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT3340# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
3470#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 4073341#elif defined(_LIBCPP_COMPILER_GCC)
3471# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT3342# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
3472#endif3343#endif
34733344
...@@ -5669,6 +5540,52 @@ struct __is_allocator<_Alloc,...@@ -5669,6 +5540,52 @@ struct __is_allocator<_Alloc,
5669 >5540 >
5670 : true_type {};5541 : true_type {};
56715542
5543// __builtin_new_allocator -- A non-templated helper for allocating and
5544// deallocating memory using __builtin_operator_new and
5545// __builtin_operator_delete. It should be used in preference to
5546// `std::allocator<T>` to avoid additional instantiations.
5547struct __builtin_new_allocator {
5548 struct __builtin_new_deleter {
5549 typedef void* pointer_type;
5550
5551 _LIBCPP_CONSTEXPR explicit __builtin_new_deleter(size_t __size, size_t __align)
5552 : __size_(__size), __align_(__align) {}
5553
5554 void operator()(void* p) const _NOEXCEPT {
5555 std::__libcpp_deallocate(p, __size_, __align_);
5556 }
5557
5558 private:
5559 size_t __size_;
5560 size_t __align_;
5561 };
5562
5563 typedef unique_ptr<void, __builtin_new_deleter> __holder_t;
5564
5565 static __holder_t __allocate_bytes(size_t __s, size_t __align) {
5566 return __holder_t(std::__libcpp_allocate(__s, __align),
5567 __builtin_new_deleter(__s, __align));
5568 }
5569
5570 static void __deallocate_bytes(void* __p, size_t __s,
5571 size_t __align) _NOEXCEPT {
5572 std::__libcpp_deallocate(__p, __s, __align);
5573 }
5574
5575 template <class _Tp>
5576 _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
5577 static __holder_t __allocate_type(size_t __n) {
5578 return __allocate_bytes(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
5579 }
5580
5581 template <class _Tp>
5582 _LIBCPP_NODEBUG _LIBCPP_ALWAYS_INLINE
5583 static void __deallocate_type(void* __p, size_t __n) _NOEXCEPT {
5584 __deallocate_bytes(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
5585 }
5586};
5587
5588
5672_LIBCPP_END_NAMESPACE_STD5589_LIBCPP_END_NAMESPACE_STD
56735590
5674_LIBCPP_POP_MACROS5591_LIBCPP_POP_MACROS
lib/libcxx/include/module.modulemap+4-1
...@@ -24,7 +24,10 @@ module std [system] {...@@ -24,7 +24,10 @@ module std [system] {
24 header "errno.h"24 header "errno.h"
25 export *25 export *
26 }26 }
27 // <fenv.h> provided by C library.27 module fenv_h {
28 header "fenv.h"
29 export *
30 }
28 // <float.h> provided by compiler or C library.31 // <float.h> provided by compiler or C library.
29 module inttypes_h {32 module inttypes_h {
30 header "inttypes.h"33 header "inttypes.h"
lib/libcxx/include/mutex+17-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- mutex ------------------------------------===//2//===--------------------------- mutex ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -189,6 +188,7 @@ template<class Callable, class ...Args>...@@ -189,6 +188,7 @@ template<class Callable, class ...Args>
189188
190#include <__config>189#include <__config>
191#include <__mutex_base>190#include <__mutex_base>
191#include <cstdint>
192#include <functional>192#include <functional>
193#include <memory>193#include <memory>
194#ifndef _LIBCPP_CXX03_LANG194#ifndef _LIBCPP_CXX03_LANG
...@@ -576,11 +576,18 @@ struct _LIBCPP_TEMPLATE_VIS once_flag...@@ -576,11 +576,18 @@ struct _LIBCPP_TEMPLATE_VIS once_flag
576 _LIBCPP_CONSTEXPR576 _LIBCPP_CONSTEXPR
577 once_flag() _NOEXCEPT : __state_(0) {}577 once_flag() _NOEXCEPT : __state_(0) {}
578578
579#if defined(_LIBCPP_ABI_MICROSOFT)
580 typedef uintptr_t _State_type;
581#else
582 typedef unsigned long _State_type;
583#endif
584
585
579private:586private:
580 once_flag(const once_flag&); // = delete;587 once_flag(const once_flag&); // = delete;
581 once_flag& operator=(const once_flag&); // = delete;588 once_flag& operator=(const once_flag&); // = delete;
582589
583 unsigned long __state_;590 _State_type __state_;
584591
585#ifndef _LIBCPP_CXX03_LANG592#ifndef _LIBCPP_CXX03_LANG
586 template<class _Callable, class... _Args>593 template<class _Callable, class... _Args>
...@@ -650,7 +657,8 @@ __call_once_proxy(void* __vp)...@@ -650,7 +657,8 @@ __call_once_proxy(void* __vp)
650 (*__p)();657 (*__p)();
651}658}
652659
653_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));660_LIBCPP_FUNC_VIS void __call_once(volatile once_flag::_State_type&, void*,
661 void (*)(void*));
654662
655#ifndef _LIBCPP_CXX03_LANG663#ifndef _LIBCPP_CXX03_LANG
656664
...@@ -659,7 +667,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -659,7 +667,7 @@ inline _LIBCPP_INLINE_VISIBILITY
659void667void
660call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)668call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
661{669{
662 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)670 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
663 {671 {
664 typedef tuple<_Callable&&, _Args&&...> _Gp;672 typedef tuple<_Callable&&, _Args&&...> _Gp;
665 _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);673 _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
...@@ -675,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -675,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY
675void683void
676call_once(once_flag& __flag, _Callable& __func)684call_once(once_flag& __flag, _Callable& __func)
677{685{
678 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)686 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
679 {687 {
680 __call_once_param<_Callable> __p(__func);688 __call_once_param<_Callable> __p(__func);
681 __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);689 __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
...@@ -687,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY...@@ -687,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY
687void695void
688call_once(once_flag& __flag, const _Callable& __func)696call_once(once_flag& __flag, const _Callable& __func)
689{697{
690 if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)698 if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0))
691 {699 {
692 __call_once_param<const _Callable> __p(__func);700 __call_once_param<const _Callable> __p(__func);
693 __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);701 __call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
lib/libcxx/include/new+28-14
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------------- new ------------------------------------===//2//===----------------------------- new ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -34,6 +33,12 @@ public:...@@ -34,6 +33,12 @@ public:
34};33};
3534
36enum class align_val_t : size_t {}; // C++1735enum class align_val_t : size_t {}; // C++17
36
37struct destroying_delete_t { // C++20
38 explicit destroying_delete_t() = default;
39};
40inline constexpr destroying_delete_t destroying_delete{}; // C++20
41
37struct nothrow_t {};42struct nothrow_t {};
38extern const nothrow_t nothrow;43extern const nothrow_t nothrow;
39typedef void (*new_handler)();44typedef void (*new_handler)();
...@@ -90,7 +95,7 @@ void operator delete[](void* ptr, void*) noexcept;...@@ -90,7 +95,7 @@ void operator delete[](void* ptr, void*) noexcept;
90#include <cstdlib>95#include <cstdlib>
91#endif96#endif
9297
93#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)98#if defined(_LIBCPP_ABI_VCRUNTIME)
94#include <new.h>99#include <new.h>
95#endif100#endif
96101
...@@ -120,7 +125,7 @@ void operator delete[](void* ptr, void*) noexcept;...@@ -120,7 +125,7 @@ void operator delete[](void* ptr, void*) noexcept;
120namespace std // purposefully not using versioning namespace125namespace std // purposefully not using versioning namespace
121{126{
122127
123#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)128#if !defined(_LIBCPP_ABI_VCRUNTIME)
124struct _LIBCPP_TYPE_VIS nothrow_t {};129struct _LIBCPP_TYPE_VIS nothrow_t {};
125extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;130extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
126131
...@@ -146,12 +151,12 @@ typedef void (*new_handler)();...@@ -146,12 +151,12 @@ typedef void (*new_handler)();
146_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;151_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
147_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;152_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
148153
149#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME154#endif // !_LIBCPP_ABI_VCRUNTIME
150155
151_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec156_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
152157
153#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \158#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \
154 !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)159 !defined(_LIBCPP_ABI_VCRUNTIME)
155#ifndef _LIBCPP_CXX03_LANG160#ifndef _LIBCPP_CXX03_LANG
156enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };161enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
157#else162#else
...@@ -159,6 +164,15 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };...@@ -159,6 +164,15 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
159#endif164#endif
160#endif165#endif
161166
167#if _LIBCPP_STD_VER > 17
168// Enable the declaration even if the compiler doesn't support the language
169// feature.
170struct destroying_delete_t {
171 explicit destroying_delete_t() = default;
172};
173_LIBCPP_INLINE_VAR constexpr destroying_delete_t destroying_delete{};
174#endif // _LIBCPP_STD_VER > 17
175
162} // std176} // std
163177
164#if defined(_LIBCPP_CXX03_LANG)178#if defined(_LIBCPP_CXX03_LANG)
...@@ -167,10 +181,10 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };...@@ -167,10 +181,10 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
167#define _THROW_BAD_ALLOC181#define _THROW_BAD_ALLOC
168#endif182#endif
169183
170#if !defined(_LIBCPP_DEFER_NEW_TO_VCRUNTIME)184#if !defined(_LIBCPP_ABI_VCRUNTIME)
171185
172_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;186_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
173_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;187_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
174_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;188_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
175_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;189_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
176#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION190#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
...@@ -178,7 +192,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato...@@ -178,7 +192,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
178#endif192#endif
179193
180_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;194_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
181_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;195_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
182_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;196_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
183_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;197_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
184#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION198#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
...@@ -187,7 +201,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato...@@ -187,7 +201,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
187201
188#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION202#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
189_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;203_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
190_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;204_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
191_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;205_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
192_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;206_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
193#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION207#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
...@@ -195,7 +209,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato...@@ -195,7 +209,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operato
195#endif209#endif
196210
197_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;211_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
198_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;212_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
199_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;213_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
200_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;214_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
201#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION215#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
...@@ -208,7 +222,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator ne...@@ -208,7 +222,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator ne
208inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}222inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
209inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}223inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
210224
211#endif // !_LIBCPP_DEFER_NEW_TO_VCRUNTIME225#endif // !_LIBCPP_ABI_VCRUNTIME
212226
213_LIBCPP_BEGIN_NAMESPACE_STD227_LIBCPP_BEGIN_NAMESPACE_STD
214228
lib/libcxx/include/numeric+73-11
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- numeric ---------------------------------===//2//===---------------------------- numeric ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -134,6 +133,10 @@ template <class M, class N>...@@ -134,6 +133,10 @@ template <class M, class N>
134template <class M, class N>133template <class M, class N>
135 constexpr common_type_t<M,N> lcm(M m, N n); // C++17134 constexpr common_type_t<M,N> lcm(M m, N n); // C++17
136135
136integer midpoint(integer a, integer b); // C++20
137pointer midpoint(pointer a, pointer b); // C++20
138floating_point midpoint(floating_point a, floating_point b); // C++20
139
137} // std140} // std
138141
139*/142*/
...@@ -142,6 +145,7 @@ template <class M, class N>...@@ -142,6 +145,7 @@ template <class M, class N>
142#include <iterator>145#include <iterator>
143#include <limits> // for numeric_limits146#include <limits> // for numeric_limits
144#include <functional>147#include <functional>
148#include <cmath> // for isnormal
145#include <version>149#include <version>
146150
147#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)151#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
...@@ -456,10 +460,10 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)...@@ -456,10 +460,10 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
456460
457461
458#if _LIBCPP_STD_VER > 14462#if _LIBCPP_STD_VER > 14
459template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;463template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
460464
461template <typename _Result, typename _Source>465template <typename _Result, typename _Source>
462struct __abs<_Result, _Source, true> {466struct __ct_abs<_Result, _Source, true> {
463 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY467 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
464 _Result operator()(_Source __t) const noexcept468 _Result operator()(_Source __t) const noexcept
465 {469 {
...@@ -470,7 +474,7 @@ struct __abs<_Result, _Source, true> {...@@ -470,7 +474,7 @@ struct __abs<_Result, _Source, true> {
470};474};
471475
472template <typename _Result, typename _Source>476template <typename _Result, typename _Source>
473struct __abs<_Result, _Source, false> {477struct __ct_abs<_Result, _Source, false> {
474 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY478 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
475 _Result operator()(_Source __t) const noexcept { return __t; }479 _Result operator()(_Source __t) const noexcept { return __t; }
476};480};
...@@ -496,8 +500,8 @@ gcd(_Tp __m, _Up __n)...@@ -496,8 +500,8 @@ gcd(_Tp __m, _Up __n)
496 using _Rp = common_type_t<_Tp,_Up>;500 using _Rp = common_type_t<_Tp,_Up>;
497 using _Wp = make_unsigned_t<_Rp>;501 using _Wp = make_unsigned_t<_Rp>;
498 return static_cast<_Rp>(_VSTD::__gcd(502 return static_cast<_Rp>(_VSTD::__gcd(
499 static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),503 static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)),
500 static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));504 static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
501}505}
502506
503template<class _Tp, class _Up>507template<class _Tp, class _Up>
...@@ -512,14 +516,72 @@ lcm(_Tp __m, _Up __n)...@@ -512,14 +516,72 @@ lcm(_Tp __m, _Up __n)
512 return 0;516 return 0;
513517
514 using _Rp = common_type_t<_Tp,_Up>;518 using _Rp = common_type_t<_Tp,_Up>;
515 _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);519 _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n);
516 _Rp __val2 = __abs<_Rp, _Up>()(__n);520 _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
517 _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");521 _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
518 return __val1 * __val2;522 return __val1 * __val2;
519}523}
520524
521#endif /* _LIBCPP_STD_VER > 14 */525#endif /* _LIBCPP_STD_VER > 14 */
522526
527#if _LIBCPP_STD_VER > 17
528template <class _Tp>
529_LIBCPP_INLINE_VISIBILITY constexpr
530enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
531midpoint(_Tp __a, _Tp __b) noexcept
532_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
533{
534 using _Up = std::make_unsigned_t<_Tp>;
535
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);
546}
547
548
549template <class _TPtr>
550_LIBCPP_INLINE_VISIBILITY constexpr
551enable_if_t<is_pointer_v<_TPtr>
552 && is_object_v<remove_pointer_t<_TPtr>>
553 && ! is_void_v<remove_pointer_t<_TPtr>>
554 && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr>
555midpoint(_TPtr __a, _TPtr __b) noexcept
556{
557 return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a);
558}
559
560
561template <typename _Tp>
562constexpr int __sign(_Tp __val) {
563 return (_Tp(0) < __val) - (__val < _Tp(0));
564}
565
566template <typename _Fp>
567constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; }
568
569template <class _Fp>
570_LIBCPP_INLINE_VISIBILITY constexpr
571enable_if_t<is_floating_point_v<_Fp>, _Fp>
572midpoint(_Fp __a, _Fp __b) noexcept
573{
574 constexpr _Fp __lo = numeric_limits<_Fp>::min()*2;
575 constexpr _Fp __hi = numeric_limits<_Fp>::max()/2;
576 return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible
577 (__a + __b)/2 : // always correctly rounded
578 __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
580 __a/2 + __b/2; // otherwise correctly rounded
581}
582
583#endif // _LIBCPP_STD_VER > 17
584
523_LIBCPP_END_NAMESPACE_STD585_LIBCPP_END_NAMESPACE_STD
524586
525_LIBCPP_POP_MACROS587_LIBCPP_POP_MACROS
lib/libcxx/include/optional+60-54
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- optional ----------------------------------===//2//===-------------------------- optional ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -593,7 +592,7 @@ public:...@@ -593,7 +592,7 @@ public:
593592
594private:593private:
595 // Disable the reference extension using this static assert.594 // Disable the reference extension using this static assert.
596 static_assert(!is_same_v<value_type, in_place_t>,595 static_assert(!is_same_v<__uncvref_t<value_type>, in_place_t>,
597 "instantiation of optional with in_place_t is ill-formed");596 "instantiation of optional with in_place_t is ill-formed");
598 static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>,597 static_assert(!is_same_v<__uncvref_t<value_type>, nullopt_t>,
599 "instantiation of optional with nullopt_t is ill-formed");598 "instantiation of optional with nullopt_t is ill-formed");
...@@ -601,6 +600,8 @@ private:...@@ -601,6 +600,8 @@ private:
601 "instantiation of optional with a reference type is ill-formed");600 "instantiation of optional with a reference type is ill-formed");
602 static_assert(is_destructible_v<value_type>,601 static_assert(is_destructible_v<value_type>,
603 "instantiation of optional with a non-destructible type is ill-formed");602 "instantiation of optional with a non-destructible type is ill-formed");
603 static_assert(!is_array_v<value_type>,
604 "instantiation of optional with an array type is ill-formed");
604605
605 // LWG2756: conditionally explicit conversion from _Up606 // LWG2756: conditionally explicit conversion from _Up
606 struct _CheckOptionalArgsConstructor {607 struct _CheckOptionalArgsConstructor {
...@@ -617,16 +618,16 @@ private:...@@ -617,16 +618,16 @@ private:
617 }618 }
618 };619 };
619 template <class _Up>620 template <class _Up>
620 using _CheckOptionalArgsCtor = conditional_t<621 using _CheckOptionalArgsCtor = _If<
621 !is_same_v<__uncvref_t<_Up>, in_place_t> &&622 _IsNotSame<__uncvref_t<_Up>, in_place_t>::value &&
622 !is_same_v<__uncvref_t<_Up>, optional>,623 _IsNotSame<__uncvref_t<_Up>, optional>::value,
623 _CheckOptionalArgsConstructor,624 _CheckOptionalArgsConstructor,
624 __check_tuple_constructor_fail625 __check_tuple_constructor_fail
625 >;626 >;
626 template <class _QualUp>627 template <class _QualUp>
627 struct _CheckOptionalLikeConstructor {628 struct _CheckOptionalLikeConstructor {
628 template <class _Up, class _Opt = optional<_Up>>629 template <class _Up, class _Opt = optional<_Up>>
629 using __check_constructible_from_opt = __lazy_or<630 using __check_constructible_from_opt = _Or<
630 is_constructible<_Tp, _Opt&>,631 is_constructible<_Tp, _Opt&>,
631 is_constructible<_Tp, _Opt const&>,632 is_constructible<_Tp, _Opt const&>,
632 is_constructible<_Tp, _Opt&&>,633 is_constructible<_Tp, _Opt&&>,
...@@ -637,7 +638,7 @@ private:...@@ -637,7 +638,7 @@ private:
637 is_convertible<_Opt const&&, _Tp>638 is_convertible<_Opt const&&, _Tp>
638 >;639 >;
639 template <class _Up, class _Opt = optional<_Up>>640 template <class _Up, class _Opt = optional<_Up>>
640 using __check_assignable_from_opt = __lazy_or<641 using __check_assignable_from_opt = _Or<
641 is_assignable<_Tp&, _Opt&>,642 is_assignable<_Tp&, _Opt&>,
642 is_assignable<_Tp&, _Opt const&>,643 is_assignable<_Tp&, _Opt const&>,
643 is_assignable<_Tp&, _Opt&&>,644 is_assignable<_Tp&, _Opt&&>,
...@@ -663,18 +664,18 @@ private:...@@ -663,18 +664,18 @@ private:
663 };664 };
664665
665 template <class _Up, class _QualUp>666 template <class _Up, class _QualUp>
666 using _CheckOptionalLikeCtor = conditional_t<667 using _CheckOptionalLikeCtor = _If<
667 __lazy_and<668 _And<
668 __lazy_not<is_same<_Up, _Tp>>,669 _IsNotSame<_Up, _Tp>,
669 is_constructible<_Tp, _QualUp>670 is_constructible<_Tp, _QualUp>
670 >::value,671 >::value,
671 _CheckOptionalLikeConstructor<_QualUp>,672 _CheckOptionalLikeConstructor<_QualUp>,
672 __check_tuple_constructor_fail673 __check_tuple_constructor_fail
673 >;674 >;
674 template <class _Up, class _QualUp>675 template <class _Up, class _QualUp>
675 using _CheckOptionalLikeAssign = conditional_t<676 using _CheckOptionalLikeAssign = _If<
676 __lazy_and<677 _And<
677 __lazy_not<is_same<_Up, _Tp>>,678 _IsNotSame<_Up, _Tp>,
678 is_constructible<_Tp, _QualUp>,679 is_constructible<_Tp, _QualUp>,
679 is_assignable<_Tp&, _QualUp>680 is_assignable<_Tp&, _QualUp>
680 >::value,681 >::value,
...@@ -688,28 +689,32 @@ public:...@@ -688,28 +689,32 @@ public:
688 _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;689 _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
689 _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}690 _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
690691
691 template <class... _Args, class = enable_if_t<692 template <class _InPlaceT, class... _Args, class = _EnableIf<
692 is_constructible_v<value_type, _Args...>>693 _And<
694 _IsSame<_InPlaceT, in_place_t>,
695 is_constructible<value_type, _Args...>
696 >::value
697 >
693 >698 >
694 _LIBCPP_INLINE_VISIBILITY699 _LIBCPP_INLINE_VISIBILITY
695 constexpr explicit optional(in_place_t, _Args&&... __args)700 constexpr explicit optional(_InPlaceT, _Args&&... __args)
696 : __base(in_place, _VSTD::forward<_Args>(__args)...) {}701 : __base(in_place, _VSTD::forward<_Args>(__args)...) {}
697702
698 template <class _Up, class... _Args, class = enable_if_t<703 template <class _Up, class... _Args, class = _EnableIf<
699 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>704 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
700 >705 >
701 _LIBCPP_INLINE_VISIBILITY706 _LIBCPP_INLINE_VISIBILITY
702 constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)707 constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
703 : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}708 : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
704709
705 template <class _Up = value_type, enable_if_t<710 template <class _Up = value_type, _EnableIf<
706 _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()711 _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
707 , int> = 0>712 , int> = 0>
708 _LIBCPP_INLINE_VISIBILITY713 _LIBCPP_INLINE_VISIBILITY
709 constexpr optional(_Up&& __v)714 constexpr optional(_Up&& __v)
710 : __base(in_place, _VSTD::forward<_Up>(__v)) {}715 : __base(in_place, _VSTD::forward<_Up>(__v)) {}
711716
712 template <class _Up, enable_if_t<717 template <class _Up, _EnableIf<
713 _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()718 _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
714 , int> = 0>719 , int> = 0>
715 _LIBCPP_INLINE_VISIBILITY720 _LIBCPP_INLINE_VISIBILITY
...@@ -717,7 +722,7 @@ public:...@@ -717,7 +722,7 @@ public:
717 : __base(in_place, _VSTD::forward<_Up>(__v)) {}722 : __base(in_place, _VSTD::forward<_Up>(__v)) {}
718723
719 // LWG2756: conditionally explicit conversion from const optional<_Up>&724 // LWG2756: conditionally explicit conversion from const optional<_Up>&
720 template <class _Up, enable_if_t<725 template <class _Up, _EnableIf<
721 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()726 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
722 , int> = 0>727 , int> = 0>
723 _LIBCPP_INLINE_VISIBILITY728 _LIBCPP_INLINE_VISIBILITY
...@@ -725,7 +730,7 @@ public:...@@ -725,7 +730,7 @@ public:
725 {730 {
726 this->__construct_from(__v);731 this->__construct_from(__v);
727 }732 }
728 template <class _Up, enable_if_t<733 template <class _Up, _EnableIf<
729 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()734 _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
730 , int> = 0>735 , int> = 0>
731 _LIBCPP_INLINE_VISIBILITY736 _LIBCPP_INLINE_VISIBILITY
...@@ -735,7 +740,7 @@ public:...@@ -735,7 +740,7 @@ public:
735 }740 }
736741
737 // LWG2756: conditionally explicit conversion from optional<_Up>&&742 // LWG2756: conditionally explicit conversion from optional<_Up>&&
738 template <class _Up, enable_if_t<743 template <class _Up, _EnableIf<
739 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()744 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
740 , int> = 0>745 , int> = 0>
741 _LIBCPP_INLINE_VISIBILITY746 _LIBCPP_INLINE_VISIBILITY
...@@ -743,7 +748,7 @@ public:...@@ -743,7 +748,7 @@ public:
743 {748 {
744 this->__construct_from(_VSTD::move(__v));749 this->__construct_from(_VSTD::move(__v));
745 }750 }
746 template <class _Up, enable_if_t<751 template <class _Up, _EnableIf<
747 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()752 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
748 , int> = 0>753 , int> = 0>
749 _LIBCPP_INLINE_VISIBILITY754 _LIBCPP_INLINE_VISIBILITY
...@@ -764,11 +769,12 @@ public:...@@ -764,11 +769,12 @@ public:
764769
765 // LWG2756770 // LWG2756
766 template <class _Up = value_type,771 template <class _Up = value_type,
767 class = enable_if_t772 class = _EnableIf<
768 <__lazy_and<773 _And<
769 integral_constant<bool,774 _IsNotSame<__uncvref_t<_Up>, optional>,
770 !is_same_v<__uncvref_t<_Up>, optional> &&775 _Or<
771 !(is_same_v<_Up, value_type> && is_scalar_v<value_type>)776 _IsNotSame<__uncvref_t<_Up>, value_type>,
777 _Not<is_scalar<value_type>>
772 >,778 >,
773 is_constructible<value_type, _Up>,779 is_constructible<value_type, _Up>,
774 is_assignable<value_type&, _Up>780 is_assignable<value_type&, _Up>
...@@ -786,7 +792,7 @@ public:...@@ -786,7 +792,7 @@ public:
786 }792 }
787793
788 // LWG2756794 // LWG2756
789 template <class _Up, enable_if_t<795 template <class _Up, _EnableIf<
790 _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()796 _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
791 , int> = 0>797 , int> = 0>
792 _LIBCPP_INLINE_VISIBILITY798 _LIBCPP_INLINE_VISIBILITY
...@@ -798,7 +804,7 @@ public:...@@ -798,7 +804,7 @@ public:
798 }804 }
799805
800 // LWG2756806 // LWG2756
801 template <class _Up, enable_if_t<807 template <class _Up, _EnableIf<
802 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()808 _CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
803 , int> = 0>809 , int> = 0>
804 _LIBCPP_INLINE_VISIBILITY810 _LIBCPP_INLINE_VISIBILITY
...@@ -810,7 +816,7 @@ public:...@@ -810,7 +816,7 @@ public:
810 }816 }
811817
812 template <class... _Args,818 template <class... _Args,
813 class = enable_if_t819 class = _EnableIf
814 <820 <
815 is_constructible_v<value_type, _Args...>821 is_constructible_v<value_type, _Args...>
816 >822 >
...@@ -825,7 +831,7 @@ public:...@@ -825,7 +831,7 @@ public:
825 }831 }
826832
827 template <class _Up, class... _Args,833 template <class _Up, class... _Args,
828 class = enable_if_t834 class = _EnableIf
829 <835 <
830 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>836 is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
831 >837 >
...@@ -1021,7 +1027,7 @@ template<class T>...@@ -1021,7 +1027,7 @@ template<class T>
1021// Comparisons between optionals1027// Comparisons between optionals
1022template <class _Tp, class _Up>1028template <class _Tp, class _Up>
1023_LIBCPP_INLINE_VISIBILITY constexpr1029_LIBCPP_INLINE_VISIBILITY constexpr
1024enable_if_t<1030_EnableIf<
1025 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==1031 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
1026 _VSTD::declval<const _Up&>()), bool>,1032 _VSTD::declval<const _Up&>()), bool>,
1027 bool1033 bool
...@@ -1037,7 +1043,7 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y)...@@ -1037,7 +1043,7 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
10371043
1038template <class _Tp, class _Up>1044template <class _Tp, class _Up>
1039_LIBCPP_INLINE_VISIBILITY constexpr1045_LIBCPP_INLINE_VISIBILITY constexpr
1040enable_if_t<1046_EnableIf<
1041 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=1047 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
1042 _VSTD::declval<const _Up&>()), bool>,1048 _VSTD::declval<const _Up&>()), bool>,
1043 bool1049 bool
...@@ -1053,7 +1059,7 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)...@@ -1053,7 +1059,7 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
10531059
1054template <class _Tp, class _Up>1060template <class _Tp, class _Up>
1055_LIBCPP_INLINE_VISIBILITY constexpr1061_LIBCPP_INLINE_VISIBILITY constexpr
1056enable_if_t<1062_EnableIf<
1057 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <1063 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
1058 _VSTD::declval<const _Up&>()), bool>,1064 _VSTD::declval<const _Up&>()), bool>,
1059 bool1065 bool
...@@ -1069,7 +1075,7 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y)...@@ -1069,7 +1075,7 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
10691075
1070template <class _Tp, class _Up>1076template <class _Tp, class _Up>
1071_LIBCPP_INLINE_VISIBILITY constexpr1077_LIBCPP_INLINE_VISIBILITY constexpr
1072enable_if_t<1078_EnableIf<
1073 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >1079 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
1074 _VSTD::declval<const _Up&>()), bool>,1080 _VSTD::declval<const _Up&>()), bool>,
1075 bool1081 bool
...@@ -1085,7 +1091,7 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y)...@@ -1085,7 +1091,7 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
10851091
1086template <class _Tp, class _Up>1092template <class _Tp, class _Up>
1087_LIBCPP_INLINE_VISIBILITY constexpr1093_LIBCPP_INLINE_VISIBILITY constexpr
1088enable_if_t<1094_EnableIf<
1089 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=1095 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
1090 _VSTD::declval<const _Up&>()), bool>,1096 _VSTD::declval<const _Up&>()), bool>,
1091 bool1097 bool
...@@ -1101,7 +1107,7 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)...@@ -1101,7 +1107,7 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
11011107
1102template <class _Tp, class _Up>1108template <class _Tp, class _Up>
1103_LIBCPP_INLINE_VISIBILITY constexpr1109_LIBCPP_INLINE_VISIBILITY constexpr
1104enable_if_t<1110_EnableIf<
1105 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=1111 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
1106 _VSTD::declval<const _Up&>()), bool>,1112 _VSTD::declval<const _Up&>()), bool>,
1107 bool1113 bool
...@@ -1215,7 +1221,7 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept...@@ -1215,7 +1221,7 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
1215// Comparisons with T1221// Comparisons with T
1216template <class _Tp, class _Up>1222template <class _Tp, class _Up>
1217_LIBCPP_INLINE_VISIBILITY constexpr1223_LIBCPP_INLINE_VISIBILITY constexpr
1218enable_if_t<1224_EnableIf<
1219 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==1225 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
1220 _VSTD::declval<const _Up&>()), bool>,1226 _VSTD::declval<const _Up&>()), bool>,
1221 bool1227 bool
...@@ -1227,7 +1233,7 @@ operator==(const optional<_Tp>& __x, const _Up& __v)...@@ -1227,7 +1233,7 @@ operator==(const optional<_Tp>& __x, const _Up& __v)
12271233
1228template <class _Tp, class _Up>1234template <class _Tp, class _Up>
1229_LIBCPP_INLINE_VISIBILITY constexpr1235_LIBCPP_INLINE_VISIBILITY constexpr
1230enable_if_t<1236_EnableIf<
1231 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==1237 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
1232 _VSTD::declval<const _Up&>()), bool>,1238 _VSTD::declval<const _Up&>()), bool>,
1233 bool1239 bool
...@@ -1239,7 +1245,7 @@ operator==(const _Tp& __v, const optional<_Up>& __x)...@@ -1239,7 +1245,7 @@ operator==(const _Tp& __v, const optional<_Up>& __x)
12391245
1240template <class _Tp, class _Up>1246template <class _Tp, class _Up>
1241_LIBCPP_INLINE_VISIBILITY constexpr1247_LIBCPP_INLINE_VISIBILITY constexpr
1242enable_if_t<1248_EnableIf<
1243 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=1249 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
1244 _VSTD::declval<const _Up&>()), bool>,1250 _VSTD::declval<const _Up&>()), bool>,
1245 bool1251 bool
...@@ -1251,7 +1257,7 @@ operator!=(const optional<_Tp>& __x, const _Up& __v)...@@ -1251,7 +1257,7 @@ operator!=(const optional<_Tp>& __x, const _Up& __v)
12511257
1252template <class _Tp, class _Up>1258template <class _Tp, class _Up>
1253_LIBCPP_INLINE_VISIBILITY constexpr1259_LIBCPP_INLINE_VISIBILITY constexpr
1254enable_if_t<1260_EnableIf<
1255 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=1261 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
1256 _VSTD::declval<const _Up&>()), bool>,1262 _VSTD::declval<const _Up&>()), bool>,
1257 bool1263 bool
...@@ -1263,7 +1269,7 @@ operator!=(const _Tp& __v, const optional<_Up>& __x)...@@ -1263,7 +1269,7 @@ operator!=(const _Tp& __v, const optional<_Up>& __x)
12631269
1264template <class _Tp, class _Up>1270template <class _Tp, class _Up>
1265_LIBCPP_INLINE_VISIBILITY constexpr1271_LIBCPP_INLINE_VISIBILITY constexpr
1266enable_if_t<1272_EnableIf<
1267 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <1273 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
1268 _VSTD::declval<const _Up&>()), bool>,1274 _VSTD::declval<const _Up&>()), bool>,
1269 bool1275 bool
...@@ -1275,7 +1281,7 @@ operator<(const optional<_Tp>& __x, const _Up& __v)...@@ -1275,7 +1281,7 @@ operator<(const optional<_Tp>& __x, const _Up& __v)
12751281
1276template <class _Tp, class _Up>1282template <class _Tp, class _Up>
1277_LIBCPP_INLINE_VISIBILITY constexpr1283_LIBCPP_INLINE_VISIBILITY constexpr
1278enable_if_t<1284_EnableIf<
1279 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <1285 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
1280 _VSTD::declval<const _Up&>()), bool>,1286 _VSTD::declval<const _Up&>()), bool>,
1281 bool1287 bool
...@@ -1287,7 +1293,7 @@ operator<(const _Tp& __v, const optional<_Up>& __x)...@@ -1287,7 +1293,7 @@ operator<(const _Tp& __v, const optional<_Up>& __x)
12871293
1288template <class _Tp, class _Up>1294template <class _Tp, class _Up>
1289_LIBCPP_INLINE_VISIBILITY constexpr1295_LIBCPP_INLINE_VISIBILITY constexpr
1290enable_if_t<1296_EnableIf<
1291 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=1297 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
1292 _VSTD::declval<const _Up&>()), bool>,1298 _VSTD::declval<const _Up&>()), bool>,
1293 bool1299 bool
...@@ -1299,7 +1305,7 @@ operator<=(const optional<_Tp>& __x, const _Up& __v)...@@ -1299,7 +1305,7 @@ operator<=(const optional<_Tp>& __x, const _Up& __v)
12991305
1300template <class _Tp, class _Up>1306template <class _Tp, class _Up>
1301_LIBCPP_INLINE_VISIBILITY constexpr1307_LIBCPP_INLINE_VISIBILITY constexpr
1302enable_if_t<1308_EnableIf<
1303 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=1309 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
1304 _VSTD::declval<const _Up&>()), bool>,1310 _VSTD::declval<const _Up&>()), bool>,
1305 bool1311 bool
...@@ -1311,7 +1317,7 @@ operator<=(const _Tp& __v, const optional<_Up>& __x)...@@ -1311,7 +1317,7 @@ operator<=(const _Tp& __v, const optional<_Up>& __x)
13111317
1312template <class _Tp, class _Up>1318template <class _Tp, class _Up>
1313_LIBCPP_INLINE_VISIBILITY constexpr1319_LIBCPP_INLINE_VISIBILITY constexpr
1314enable_if_t<1320_EnableIf<
1315 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >1321 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
1316 _VSTD::declval<const _Up&>()), bool>,1322 _VSTD::declval<const _Up&>()), bool>,
1317 bool1323 bool
...@@ -1323,7 +1329,7 @@ operator>(const optional<_Tp>& __x, const _Up& __v)...@@ -1323,7 +1329,7 @@ operator>(const optional<_Tp>& __x, const _Up& __v)
13231329
1324template <class _Tp, class _Up>1330template <class _Tp, class _Up>
1325_LIBCPP_INLINE_VISIBILITY constexpr1331_LIBCPP_INLINE_VISIBILITY constexpr
1326enable_if_t<1332_EnableIf<
1327 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >1333 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
1328 _VSTD::declval<const _Up&>()), bool>,1334 _VSTD::declval<const _Up&>()), bool>,
1329 bool1335 bool
...@@ -1335,7 +1341,7 @@ operator>(const _Tp& __v, const optional<_Up>& __x)...@@ -1335,7 +1341,7 @@ operator>(const _Tp& __v, const optional<_Up>& __x)
13351341
1336template <class _Tp, class _Up>1342template <class _Tp, class _Up>
1337_LIBCPP_INLINE_VISIBILITY constexpr1343_LIBCPP_INLINE_VISIBILITY constexpr
1338enable_if_t<1344_EnableIf<
1339 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=1345 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
1340 _VSTD::declval<const _Up&>()), bool>,1346 _VSTD::declval<const _Up&>()), bool>,
1341 bool1347 bool
...@@ -1347,7 +1353,7 @@ operator>=(const optional<_Tp>& __x, const _Up& __v)...@@ -1347,7 +1353,7 @@ operator>=(const optional<_Tp>& __x, const _Up& __v)
13471353
1348template <class _Tp, class _Up>1354template <class _Tp, class _Up>
1349_LIBCPP_INLINE_VISIBILITY constexpr1355_LIBCPP_INLINE_VISIBILITY constexpr
1350enable_if_t<1356_EnableIf<
1351 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=1357 is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
1352 _VSTD::declval<const _Up&>()), bool>,1358 _VSTD::declval<const _Up&>()), bool>,
1353 bool1359 bool
...@@ -1360,7 +1366,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x)...@@ -1360,7 +1366,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x)
13601366
1361template <class _Tp>1367template <class _Tp>
1362inline _LIBCPP_INLINE_VISIBILITY1368inline _LIBCPP_INLINE_VISIBILITY
1363enable_if_t<1369_EnableIf<
1364 is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,1370 is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
1365 void1371 void
1366>1372>
lib/libcxx/include/ostream+8-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- ostream -----------------------------------===//2//===-------------------------- ostream -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -57,6 +56,7 @@ public:...@@ -57,6 +56,7 @@ public:
57 basic_ostream& operator<<(long double f);56 basic_ostream& operator<<(long double f);
58 basic_ostream& operator<<(const void* p);57 basic_ostream& operator<<(const void* p);
59 basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);58 basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb);
59 basic_ostream& operator<<(nullptr_t);
6060
61 // 27.7.2.7 Unformatted output:61 // 27.7.2.7 Unformatted output:
62 basic_ostream& put(char_type c);62 basic_ostream& put(char_type c);
...@@ -219,6 +219,10 @@ public:...@@ -219,6 +219,10 @@ public:
219 basic_ostream& operator<<(const void* __p);219 basic_ostream& operator<<(const void* __p);
220 basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);220 basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
221221
222 _LIBCPP_INLINE_VISIBILITY
223 basic_ostream& operator<<(nullptr_t)
224 { return *this << "nullptr"; }
225
222 // 27.7.2.7 Unformatted output:226 // 27.7.2.7 Unformatted output:
223 basic_ostream& put(char_type __c);227 basic_ostream& put(char_type __c);
224 basic_ostream& write(const char_type* __s, streamsize __n);228 basic_ostream& write(const char_type* __s, streamsize __n);
lib/libcxx/include/queue+13-14
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- queue ------------------------------------===//2//===--------------------------- queue ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -71,8 +70,8 @@ public:...@@ -71,8 +70,8 @@ public:
7170
72template<class Container>71template<class Container>
73 queue(Container) -> queue<typename Container::value_type, Container>; // C++1772 queue(Container) -> queue<typename Container::value_type, Container>; // C++17
74 73
75template<class Container, class Allocator> 74template<class Container, class Allocator>
76 queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++1775 queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
7776
78template <class T, class Container>77template <class T, class Container>
...@@ -166,13 +165,13 @@ public:...@@ -166,13 +165,13 @@ public:
166template <class Compare, class Container>165template <class Compare, class Container>
167priority_queue(Compare, Container)166priority_queue(Compare, Container)
168 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17167 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
169 168
170template<class InputIterator, 169template<class InputIterator,
171 class Compare = less<typename iterator_traits<InputIterator>::value_type>,170 class Compare = less<typename iterator_traits<InputIterator>::value_type>,
172 class Container = vector<typename iterator_traits<InputIterator>::value_type>>171 class Container = vector<typename iterator_traits<InputIterator>::value_type>>
173priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())172priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
174 -> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17173 -> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17
175 174
176template<class Compare, class Container, class Allocator>175template<class Compare, class Container, class Allocator>
177priority_queue(Compare, Container, Allocator)176priority_queue(Compare, Container, Allocator)
178 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17177 -> priority_queue<typename Container::value_type, Container, Compare>; // C++17
...@@ -347,7 +346,7 @@ template<class _Container,...@@ -347,7 +346,7 @@ template<class _Container,
347>346>
348queue(_Container)347queue(_Container)
349 -> queue<typename _Container::value_type, _Container>;348 -> queue<typename _Container::value_type, _Container>;
350 349
351template<class _Container,350template<class _Container,
352 class _Alloc,351 class _Alloc,
353 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,352 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
...@@ -559,8 +558,8 @@ template <class _Compare,...@@ -559,8 +558,8 @@ template <class _Compare,
559>558>
560priority_queue(_Compare, _Container)559priority_queue(_Compare, _Container)
561 -> priority_queue<typename _Container::value_type, _Container, _Compare>;560 -> priority_queue<typename _Container::value_type, _Container, _Compare>;
562 561
563template<class _InputIterator, 562template<class _InputIterator,
564 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,563 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
565 class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,564 class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
566 class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,565 class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,
...@@ -569,8 +568,8 @@ template<class _InputIterator,...@@ -569,8 +568,8 @@ template<class _InputIterator,
569>568>
570priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())569priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
571 -> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;570 -> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
572 571
573template<class _Compare, 572template<class _Compare,
574 class _Container,573 class _Container,
575 class _Alloc,574 class _Alloc,
576 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,575 class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
lib/libcxx/include/random+11-12
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- random -----------------------------------===//2//===--------------------------- random -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -2227,19 +2226,19 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,...@@ -2227,19 +2226,19 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2227template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2226template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2228 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2227 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2229 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2228 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2230 _LIBCPP_CONSTEXPR const size_t 2229 _LIBCPP_CONSTEXPR const size_t
2231 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;2230 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
22322231
2233template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2232template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2234 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2233 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2235 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2234 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2236 _LIBCPP_CONSTEXPR const size_t 2235 _LIBCPP_CONSTEXPR const size_t
2237 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;2236 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
22382237
2239template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2238template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2240 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2239 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2241 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2240 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2242 _LIBCPP_CONSTEXPR const size_t 2241 _LIBCPP_CONSTEXPR const size_t
2243 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;2242 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
22442243
2245template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2244template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
...@@ -2251,7 +2250,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,...@@ -2251,7 +2250,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2251template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2250template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2252 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2251 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2253 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2252 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2254 _LIBCPP_CONSTEXPR const size_t 2253 _LIBCPP_CONSTEXPR const size_t
2255 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;2254 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
22562255
2257template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2256template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
...@@ -2263,7 +2262,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,...@@ -2263,7 +2262,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2263template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2262template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2264 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2263 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2265 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2264 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2266 _LIBCPP_CONSTEXPR const size_t 2265 _LIBCPP_CONSTEXPR const size_t
2267 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;2266 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
22682267
2269template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2268template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
...@@ -2275,7 +2274,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,...@@ -2275,7 +2274,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2275template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2274template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2276 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2275 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2277 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2276 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2278 _LIBCPP_CONSTEXPR const size_t 2277 _LIBCPP_CONSTEXPR const size_t
2279 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;2278 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
22802279
2281template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2280template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
...@@ -2287,7 +2286,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,...@@ -2287,7 +2286,7 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2287template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2286template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
2288 _UIntType __a, size_t __u, _UIntType __d, size_t __s,2287 _UIntType __a, size_t __u, _UIntType __d, size_t __s,
2289 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>2288 _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
2290 _LIBCPP_CONSTEXPR const size_t 2289 _LIBCPP_CONSTEXPR const size_t
2291 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;2290 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
22922291
2293template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,2292template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
...@@ -6427,7 +6426,7 @@ public:...@@ -6427,7 +6426,7 @@ public:
6427 param_type(size_t __nw, result_type __xmin, result_type __xmax,6426 param_type(size_t __nw, result_type __xmin, result_type __xmax,
6428 _UnaryOperation __fw);6427 _UnaryOperation __fw);
6429 param_type & operator=(const param_type& __rhs);6428 param_type & operator=(const param_type& __rhs);
6430 6429
6431 _LIBCPP_INLINE_VISIBILITY6430 _LIBCPP_INLINE_VISIBILITY
6432 vector<result_type> intervals() const {return __b_;}6431 vector<result_type> intervals() const {return __b_;}
6433 _LIBCPP_INLINE_VISIBILITY6432 _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/ratio+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- ratio -----------------------------------===//2//===---------------------------- ratio -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/regex+89-46
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- regex ------------------------------------===//2//===--------------------------- regex ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -678,7 +677,7 @@ public:...@@ -678,7 +677,7 @@ public:
678 regex_constants::match_flag_type m = regex_constants::match_default);677 regex_constants::match_flag_type m = regex_constants::match_default);
679 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,678 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
680 const regex_type&& __re,679 const regex_type&& __re,
681 regex_constants::match_flag_type __m 680 regex_constants::match_flag_type __m
682 = regex_constants::match_default) = delete; // C++14681 = regex_constants::match_default) = delete; // C++14
683 regex_iterator(const regex_iterator&);682 regex_iterator(const regex_iterator&);
684 regex_iterator& operator=(const regex_iterator&);683 regex_iterator& operator=(const regex_iterator&);
...@@ -794,7 +793,11 @@ enum syntax_option_type...@@ -794,7 +793,11 @@ enum syntax_option_type
794 nosubs = 1 << 1,793 nosubs = 1 << 1,
795 optimize = 1 << 2,794 optimize = 1 << 2,
796 collate = 1 << 3,795 collate = 1 << 3,
796#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
797 ECMAScript = 1 << 9,
798#else
797 ECMAScript = 0,799 ECMAScript = 0,
800#endif
798 basic = 1 << 4,801 basic = 1 << 4,
799 extended = 1 << 5,802 extended = 1 << 5,
800 awk = 1 << 6,803 awk = 1 << 6,
...@@ -802,6 +805,16 @@ enum syntax_option_type...@@ -802,6 +805,16 @@ enum syntax_option_type
802 egrep = 1 << 8805 egrep = 1 << 8
803};806};
804807
808inline _LIBCPP_CONSTEXPR
809syntax_option_type __get_grammar(syntax_option_type __g)
810{
811#ifdef _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
812 return static_cast<syntax_option_type>(__g & 0x3F0);
813#else
814 return static_cast<syntax_option_type>(__g & 0x1F0);
815#endif
816}
817
805inline _LIBCPP_INLINE_VISIBILITY818inline _LIBCPP_INLINE_VISIBILITY
806_LIBCPP_CONSTEXPR819_LIBCPP_CONSTEXPR
807syntax_option_type820syntax_option_type
...@@ -988,16 +1001,7 @@ public:...@@ -988,16 +1001,7 @@ public:
988 typedef locale locale_type;1001 typedef locale locale_type;
989 typedef ctype_base::mask char_class_type;1002 typedef ctype_base::mask char_class_type;
9901003
991#if defined(__mips__) && defined(__GLIBC__)1004 static const char_class_type __regex_word = ctype_base::__regex_word;
992 static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
993#elif defined(__NetBSD__)
994 // NetBSD defines classes up to 0x2000
995 // see sys/ctype_bits.h, _CTYPE_Q
996 static const char_class_type __regex_word = 0x8000;
997#else
998 static const char_class_type __regex_word = 0x80;
999#endif
1000
1001private:1005private:
1002 locale __loc_;1006 locale __loc_;
1003 const ctype<char_type>* __ct_;1007 const ctype<char_type>* __ct_;
...@@ -2293,7 +2297,7 @@ public:...@@ -2293,7 +2297,7 @@ public:
2293 else2297 else
2294 {2298 {
2295 if (__b.size() != 1 || __e.size() != 1)2299 if (__b.size() != 1 || __e.size() != 1)
2296 __throw_regex_error<regex_constants::error_collate>();2300 __throw_regex_error<regex_constants::error_range>();
2297 if (__icase_)2301 if (__icase_)
2298 {2302 {
2299 __b[0] = __traits_.translate_nocase(__b[0]);2303 __b[0] = __traits_.translate_nocase(__b[0]);
...@@ -2527,19 +2531,27 @@ public:...@@ -2527,19 +2531,27 @@ public:
2527 // construct/copy/destroy:2531 // construct/copy/destroy:
2528 _LIBCPP_INLINE_VISIBILITY2532 _LIBCPP_INLINE_VISIBILITY
2529 basic_regex()2533 basic_regex()
2530 : __flags_(), __marked_count_(0), __loop_count_(0), __open_count_(0),2534 : __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
2531 __end_(0)2535 __end_(0)
2532 {}2536 {}
2533 _LIBCPP_INLINE_VISIBILITY2537 _LIBCPP_INLINE_VISIBILITY
2534 explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)2538 explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
2535 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2539 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2536 __end_(0)2540 __end_(0)
2537 {__parse(__p, __p + __traits_.length(__p));}2541 {
2542 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2543 __parse(__p, __p + __traits_.length(__p));
2544 }
2545
2538 _LIBCPP_INLINE_VISIBILITY2546 _LIBCPP_INLINE_VISIBILITY
2539 basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)2547 basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
2540 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2548 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2541 __end_(0)2549 __end_(0)
2542 {__parse(__p, __p + __len);}2550 {
2551 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2552 __parse(__p, __p + __len);
2553 }
2554
2543// basic_regex(const basic_regex&) = default;2555// basic_regex(const basic_regex&) = default;
2544// basic_regex(basic_regex&&) = default;2556// basic_regex(basic_regex&&) = default;
2545 template <class _ST, class _SA>2557 template <class _ST, class _SA>
...@@ -2548,21 +2560,31 @@ public:...@@ -2548,21 +2560,31 @@ public:
2548 flag_type __f = regex_constants::ECMAScript)2560 flag_type __f = regex_constants::ECMAScript)
2549 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2561 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2550 __end_(0)2562 __end_(0)
2551 {__parse(__p.begin(), __p.end());}2563 {
2564 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2565 __parse(__p.begin(), __p.end());
2566 }
2567
2552 template <class _ForwardIterator>2568 template <class _ForwardIterator>
2553 _LIBCPP_INLINE_VISIBILITY2569 _LIBCPP_INLINE_VISIBILITY
2554 basic_regex(_ForwardIterator __first, _ForwardIterator __last,2570 basic_regex(_ForwardIterator __first, _ForwardIterator __last,
2555 flag_type __f = regex_constants::ECMAScript)2571 flag_type __f = regex_constants::ECMAScript)
2556 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2572 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2557 __end_(0)2573 __end_(0)
2558 {__parse(__first, __last);}2574 {
2575 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2576 __parse(__first, __last);
2577 }
2559#ifndef _LIBCPP_CXX03_LANG2578#ifndef _LIBCPP_CXX03_LANG
2560 _LIBCPP_INLINE_VISIBILITY2579 _LIBCPP_INLINE_VISIBILITY
2561 basic_regex(initializer_list<value_type> __il,2580 basic_regex(initializer_list<value_type> __il,
2562 flag_type __f = regex_constants::ECMAScript)2581 flag_type __f = regex_constants::ECMAScript)
2563 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),2582 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
2564 __end_(0)2583 __end_(0)
2565 {__parse(__il.begin(), __il.end());}2584 {
2585 if (__get_grammar(__flags_) == 0) __flags_ |= regex_constants::ECMAScript;
2586 __parse(__il.begin(), __il.end());
2587 }
2566#endif // _LIBCPP_CXX03_LANG2588#endif // _LIBCPP_CXX03_LANG
25672589
2568// ~basic_regex() = default;2590// ~basic_regex() = default;
...@@ -3044,7 +3066,7 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,...@@ -3044,7 +3066,7 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
3044 __h.release();3066 __h.release();
3045 __end_ = __start_.get();3067 __end_ = __start_.get();
3046 }3068 }
3047 switch (__flags_ & 0x1F0)3069 switch (__get_grammar(__flags_))
3048 {3070 {
3049 case ECMAScript:3071 case ECMAScript:
3050 __first = __parse_ecma_exp(__first, __last);3072 __first = __parse_ecma_exp(__first, __last);
...@@ -3379,7 +3401,7 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,...@@ -3379,7 +3401,7 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first,
3379 if (__temp != __last)3401 if (__temp != __last)
3380 {3402 {
3381 if (*__first == '\\')3403 if (*__first == '\\')
3382 { 3404 {
3383 int __val = __traits_.value(*__temp, 10);3405 int __val = __traits_.value(*__temp, 10);
3384 if (__val >= 1 && __val <= 9)3406 if (__val >= 1 && __val <= 9)
3385 {3407 {
...@@ -3513,7 +3535,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,...@@ -3513,7 +3535,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
3513 __first = ++__temp;3535 __first = ++__temp;
3514 break;3536 break;
3515 default:3537 default:
3516 if ((__flags_ & 0x1F0) == awk)3538 if (__get_grammar(__flags_) == awk)
3517 __first = __parse_awk_escape(++__first, __last);3539 __first = __parse_awk_escape(++__first, __last);
3518 break;3540 break;
3519 }3541 }
...@@ -3597,7 +3619,7 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,...@@ -3597,7 +3619,7 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
3597{3619{
3598 if (__first != __last)3620 if (__first != __last)
3599 {3621 {
3600 unsigned __grammar = __flags_ & 0x1F0;3622 unsigned __grammar = __get_grammar(__flags_);
3601 switch (*__first)3623 switch (*__first)
3602 {3624 {
3603 case '*':3625 case '*':
...@@ -3718,7 +3740,7 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs...@@ -3718,7 +3740,7 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
3718 // __ml owned by *this3740 // __ml owned by *this
3719 if (__first == __last)3741 if (__first == __last)
3720 __throw_regex_error<regex_constants::error_brack>();3742 __throw_regex_error<regex_constants::error_brack>();
3721 if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')3743 if (__get_grammar(__flags_) != ECMAScript && *__first == ']')
3722 {3744 {
3723 __ml->__add_char(']');3745 __ml->__add_char(']');
3724 ++__first;3746 ++__first;
...@@ -3779,7 +3801,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,...@@ -3779,7 +3801,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
3779 else if (*__temp == '.')3801 else if (*__temp == '.')
3780 __first = __parse_collating_symbol(++__temp, __last, __start_range);3802 __first = __parse_collating_symbol(++__temp, __last, __start_range);
3781 }3803 }
3782 unsigned __grammar = __flags_ & 0x1F0;3804 unsigned __grammar = __get_grammar(__flags_);
3783 if (__start_range.empty())3805 if (__start_range.empty())
3784 {3806 {
3785 if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')3807 if ((__grammar == ECMAScript || __grammar == awk) && *__first == '\\')
...@@ -4076,7 +4098,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,...@@ -4076,7 +4098,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
4076 if ( __val != -1 )4098 if ( __val != -1 )
4077 {4099 {
4078 __c = __val;4100 __c = __val;
4079 for (++__first; 4101 for (++__first;
4080 __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;4102 __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
4081 ++__first)4103 ++__first)
4082 {4104 {
...@@ -4456,7 +4478,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,...@@ -4456,7 +4478,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
4456 case 'c':4478 case 'c':
4457 if ((__t = _VSTD::next(__first)) != __last)4479 if ((__t = _VSTD::next(__first)) != __last)
4458 {4480 {
4459 if (('A' <= *__t && *__t <= 'Z') || 4481 if (('A' <= *__t && *__t <= 'Z') ||
4460 ('a' <= *__t && *__t <= 'z'))4482 ('a' <= *__t && *__t <= 'z'))
4461 {4483 {
4462 if (__str)4484 if (__str)
...@@ -4465,7 +4487,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,...@@ -4465,7 +4487,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
4465 __push_char(_CharT(*__t % 32));4487 __push_char(_CharT(*__t % 32));
4466 __first = ++__t;4488 __first = ++__t;
4467 }4489 }
4468 else 4490 else
4469 __throw_regex_error<regex_constants::error_escape>();4491 __throw_regex_error<regex_constants::error_escape>();
4470 }4492 }
4471 else4493 else
...@@ -5265,21 +5287,41 @@ public:...@@ -5265,21 +5287,41 @@ public:
5265 // element access:5287 // element access:
5266 _LIBCPP_INLINE_VISIBILITY5288 _LIBCPP_INLINE_VISIBILITY
5267 difference_type length(size_type __sub = 0) const5289 difference_type length(size_type __sub = 0) const
5268 {return (*this)[__sub].length();}5290 {
5291 _LIBCPP_ASSERT(ready(), "match_results::length() called when not ready");
5292 return (*this)[__sub].length();
5293 }
5269 _LIBCPP_INLINE_VISIBILITY5294 _LIBCPP_INLINE_VISIBILITY
5270 difference_type position(size_type __sub = 0) const5295 difference_type position(size_type __sub = 0) const
5271 {return _VSTD::distance(__position_start_, (*this)[__sub].first);}5296 {
5297 _LIBCPP_ASSERT(ready(), "match_results::position() called when not ready");
5298 return _VSTD::distance(__position_start_, (*this)[__sub].first);
5299 }
5272 _LIBCPP_INLINE_VISIBILITY5300 _LIBCPP_INLINE_VISIBILITY
5273 string_type str(size_type __sub = 0) const5301 string_type str(size_type __sub = 0) const
5274 {return (*this)[__sub].str();}5302 {
5303 _LIBCPP_ASSERT(ready(), "match_results::str() called when not ready");
5304 return (*this)[__sub].str();
5305 }
5275 _LIBCPP_INLINE_VISIBILITY5306 _LIBCPP_INLINE_VISIBILITY
5276 const_reference operator[](size_type __n) const5307 const_reference operator[](size_type __n) const
5277 {return __n < __matches_.size() ? __matches_[__n] : __unmatched_;}5308 {
5309 _LIBCPP_ASSERT(ready(), "match_results::operator[]() called when not ready");
5310 return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
5311 }
52785312
5279 _LIBCPP_INLINE_VISIBILITY5313 _LIBCPP_INLINE_VISIBILITY
5280 const_reference prefix() const {return __prefix_;}5314 const_reference prefix() const
5315 {
5316 _LIBCPP_ASSERT(ready(), "match_results::prefix() called when not ready");
5317 return __prefix_;
5318 }
5281 _LIBCPP_INLINE_VISIBILITY5319 _LIBCPP_INLINE_VISIBILITY
5282 const_reference suffix() const {return __suffix_;}5320 const_reference suffix() const
5321 {
5322 _LIBCPP_ASSERT(ready(), "match_results::suffix() called when not ready");
5323 return __suffix_;
5324 }
52835325
5284 _LIBCPP_INLINE_VISIBILITY5326 _LIBCPP_INLINE_VISIBILITY
5285 const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}5327 const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
...@@ -5417,6 +5459,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i...@@ -5417,6 +5459,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
5417 const char_type* __fmt_first, const char_type* __fmt_last,5459 const char_type* __fmt_first, const char_type* __fmt_last,
5418 regex_constants::match_flag_type __flags) const5460 regex_constants::match_flag_type __flags) const
5419{5461{
5462 _LIBCPP_ASSERT(ready(), "match_results::format() called when not ready");
5420 if (__flags & regex_constants::format_sed)5463 if (__flags & regex_constants::format_sed)
5421 {5464 {
5422 for (; __fmt_first != __fmt_last; ++__fmt_first)5465 for (; __fmt_first != __fmt_last; ++__fmt_first)
...@@ -5849,7 +5892,7 @@ basic_regex<_CharT, _Traits>::__match_at_start(...@@ -5849,7 +5892,7 @@ basic_regex<_CharT, _Traits>::__match_at_start(
5849 match_results<const _CharT*, _Allocator>& __m,5892 match_results<const _CharT*, _Allocator>& __m,
5850 regex_constants::match_flag_type __flags, bool __at_first) const5893 regex_constants::match_flag_type __flags, bool __at_first) const
5851{5894{
5852 if ((__flags_ & 0x1F0) == ECMAScript)5895 if (__get_grammar(__flags_) == ECMAScript)
5853 return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);5896 return __match_at_start_ecma(__first, __last, __m, __flags, __at_first);
5854 if (mark_count() == 0)5897 if (mark_count() == 0)
5855 return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);5898 return __match_at_start_posix_nosubs(__first, __last, __m, __flags, __at_first);
...@@ -5866,7 +5909,7 @@ basic_regex<_CharT, _Traits>::__search(...@@ -5866,7 +5909,7 @@ basic_regex<_CharT, _Traits>::__search(
5866{5909{
5867 __m.__init(1 + mark_count(), __first, __last,5910 __m.__init(1 + mark_count(), __first, __last,
5868 __flags & regex_constants::__no_update_pos);5911 __flags & regex_constants::__no_update_pos);
5869 if (__match_at_start(__first, __last, __m, __flags, 5912 if (__match_at_start(__first, __last, __m, __flags,
5870 !(__flags & regex_constants::__no_update_pos)))5913 !(__flags & regex_constants::__no_update_pos)))
5871 {5914 {
5872 __m.__prefix_.second = __m[0].first;5915 __m.__prefix_.second = __m[0].first;
...@@ -6012,7 +6055,7 @@ bool...@@ -6012,7 +6055,7 @@ bool
6012regex_search(const basic_string<_Cp, _ST, _SA>&& __s,6055regex_search(const basic_string<_Cp, _ST, _SA>&& __s,
6013 match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,6056 match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
6014 const basic_regex<_Cp, _Tp>& __e,6057 const basic_regex<_Cp, _Tp>& __e,
6015 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 6058 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
6016#endif6059#endif
60176060
6018// regex_match6061// regex_match
...@@ -6076,7 +6119,7 @@ bool...@@ -6076,7 +6119,7 @@ bool
6076regex_match(const basic_string<_CharT, _ST, _SA>&& __s,6119regex_match(const basic_string<_CharT, _ST, _SA>&& __s,
6077 match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,6120 match_results<typename basic_string<_CharT, _ST, _SA>::const_iterator, _Allocator>& __m,
6078 const basic_regex<_CharT, _Traits>& __e,6121 const basic_regex<_CharT, _Traits>& __e,
6079 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete; 6122 regex_constants::match_flag_type __flags = regex_constants::match_default) = delete;
6080#endif6123#endif
60816124
6082template <class _CharT, class _Traits>6125template <class _CharT, class _Traits>
...@@ -6129,7 +6172,7 @@ public:...@@ -6129,7 +6172,7 @@ public:
6129#if _LIBCPP_STD_VER > 116172#if _LIBCPP_STD_VER > 11
6130 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,6173 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
6131 const regex_type&& __re,6174 const regex_type&& __re,
6132 regex_constants::match_flag_type __m 6175 regex_constants::match_flag_type __m
6133 = regex_constants::match_default) = delete;6176 = regex_constants::match_default) = delete;
6134#endif6177#endif
61356178
...@@ -6140,7 +6183,7 @@ public:...@@ -6140,7 +6183,7 @@ public:
6140 _LIBCPP_INLINE_VISIBILITY6183 _LIBCPP_INLINE_VISIBILITY
6141 reference operator*() const {return __match_;}6184 reference operator*() const {return __match_;}
6142 _LIBCPP_INLINE_VISIBILITY6185 _LIBCPP_INLINE_VISIBILITY
6143 pointer operator->() const {return &__match_;}6186 pointer operator->() const {return _VSTD::addressof(__match_);}
61446187
6145 regex_iterator& operator++();6188 regex_iterator& operator++();
6146 _LIBCPP_INLINE_VISIBILITY6189 _LIBCPP_INLINE_VISIBILITY
...@@ -6164,7 +6207,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::...@@ -6164,7 +6207,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::
6164 const regex_type& __re, regex_constants::match_flag_type __m)6207 const regex_type& __re, regex_constants::match_flag_type __m)
6165 : __begin_(__a),6208 : __begin_(__a),
6166 __end_(__b),6209 __end_(__b),
6167 __pregex_(&__re),6210 __pregex_(_VSTD::addressof(__re)),
6168 __flags_(__m)6211 __flags_(__m)
6169{6212{
6170 _VSTD::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);6213 _VSTD::regex_search(__begin_, __end_, __match_, *__pregex_, __flags_);
...@@ -6325,7 +6368,7 @@ private:...@@ -6325,7 +6368,7 @@ private:
6325 __result_ = &__position_->prefix();6368 __result_ = &__position_->prefix();
6326 else6369 else
6327 __result_ = &(*__position_)[__subs_[__n_]];6370 __result_ = &(*__position_)[__subs_[__n_]];
6328 } 6371 }
6329};6372};
63306373
6331template <class _BidirectionalIterator, class _CharT, class _Traits>6374template <class _BidirectionalIterator, class _CharT, class _Traits>
...@@ -6405,7 +6448,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::...@@ -6405,7 +6448,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
6405 regex_constants::match_flag_type __m)6448 regex_constants::match_flag_type __m)
6406 : __position_(__a, __b, __re, __m),6449 : __position_(__a, __b, __re, __m),
6407 __n_(0),6450 __n_(0),
6408 __subs_(__submatches, __submatches + _Np)6451 __subs_(begin(__submatches), end(__submatches))
6409{6452{
6410 __init(__a, __b);6453 __init(__a, __b);
6411}6454}
lib/libcxx/include/scoped_allocator+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- scoped_allocator --------------------------===//2//===-------------------------- scoped_allocator --------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/set+87-11
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- set -------------------------------------===//2//===---------------------------- set -------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -156,9 +155,9 @@ public:...@@ -156,9 +155,9 @@ public:
156 template<typename K>155 template<typename K>
157 const_iterator find(const K& x) const; // C++14156 const_iterator find(const K& x) const; // C++14
158 template<typename K>157 template<typename K>
159 size_type count(const K& x) const; // C++14158 size_type count(const K& x) const; // C++14
160
161 size_type count(const key_type& k) const;159 size_type count(const key_type& k) const;
160 bool contains(const key_type& x) const; // C++20
162 iterator lower_bound(const key_type& k);161 iterator lower_bound(const key_type& k);
163 const_iterator lower_bound(const key_type& k) const;162 const_iterator lower_bound(const key_type& k) const;
164 template<typename K>163 template<typename K>
...@@ -355,8 +354,10 @@ public:...@@ -355,8 +354,10 @@ public:
355 iterator find(const K& x);354 iterator find(const K& x);
356 template<typename K>355 template<typename K>
357 const_iterator find(const K& x) const; // C++14356 const_iterator find(const K& x) const; // C++14
358357 template<typename K>
358 size_type count(const K& x) const; // C++14
359 size_type count(const key_type& k) const;359 size_type count(const key_type& k) const;
360 bool contains(const key_type& x) const; // C++20
360 iterator lower_bound(const key_type& k);361 iterator lower_bound(const key_type& k);
361 const_iterator lower_bound(const key_type& k) const;362 const_iterator lower_bound(const key_type& k) const;
362 template<typename K>363 template<typename K>
...@@ -447,11 +448,10 @@ public:...@@ -447,11 +448,10 @@ public:
447 typedef key_type value_type;448 typedef key_type value_type;
448 typedef _Compare key_compare;449 typedef _Compare key_compare;
449 typedef key_compare value_compare;450 typedef key_compare value_compare;
450 typedef _Allocator allocator_type;451 typedef typename __identity<_Allocator>::type allocator_type;
451 typedef value_type& reference;452 typedef value_type& reference;
452 typedef const value_type& const_reference;453 typedef const value_type& const_reference;
453454
454 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
455 static_assert((is_same<typename allocator_type::value_type, value_type>::value),455 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
456 "Allocator::value_type must be same type as value_type");456 "Allocator::value_type must be same type as value_type");
457457
...@@ -597,6 +597,11 @@ public:...@@ -597,6 +597,11 @@ public:
597 }597 }
598#endif // _LIBCPP_CXX03_LANG598#endif // _LIBCPP_CXX03_LANG
599599
600 _LIBCPP_INLINE_VISIBILITY
601 ~set() {
602 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
603 }
604
600 _LIBCPP_INLINE_VISIBILITY605 _LIBCPP_INLINE_VISIBILITY
601 iterator begin() _NOEXCEPT {return __tree_.begin();}606 iterator begin() _NOEXCEPT {return __tree_.begin();}
602 _LIBCPP_INLINE_VISIBILITY607 _LIBCPP_INLINE_VISIBILITY
...@@ -784,6 +789,12 @@ public:...@@ -784,6 +789,12 @@ public:
784 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type789 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
785 count(const _K2& __k) const {return __tree_.__count_multi(__k);}790 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
786#endif791#endif
792
793#if _LIBCPP_STD_VER > 17
794 _LIBCPP_INLINE_VISIBILITY
795 bool contains(const key_type& __k) const {return find(__k) != end();}
796#endif // _LIBCPP_STD_VER > 17
797
787 _LIBCPP_INLINE_VISIBILITY798 _LIBCPP_INLINE_VISIBILITY
788 iterator lower_bound(const key_type& __k)799 iterator lower_bound(const key_type& __k)
789 {return __tree_.lower_bound(__k);}800 {return __tree_.lower_bound(__k);}
...@@ -837,6 +848,34 @@ public:...@@ -837,6 +848,34 @@ public:
837#endif848#endif
838};849};
839850
851#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
852template<class _InputIterator,
853 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
854 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
855 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
856 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
857set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
858 -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
859
860template<class _Key, class _Compare = less<_Key>,
861 class _Allocator = allocator<_Key>,
862 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
863 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
864set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
865 -> set<_Key, _Compare, _Allocator>;
866
867template<class _InputIterator, class _Allocator,
868 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
869set(_InputIterator, _InputIterator, _Allocator)
870 -> set<typename iterator_traits<_InputIterator>::value_type,
871 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
872
873template<class _Key, class _Allocator,
874 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
875set(initializer_list<_Key>, _Allocator)
876 -> set<_Key, less<_Key>, _Allocator>;
877#endif
878
840#ifndef _LIBCPP_CXX03_LANG879#ifndef _LIBCPP_CXX03_LANG
841880
842template <class _Key, class _Compare, class _Allocator>881template <class _Key, class _Compare, class _Allocator>
...@@ -935,11 +974,10 @@ public:...@@ -935,11 +974,10 @@ public:
935 typedef key_type value_type;974 typedef key_type value_type;
936 typedef _Compare key_compare;975 typedef _Compare key_compare;
937 typedef key_compare value_compare;976 typedef key_compare value_compare;
938 typedef _Allocator allocator_type;977 typedef typename __identity<_Allocator>::type allocator_type;
939 typedef value_type& reference;978 typedef value_type& reference;
940 typedef const value_type& const_reference;979 typedef const value_type& const_reference;
941980
942 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
943 static_assert((is_same<typename allocator_type::value_type, value_type>::value),981 static_assert((is_same<typename allocator_type::value_type, value_type>::value),
944 "Allocator::value_type must be same type as value_type");982 "Allocator::value_type must be same type as value_type");
945983
...@@ -1084,6 +1122,11 @@ public:...@@ -1084,6 +1122,11 @@ public:
1084 }1122 }
1085#endif // _LIBCPP_CXX03_LANG1123#endif // _LIBCPP_CXX03_LANG
10861124
1125 _LIBCPP_INLINE_VISIBILITY
1126 ~multiset() {
1127 static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1128 }
1129
1087 _LIBCPP_INLINE_VISIBILITY1130 _LIBCPP_INLINE_VISIBILITY
1088 iterator begin() _NOEXCEPT {return __tree_.begin();}1131 iterator begin() _NOEXCEPT {return __tree_.begin();}
1089 _LIBCPP_INLINE_VISIBILITY1132 _LIBCPP_INLINE_VISIBILITY
...@@ -1272,6 +1315,11 @@ public:...@@ -1272,6 +1315,11 @@ public:
1272 count(const _K2& __k) const {return __tree_.__count_multi(__k);}1315 count(const _K2& __k) const {return __tree_.__count_multi(__k);}
1273#endif1316#endif
12741317
1318#if _LIBCPP_STD_VER > 17
1319 _LIBCPP_INLINE_VISIBILITY
1320 bool contains(const key_type& __k) const {return find(__k) != end();}
1321#endif // _LIBCPP_STD_VER > 17
1322
1275 _LIBCPP_INLINE_VISIBILITY1323 _LIBCPP_INLINE_VISIBILITY
1276 iterator lower_bound(const key_type& __k)1324 iterator lower_bound(const key_type& __k)
1277 {return __tree_.lower_bound(__k);}1325 {return __tree_.lower_bound(__k);}
...@@ -1325,6 +1373,34 @@ public:...@@ -1325,6 +1373,34 @@ public:
1325#endif1373#endif
1326};1374};
13271375
1376#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1377template<class _InputIterator,
1378 class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
1379 class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
1380 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1381 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1382multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
1383 -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
1384
1385template<class _Key, class _Compare = less<_Key>,
1386 class _Allocator = allocator<_Key>,
1387 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type,
1388 class = typename enable_if<!__is_allocator<_Compare>::value, void>::type>
1389multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
1390 -> multiset<_Key, _Compare, _Allocator>;
1391
1392template<class _InputIterator, class _Allocator,
1393 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1394multiset(_InputIterator, _InputIterator, _Allocator)
1395 -> multiset<typename iterator_traits<_InputIterator>::value_type,
1396 less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
1397
1398template<class _Key, class _Allocator,
1399 class = typename enable_if<__is_allocator<_Allocator>::value, void>::type>
1400multiset(initializer_list<_Key>, _Allocator)
1401 -> multiset<_Key, less<_Key>, _Allocator>;
1402#endif
1403
1328#ifndef _LIBCPP_CXX03_LANG1404#ifndef _LIBCPP_CXX03_LANG
13291405
1330template <class _Key, class _Compare, class _Allocator>1406template <class _Key, class _Compare, class _Allocator>
lib/libcxx/include/setjmp.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- setjmp.h ---------------------------------===//2//===--------------------------- setjmp.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/shared_mutex+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ shared_mutex --------------------------------===//2//===------------------------ shared_mutex --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/span+139-112
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ span ---------------------------------===//2//===------------------------------ span ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===---------------------------------------------------------------------===//8//===---------------------------------------------------------------------===//
109
...@@ -17,33 +16,35 @@...@@ -17,33 +16,35 @@
17namespace std {16namespace std {
1817
19// constants18// constants
20inline constexpr ptrdiff_t dynamic_extent = -1;19inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
2120
22// [views.span], class template span21// [views.span], class template span
23template <class ElementType, ptrdiff_t Extent = dynamic_extent>22template <class ElementType, size_t Extent = dynamic_extent>
24 class span;23 class span;
2524
26// [span.objectrep], views of object representation25// [span.objectrep], views of object representation
27template <class ElementType, ptrdiff_t Extent>26template <class ElementType, size_t Extent>
28 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :27 span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
29 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;28 (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
3029
31template <class ElementType, ptrdiff_t Extent>30template <class ElementType, size_t Extent>
32 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :31 span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
33 (static_cast<ptrdiff_t>(sizeof(ElementType)) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;32 (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
3433
3534
36namespace std {35namespace std {
37template <class ElementType, ptrdiff_t Extent = dynamic_extent>36template <class ElementType, size_t Extent = dynamic_extent>
38class span {37class span {
39public:38public:
40 // constants and types39 // constants and types
41 using element_type = ElementType;40 using element_type = ElementType;
42 using value_type = remove_cv_t<ElementType>;41 using value_type = remove_cv_t<ElementType>;
43 using index_type = ptrdiff_t;42 using index_type = size_t;
44 using difference_type = ptrdiff_t;43 using difference_type = ptrdiff_t;
45 using pointer = element_type*;44 using pointer = element_type*;
45 using const_pointer = const element_type*;
46 using reference = element_type&;46 using reference = element_type&;
47 using const_reference = const element_type&;
47 using iterator = implementation-defined;48 using iterator = implementation-defined;
48 using const_iterator = implementation-defined;49 using const_iterator = implementation-defined;
49 using reverse_iterator = std::reverse_iterator<iterator>;50 using reverse_iterator = std::reverse_iterator<iterator>;
...@@ -65,17 +66,17 @@ public:...@@ -65,17 +66,17 @@ public:
65 template <class Container>66 template <class Container>
66 constexpr span(const Container& cont);67 constexpr span(const Container& cont);
67 constexpr span(const span& other) noexcept = default;68 constexpr span(const span& other) noexcept = default;
68 template <class OtherElementType, ptrdiff_t OtherExtent>69 template <class OtherElementType, size_t OtherExtent>
69 constexpr span(const span<OtherElementType, OtherExtent>& s) noexcept;70 constexpr span(const span<OtherElementType, OtherExtent>& s) noexcept;
70 ~span() noexcept = default;71 ~span() noexcept = default;
71 constexpr span& operator=(const span& other) noexcept = default;72 constexpr span& operator=(const span& other) noexcept = default;
7273
73 // [span.sub], span subviews74 // [span.sub], span subviews
74 template <ptrdiff_t Count>75 template <size_t Count>
75 constexpr span<element_type, Count> first() const;76 constexpr span<element_type, Count> first() const;
76 template <ptrdiff_t Count>77 template <size_t Count>
77 constexpr span<element_type, Count> last() const;78 constexpr span<element_type, Count> last() const;
78 template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>79 template <size_t Offset, size_t Count = dynamic_extent>
79 constexpr span<element_type, see below> subspan() const;80 constexpr span<element_type, see below> subspan() const;
8081
81 constexpr span<element_type, dynamic_extent> first(index_type count) const;82 constexpr span<element_type, dynamic_extent> first(index_type count) const;
...@@ -89,7 +90,8 @@ public:...@@ -89,7 +90,8 @@ public:
8990
90 // [span.elem], span element access91 // [span.elem], span element access
91 constexpr reference operator[](index_type idx) const;92 constexpr reference operator[](index_type idx) const;
92 constexpr reference operator()(index_type idx) const;93 constexpr reference front() const;
94 constexpr reference back() const;
93 constexpr pointer data() const noexcept;95 constexpr pointer data() const noexcept;
9496
95 // [span.iterators], span iterator support97 // [span.iterators], span iterator support
...@@ -141,14 +143,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD...@@ -141,14 +143,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
141143
142#if _LIBCPP_STD_VER > 17144#if _LIBCPP_STD_VER > 17
143145
144inline constexpr ptrdiff_t dynamic_extent = -1;146inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
145template <typename _Tp, ptrdiff_t _Extent = dynamic_extent> class span;147template <typename _Tp, size_t _Extent = dynamic_extent> class span;
146148
147149
148template <class _Tp>150template <class _Tp>
149struct __is_span_impl : public false_type {};151struct __is_span_impl : public false_type {};
150152
151template <class _Tp, ptrdiff_t _Extent>153template <class _Tp, size_t _Extent>
152struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};154struct __is_span_impl<span<_Tp, _Extent>> : public true_type {};
153155
154template <class _Tp>156template <class _Tp>
...@@ -187,25 +189,24 @@ struct __is_span_compatible_container<_Tp, _ElementType,...@@ -187,25 +189,24 @@ struct __is_span_compatible_container<_Tp, _ElementType,
187 : public true_type {};189 : public true_type {};
188190
189191
190template <typename _Tp, ptrdiff_t _Extent>192template <typename _Tp, size_t _Extent>
191class _LIBCPP_TEMPLATE_VIS span {193class _LIBCPP_TEMPLATE_VIS span {
192public:194public:
193// constants and types195// constants and types
194 using element_type = _Tp;196 using element_type = _Tp;
195 using value_type = remove_cv_t<_Tp>;197 using value_type = remove_cv_t<_Tp>;
196 using index_type = ptrdiff_t;198 using index_type = size_t;
197 using difference_type = ptrdiff_t;199 using difference_type = ptrdiff_t;
198 using pointer = _Tp *;200 using pointer = _Tp *;
199 using const_pointer = const _Tp *; // not in standard201 using const_pointer = const _Tp *;
200 using reference = _Tp &;202 using reference = _Tp &;
201 using const_reference = const _Tp &; // not in standard203 using const_reference = const _Tp &;
202 using iterator = __wrap_iter<pointer>;204 using iterator = __wrap_iter<pointer>;
203 using const_iterator = __wrap_iter<const_pointer>;205 using const_iterator = __wrap_iter<const_pointer>;
204 using reverse_iterator = _VSTD::reverse_iterator<iterator>;206 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
205 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;207 using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>;
206208
207 static constexpr index_type extent = _Extent;209 static constexpr index_type extent = _Extent;
208 static_assert (_Extent >= 0, "Can't have a span with an extent < 0");
209210
210// [span.cons], span constructors, copy, assignment, and destructor211// [span.cons], span constructors, copy, assignment, and destructor
211 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}212 _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr}
...@@ -223,22 +224,8 @@ public:...@@ -223,22 +224,8 @@ public:
223 _LIBCPP_INLINE_VISIBILITY constexpr span( array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}224 _LIBCPP_INLINE_VISIBILITY constexpr span( array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
224 _LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}225 _LIBCPP_INLINE_VISIBILITY constexpr span(const array<value_type, _Extent>& __arr) noexcept : __data{__arr.data()} {}
225226
226 template <class _Container>
227 inline _LIBCPP_INLINE_VISIBILITY
228 constexpr span( _Container& __c,
229 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
230 : __data{_VSTD::data(__c)}
231 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
232
233 template <class _Container>
234 inline _LIBCPP_INLINE_VISIBILITY
235 constexpr span(const _Container& __c,
236 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
237 : __data{_VSTD::data(__c)}
238 { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const container)"); }
239
240 template <class _OtherElementType>227 template <class _OtherElementType>
241 inline _LIBCPP_INLINE_VISIBILITY228 _LIBCPP_INLINE_VISIBILITY
242 constexpr span(const span<_OtherElementType, _Extent>& __other,229 constexpr span(const span<_OtherElementType, _Extent>& __other,
243 enable_if_t<230 enable_if_t<
244 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,231 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
...@@ -246,7 +233,7 @@ public:...@@ -246,7 +233,7 @@ public:
246 : __data{__other.data()} {}233 : __data{__other.data()} {}
247234
248 template <class _OtherElementType>235 template <class _OtherElementType>
249 inline _LIBCPP_INLINE_VISIBILITY236 _LIBCPP_INLINE_VISIBILITY
250 constexpr span(const span<_OtherElementType, dynamic_extent>& __other,237 constexpr span(const span<_OtherElementType, dynamic_extent>& __other,
251 enable_if_t<238 enable_if_t<
252 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,239 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
...@@ -256,20 +243,18 @@ public:...@@ -256,20 +243,18 @@ public:
256243
257// ~span() noexcept = default;244// ~span() noexcept = default;
258245
259 template <ptrdiff_t _Count>246 template <size_t _Count>
260 inline _LIBCPP_INLINE_VISIBILITY247 _LIBCPP_INLINE_VISIBILITY
261 constexpr span<element_type, _Count> first() const noexcept248 constexpr span<element_type, _Count> first() const noexcept
262 {249 {
263 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
264 static_assert(_Count <= _Extent, "Count out of range in span::first()");250 static_assert(_Count <= _Extent, "Count out of range in span::first()");
265 return {data(), _Count};251 return {data(), _Count};
266 }252 }
267253
268 template <ptrdiff_t _Count>254 template <size_t _Count>
269 inline _LIBCPP_INLINE_VISIBILITY255 _LIBCPP_INLINE_VISIBILITY
270 constexpr span<element_type, _Count> last() const noexcept256 constexpr span<element_type, _Count> last() const noexcept
271 {257 {
272 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
273 static_assert(_Count <= _Extent, "Count out of range in span::last()");258 static_assert(_Count <= _Extent, "Count out of range in span::last()");
274 return {data() + size() - _Count, _Count};259 return {data() + size() - _Count, _Count};
275 }260 }
...@@ -277,36 +262,36 @@ public:...@@ -277,36 +262,36 @@ public:
277 _LIBCPP_INLINE_VISIBILITY262 _LIBCPP_INLINE_VISIBILITY
278 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept263 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
279 {264 {
280 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");265 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
281 return {data(), __count};266 return {data(), __count};
282 }267 }
283268
284 _LIBCPP_INLINE_VISIBILITY269 _LIBCPP_INLINE_VISIBILITY
285 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept270 constexpr span<element_type, dynamic_extent> last(index_type __count) const noexcept
286 {271 {
287 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");272 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
288 return {data() + size() - __count, __count};273 return {data() + size() - __count, __count};
289 }274 }
290275
291 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>276 template <size_t _Offset, size_t _Count = dynamic_extent>
292 inline _LIBCPP_INLINE_VISIBILITY277 _LIBCPP_INLINE_VISIBILITY
293 constexpr auto subspan() const noexcept278 constexpr auto subspan() const noexcept
294 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>279 -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>
295 {280 {
296 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");281 static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
297 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};282 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
298 }283 }
299284
300285
301 inline _LIBCPP_INLINE_VISIBILITY286 _LIBCPP_INLINE_VISIBILITY
302 constexpr span<element_type, dynamic_extent>287 constexpr span<element_type, dynamic_extent>
303 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept288 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
304 {289 {
305 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");290 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
306 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");291 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "Count out of range in span::subspan(offset, count)");
307 if (__count == dynamic_extent)292 if (__count == dynamic_extent)
308 return {data() + __offset, size() - __offset};293 return {data() + __offset, size() - __offset};
309 _LIBCPP_ASSERT(__offset + __count <= size(), "count + offset out of range in span::subspan(offset, count)");294 _LIBCPP_ASSERT(__offset <= size() - __count, "count + offset out of range in span::subspan(offset, count)");
310 return {data() + __offset, __count};295 return {data() + __offset, __count};
311 }296 }
312297
...@@ -320,10 +305,16 @@ public:...@@ -320,10 +305,16 @@ public:
320 return __data[__idx];305 return __data[__idx];
321 }306 }
322307
323 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept308 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
324 {309 {
325 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>() index out of bounds");310 static_assert(_Extent > 0, "span<T,N>[].front() on empty span");
326 return __data[__idx];311 return __data[0];
312 }
313
314 _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
315 {
316 static_assert(_Extent > 0, "span<T,N>[].back() on empty span");
317 return __data[size()-1];
327 }318 }
328319
329 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }320 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
...@@ -348,7 +339,7 @@ public:...@@ -348,7 +339,7 @@ public:
348 _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept339 _LIBCPP_INLINE_VISIBILITY span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept
349 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }340 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
350341
351 _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writeable_bytes() const noexcept342 _LIBCPP_INLINE_VISIBILITY span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept
352 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }343 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
353344
354private:345private:
...@@ -365,12 +356,12 @@ public:...@@ -365,12 +356,12 @@ public:
365// constants and types356// constants and types
366 using element_type = _Tp;357 using element_type = _Tp;
367 using value_type = remove_cv_t<_Tp>;358 using value_type = remove_cv_t<_Tp>;
368 using index_type = ptrdiff_t;359 using index_type = size_t;
369 using difference_type = ptrdiff_t;360 using difference_type = ptrdiff_t;
370 using pointer = _Tp *;361 using pointer = _Tp *;
371 using const_pointer = const _Tp *; // not in standard362 using const_pointer = const _Tp *;
372 using reference = _Tp &;363 using reference = _Tp &;
373 using const_reference = const _Tp &; // not in standard364 using const_reference = const _Tp &;
374 using iterator = __wrap_iter<pointer>;365 using iterator = __wrap_iter<pointer>;
375 using const_iterator = __wrap_iter<const_pointer>;366 using const_iterator = __wrap_iter<const_pointer>;
376 using reverse_iterator = _VSTD::reverse_iterator<iterator>;367 using reverse_iterator = _VSTD::reverse_iterator<iterator>;
...@@ -385,35 +376,35 @@ public:...@@ -385,35 +376,35 @@ public:
385 constexpr span& operator=(const span&) noexcept = default;376 constexpr span& operator=(const span&) noexcept = default;
386377
387 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {}378 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __ptr, index_type __count) : __data{__ptr}, __size{__count} {}
388 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{distance(__f, __l)} {}379 _LIBCPP_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l) : __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
389380
390 template <size_t _Sz>381 template <size_t _Sz>
391 inline _LIBCPP_INLINE_VISIBILITY382 _LIBCPP_INLINE_VISIBILITY
392 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}383 constexpr span(element_type (&__arr)[_Sz]) noexcept : __data{__arr}, __size{_Sz} {}
393384
394 template <size_t _Sz>385 template <size_t _Sz>
395 inline _LIBCPP_INLINE_VISIBILITY386 _LIBCPP_INLINE_VISIBILITY
396 constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}387 constexpr span(array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
397388
398 template <size_t _Sz>389 template <size_t _Sz>
399 inline _LIBCPP_INLINE_VISIBILITY390 _LIBCPP_INLINE_VISIBILITY
400 constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}391 constexpr span(const array<value_type, _Sz>& __arr) noexcept : __data{__arr.data()}, __size{_Sz} {}
401392
402 template <class _Container>393 template <class _Container>
403 inline _LIBCPP_INLINE_VISIBILITY394 _LIBCPP_INLINE_VISIBILITY
404 constexpr span( _Container& __c,395 constexpr span( _Container& __c,
405 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)396 enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
406 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}397 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
407398
408 template <class _Container>399 template <class _Container>
409 inline _LIBCPP_INLINE_VISIBILITY400 _LIBCPP_INLINE_VISIBILITY
410 constexpr span(const _Container& __c,401 constexpr span(const _Container& __c,
411 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)402 enable_if_t<__is_span_compatible_container<const _Container, _Tp>::value, nullptr_t> = nullptr)
412 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}403 : __data{_VSTD::data(__c)}, __size{(index_type) _VSTD::size(__c)} {}
413404
414405
415 template <class _OtherElementType, ptrdiff_t _OtherExtent>406 template <class _OtherElementType, size_t _OtherExtent>
416 inline _LIBCPP_INLINE_VISIBILITY407 _LIBCPP_INLINE_VISIBILITY
417 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,408 constexpr span(const span<_OtherElementType, _OtherExtent>& __other,
418 enable_if_t<409 enable_if_t<
419 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,410 is_convertible_v<_OtherElementType(*)[], element_type (*)[]>,
...@@ -422,20 +413,18 @@ public:...@@ -422,20 +413,18 @@ public:
422413
423// ~span() noexcept = default;414// ~span() noexcept = default;
424415
425 template <ptrdiff_t _Count>416 template <size_t _Count>
426 inline _LIBCPP_INLINE_VISIBILITY417 _LIBCPP_INLINE_VISIBILITY
427 constexpr span<element_type, _Count> first() const noexcept418 constexpr span<element_type, _Count> first() const noexcept
428 {419 {
429 static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
430 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");420 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
431 return {data(), _Count};421 return {data(), _Count};
432 }422 }
433423
434 template <ptrdiff_t _Count>424 template <size_t _Count>
435 inline _LIBCPP_INLINE_VISIBILITY425 _LIBCPP_INLINE_VISIBILITY
436 constexpr span<element_type, _Count> last() const noexcept426 constexpr span<element_type, _Count> last() const noexcept
437 {427 {
438 static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
439 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");428 _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
440 return {data() + size() - _Count, _Count};429 return {data() + size() - _Count, _Count};
441 }430 }
...@@ -443,35 +432,35 @@ public:...@@ -443,35 +432,35 @@ public:
443 _LIBCPP_INLINE_VISIBILITY432 _LIBCPP_INLINE_VISIBILITY
444 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept433 constexpr span<element_type, dynamic_extent> first(index_type __count) const noexcept
445 {434 {
446 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::first(count)");435 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::first(count)");
447 return {data(), __count};436 return {data(), __count};
448 }437 }
449438
450 _LIBCPP_INLINE_VISIBILITY439 _LIBCPP_INLINE_VISIBILITY
451 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept440 constexpr span<element_type, dynamic_extent> last (index_type __count) const noexcept
452 {441 {
453 _LIBCPP_ASSERT(__count >= 0 && __count <= size(), "Count out of range in span::last(count)");442 _LIBCPP_ASSERT(__count <= size(), "Count out of range in span::last(count)");
454 return {data() + size() - __count, __count};443 return {data() + size() - __count, __count};
455 }444 }
456445
457 template <ptrdiff_t _Offset, ptrdiff_t _Count = dynamic_extent>446 template <size_t _Offset, size_t _Count = dynamic_extent>
458 inline _LIBCPP_INLINE_VISIBILITY447 _LIBCPP_INLINE_VISIBILITY
459 constexpr span<_Tp, dynamic_extent> subspan() const noexcept448 constexpr span<_Tp, dynamic_extent> subspan() const noexcept
460 {449 {
461 _LIBCPP_ASSERT(_Offset >= 0 && _Offset <= size(), "Offset out of range in span::subspan()");450 _LIBCPP_ASSERT(_Offset <= size(), "Offset out of range in span::subspan()");
462 _LIBCPP_ASSERT(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");451 _LIBCPP_ASSERT(_Count == dynamic_extent || _Offset + _Count <= size(), "Count out of range in span::subspan()");
463 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};452 return {data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
464 }453 }
465454
466 constexpr span<element_type, dynamic_extent>455 constexpr span<element_type, dynamic_extent>
467 inline _LIBCPP_INLINE_VISIBILITY456 _LIBCPP_INLINE_VISIBILITY
468 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept457 subspan(index_type __offset, index_type __count = dynamic_extent) const noexcept
469 {458 {
470 _LIBCPP_ASSERT( __offset >= 0 && __offset <= size(), "Offset out of range in span::subspan(offset, count)");459 _LIBCPP_ASSERT(__offset <= size(), "Offset out of range in span::subspan(offset, count)");
471 _LIBCPP_ASSERT((__count >= 0 && __count <= size()) || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");460 _LIBCPP_ASSERT(__count <= size() || __count == dynamic_extent, "count out of range in span::subspan(offset, count)");
472 if (__count == dynamic_extent)461 if (__count == dynamic_extent)
473 return {data() + __offset, size() - __offset};462 return {data() + __offset, size() - __offset};
474 _LIBCPP_ASSERT(__offset + __count <= size(), "Offset + count out of range in span::subspan(offset, count)");463 _LIBCPP_ASSERT(__offset <= size() - __count, "Offset + count out of range in span::subspan(offset, count)");
475 return {data() + __offset, __count};464 return {data() + __offset, __count};
476 }465 }
477466
...@@ -485,12 +474,19 @@ public:...@@ -485,12 +474,19 @@ public:
485 return __data[__idx];474 return __data[__idx];
486 }475 }
487476
488 _LIBCPP_INLINE_VISIBILITY constexpr reference operator()(index_type __idx) const noexcept477 _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
489 {478 {
490 _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>() index out of bounds");479 _LIBCPP_ASSERT(!empty(), "span<T>[].front() on empty span");
491 return __data[__idx];480 return __data[0];
492 }481 }
493482
483 _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
484 {
485 _LIBCPP_ASSERT(!empty(), "span<T>[].back() on empty span");
486 return __data[size()-1];
487 }
488
489
494 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }490 _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; }
495491
496// [span.iter], span iterator support492// [span.iter], span iterator support
...@@ -517,7 +513,7 @@ public:...@@ -517,7 +513,7 @@ public:
517 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept513 _LIBCPP_INLINE_VISIBILITY span<const byte, dynamic_extent> __as_bytes() const noexcept
518 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }514 { return {reinterpret_cast<const byte *>(data()), size_bytes()}; }
519515
520 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writeable_bytes() const noexcept516 _LIBCPP_INLINE_VISIBILITY span<byte, dynamic_extent> __as_writable_bytes() const noexcept
521 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }517 { return {reinterpret_cast<byte *>(data()), size_bytes()}; }
522518
523private:519private:
...@@ -525,20 +521,51 @@ private:...@@ -525,20 +521,51 @@ private:
525 index_type __size;521 index_type __size;
526};522};
527523
528// as_bytes & as_writeable_bytes524// tuple interface
529template <class _Tp, ptrdiff_t _Extent>525template <class _Tp, size_t _Size>
530 auto as_bytes(span<_Tp, _Extent> __s) noexcept526struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, _Size>>
531 -> decltype(__s.__as_bytes())527 : public integral_constant<size_t, _Size> {};
532 { return __s.__as_bytes(); }
533528
534template <class _Tp, ptrdiff_t _Extent>529template <class _Tp>
535 auto as_writeable_bytes(span<_Tp, _Extent> __s) noexcept530struct _LIBCPP_TEMPLATE_VIS tuple_size<span<_Tp, dynamic_extent>>; // declared but not defined
536 -> typename enable_if<!is_const_v<_Tp>, decltype(__s.__as_writeable_bytes())>::type531
537 { return __s.__as_writeable_bytes(); }532
533template <size_t _Ip, class _Tp, size_t _Size>
534struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, span<_Tp, _Size>>
535{
536 static_assert( dynamic_extent != _Size, "std::tuple_element<> not supported for std::span<T, dynamic_extent>");
537 static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::span)");
538 typedef _Tp type;
539};
538540
539template <class _Tp, ptrdiff_t _Extent>541template <size_t _Ip, class _Tp, size_t _Size>
540 constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept542_LIBCPP_INLINE_VISIBILITY constexpr
541 { __lhs.swap(__rhs); }543_Tp&
544get(span<_Tp, _Size> __s) noexcept
545{
546 static_assert( dynamic_extent != _Size, "std::get<> not supported for std::span<T, dynamic_extent>");
547 static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::span)");
548 return __s[_Ip];
549}
550
551
552// as_bytes & as_writable_bytes
553template <class _Tp, size_t _Extent>
554_LIBCPP_INLINE_VISIBILITY
555auto as_bytes(span<_Tp, _Extent> __s) noexcept
556-> decltype(__s.__as_bytes())
557{ return __s.__as_bytes(); }
558
559template <class _Tp, size_t _Extent>
560_LIBCPP_INLINE_VISIBILITY
561auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept
562-> enable_if_t<!is_const_v<_Tp>, decltype(__s.__as_writable_bytes())>
563{ return __s.__as_writable_bytes(); }
564
565template <class _Tp, size_t _Extent>
566_LIBCPP_INLINE_VISIBILITY
567constexpr void swap(span<_Tp, _Extent> &__lhs, span<_Tp, _Extent> &__rhs) noexcept
568{ __lhs.swap(__rhs); }
542569
543570
544// Deduction guides571// Deduction guides
lib/libcxx/include/sstream+4-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- sstream ----------------------------------===//2//===--------------------------- sstream ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -559,7 +558,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)...@@ -559,7 +558,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
559 char_type* __p = const_cast<char_type*>(__str_.data());558 char_type* __p = const_cast<char_type*>(__str_.data());
560 this->setg(__p, __p + __ninp, __hm_);559 this->setg(__p, __p + __ninp, __hm_);
561 }560 }
562 return this->sputc(__c);561 return this->sputc(traits_type::to_char_type(__c));
563 }562 }
564 return traits_type::not_eof(__c);563 return traits_type::not_eof(__c);
565}564}
lib/libcxx/include/stack+8-9
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- stack -----------------------------------===//2//===---------------------------- stack -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -63,8 +62,8 @@ public:...@@ -63,8 +62,8 @@ public:
6362
64template<class Container>63template<class Container>
65 stack(Container) -> stack<typename Container::value_type, Container>; // C++1764 stack(Container) -> stack<typename Container::value_type, Container>; // C++17
66 65
67template<class Container, class Allocator> 66template<class Container, class Allocator>
68 stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++1767 stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
6968
70template <class T, class Container>69template <class T, class Container>
...@@ -119,7 +118,7 @@ public:...@@ -119,7 +118,7 @@ public:
119 typedef typename container_type::const_reference const_reference;118 typedef typename container_type::const_reference const_reference;
120 typedef typename container_type::size_type size_type;119 typedef typename container_type::size_type size_type;
121 static_assert((is_same<_Tp, value_type>::value), "" );120 static_assert((is_same<_Tp, value_type>::value), "" );
122 121
123protected:122protected:
124 container_type c;123 container_type c;
125124
...@@ -241,12 +240,12 @@ template<class _Container,...@@ -241,12 +240,12 @@ template<class _Container,
241>240>
242stack(_Container)241stack(_Container)
243 -> stack<typename _Container::value_type, _Container>;242 -> stack<typename _Container::value_type, _Container>;
244 243
245template<class _Container,244template<class _Container,
246 class _Alloc,245 class _Alloc,
247 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,246 class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
248 class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type247 class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
249 > 248 >
250stack(_Container, _Alloc)249stack(_Container, _Alloc)
251 -> stack<typename _Container::value_type, _Container>;250 -> stack<typename _Container::value_type, _Container>;
252#endif251#endif
lib/libcxx/include/stdbool.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- stdbool.h --------------------------------===//2//===--------------------------- stdbool.h --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10#ifndef _LIBCPP_STDBOOL_H9#ifndef _LIBCPP_STDBOOL_H
lib/libcxx/include/stddef.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- stddef.h ---------------------------------===//2//===--------------------------- stddef.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/stdexcept+31-5
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- stdexcept --------------------------------===//2//===--------------------------- stdexcept --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -55,6 +54,7 @@ public:...@@ -55,6 +54,7 @@ public:
5554
56_LIBCPP_BEGIN_NAMESPACE_STD55_LIBCPP_BEGIN_NAMESPACE_STD
5756
57#ifndef _LIBCPP_ABI_VCRUNTIME
58class _LIBCPP_HIDDEN __libcpp_refstring58class _LIBCPP_HIDDEN __libcpp_refstring
59{59{
60 const char* __imp_;60 const char* __imp_;
...@@ -68,6 +68,7 @@ public:...@@ -68,6 +68,7 @@ public:
6868
69 const char* c_str() const _NOEXCEPT {return __imp_;}69 const char* c_str() const _NOEXCEPT {return __imp_;}
70};70};
71#endif // !_LIBCPP_ABI_VCRUNTIME
7172
72_LIBCPP_END_NAMESPACE_STD73_LIBCPP_END_NAMESPACE_STD
7374
...@@ -77,6 +78,7 @@ namespace std // purposefully not using versioning namespace...@@ -77,6 +78,7 @@ namespace std // purposefully not using versioning namespace
77class _LIBCPP_EXCEPTION_ABI logic_error78class _LIBCPP_EXCEPTION_ABI logic_error
78 : public exception79 : public exception
79{80{
81#ifndef _LIBCPP_ABI_VCRUNTIME
80private:82private:
81 _VSTD::__libcpp_refstring __imp_;83 _VSTD::__libcpp_refstring __imp_;
82public:84public:
...@@ -89,11 +91,17 @@ public:...@@ -89,11 +91,17 @@ public:
89 virtual ~logic_error() _NOEXCEPT;91 virtual ~logic_error() _NOEXCEPT;
9092
91 virtual const char* what() const _NOEXCEPT;93 virtual const char* what() const _NOEXCEPT;
94#else
95public:
96 explicit logic_error(const _VSTD::string&); // Symbol uses versioned std::string
97 _LIBCPP_INLINE_VISIBILITY explicit logic_error(const char* __s) : exception(__s) {}
98#endif
92};99};
93100
94class _LIBCPP_EXCEPTION_ABI runtime_error101class _LIBCPP_EXCEPTION_ABI runtime_error
95 : public exception102 : public exception
96{103{
104#ifndef _LIBCPP_ABI_VCRUNTIME
97private:105private:
98 _VSTD::__libcpp_refstring __imp_;106 _VSTD::__libcpp_refstring __imp_;
99public:107public:
...@@ -106,6 +114,11 @@ public:...@@ -106,6 +114,11 @@ public:
106 virtual ~runtime_error() _NOEXCEPT;114 virtual ~runtime_error() _NOEXCEPT;
107115
108 virtual const char* what() const _NOEXCEPT;116 virtual const char* what() const _NOEXCEPT;
117#else
118public:
119 explicit runtime_error(const _VSTD::string&); // Symbol uses versioned std::string
120 _LIBCPP_INLINE_VISIBILITY explicit runtime_error(const char* __s) : exception(__s) {}
121#endif // _LIBCPP_ABI_VCRUNTIME
109};122};
110123
111class _LIBCPP_EXCEPTION_ABI domain_error124class _LIBCPP_EXCEPTION_ABI domain_error
...@@ -115,7 +128,9 @@ public:...@@ -115,7 +128,9 @@ public:
115 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}128 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
116 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}129 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
117130
131#ifndef _LIBCPP_ABI_VCRUNTIME
118 virtual ~domain_error() _NOEXCEPT;132 virtual ~domain_error() _NOEXCEPT;
133#endif
119};134};
120135
121class _LIBCPP_EXCEPTION_ABI invalid_argument136class _LIBCPP_EXCEPTION_ABI invalid_argument
...@@ -125,7 +140,9 @@ public:...@@ -125,7 +140,9 @@ public:
125 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}140 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
126 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}141 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
127142
143#ifndef _LIBCPP_ABI_VCRUNTIME
128 virtual ~invalid_argument() _NOEXCEPT;144 virtual ~invalid_argument() _NOEXCEPT;
145#endif
129};146};
130147
131class _LIBCPP_EXCEPTION_ABI length_error148class _LIBCPP_EXCEPTION_ABI length_error
...@@ -134,8 +151,9 @@ class _LIBCPP_EXCEPTION_ABI length_error...@@ -134,8 +151,9 @@ class _LIBCPP_EXCEPTION_ABI length_error
134public:151public:
135 _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}152 _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
136 _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}153 _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
137154#ifndef _LIBCPP_ABI_VCRUNTIME
138 virtual ~length_error() _NOEXCEPT;155 virtual ~length_error() _NOEXCEPT;
156#endif
139};157};
140158
141class _LIBCPP_EXCEPTION_ABI out_of_range159class _LIBCPP_EXCEPTION_ABI out_of_range
...@@ -145,7 +163,9 @@ public:...@@ -145,7 +163,9 @@ public:
145 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}163 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
146 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}164 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
147165
166#ifndef _LIBCPP_ABI_VCRUNTIME
148 virtual ~out_of_range() _NOEXCEPT;167 virtual ~out_of_range() _NOEXCEPT;
168#endif
149};169};
150170
151class _LIBCPP_EXCEPTION_ABI range_error171class _LIBCPP_EXCEPTION_ABI range_error
...@@ -155,7 +175,9 @@ public:...@@ -155,7 +175,9 @@ public:
155 _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}175 _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
156 _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}176 _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
157177
178#ifndef _LIBCPP_ABI_VCRUNTIME
158 virtual ~range_error() _NOEXCEPT;179 virtual ~range_error() _NOEXCEPT;
180#endif
159};181};
160182
161class _LIBCPP_EXCEPTION_ABI overflow_error183class _LIBCPP_EXCEPTION_ABI overflow_error
...@@ -165,7 +187,9 @@ public:...@@ -165,7 +187,9 @@ public:
165 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}187 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
166 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}188 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
167189
190#ifndef _LIBCPP_ABI_VCRUNTIME
168 virtual ~overflow_error() _NOEXCEPT;191 virtual ~overflow_error() _NOEXCEPT;
192#endif
169};193};
170194
171class _LIBCPP_EXCEPTION_ABI underflow_error195class _LIBCPP_EXCEPTION_ABI underflow_error
...@@ -175,7 +199,9 @@ public:...@@ -175,7 +199,9 @@ public:
175 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}199 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
176 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}200 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
177201
202#ifndef _LIBCPP_ABI_VCRUNTIME
178 virtual ~underflow_error() _NOEXCEPT;203 virtual ~underflow_error() _NOEXCEPT;
204#endif
179};205};
180206
181} // std207} // std
lib/libcxx/include/stdint.h+8-4
...@@ -1,15 +1,19 @@...@@ -1,15 +1,19 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- stdint.h --------------------------------===//2//===---------------------------- stdint.h --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
11#ifndef _LIBCPP_STDINT_H10#ifndef _LIBCPP_STDINT_H
11// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
12// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
13// case the header guard macro is defined.
14#if !defined(_AIX) || !defined(_STD_TYPES_T)
12#define _LIBCPP_STDINT_H15#define _LIBCPP_STDINT_H
16#endif // _STD_TYPES_T
1317
14/*18/*
15 stdint.h synopsis19 stdint.h synopsis
lib/libcxx/include/stdio.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- stdio.h ---------------------------------===//2//===---------------------------- stdio.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/stdlib.h+9-32
...@@ -1,19 +1,22 @@...@@ -1,19 +1,22 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- stdlib.h ---------------------------------===//2//===--------------------------- stdlib.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
11#if defined(__need_malloc_and_calloc)10#if defined(__need_malloc_and_calloc) || defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
1211
13#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)12#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
14#pragma GCC system_header13#pragma GCC system_header
15#endif14#endif
1615
16#if defined(_LIBCPP_STDLIB_INCLUDE_NEXT)
17#undef _LIBCPP_STDLIB_INCLUDE_NEXT
18#endif
19
17#include_next <stdlib.h>20#include_next <stdlib.h>
1821
19#elif !defined(_LIBCPP_STDLIB_H)22#elif !defined(_LIBCPP_STDLIB_H)
...@@ -94,33 +97,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11...@@ -94,33 +97,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
94#include_next <stdlib.h>97#include_next <stdlib.h>
9598
96#ifdef __cplusplus99#ifdef __cplusplus
97100#include <math.h>
98extern "C++" {
99
100#undef abs
101#undef div
102#undef labs
103#undef ldiv
104#ifndef _LIBCPP_HAS_NO_LONG_LONG
105#undef llabs
106#undef lldiv
107#endif
108
109// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
110#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
111inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
112#ifndef _LIBCPP_HAS_NO_LONG_LONG
113inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
114#endif // _LIBCPP_HAS_NO_LONG_LONG
115
116inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
117#ifndef _LIBCPP_HAS_NO_LONG_LONG
118inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
119#endif // _LIBCPP_HAS_NO_LONG_LONG
120#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
121
122} // extern "C++"
123
124#endif // __cplusplus101#endif // __cplusplus
125102
126#endif // _LIBCPP_STDLIB_H103#endif // _LIBCPP_STDLIB_H
lib/libcxx/include/streambuf+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------- streambuf ----------------------------------===//2//===------------------------- streambuf ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/string+36-41
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- string -----------------------------------===//2//===--------------------------- string -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -628,13 +627,13 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};...@@ -628,13 +627,13 @@ struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
628#else627#else
629template <class _Iter, bool = __is_forward_iterator<_Iter>::value>628template <class _Iter, bool = __is_forward_iterator<_Iter>::value>
630struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((629struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
631 noexcept(++(declval<_Iter&>())) && 630 noexcept(++(declval<_Iter&>())) &&
632 is_nothrow_assignable<_Iter&, _Iter>::value && 631 is_nothrow_assignable<_Iter&, _Iter>::value &&
633 noexcept(declval<_Iter>() == declval<_Iter>()) && 632 noexcept(declval<_Iter>() == declval<_Iter>()) &&
634 noexcept(*declval<_Iter>())633 noexcept(*declval<_Iter>())
635)) {};634)) {};
636635
637template <class _Iter> 636template <class _Iter>
638struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};637struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};
639#endif638#endif
640639
...@@ -863,10 +862,10 @@ public:...@@ -863,10 +862,10 @@ public:
863 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS862 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
864 explicit basic_string(const _Tp& __t, const allocator_type& __a);863 explicit basic_string(const _Tp& __t, const allocator_type& __a);
865864
866 template<class _InputIterator>865 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
867 _LIBCPP_INLINE_VISIBILITY866 _LIBCPP_INLINE_VISIBILITY
868 basic_string(_InputIterator __first, _InputIterator __last);867 basic_string(_InputIterator __first, _InputIterator __last);
869 template<class _InputIterator>868 template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type>
870 _LIBCPP_INLINE_VISIBILITY869 _LIBCPP_INLINE_VISIBILITY
871 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);870 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
872#ifndef _LIBCPP_CXX03_LANG871#ifndef _LIBCPP_CXX03_LANG
...@@ -1061,10 +1060,10 @@ public:...@@ -1061,10 +1060,10 @@ public:
1061 void push_back(value_type __c);1060 void push_back(value_type __c);
1062 _LIBCPP_INLINE_VISIBILITY1061 _LIBCPP_INLINE_VISIBILITY
1063 void pop_back();1062 void pop_back();
1064 _LIBCPP_INLINE_VISIBILITY reference front();1063 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT;
1065 _LIBCPP_INLINE_VISIBILITY const_reference front() const;1064 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT;
1066 _LIBCPP_INLINE_VISIBILITY reference back();1065 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT;
1067 _LIBCPP_INLINE_VISIBILITY const_reference back() const;1066 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT;
10681067
1069 template <class _Tp>1068 template <class _Tp>
1070 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS1069 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
...@@ -1237,9 +1236,9 @@ public:...@@ -1237,9 +1236,9 @@ public:
1237 _LIBCPP_INLINE_VISIBILITY1236 _LIBCPP_INLINE_VISIBILITY
1238 void swap(basic_string& __str)1237 void swap(basic_string& __str)
1239#if _LIBCPP_STD_VER >= 141238#if _LIBCPP_STD_VER >= 14
1240 _NOEXCEPT_DEBUG;1239 _NOEXCEPT;
1241#else1240#else
1242 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||1241 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
1243 __is_nothrow_swappable<allocator_type>::value);1242 __is_nothrow_swappable<allocator_type>::value);
1244#endif1243#endif
12451244
...@@ -1421,7 +1420,7 @@ public:...@@ -1421,7 +1420,7 @@ public:
1421 _LIBCPP_INLINE_VISIBILITY bool __invariants() const;1420 _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
14221421
1423 _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;1422 _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
1424 1423
1425 _LIBCPP_INLINE_VISIBILITY1424 _LIBCPP_INLINE_VISIBILITY
1426 bool __is_long() const _NOEXCEPT1425 bool __is_long() const _NOEXCEPT
1427 {return bool(__r_.first().__s.__size_ & __short_mask);}1426 {return bool(__r_.first().__s.__size_ & __short_mask);}
...@@ -1683,7 +1682,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _...@@ -1683,7 +1682,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
1683 -> basic_string<_CharT, _Traits, _Allocator>;1682 -> basic_string<_CharT, _Traits, _Allocator>;
1684#endif1683#endif
16851684
1686 1685
1687template <class _CharT, class _Traits, class _Allocator>1686template <class _CharT, class _Traits, class _Allocator>
1688inline1687inline
1689void1688void
...@@ -2078,7 +2077,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For...@@ -2078,7 +2077,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
2078}2077}
20792078
2080template <class _CharT, class _Traits, class _Allocator>2079template <class _CharT, class _Traits, class _Allocator>
2081template<class _InputIterator>2080template<class _InputIterator, class>
2082inline2081inline
2083basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)2082basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
2084{2083{
...@@ -2089,7 +2088,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,...@@ -2089,7 +2088,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
2089}2088}
20902089
2091template <class _CharT, class _Traits, class _Allocator>2090template <class _CharT, class _Traits, class _Allocator>
2092template<class _InputIterator>2091template<class _InputIterator, class>
2093inline2092inline
2094basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,2093basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
2095 const allocator_type& __a)2094 const allocator_type& __a)
...@@ -2526,7 +2525,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(...@@ -2526,7 +2525,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
2526 const basic_string __temp (__first, __last, __alloc());2525 const basic_string __temp (__first, __last, __alloc());
2527 append(__temp.data(), __temp.size());2526 append(__temp.data(), __temp.size());
2528 }2527 }
2529 else 2528 else
2530 {2529 {
2531 if (__cap - __sz < __n)2530 if (__cap - __sz < __n)
2532 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);2531 __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
...@@ -3238,7 +3237,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)...@@ -3238,7 +3237,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
3238template <class _CharT, class _Traits, class _Allocator>3237template <class _CharT, class _Traits, class _Allocator>
3239inline3238inline
3240typename basic_string<_CharT, _Traits, _Allocator>::reference3239typename basic_string<_CharT, _Traits, _Allocator>::reference
3241basic_string<_CharT, _Traits, _Allocator>::front()3240basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
3242{3241{
3243 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");3242 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
3244 return *__get_pointer();3243 return *__get_pointer();
...@@ -3247,7 +3246,7 @@ basic_string<_CharT, _Traits, _Allocator>::front()...@@ -3247,7 +3246,7 @@ basic_string<_CharT, _Traits, _Allocator>::front()
3247template <class _CharT, class _Traits, class _Allocator>3246template <class _CharT, class _Traits, class _Allocator>
3248inline3247inline
3249typename basic_string<_CharT, _Traits, _Allocator>::const_reference3248typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3250basic_string<_CharT, _Traits, _Allocator>::front() const3249basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
3251{3250{
3252 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");3251 _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
3253 return *data();3252 return *data();
...@@ -3256,7 +3255,7 @@ basic_string<_CharT, _Traits, _Allocator>::front() const...@@ -3256,7 +3255,7 @@ basic_string<_CharT, _Traits, _Allocator>::front() const
3256template <class _CharT, class _Traits, class _Allocator>3255template <class _CharT, class _Traits, class _Allocator>
3257inline3256inline
3258typename basic_string<_CharT, _Traits, _Allocator>::reference3257typename basic_string<_CharT, _Traits, _Allocator>::reference
3259basic_string<_CharT, _Traits, _Allocator>::back()3258basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
3260{3259{
3261 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");3260 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
3262 return *(__get_pointer() + size() - 1);3261 return *(__get_pointer() + size() - 1);
...@@ -3265,7 +3264,7 @@ basic_string<_CharT, _Traits, _Allocator>::back()...@@ -3265,7 +3264,7 @@ basic_string<_CharT, _Traits, _Allocator>::back()
3265template <class _CharT, class _Traits, class _Allocator>3264template <class _CharT, class _Traits, class _Allocator>
3266inline3265inline
3267typename basic_string<_CharT, _Traits, _Allocator>::const_reference3266typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3268basic_string<_CharT, _Traits, _Allocator>::back() const3267basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
3269{3268{
3270 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");3269 _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
3271 return *(data() + size() - 1);3270 return *(data() + size() - 1);
...@@ -3296,9 +3295,9 @@ inline...@@ -3296,9 +3295,9 @@ inline
3296void3295void
3297basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)3296basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
3298#if _LIBCPP_STD_VER >= 143297#if _LIBCPP_STD_VER >= 14
3299 _NOEXCEPT_DEBUG3298 _NOEXCEPT
3300#else3299#else
3301 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||3300 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
3302 __is_nothrow_swappable<allocator_type>::value)3301 __is_nothrow_swappable<allocator_type>::value)
3303#endif3302#endif
3304{3303{
...@@ -3825,7 +3824,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const...@@ -3825,7 +3824,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
38253824
3826template<class _CharT, class _Traits, class _Allocator>3825template<class _CharT, class _Traits, class _Allocator>
3827inline3826inline
3828void 3827void
3829basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT3828basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
3830{3829{
3831 clear();3830 clear();
...@@ -3835,7 +3834,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT...@@ -3835,7 +3834,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
3835 __set_long_cap(0);3834 __set_long_cap(0);
3836 __set_short_size(0);3835 __set_short_size(0);
3837 }3836 }
3838} 3837}
38393838
3840// operator==3839// operator==
38413840
...@@ -4228,21 +4227,17 @@ template<class _CharT, class _Traits, class _Allocator>...@@ -4228,21 +4227,17 @@ template<class _CharT, class _Traits, class _Allocator>
4228 const typename basic_string<_CharT, _Traits, _Allocator>::size_type4227 const typename basic_string<_CharT, _Traits, _Allocator>::size_type
4229 basic_string<_CharT, _Traits, _Allocator>::npos;4228 basic_string<_CharT, _Traits, _Allocator>::npos;
42304229
4231template<class _CharT, class _Traits, class _Allocator>4230template <class _CharT, class _Allocator>
4232struct _LIBCPP_TEMPLATE_VIS hash<basic_string<_CharT, _Traits, _Allocator> >4231struct _LIBCPP_TEMPLATE_VIS
4233 : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>4232 hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> >
4233 : public unary_function<
4234 basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t>
4234{4235{
4235 size_t4236 size_t
4236 operator()(const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT;4237 operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT
4238 { return __do_string_hash(__val.data(), __val.data() + __val.size()); }
4237};4239};
42384240
4239template<class _CharT, class _Traits, class _Allocator>
4240size_t
4241hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
4242 const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
4243{
4244 return __do_string_hash(__val.data(), __val.data() + __val.size());
4245}
42464241
4247template<class _CharT, class _Traits, class _Allocator>4242template<class _CharT, class _Traits, class _Allocator>
4248basic_ostream<_CharT, _Traits>&4243basic_ostream<_CharT, _Traits>&
...@@ -4332,7 +4327,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*...@@ -4332,7 +4327,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
4332_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)4327_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
4333_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)4328_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
43344329
4335#if _LIBCPP_STD_VER > 11 4330#if _LIBCPP_STD_VER > 11
4336// Literal suffixes for basic_string [basic.string.literals]4331// Literal suffixes for basic_string [basic.string.literals]
4337inline namespace literals4332inline namespace literals
4338{4333{
lib/libcxx/include/string.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- string.h ---------------------------------===//2//===--------------------------- string.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/string_view+20-21
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ string_view ---------------------------------===//2//===------------------------ string_view ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -229,9 +228,9 @@ public:...@@ -229,9 +228,9 @@ public:
229 basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT228 basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
230 : __data(__s), __size(__len)229 : __data(__s), __size(__len)
231 {230 {
232// #if _LIBCPP_STD_VER > 11231#if _LIBCPP_STD_VER > 11
233// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");232 _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
234// #endif233#endif
235 }234 }
236235
237 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY236 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
...@@ -289,13 +288,13 @@ public:...@@ -289,13 +288,13 @@ public:
289 }288 }
290289
291 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY290 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
292 const_reference front() const291 const_reference front() const _NOEXCEPT
293 {292 {
294 return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];293 return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
295 }294 }
296295
297 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY296 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
298 const_reference back() const297 const_reference back() const _NOEXCEPT
299 {298 {
300 return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];299 return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
301 }300 }
...@@ -365,7 +364,7 @@ public:...@@ -365,7 +364,7 @@ public:
365 }364 }
366365
367 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY366 _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
368 int compare( size_type __pos1, size_type __n1, 367 int compare( size_type __pos1, size_type __n1,
369 basic_string_view __sv, size_type __pos2, size_type __n2) const368 basic_string_view __sv, size_type __pos2, size_type __n2) const
370 {369 {
371 return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));370 return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
...@@ -629,7 +628,7 @@ bool operator==(basic_string_view<_CharT, _Traits> __lhs,...@@ -629,7 +628,7 @@ bool operator==(basic_string_view<_CharT, _Traits> __lhs,
629628
630template<class _CharT, class _Traits>629template<class _CharT, class _Traits>
631_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY630_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
632bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 631bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
633 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT632 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
634{633{
635 if ( __lhs.size() != __rhs.size()) return false;634 if ( __lhs.size() != __rhs.size()) return false;
...@@ -659,7 +658,7 @@ bool operator!=(basic_string_view<_CharT, _Traits> __lhs,...@@ -659,7 +658,7 @@ bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
659658
660template<class _CharT, class _Traits>659template<class _CharT, class _Traits>
661_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY660_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
662bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 661bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
663 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT662 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
664{663{
665 if ( __lhs.size() != __rhs.size())664 if ( __lhs.size() != __rhs.size())
...@@ -686,7 +685,7 @@ bool operator<(basic_string_view<_CharT, _Traits> __lhs,...@@ -686,7 +685,7 @@ bool operator<(basic_string_view<_CharT, _Traits> __lhs,
686685
687template<class _CharT, class _Traits>686template<class _CharT, class _Traits>
688_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY687_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
689bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 688bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
690 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT689 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
691{690{
692 return __lhs.compare(__rhs) < 0;691 return __lhs.compare(__rhs) < 0;
...@@ -711,7 +710,7 @@ bool operator>(basic_string_view<_CharT, _Traits> __lhs,...@@ -711,7 +710,7 @@ bool operator>(basic_string_view<_CharT, _Traits> __lhs,
711710
712template<class _CharT, class _Traits>711template<class _CharT, class _Traits>
713_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY712_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
714bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 713bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
715 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT714 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
716{715{
717 return __lhs.compare(__rhs) > 0;716 return __lhs.compare(__rhs) > 0;
...@@ -736,7 +735,7 @@ bool operator<=(basic_string_view<_CharT, _Traits> __lhs,...@@ -736,7 +735,7 @@ bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
736735
737template<class _CharT, class _Traits>736template<class _CharT, class _Traits>
738_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY737_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
739bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 738bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
740 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT739 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
741{740{
742 return __lhs.compare(__rhs) <= 0;741 return __lhs.compare(__rhs) <= 0;
...@@ -762,7 +761,7 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs,...@@ -762,7 +761,7 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
762761
763template<class _CharT, class _Traits>762template<class _CharT, class _Traits>
764_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY763_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
765bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 764bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
766 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT765 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
767{766{
768 return __lhs.compare(__rhs) >= 0;767 return __lhs.compare(__rhs) >= 0;
...@@ -777,18 +776,18 @@ typedef basic_string_view<char32_t> u32string_view;...@@ -777,18 +776,18 @@ typedef basic_string_view<char32_t> u32string_view;
777typedef basic_string_view<wchar_t> wstring_view;776typedef basic_string_view<wchar_t> wstring_view;
778777
779// [string.view.hash]778// [string.view.hash]
780template<class _CharT, class _Traits>779template<class _CharT>
781struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, _Traits> >780struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > >
782 : public unary_function<basic_string_view<_CharT, _Traits>, size_t>781 : public unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t>
783{782{
784 _LIBCPP_INLINE_VISIBILITY783 _LIBCPP_INLINE_VISIBILITY
785 size_t operator()(const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT {784 size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT {
786 return __do_string_hash(__val.data(), __val.data() + __val.size());785 return __do_string_hash(__val.data(), __val.data() + __val.size());
787 }786 }
788};787};
789788
790789
791#if _LIBCPP_STD_VER > 11 790#if _LIBCPP_STD_VER > 11
792inline namespace literals791inline namespace literals
793{792{
794 inline namespace string_view_literals793 inline namespace string_view_literals
lib/libcxx/include/strstream+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- strstream --------------------------------===//2//===--------------------------- strstream --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/android/locale_bionic.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------- support/android/locale_bionic.h ------------------===//2//===------------------- support/android/locale_bionic.h ------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/fuchsia/xlocale.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------- support/fuchsia/xlocale.h ------------------------===//2//===------------------- support/fuchsia/xlocale.h ------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/limits.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------- support/ibm/limits.h ---------------------------===//2//===--------------------- support/ibm/limits.h ---------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/locale_mgmt_aix.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------- support/ibm/locale_mgmt_aix.h --------------------===//2//===------------------- support/ibm/locale_mgmt_aix.h --------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/support.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===----------------------- support/ibm/support.h ----------------------===//2//===----------------------- support/ibm/support.h ----------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/ibm/xlocale.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------- support/ibm/xlocale.h -------------------===//2//===--------------------- support/ibm/xlocale.h -------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/musl/xlocale.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------- support/musl/xlocale.h ------------------------===//2//===------------------- support/musl/xlocale.h ------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10// This adds support for the extended locale functions that are currently9// This adds support for the extended locale functions that are currently
lib/libcxx/include/support/newlib/xlocale.h+3-4
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1//===----------------------------------------------------------------------===//1//===----------------------------------------------------------------------===//
2//2//
3// The LLVM Compiler Infrastructure3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4//4// See https://llvm.org/LICENSE.txt for license information.
5// This file is dual licensed under the MIT and the University of Illinois Open5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6// Source Licenses. See LICENSE.TXT for details.
7//6//
8//===----------------------------------------------------------------------===//7//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/floatingpoint.h+3-4
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1//===----------------------------------------------------------------------===//1//===----------------------------------------------------------------------===//
2//2//
3// The LLVM Compiler Infrastructure3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4//4// See https://llvm.org/LICENSE.txt for license information.
5// This file is dual licensed under the MIT and the University of Illinois Open5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6// Source Licenses. See LICENSE.TXT for details.
7//6//
8//===----------------------------------------------------------------------===//7//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/wchar.h+3-4
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1//===----------------------------------------------------------------------===//1//===----------------------------------------------------------------------===//
2//2//
3// The LLVM Compiler Infrastructure3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4//4// See https://llvm.org/LICENSE.txt for license information.
5// This file is dual licensed under the MIT and the University of Illinois Open5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6// Source Licenses. See LICENSE.TXT for details.
7//6//
8//===----------------------------------------------------------------------===//7//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/solaris/xlocale.h+3-4
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1//===----------------------------------------------------------------------===//1//===----------------------------------------------------------------------===//
2//2//
3// The LLVM Compiler Infrastructure3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4//4// See https://llvm.org/LICENSE.txt for license information.
5// This file is dual licensed under the MIT and the University of Illinois Open5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6// Source Licenses. See LICENSE.TXT for details.
7//6//
8//===----------------------------------------------------------------------===//7//===----------------------------------------------------------------------===//
98
lib/libcxx/include/support/win32/limits_msvc_win32.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------ support/win32/limits_msvc_win32.h -----------------===//2//===------------------ support/win32/limits_msvc_win32.h -----------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/win32/locale_win32.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------- support/win32/locale_win32.h -------------------===//2//===--------------------- support/win32/locale_win32.h -------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/xlocale/__nop_locale_mgmt.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===//2//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/support/xlocale/__posix_l_fallback.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------- support/xlocale/__posix_l_fallback.h -----------------===//2//===--------------- support/xlocale/__posix_l_fallback.h -----------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10// These are reimplementations of some extended locale functions ( *_l ) that9// These are reimplementations of some extended locale functions ( *_l ) that
lib/libcxx/include/support/xlocale/__strtonum_fallback.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------- support/xlocale/__strtonum_fallback.h -----------------===//2//===-------------- support/xlocale/__strtonum_fallback.h -----------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
10// These are reimplementations of some extended locale functions ( *_l ) that9// These are reimplementations of some extended locale functions ( *_l ) that
lib/libcxx/include/support/xlocale/xlocale.h deleted
lib/libcxx/include/system_error+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===---------------------------- system_error ----------------------------===//2//===---------------------------- system_error ----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/tgmath.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- tgmath.h ----------------------------------===//2//===-------------------------- tgmath.h ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/thread+8-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- thread -----------------------------------===//2//===--------------------------- thread -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -435,7 +434,12 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)...@@ -435,7 +434,12 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
435 using namespace chrono;434 using namespace chrono;
436 if (__d > duration<_Rep, _Period>::zero())435 if (__d > duration<_Rep, _Period>::zero())
437 {436 {
437#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
438 // GCC's long double const folding is incomplete for IBM128 long doubles.
438 _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();439 _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
440#else
441 _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
442#endif
439 nanoseconds __ns;443 nanoseconds __ns;
440 if (__d < _Max)444 if (__d < _Max)
441 {445 {
lib/libcxx/include/tuple+87-68
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- tuple ------------------------------------===//2//===--------------------------- tuple ------------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is distributed under the University of Illinois Open Source6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// License. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -88,8 +87,8 @@ template <class T> struct tuple_size; // undefined...@@ -88,8 +87,8 @@ template <class T> struct tuple_size; // undefined
88template <class... T> struct tuple_size<tuple<T...>>;87template <class... T> struct tuple_size<tuple<T...>>;
89template <class T>88template <class T>
90 inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++1789 inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
91template <size_t I, class T> class tuple_element; // undefined90template <size_t I, class T> struct tuple_element; // undefined
92template <size_t I, class... T> class tuple_element<I, tuple<T...>>;91template <size_t I, class... T> struct tuple_element<I, tuple<T...>>;
93template <size_t I, class T>92template <size_t I, class T>
94 using tuple_element_t = typename tuple_element <I, T>::type; // C++1493 using tuple_element_t = typename tuple_element <I, T>::type; // C++14
9594
...@@ -210,12 +209,12 @@ public:...@@ -210,12 +209,12 @@ public:
210 "Attempted to default construct a reference element in a tuple");}209 "Attempted to default construct a reference element in a tuple");}
211210
212 template <class _Tp,211 template <class _Tp,
213 class = typename enable_if<212 class = _EnableIf<
214 __lazy_and<213 _And<
215 __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>214 _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
216 , is_constructible<_Hp, _Tp>215 is_constructible<_Hp, _Tp>
217 >::value216 >::value
218 >::type217 >
219 >218 >
220 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11219 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
221 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))220 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
...@@ -292,12 +291,12 @@ public:...@@ -292,12 +291,12 @@ public:
292 : _Hp(__a) {}291 : _Hp(__a) {}
293292
294 template <class _Tp,293 template <class _Tp,
295 class = typename enable_if<294 class = _EnableIf<
296 __lazy_and<295 _And<
297 __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>296 _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>,
298 , is_constructible<_Hp, _Tp>297 is_constructible<_Hp, _Tp>
299 >::value298 >::value
300 >::type299 >
301 >300 >
302 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11301 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
303 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))302 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
...@@ -346,9 +345,6 @@ template <class ..._Tp>...@@ -346,9 +345,6 @@ template <class ..._Tp>
346_LIBCPP_INLINE_VISIBILITY345_LIBCPP_INLINE_VISIBILITY
347void __swallow(_Tp&&...) _NOEXCEPT {}346void __swallow(_Tp&&...) _NOEXCEPT {}
348347
349template <class ..._Tp>
350struct __lazy_all : __all<_Tp::value...> {};
351
352template <class _Tp>348template <class _Tp>
353struct __all_default_constructible;349struct __all_default_constructible;
354350
...@@ -525,6 +521,13 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -525,6 +521,13 @@ class _LIBCPP_TEMPLATE_VIS tuple
525 template <class ..._Args>521 template <class ..._Args>
526 static constexpr bool __enable_implicit() {522 static constexpr bool __enable_implicit() {
527 return523 return
524 __tuple_constructible<
525 tuple<_Args...>,
526 typename __make_tuple_types<tuple,
527 sizeof...(_Args) < sizeof...(_Tp) ?
528 sizeof...(_Args) :
529 sizeof...(_Tp)>::type
530 >::value &&
528 __tuple_convertible<531 __tuple_convertible<
529 tuple<_Args...>,532 tuple<_Args...>,
530 typename __make_tuple_types<tuple,533 typename __make_tuple_types<tuple,
...@@ -551,7 +554,8 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -551,7 +554,8 @@ class _LIBCPP_TEMPLATE_VIS tuple
551 {554 {
552 template <class _Tuple>555 template <class _Tuple>
553 static constexpr bool __enable_implicit() {556 static constexpr bool __enable_implicit() {
554 return __tuple_convertible<_Tuple, tuple>::value;557 return __tuple_constructible<_Tuple, tuple>::value
558 && __tuple_convertible<_Tuple, tuple>::value;
555 }559 }
556560
557 template <class _Tuple>561 template <class _Tuple>
...@@ -568,19 +572,20 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -568,19 +572,20 @@ class _LIBCPP_TEMPLATE_VIS tuple
568 // the UTypes... constructor should be selected instead.572 // the UTypes... constructor should be selected instead.
569 // See LWG issue #2549.573 // See LWG issue #2549.
570 template <class _Tuple>574 template <class _Tuple>
571 using _PreferTupleLikeConstructor = __lazy_or<575 using _PreferTupleLikeConstructor = _Or<
572 // Don't attempt the two checks below if the tuple we are given576 // Don't attempt the two checks below if the tuple we are given
573 // has the same type as this tuple.577 // has the same type as this tuple.
574 is_same<typename __uncvref<_Tuple>::type, tuple>,578 _IsSame<__uncvref_t<_Tuple>, tuple>,
575 __lazy_and<579 _Lazy<_And,
576 __lazy_not<is_constructible<_Tp..., _Tuple>>,580 _Not<is_constructible<_Tp..., _Tuple>>,
577 __lazy_not<is_convertible<_Tuple, _Tp...>>581 _Not<is_convertible<_Tuple, _Tp...>>
578 >582 >
579 >;583 >;
580584
581 template <class _Tuple>585 template <class _Tuple>
582 static constexpr bool __enable_implicit() {586 static constexpr bool __enable_implicit() {
583 return __lazy_and<587 return _And<
588 __tuple_constructible<_Tuple, tuple>,
584 __tuple_convertible<_Tuple, tuple>,589 __tuple_convertible<_Tuple, tuple>,
585 _PreferTupleLikeConstructor<_Tuple>590 _PreferTupleLikeConstructor<_Tuple>
586 >::value;591 >::value;
...@@ -588,14 +593,33 @@ class _LIBCPP_TEMPLATE_VIS tuple...@@ -588,14 +593,33 @@ class _LIBCPP_TEMPLATE_VIS tuple
588593
589 template <class _Tuple>594 template <class _Tuple>
590 static constexpr bool __enable_explicit() {595 static constexpr bool __enable_explicit() {
591 return __lazy_and<596 return _And<
592 __tuple_constructible<_Tuple, tuple>,597 __tuple_constructible<_Tuple, tuple>,
593 _PreferTupleLikeConstructor<_Tuple>,598 _PreferTupleLikeConstructor<_Tuple>,
594 __lazy_not<__tuple_convertible<_Tuple, tuple>>599 _Not<__tuple_convertible<_Tuple, tuple>>
595 >::value;600 >::value;
596 }601 }
597 };602 };
598603
604 template <class _Tuple, bool _DisableIfLValue>
605 using _EnableImplicitTupleLikeConstructor = _EnableIf<
606 _CheckTupleLikeConstructor<
607 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
608 && !_PackExpandsToThisTuple<_Tuple>::value
609 && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue)
610 >::template __enable_implicit<_Tuple>(),
611 bool
612 >;
613
614 template <class _Tuple, bool _DisableIfLValue>
615 using _EnableExplicitTupleLikeConstructor = _EnableIf<
616 _CheckTupleLikeConstructor<
617 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
618 && !_PackExpandsToThisTuple<_Tuple>::value
619 && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue)
620 >::template __enable_explicit<_Tuple>(),
621 bool
622 >;
599 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11623 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
600 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;624 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
601 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11625 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
...@@ -616,12 +640,13 @@ public:...@@ -616,12 +640,13 @@ public:
616 tuple(tuple const&) = default;640 tuple(tuple const&) = default;
617 tuple(tuple&&) = default;641 tuple(tuple&&) = default;
618642
619 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = typename enable_if<643 template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf<
620 __lazy_and<644 _And<
621 is_same<allocator_arg_t, _AllocArgT>,645 _IsSame<allocator_arg_t, _AllocArgT>,
622 __lazy_all<__dependent_type<is_default_constructible<_Tp>, _Dummy>...>646 __dependent_type<is_default_constructible<_Tp>, _Dummy>...
623 >::value647 >::value
624 >::type>648 >
649 >
625 _LIBCPP_INLINE_VISIBILITY650 _LIBCPP_INLINE_VISIBILITY
626 tuple(_AllocArgT, _Alloc const& __a)651 tuple(_AllocArgT, _Alloc const& __a)
627 : __base_(allocator_arg_t(), __a,652 : __base_(allocator_arg_t(), __a,
...@@ -809,35 +834,27 @@ public:...@@ -809,35 +834,27 @@ public:
809 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),834 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
810 _VSTD::forward<_Up>(__u)...) {}835 _VSTD::forward<_Up>(__u)...) {}
811836
812 template <class _Tuple,837 template <class _Tuple, _EnableImplicitTupleLikeConstructor<_Tuple, true> = false>
813 typename enable_if
814 <
815 _CheckTupleLikeConstructor<
816 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value
817 && !_PackExpandsToThisTuple<_Tuple>::value
818 >::template __enable_implicit<_Tuple>(),
819 bool
820 >::type = false
821 >
822 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11838 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
823 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))839 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
824 : __base_(_VSTD::forward<_Tuple>(__t)) {}840 : __base_(_VSTD::forward<_Tuple>(__t)) {}
825841
826 template <class _Tuple,842 template <class _Tuple, _EnableImplicitTupleLikeConstructor<const _Tuple&, false> = false>
827 typename enable_if843 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
828 <844 tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value))
829 _CheckTupleLikeConstructor<845 : __base_(__t) {}
830 __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value846 template <class _Tuple, _EnableExplicitTupleLikeConstructor<_Tuple, true> = false>
831 && !_PackExpandsToThisTuple<_Tuple>::value
832 >::template __enable_explicit<_Tuple>(),
833 bool
834 >::type = false
835 >
836 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11847 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
837 explicit848 explicit
838 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))849 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
839 : __base_(_VSTD::forward<_Tuple>(__t)) {}850 : __base_(_VSTD::forward<_Tuple>(__t)) {}
840851
852 template <class _Tuple, _EnableExplicitTupleLikeConstructor<const _Tuple&, false> = false>
853 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
854 explicit
855 tuple(const _Tuple& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, const _Tuple&>::value))
856 : __base_(__t) {}
857
841 template <class _Alloc, class _Tuple,858 template <class _Alloc, class _Tuple,
842 typename enable_if859 typename enable_if
843 <860 <
...@@ -908,7 +925,7 @@ class _LIBCPP_TEMPLATE_VIS tuple<>...@@ -908,7 +925,7 @@ class _LIBCPP_TEMPLATE_VIS tuple<>
908{925{
909public:926public:
910 _LIBCPP_INLINE_VISIBILITY927 _LIBCPP_INLINE_VISIBILITY
911 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}928 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT = default;
912 template <class _Alloc>929 template <class _Alloc>
913 _LIBCPP_INLINE_VISIBILITY930 _LIBCPP_INLINE_VISIBILITY
914 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}931 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
...@@ -953,7 +970,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -953,7 +970,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
953typename tuple_element<_Ip, tuple<_Tp...> >::type&970typename tuple_element<_Ip, tuple<_Tp...> >::type&
954get(tuple<_Tp...>& __t) _NOEXCEPT971get(tuple<_Tp...>& __t) _NOEXCEPT
955{972{
956 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;973 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
957 return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();974 return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
958}975}
959976
...@@ -962,7 +979,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -962,7 +979,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
962const typename tuple_element<_Ip, tuple<_Tp...> >::type&979const typename tuple_element<_Ip, tuple<_Tp...> >::type&
963get(const tuple<_Tp...>& __t) _NOEXCEPT980get(const tuple<_Tp...>& __t) _NOEXCEPT
964{981{
965 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;982 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
966 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();983 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
967}984}
968985
...@@ -971,7 +988,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -971,7 +988,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
971typename tuple_element<_Ip, tuple<_Tp...> >::type&&988typename tuple_element<_Ip, tuple<_Tp...> >::type&&
972get(tuple<_Tp...>&& __t) _NOEXCEPT989get(tuple<_Tp...>&& __t) _NOEXCEPT
973{990{
974 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;991 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
975 return static_cast<type&&>(992 return static_cast<type&&>(
976 static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());993 static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
977}994}
...@@ -981,7 +998,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -981,7 +998,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
981const typename tuple_element<_Ip, tuple<_Tp...> >::type&&998const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
982get(const tuple<_Tp...>&& __t) _NOEXCEPT999get(const tuple<_Tp...>&& __t) _NOEXCEPT
983{1000{
984 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;1001 typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, tuple<_Tp...> >::type type;
985 return static_cast<const type&&>(1002 return static_cast<const type&&>(
986 static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());1003 static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
987}1004}
...@@ -1121,6 +1138,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -1121,6 +1138,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1121bool1138bool
1122operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)1139operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
1123{1140{
1141 static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
1124 return __tuple_equal<sizeof...(_Tp)>()(__x, __y);1142 return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
1125}1143}
11261144
...@@ -1164,6 +1182,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -1164,6 +1182,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1164bool1182bool
1165operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)1183operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
1166{1184{
1185 static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
1167 return __tuple_less<sizeof...(_Tp)>()(__x, __y);1186 return __tuple_less<sizeof...(_Tp)>()(__x, __y);
1168}1187}
11691188
...@@ -1198,7 +1217,7 @@ template <class _Tp, class _Up> struct __tuple_cat_type;...@@ -1198,7 +1217,7 @@ template <class _Tp, class _Up> struct __tuple_cat_type;
1198template <class ..._Ttypes, class ..._Utypes>1217template <class ..._Ttypes, class ..._Utypes>
1199struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >1218struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
1200{1219{
1201 typedef tuple<_Ttypes..., _Utypes...> type;1220 typedef _LIBCPP_NODEBUG_TYPE tuple<_Ttypes..., _Utypes...> type;
1202};1221};
12031222
1204template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>1223template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
...@@ -1209,8 +1228,8 @@ struct __tuple_cat_return_1...@@ -1209,8 +1228,8 @@ struct __tuple_cat_return_1
1209template <class ..._Types, class _Tuple0>1228template <class ..._Types, class _Tuple0>
1210struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>1229struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
1211{1230{
1212 typedef typename __tuple_cat_type<tuple<_Types...>,1231 typedef _LIBCPP_NODEBUG_TYPE typename __tuple_cat_type<tuple<_Types...>,
1213 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type1232 typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type>::type
1214 type;1233 type;
1215};1234};
12161235
...@@ -1219,7 +1238,7 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples......@@ -1219,7 +1238,7 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...
1219 : public __tuple_cat_return_1<1238 : public __tuple_cat_return_1<
1220 typename __tuple_cat_type<1239 typename __tuple_cat_type<
1221 tuple<_Types...>,1240 tuple<_Types...>,
1222 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type1241 typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type
1223 >::type,1242 >::type,
1224 __tuple_like<typename remove_reference<_Tuple1>::type>::value,1243 __tuple_like<typename remove_reference<_Tuple1>::type>::value,
1225 _Tuple1, _Tuples...>1244 _Tuple1, _Tuples...>
...@@ -1239,7 +1258,7 @@ struct __tuple_cat_return<_Tuple0, _Tuples...>...@@ -1239,7 +1258,7 @@ struct __tuple_cat_return<_Tuple0, _Tuples...>
1239template <>1258template <>
1240struct __tuple_cat_return<>1259struct __tuple_cat_return<>
1241{1260{
1242 typedef tuple<> type;1261 typedef _LIBCPP_NODEBUG_TYPE tuple<> type;
1243};1262};
12441263
1245inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX111264inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
...@@ -1255,7 +1274,7 @@ struct __tuple_cat_return_ref_imp;...@@ -1255,7 +1274,7 @@ struct __tuple_cat_return_ref_imp;
1255template <class ..._Types, size_t ..._I0, class _Tuple0>1274template <class ..._Types, size_t ..._I0, class _Tuple0>
1256struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>1275struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
1257{1276{
1258 typedef typename remove_reference<_Tuple0>::type _T0;1277 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
1259 typedef tuple<_Types..., typename __apply_cv<_Tuple0,1278 typedef tuple<_Types..., typename __apply_cv<_Tuple0,
1260 typename tuple_element<_I0, _T0>::type>::type&&...> type;1279 typename tuple_element<_I0, _T0>::type>::type&&...> type;
1261};1280};
...@@ -1302,8 +1321,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J...@@ -1302,8 +1321,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
1302 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type1321 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
1303 operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)1322 operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
1304 {1323 {
1305 typedef typename remove_reference<_Tuple0>::type _T0;1324 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
1306 typedef typename remove_reference<_Tuple1>::type _T1;1325 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple1>::type _T1;
1307 return __tuple_cat<1326 return __tuple_cat<
1308 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,1327 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
1309 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,1328 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
...@@ -1322,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11...@@ -1322,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
1322typename __tuple_cat_return<_Tuple0, _Tuples...>::type1341typename __tuple_cat_return<_Tuple0, _Tuples...>::type
1323tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)1342tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
1324{1343{
1325 typedef typename remove_reference<_Tuple0>::type _T0;1344 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tuple0>::type _T0;
1326 return __tuple_cat<tuple<>, __tuple_indices<>,1345 return __tuple_cat<tuple<>, __tuple_indices<>,
1327 typename __make_tuple_indices<tuple_size<_T0>::value>::type>()1346 typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
1328 (tuple<>(), _VSTD::forward<_Tuple0>(__t0),1347 (tuple<>(), _VSTD::forward<_Tuple0>(__t0),
lib/libcxx/include/type_traits+431-1240
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------ type_traits ---------------------------------===//2//===------------------------ type_traits ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -91,6 +90,9 @@ namespace std...@@ -91,6 +90,9 @@ namespace std
91 template <class T> struct remove_extent;90 template <class T> struct remove_extent;
92 template <class T> struct remove_all_extents;91 template <class T> struct remove_all_extents;
9392
93 template <class T> struct is_bounded_array; // C++20
94 template <class T> struct is_unbounded_array; // C++20
95
94 // Member introspection:96 // Member introspection:
95 template <class T> struct is_pod;97 template <class T> struct is_pod;
96 template <class T> struct is_trivial;98 template <class T> struct is_trivial;
...@@ -141,7 +143,10 @@ namespace std...@@ -141,7 +143,10 @@ namespace std
141 // Relationships between types:143 // Relationships between types:
142 template <class T, class U> struct is_same;144 template <class T, class U> struct is_same;
143 template <class Base, class Derived> struct is_base_of;145 template <class Base, class Derived> struct is_base_of;
146
144 template <class From, class To> struct is_convertible;147 template <class From, class To> struct is_convertible;
148 template <typename From, typename To> struct is_nothrow_convertible; // C++20
149 template <typename From, typename To> inline constexpr bool is_nothrow_convertible_v; // C++20
145150
146 template <class Fn, class... ArgTypes> struct is_invocable;151 template <class Fn, class... ArgTypes> struct is_invocable;
147 template <class R, class Fn, class... ArgTypes> struct is_invocable_r;152 template <class R, class Fn, class... ArgTypes> struct is_invocable_r;
...@@ -197,6 +202,12 @@ namespace std...@@ -197,6 +202,12 @@ namespace std
197 template <class T>202 template <class T>
198 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14203 using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14
199204
205 template <class T>
206 inline constexpr bool is_bounded_array_v
207 = is_bounded_array<T>::value; // C++20
208 inline constexpr bool is_unbounded_array_v
209 = is_unbounded_array<T>::value; // C++20
210
200 // pointer modifications:211 // pointer modifications:
201 template <class T>212 template <class T>
202 using remove_pointer_t = typename remove_pointer<T>::type; // C++14213 using remove_pointer_t = typename remove_pointer<T>::type; // C++14
...@@ -416,6 +427,96 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;...@@ -416,6 +427,96 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
416template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;427template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
417template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;428template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
418429
430
431template <class _Tp, _Tp __v>
432struct _LIBCPP_TEMPLATE_VIS integral_constant
433{
434 static _LIBCPP_CONSTEXPR const _Tp value = __v;
435 typedef _Tp value_type;
436 typedef integral_constant type;
437 _LIBCPP_INLINE_VISIBILITY
438 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
439#if _LIBCPP_STD_VER > 11
440 _LIBCPP_INLINE_VISIBILITY
441 constexpr value_type operator ()() const _NOEXCEPT {return value;}
442#endif
443};
444
445template <class _Tp, _Tp __v>
446_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
447
448#if _LIBCPP_STD_VER > 14
449template <bool __b>
450using bool_constant = integral_constant<bool, __b>;
451#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
452#else
453#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
454#endif
455
456typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
457typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
458
459template <bool _Val>
460using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool, _Val>;
461
462template <bool> struct _MetaBase;
463template <>
464struct _MetaBase<true> {
465 template <class _Tp, class _Up>
466 using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Tp;
467 template <template <class...> class _FirstFn, template <class...> class, class ..._Args>
468 using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _FirstFn<_Args...>;
469 template <class _First, class...>
470 using _FirstImpl _LIBCPP_NODEBUG_TYPE = _First;
471 template <class, class _Second, class...>
472 using _SecondImpl _LIBCPP_NODEBUG_TYPE = _Second;
473 template <class _Tp = void>
474 using _EnableIfImpl _LIBCPP_NODEBUG_TYPE = _Tp;
475 template <class _Result, class _First, class ..._Rest>
476 using _OrImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>;
477 template <class _Result, class _First, class ..._Rest>
478 using _AndImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>;
479};
480
481template <>
482struct _MetaBase<false> {
483 template <class _Tp, class _Up>
484 using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Up;
485 template <template <class...> class, template <class...> class _SecondFn, class ..._Args>
486 using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _SecondFn<_Args...>;
487 template <class _Result, class ...>
488 using _OrImpl _LIBCPP_NODEBUG_TYPE = _Result;
489 template <class _Result, class ...>
490 using _AndImpl _LIBCPP_NODEBUG_TYPE = _Result;
491};
492template <bool _Cond, class _Ret = void>
493using _EnableIf _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
494template <bool _Cond, class _IfRes, class _ElseRes>
495using _If _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
496template <class ..._Rest>
497using _Or _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>;
498template <class ..._Rest>
499using _And _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _AndImpl<true_type, _Rest...>;
500template <class _Pred>
501struct _Not : _BoolConstant<!_Pred::value> {};
502template <class ..._Args>
503using _FirstType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>;
504template <class ..._Args>
505using _SecondType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>;
506
507template <template <class...> class _Func, class ..._Args>
508struct _Lazy : _Func<_Args...> {};
509
510// Member detector base
511
512template <template <class...> class _Templ, class ..._Args>
513true_type __sfinae_test_impl(_FirstType<int, _Templ<_Args...> >);
514template <template <class...> class, class ...>
515false_type __sfinae_test_impl(...);
516
517template <template <class ...> class _Templ, class ..._Args>
518using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
519
419template <class>520template <class>
420struct __void_t { typedef void type; };521struct __void_t { typedef void type; };
421522
...@@ -434,9 +535,6 @@ template <class _If, class _Then>...@@ -434,9 +535,6 @@ template <class _If, class _Then>
434template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;535template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
435#endif536#endif
436537
437template <bool, class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if {};
438template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
439
440template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};538template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
441template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};539template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
442540
...@@ -444,6 +542,34 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _...@@ -444,6 +542,34 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _
444template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;542template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
445#endif543#endif
446544
545// is_same
546
547template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
548template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
549
550#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
551template <class _Tp, class _Up>
552_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
553 = is_same<_Tp, _Up>::value;
554#endif
555
556template <class _Tp, class _Up>
557using _IsSame = _BoolConstant<
558#ifdef __clang__
559 __is_same(_Tp, _Up)
560#else
561 _VSTD::is_same<_Tp, _Up>::value
562#endif
563>;
564
565template <class _Tp, class _Up>
566using _IsNotSame = _BoolConstant<
567#ifdef __clang__
568 !__is_same(_Tp, _Up)
569#else
570 !_VSTD::is_same<_Tp, _Up>::value
571#endif
572>;
447// addressof573// addressof
448#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF574#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
449575
...@@ -517,111 +643,6 @@ struct __two {char __lx[2];};...@@ -517,111 +643,6 @@ struct __two {char __lx[2];};
517643
518// helper class:644// helper class:
519645
520template <class _Tp, _Tp __v>
521struct _LIBCPP_TEMPLATE_VIS integral_constant
522{
523 static _LIBCPP_CONSTEXPR const _Tp value = __v;
524 typedef _Tp value_type;
525 typedef integral_constant type;
526 _LIBCPP_INLINE_VISIBILITY
527 _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
528#if _LIBCPP_STD_VER > 11
529 _LIBCPP_INLINE_VISIBILITY
530 constexpr value_type operator ()() const _NOEXCEPT {return value;}
531#endif
532};
533
534template <class _Tp, _Tp __v>
535_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
536
537#if _LIBCPP_STD_VER > 14
538template <bool __b>
539using bool_constant = integral_constant<bool, __b>;
540#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
541#else
542#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
543#endif
544
545typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
546typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
547
548#if !defined(_LIBCPP_CXX03_LANG)
549
550// __lazy_and
551
552template <bool _Last, class ..._Preds>
553struct __lazy_and_impl;
554
555template <class ..._Preds>
556struct __lazy_and_impl<false, _Preds...> : false_type {};
557
558template <>
559struct __lazy_and_impl<true> : true_type {};
560
561template <class _Pred>
562struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
563
564template <class _Hp, class ..._Tp>
565struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
566
567template <class _P1, class ..._Pr>
568struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
569
570// __lazy_or
571
572template <bool _List, class ..._Preds>
573struct __lazy_or_impl;
574
575template <class ..._Preds>
576struct __lazy_or_impl<true, _Preds...> : true_type {};
577
578template <>
579struct __lazy_or_impl<false> : false_type {};
580
581template <class _Hp, class ..._Tp>
582struct __lazy_or_impl<false, _Hp, _Tp...>
583 : __lazy_or_impl<_Hp::type::value, _Tp...> {};
584
585template <class _P1, class ..._Pr>
586struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {};
587
588// __lazy_not
589
590template <class _Pred>
591struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
592
593// __and_
594template<class...> struct __and_;
595template<> struct __and_<> : true_type {};
596
597template<class _B0> struct __and_<_B0> : _B0 {};
598
599template<class _B0, class _B1>
600struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
601
602template<class _B0, class _B1, class _B2, class... _Bn>
603struct __and_<_B0, _B1, _B2, _Bn...>
604 : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
605
606// __or_
607template<class...> struct __or_;
608template<> struct __or_<> : false_type {};
609
610template<class _B0> struct __or_<_B0> : _B0 {};
611
612template<class _B0, class _B1>
613struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
614
615template<class _B0, class _B1, class _B2, class... _Bn>
616struct __or_<_B0, _B1, _B2, _Bn...>
617 : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
618
619// __not_
620template<class _Tp>
621struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
622
623#endif // !defined(_LIBCPP_CXX03_LANG)
624
625// is_const646// is_const
626647
627template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};648template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
...@@ -774,8 +795,16 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_array_v...@@ -774,8 +795,16 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_array_v
774template <class _Tp> struct __libcpp_is_pointer : public false_type {};795template <class _Tp> struct __libcpp_is_pointer : public false_type {};
775template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};796template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
776797
798template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; };
799#if defined(_LIBCPP_HAS_OBJC_ARC)
800template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; };
801template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; };
802template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; };
803template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; };
804#endif
805
777template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer806template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer
778 : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};807 : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {};
779808
780#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)809#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
781template <class _Tp>810template <class _Tp>
...@@ -789,15 +818,11 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : pub...@@ -789,15 +818,11 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : pub
789template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};818template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
790819
791template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};820template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
792#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
793template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};821template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
794#endif
795822
796template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};823template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
797template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};824template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
798#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
799template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};825template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
800#endif
801826
802#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)827#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
803template <class _Tp>828template <class _Tp>
...@@ -814,7 +839,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v...@@ -814,7 +839,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
814#endif839#endif
815// is_union840// is_union
816841
817#if __has_feature(is_union) || (_GNUC_VER >= 403)842#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC)
818843
819template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union844template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union
820 : public integral_constant<bool, __is_union(_Tp)> {};845 : public integral_constant<bool, __is_union(_Tp)> {};
...@@ -835,7 +860,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_union_v...@@ -835,7 +860,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_union_v
835860
836// is_class861// is_class
837862
838#if __has_feature(is_class) || (_GNUC_VER >= 403)863#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC)
839864
840template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class865template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class
841 : public integral_constant<bool, __is_class(_Tp)> {};866 : public integral_constant<bool, __is_class(_Tp)> {};
...@@ -859,17 +884,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v...@@ -859,17 +884,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v
859 = is_class<_Tp>::value;884 = is_class<_Tp>::value;
860#endif885#endif
861886
862// is_same
863
864template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
865template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {};
866
867#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
868template <class _Tp, class _Up>
869_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v
870 = is_same<_Tp, _Up>::value;
871#endif
872
873// is_function887// is_function
874888
875namespace __libcpp_is_function_imp889namespace __libcpp_is_function_imp
...@@ -957,7 +971,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v...@@ -957,7 +971,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
957971
958// is_enum972// is_enum
959973
960#if __has_feature(is_enum) || (_GNUC_VER >= 403)974#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC)
961975
962template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum976template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum
963 : public integral_constant<bool, __is_enum(_Tp)> {};977 : public integral_constant<bool, __is_enum(_Tp)> {};
...@@ -1061,7 +1075,7 @@ struct __is_referenceable_impl {...@@ -1061,7 +1075,7 @@ struct __is_referenceable_impl {
10611075
1062template <class _Tp>1076template <class _Tp>
1063struct __is_referenceable : integral_constant<bool,1077struct __is_referenceable : integral_constant<bool,
1064 !is_same<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};1078 _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
10651079
10661080
1067// add_const1081// add_const
...@@ -1069,13 +1083,13 @@ struct __is_referenceable : integral_constant<bool,...@@ -1069,13 +1083,13 @@ struct __is_referenceable : integral_constant<bool,
1069template <class _Tp, bool = is_reference<_Tp>::value ||1083template <class _Tp, bool = is_reference<_Tp>::value ||
1070 is_function<_Tp>::value ||1084 is_function<_Tp>::value ||
1071 is_const<_Tp>::value >1085 is_const<_Tp>::value >
1072struct __add_const {typedef _Tp type;};1086struct __add_const {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
10731087
1074template <class _Tp>1088template <class _Tp>
1075struct __add_const<_Tp, false> {typedef const _Tp type;};1089struct __add_const<_Tp, false> {typedef _LIBCPP_NODEBUG_TYPE const _Tp type;};
10761090
1077template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const1091template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
1078 {typedef typename __add_const<_Tp>::type type;};1092 {typedef _LIBCPP_NODEBUG_TYPE typename __add_const<_Tp>::type type;};
10791093
1080#if _LIBCPP_STD_VER > 111094#if _LIBCPP_STD_VER > 11
1081template <class _Tp> using add_const_t = typename add_const<_Tp>::type;1095template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
...@@ -1092,7 +1106,7 @@ template <class _Tp>...@@ -1092,7 +1106,7 @@ template <class _Tp>
1092struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};1106struct __add_volatile<_Tp, false> {typedef volatile _Tp type;};
10931107
1094template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile1108template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile
1095 {typedef typename __add_volatile<_Tp>::type type;};1109 {typedef _LIBCPP_NODEBUG_TYPE typename __add_volatile<_Tp>::type type;};
10961110
1097#if _LIBCPP_STD_VER > 111111#if _LIBCPP_STD_VER > 11
1098template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;1112template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
...@@ -1101,7 +1115,7 @@ template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;...@@ -1101,7 +1115,7 @@ template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
1101// add_cv1115// add_cv
11021116
1103template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv1117template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv
1104 {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;};1118 {typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename add_volatile<_Tp>::type>::type type;};
11051119
1106#if _LIBCPP_STD_VER > 111120#if _LIBCPP_STD_VER > 11
1107template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;1121template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
...@@ -1109,11 +1123,9 @@ template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;...@@ -1109,11 +1123,9 @@ template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
11091123
1110// remove_reference1124// remove_reference
11111125
1112template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};1126template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1113template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _Tp type;};1127template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1114#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES1128template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1115template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _Tp type;};
1116#endif
11171129
1118#if _LIBCPP_STD_VER > 111130#if _LIBCPP_STD_VER > 11
1119template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;1131template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
...@@ -1121,32 +1133,26 @@ template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::...@@ -1121,32 +1133,26 @@ template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::
11211133
1122// add_lvalue_reference1134// add_lvalue_reference
11231135
1124template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _Tp type; };1136template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
1125template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _Tp& type; };1137template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
11261138
1127template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference1139template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference
1128{typedef typename __add_lvalue_reference_impl<_Tp>::type type;};1140{typedef _LIBCPP_NODEBUG_TYPE typename __add_lvalue_reference_impl<_Tp>::type type;};
11291141
1130#if _LIBCPP_STD_VER > 111142#if _LIBCPP_STD_VER > 11
1131template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;1143template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
1132#endif1144#endif
11331145
1134#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES1146template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
11351147template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp&& type; };
1136template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _Tp type; };
1137template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _Tp&& type; };
11381148
1139template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference1149template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
1140{typedef typename __add_rvalue_reference_impl<_Tp>::type type;};1150{typedef _LIBCPP_NODEBUG_TYPE typename __add_rvalue_reference_impl<_Tp>::type type;};
11411151
1142#if _LIBCPP_STD_VER > 111152#if _LIBCPP_STD_VER > 11
1143template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;1153template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
1144#endif1154#endif
11451155
1146#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1147
1148#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1149
1150template <class _Tp> _Tp&& __declval(int);1156template <class _Tp> _Tp&& __declval(int);
1151template <class _Tp> _Tp __declval(long);1157template <class _Tp> _Tp __declval(long);
11521158
...@@ -1154,35 +1160,27 @@ template <class _Tp>...@@ -1154,35 +1160,27 @@ template <class _Tp>
1154decltype(_VSTD::__declval<_Tp>(0))1160decltype(_VSTD::__declval<_Tp>(0))
1155declval() _NOEXCEPT;1161declval() _NOEXCEPT;
11561162
1157#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1158
1159template <class _Tp>
1160typename add_lvalue_reference<_Tp>::type
1161declval();
1162
1163#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1164
1165// __uncvref1163// __uncvref
11661164
1167template <class _Tp>1165template <class _Tp>
1168struct __uncvref {1166struct __uncvref {
1169 typedef typename remove_cv<typename remove_reference<_Tp>::type>::type type;1167 typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<typename remove_reference<_Tp>::type>::type type;
1170};1168};
11711169
1172template <class _Tp>1170template <class _Tp>
1173struct __unconstref {1171struct __unconstref {
1174 typedef typename remove_const<typename remove_reference<_Tp>::type>::type type;1172 typedef _LIBCPP_NODEBUG_TYPE typename remove_const<typename remove_reference<_Tp>::type>::type type;
1175};1173};
11761174
1177#ifndef _LIBCPP_CXX03_LANG1175#ifndef _LIBCPP_CXX03_LANG
1178template <class _Tp>1176template <class _Tp>
1179using __uncvref_t = typename __uncvref<_Tp>::type;1177using __uncvref_t _LIBCPP_NODEBUG_TYPE = typename __uncvref<_Tp>::type;
1180#endif1178#endif
11811179
1182// __is_same_uncvref1180// __is_same_uncvref
11831181
1184template <class _Tp, class _Up>1182template <class _Tp, class _Up>
1185struct __is_same_uncvref : is_same<typename __uncvref<_Tp>::type,1183struct __is_same_uncvref : _IsSame<typename __uncvref<_Tp>::type,
1186 typename __uncvref<_Up>::type> {};1184 typename __uncvref<_Up>::type> {};
11871185
1188#if _LIBCPP_STD_VER > 171186#if _LIBCPP_STD_VER > 17
...@@ -1201,11 +1199,11 @@ struct __any...@@ -1201,11 +1199,11 @@ struct __any
12011199
1202// remove_pointer1200// remove_pointer
12031201
1204template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _Tp type;};1202template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1205template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _Tp type;};1203template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1206template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _Tp type;};1204template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1207template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _Tp type;};1205template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
1208template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _Tp type;};1206template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
12091207
1210#if _LIBCPP_STD_VER > 111208#if _LIBCPP_STD_VER > 11
1211template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;1209template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;
...@@ -1215,14 +1213,14 @@ template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type...@@ -1215,14 +1213,14 @@ template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type
12151213
1216template <class _Tp,1214template <class _Tp,
1217 bool = __is_referenceable<_Tp>::value ||1215 bool = __is_referenceable<_Tp>::value ||
1218 is_same<typename remove_cv<_Tp>::type, void>::value>1216 _IsSame<typename remove_cv<_Tp>::type, void>::value>
1219struct __add_pointer_impl1217struct __add_pointer_impl
1220 {typedef typename remove_reference<_Tp>::type* type;};1218 {typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type* type;};
1221template <class _Tp> struct __add_pointer_impl<_Tp, false>1219template <class _Tp> struct __add_pointer_impl<_Tp, false>
1222 {typedef _Tp type;};1220 {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
12231221
1224template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer1222template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
1225 {typedef typename __add_pointer_impl<_Tp>::type type;};1223 {typedef _LIBCPP_NODEBUG_TYPE typename __add_pointer_impl<_Tp>::type type;};
12261224
1227#if _LIBCPP_STD_VER > 111225#if _LIBCPP_STD_VER > 11
1228template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;1226template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
...@@ -1336,17 +1334,37 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<...@@ -1336,17 +1334,37 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<
1336template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;1334template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
1337#endif1335#endif
13381336
1337#if _LIBCPP_STD_VER > 17
1338// is_bounded_array
1339
1340template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {};
1341template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
1342
1343template <class _Tp>
1344_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR
1345bool is_bounded_array_v = is_bounded_array<_Tp>::value;
1346
1347// is_unbounded_array
1348
1349template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {};
1350template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
1351
1352template <class _Tp>
1353_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR
1354bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
1355#endif
1356
1339// decay1357// decay
13401358
1341template <class _Up, bool>1359template <class _Up, bool>
1342struct __decay {1360struct __decay {
1343 typedef typename remove_cv<_Up>::type type;1361 typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<_Up>::type type;
1344};1362};
13451363
1346template <class _Up>1364template <class _Up>
1347struct __decay<_Up, true> {1365struct __decay<_Up, true> {
1348public:1366public:
1349 typedef typename conditional1367 typedef _LIBCPP_NODEBUG_TYPE typename conditional
1350 <1368 <
1351 is_array<_Up>::value,1369 is_array<_Up>::value,
1352 typename remove_extent<_Up>::type*,1370 typename remove_extent<_Up>::type*,
...@@ -1363,9 +1381,9 @@ template <class _Tp>...@@ -1363,9 +1381,9 @@ template <class _Tp>
1363struct _LIBCPP_TEMPLATE_VIS decay1381struct _LIBCPP_TEMPLATE_VIS decay
1364{1382{
1365private:1383private:
1366 typedef typename remove_reference<_Tp>::type _Up;1384 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up;
1367public:1385public:
1368 typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type;1386 typedef _LIBCPP_NODEBUG_TYPE typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
1369};1387};
13701388
1371#if _LIBCPP_STD_VER > 111389#if _LIBCPP_STD_VER > 11
...@@ -1385,15 +1403,10 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_abstract_v...@@ -1385,15 +1403,10 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_abstract_v
13851403
1386// is_final1404// is_final
13871405
1388#if defined(_LIBCPP_HAS_IS_FINAL)
1389template <class _Tp> struct _LIBCPP_TEMPLATE_VIS1406template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
1390__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};1407__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
1391#else
1392template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
1393__libcpp_is_final : public false_type {};
1394#endif
13951408
1396#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 111409#if _LIBCPP_STD_VER > 11
1397template <class _Tp> struct _LIBCPP_TEMPLATE_VIS1410template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
1398is_final : public integral_constant<bool, __is_final(_Tp)> {};1411is_final : public integral_constant<bool, __is_final(_Tp)> {};
1399#endif1412#endif
...@@ -1420,39 +1433,10 @@ _LIBCPP_INLINE_VAR constexpr bool is_aggregate_v...@@ -1420,39 +1433,10 @@ _LIBCPP_INLINE_VAR constexpr bool is_aggregate_v
14201433
1421// is_base_of1434// is_base_of
14221435
1423#ifdef _LIBCPP_HAS_IS_BASE_OF
1424
1425template <class _Bp, class _Dp>1436template <class _Bp, class _Dp>
1426struct _LIBCPP_TEMPLATE_VIS is_base_of1437struct _LIBCPP_TEMPLATE_VIS is_base_of
1427 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};1438 : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
14281439
1429#else // _LIBCPP_HAS_IS_BASE_OF
1430
1431namespace __is_base_of_imp
1432{
1433template <class _Tp>
1434struct _Dst
1435{
1436 _Dst(const volatile _Tp &);
1437};
1438template <class _Tp>
1439struct _Src
1440{
1441 operator const volatile _Tp &();
1442 template <class _Up> operator const _Dst<_Up> &();
1443};
1444template <size_t> struct __one { typedef char type; };
1445template <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int);
1446template <class _Bp, class _Dp> __two __test(...);
1447}
1448
1449template <class _Bp, class _Dp>
1450struct _LIBCPP_TEMPLATE_VIS is_base_of
1451 : public integral_constant<bool, is_class<_Bp>::value &&
1452 sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {};
1453
1454#endif // _LIBCPP_HAS_IS_BASE_OF
1455
1456#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)1440#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
1457template <class _Bp, class _Dp>1441template <class _Bp, class _Dp>
1458_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v1442_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v
...@@ -1509,14 +1493,6 @@ template <class _T1, class _T2,...@@ -1509,14 +1493,6 @@ template <class _T1, class _T2,
1509struct __is_convertible1493struct __is_convertible
1510 : public integral_constant<bool,1494 : public integral_constant<bool,
1511 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value1495 __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
1512#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
1513 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
1514 && (!is_const<typename remove_reference<_T2>::type>::value
1515 || is_volatile<typename remove_reference<_T2>::type>::value)
1516 && (is_same<typename remove_cv<_T1>::type,
1517 typename remove_cv<typename remove_reference<_T2>::type>::type>::value
1518 || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
1519#endif
1520 >1496 >
1521{};1497{};
15221498
...@@ -1550,9 +1526,35 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_convertible_v...@@ -1550,9 +1526,35 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_convertible_v
1550 = is_convertible<_From, _To>::value;1526 = is_convertible<_From, _To>::value;
1551#endif1527#endif
15521528
1529// is_nothrow_convertible
1530
1531#if _LIBCPP_STD_VER > 17
1532
1533template <typename _Tp>
1534static void __test_noexcept(_Tp) noexcept;
1535
1536template<typename _Fm, typename _To>
1537static bool_constant<noexcept(__test_noexcept<_To>(declval<_Fm>()))>
1538__is_nothrow_convertible_test();
1539
1540template <typename _Fm, typename _To>
1541struct __is_nothrow_convertible_helper: decltype(__is_nothrow_convertible_test<_Fm, _To>())
1542{ };
1543
1544template <typename _Fm, typename _To>
1545struct is_nothrow_convertible : _Or<
1546 _And<is_void<_To>, is_void<_Fm>>,
1547 _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To>>
1548>::type { };
1549
1550template <typename _Fm, typename _To>
1551inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
1552
1553#endif // _LIBCPP_STD_VER > 17
1554
1553// is_empty1555// is_empty
15541556
1555#if __has_feature(is_empty) || (_GNUC_VER >= 407)1557#if __has_feature(is_empty) || defined(_LIBCPP_COMPILER_GCC)
15561558
1557template <class _Tp>1559template <class _Tp>
1558struct _LIBCPP_TEMPLATE_VIS is_empty1560struct _LIBCPP_TEMPLATE_VIS is_empty
...@@ -1615,7 +1617,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_polymorphic_v...@@ -1615,7 +1617,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_polymorphic_v
16151617
1616// has_virtual_destructor1618// has_virtual_destructor
16171619
1618#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)1620#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC)
16191621
1620template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor1622template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
1621 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};1623 : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
...@@ -1703,6 +1705,9 @@ typedef...@@ -1703,6 +1705,9 @@ typedef
1703 __nat1705 __nat
1704 > > > > > > > > > > __all_types;1706 > > > > > > > > > > __all_types;
17051707
1708template <size_t _Align>
1709struct _ALIGNAS(_Align) __fallback_overaligned {};
1710
1706template <class _TL, size_t _Align> struct __find_pod;1711template <class _TL, size_t _Align> struct __find_pod;
17071712
1708template <class _Hp, size_t _Align>1713template <class _Hp, size_t _Align>
...@@ -1711,7 +1716,7 @@ struct __find_pod<__type_list<_Hp, __nat>, _Align>...@@ -1711,7 +1716,7 @@ struct __find_pod<__type_list<_Hp, __nat>, _Align>
1711 typedef typename conditional<1716 typedef typename conditional<
1712 _Align == _Hp::value,1717 _Align == _Hp::value,
1713 typename _Hp::type,1718 typename _Hp::type,
1714 void1719 __fallback_overaligned<_Align>
1715 >::type type;1720 >::type type;
1716};1721};
17171722
...@@ -1748,7 +1753,6 @@ template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::valu...@@ -1748,7 +1753,6 @@ template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::valu
1748struct _LIBCPP_TEMPLATE_VIS aligned_storage1753struct _LIBCPP_TEMPLATE_VIS aligned_storage
1749{1754{
1750 typedef typename __find_pod<__all_types, _Align>::type _Aligner;1755 typedef typename __find_pod<__all_types, _Align>::type _Aligner;
1751 static_assert(!is_void<_Aligner>::value, "");
1752 union type1756 union type
1753 {1757 {
1754 _Aligner __align;1758 _Aligner __align;
...@@ -1792,7 +1796,6 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);...@@ -1792,7 +1796,6 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
17921796
1793#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION1797#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
17941798
1795#ifndef _LIBCPP_HAS_NO_VARIADICS
17961799
1797// aligned_union1800// aligned_union
17981801
...@@ -1826,8 +1829,6 @@ struct aligned_union...@@ -1826,8 +1829,6 @@ struct aligned_union
1826template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;1829template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
1827#endif1830#endif
18281831
1829#endif // _LIBCPP_HAS_NO_VARIADICS
1830
1831template <class _Tp>1832template <class _Tp>
1832struct __numeric_type1833struct __numeric_type
1833{1834{
...@@ -1844,7 +1845,7 @@ struct __numeric_type...@@ -1844,7 +1845,7 @@ struct __numeric_type
1844 static long double __test(long double);1845 static long double __test(long double);
18451846
1846 typedef decltype(__test(declval<_Tp>())) type;1847 typedef decltype(__test(declval<_Tp>())) type;
1847 static const bool value = !is_same<type, void>::value;1848 static const bool value = _IsNotSame<type, void>::value;
1848};1849};
18491850
1850template <>1851template <>
...@@ -1936,26 +1937,26 @@ template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeLi...@@ -1936,26 +1937,26 @@ template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeLi
1936template <class _Hp, class _Tp, size_t _Size>1937template <class _Hp, class _Tp, size_t _Size>
1937struct __find_first<__type_list<_Hp, _Tp>, _Size, true>1938struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
1938{1939{
1939 typedef _Hp type;1940 typedef _LIBCPP_NODEBUG_TYPE _Hp type;
1940};1941};
19411942
1942template <class _Hp, class _Tp, size_t _Size>1943template <class _Hp, class _Tp, size_t _Size>
1943struct __find_first<__type_list<_Hp, _Tp>, _Size, false>1944struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
1944{1945{
1945 typedef typename __find_first<_Tp, _Size>::type type;1946 typedef _LIBCPP_NODEBUG_TYPE typename __find_first<_Tp, _Size>::type type;
1946};1947};
19471948
1948template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,1949template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
1949 bool = is_volatile<typename remove_reference<_Tp>::type>::value>1950 bool = is_volatile<typename remove_reference<_Tp>::type>::value>
1950struct __apply_cv1951struct __apply_cv
1951{1952{
1952 typedef _Up type;1953 typedef _LIBCPP_NODEBUG_TYPE _Up type;
1953};1954};
19541955
1955template <class _Tp, class _Up>1956template <class _Tp, class _Up>
1956struct __apply_cv<_Tp, _Up, true, false>1957struct __apply_cv<_Tp, _Up, true, false>
1957{1958{
1958 typedef const _Up type;1959 typedef _LIBCPP_NODEBUG_TYPE const _Up type;
1959};1960};
19601961
1961template <class _Tp, class _Up>1962template <class _Tp, class _Up>
...@@ -2060,43 +2061,63 @@ struct _LIBCPP_TEMPLATE_VIS make_unsigned...@@ -2060,43 +2061,63 @@ struct _LIBCPP_TEMPLATE_VIS make_unsigned
2060template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;2061template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
2061#endif2062#endif
20622063
2063#ifdef _LIBCPP_HAS_NO_VARIADICS2064template <class _Tp, class _Up, class = void>
2065struct __common_type2_imp {};
20642066
2065template <class _Tp, class _Up = void, class _Vp = void>2067template <class _Tp, class _Up>
2066struct _LIBCPP_TEMPLATE_VIS common_type2068struct __common_type2_imp<_Tp, _Up,
2069 typename __void_t<decltype(
2070 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2071 )>::type>
2067{2072{
2068public:2073 typedef _LIBCPP_NODEBUG_TYPE typename decay<decltype(
2069 typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;2074 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2075 )>::type type;
2070};2076};
20712077
2072template <>2078template <class, class = void>
2073struct _LIBCPP_TEMPLATE_VIS common_type<void, void, void>2079struct __common_type_impl {};
2074{
2075public:
2076 typedef void type;
2077};
20782080
2079template <class _Tp>2081// Clang provides variadic templates in C++03 as an extension.
2080struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void>2082#if !defined(_LIBCPP_CXX03_LANG) || defined(__clang__)
2081{2083# define _LIBCPP_OPTIONAL_PACK(...) , __VA_ARGS__
2082public:2084template <class... Tp>
2083 typedef typename common_type<_Tp, _Tp>::type type;2085struct __common_types;
2084};2086template <class... _Tp>
2087struct _LIBCPP_TEMPLATE_VIS common_type;
2088#else
2089# define _LIBCPP_OPTIONAL_PACK(...)
2090struct __no_arg;
2091template <class _Tp, class _Up, class = __no_arg>
2092struct __common_types;
2093template <class _Tp = __no_arg, class _Up = __no_arg, class _Vp = __no_arg,
2094 class _Unused = __no_arg>
2095struct common_type {
2096 static_assert(sizeof(_Unused) == 0,
2097 "common_type accepts at most 3 arguments in C++03");
2098};
2099#endif // _LIBCPP_CXX03_LANG
20852100
2086template <class _Tp, class _Up>2101template <class _Tp, class _Up>
2087struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, void>2102struct __common_type_impl<
2103 __common_types<_Tp, _Up>,
2104 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2088{2105{
2089 typedef typename decay<decltype(2106 typedef typename common_type<_Tp, _Up>::type type;
2090 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2091 )>::type type;
2092};2107};
20932108
2094#else // _LIBCPP_HAS_NO_VARIADICS2109template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)>
2110struct __common_type_impl<
2111 __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>,
2112 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2113 : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type,
2114 _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {
2115};
20952116
2096// bullet 1 - sizeof...(Tp) == 02117// bullet 1 - sizeof...(Tp) == 0
20972118
2098template <class ..._Tp>2119template <>
2099struct _LIBCPP_TEMPLATE_VIS common_type {};2120struct _LIBCPP_TEMPLATE_VIS common_type<> {};
21002121
2101// bullet 2 - sizeof...(Tp) == 12122// bullet 2 - sizeof...(Tp) == 1
21022123
...@@ -2106,71 +2127,32 @@ struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>...@@ -2106,71 +2127,32 @@ struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
21062127
2107// bullet 3 - sizeof...(Tp) == 22128// bullet 3 - sizeof...(Tp) == 2
21082129
2109template <class _Tp, class _Up, class = void>
2110struct __common_type2_imp {};
2111
2112template <class _Tp, class _Up>
2113struct __common_type2_imp<_Tp, _Up,
2114 typename __void_t<decltype(
2115 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2116 )>::type>
2117{
2118 typedef typename decay<decltype(
2119 true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
2120 )>::type type;
2121};
2122
2123template <class _Tp, class _Up,
2124 class _DTp = typename decay<_Tp>::type,
2125 class _DUp = typename decay<_Up>::type>
2126using __common_type2 =
2127 typename conditional<
2128 is_same<_Tp, _DTp>::value && is_same<_Up, _DUp>::value,
2129 __common_type2_imp<_Tp, _Up>,
2130 common_type<_DTp, _DUp>
2131 >::type;
2132
2133template <class _Tp, class _Up>2130template <class _Tp, class _Up>
2134struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up>2131struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up>
2135 : __common_type2<_Tp, _Up> {};2132 : conditional<
2133 _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value,
2134 __common_type2_imp<_Tp, _Up>,
2135 common_type<typename decay<_Tp>::type, typename decay<_Up>::type>
2136 >::type
2137{};
21362138
2137// bullet 4 - sizeof...(Tp) > 22139// bullet 4 - sizeof...(Tp) > 2
21382140
2139template <class ...Tp> struct __common_types;2141template <class _Tp, class _Up, class _Vp _LIBCPP_OPTIONAL_PACK(class... _Rest)>
21402142struct _LIBCPP_TEMPLATE_VIS
2141template <class, class = void>2143 common_type<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>
2142struct __common_type_impl {};2144 : __common_type_impl<
21432145 __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {};
2144template <class _Tp, class _Up>
2145struct __common_type_impl<
2146 __common_types<_Tp, _Up>,
2147 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2148{
2149 typedef typename common_type<_Tp, _Up>::type type;
2150};
2151
2152template <class _Tp, class _Up, class ..._Vp>
2153struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>,
2154 typename __void_t<typename common_type<_Tp, _Up>::type>::type>
2155 : __common_type_impl<
2156 __common_types<typename common_type<_Tp, _Up>::type, _Vp...> >
2157{
2158
2159};
21602146
2161template <class _Tp, class _Up, class ..._Vp>2147#undef _LIBCPP_OPTIONAL_PACK
2162struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, _Vp...>
2163 : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
21642148
2165#if _LIBCPP_STD_VER > 112149#if _LIBCPP_STD_VER > 11
2166template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;2150template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
2167#endif2151#endif
21682152
2169#endif // _LIBCPP_HAS_NO_VARIADICS
2170
2171// is_assignable2153// is_assignable
21722154
2173template<typename, typename _Tp> struct __select_2nd { typedef _Tp type; };2155template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
21742156
2175template <class _Tp, class _Arg>2157template <class _Tp, class _Arg>
2176typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type2158typename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type
...@@ -2215,12 +2197,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_assignable_v...@@ -2215,12 +2197,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_assignable_v
2215// is_move_assignable2197// is_move_assignable
22162198
2217template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable2199template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable
2218#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2219 : public is_assignable<typename add_lvalue_reference<_Tp>::type,2200 : public is_assignable<typename add_lvalue_reference<_Tp>::type,
2220 typename add_rvalue_reference<_Tp>::type> {};2201 typename add_rvalue_reference<_Tp>::type> {};
2221#else
2222 : public is_copy_assignable<_Tp> {};
2223#endif
22242202
2225#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)2203#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
2226template <class _Tp>2204template <class _Tp>
...@@ -2294,14 +2272,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v...@@ -2294,14 +2272,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v
22942272
2295// move2273// move
22962274
2297#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2298
2299template <class _Tp>2275template <class _Tp>
2300inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR2276inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
2301typename remove_reference<_Tp>::type&&2277typename remove_reference<_Tp>::type&&
2302move(_Tp&& __t) _NOEXCEPT2278move(_Tp&& __t) _NOEXCEPT
2303{2279{
2304 typedef typename remove_reference<_Tp>::type _Up;2280 typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up;
2305 return static_cast<_Up&&>(__t);2281 return static_cast<_Up&&>(__t);
2306}2282}
23072283
...@@ -2323,81 +2299,24 @@ forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT...@@ -2323,81 +2299,24 @@ forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT
2323 return static_cast<_Tp&&>(__t);2299 return static_cast<_Tp&&>(__t);
2324}2300}
23252301
2326#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2327
2328template <class _Tp>2302template <class _Tp>
2329inline _LIBCPP_INLINE_VISIBILITY2303inline _LIBCPP_INLINE_VISIBILITY
2330_Tp&2304typename decay<_Tp>::type
2331move(_Tp& __t)2305__decay_copy(_Tp&& __t)
2332{2306{
2333 return __t;2307 return _VSTD::forward<_Tp>(__t);
2334}2308}
23352309
2336template <class _Tp>2310template <class _Rp, class _Class, class ..._Param>
2337inline _LIBCPP_INLINE_VISIBILITY2311struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
2338const _Tp&
2339move(const _Tp& __t)
2340{2312{
2341 return __t;2313 typedef _Class _ClassType;
2342}2314 typedef _Rp _ReturnType;
2315 typedef _Rp (_FnType) (_Param...);
2316};
23432317
2344template <class _Tp>2318template <class _Rp, class _Class, class ..._Param>
2345inline _LIBCPP_INLINE_VISIBILITY2319struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
2346_Tp&
2347forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
2348{
2349 return __t;
2350}
2351
2352
2353template <class _Tp>
2354class __rv
2355{
2356 typedef typename remove_reference<_Tp>::type _Trr;
2357 _Trr& t_;
2358public:
2359 _LIBCPP_INLINE_VISIBILITY
2360 _Trr* operator->() {return &t_;}
2361 _LIBCPP_INLINE_VISIBILITY
2362 explicit __rv(_Trr& __t) : t_(__t) {}
2363};
2364
2365#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
2366
2367#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2368
2369template <class _Tp>
2370inline _LIBCPP_INLINE_VISIBILITY
2371typename decay<_Tp>::type
2372__decay_copy(_Tp&& __t)
2373{
2374 return _VSTD::forward<_Tp>(__t);
2375}
2376
2377#else
2378
2379template <class _Tp>
2380inline _LIBCPP_INLINE_VISIBILITY
2381typename decay<_Tp>::type
2382__decay_copy(const _Tp& __t)
2383{
2384 return _VSTD::forward<_Tp>(__t);
2385}
2386
2387#endif
2388
2389#ifndef _LIBCPP_HAS_NO_VARIADICS
2390
2391template <class _Rp, class _Class, class ..._Param>
2392struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
2393{
2394 typedef _Class _ClassType;
2395 typedef _Rp _ReturnType;
2396 typedef _Rp (_FnType) (_Param...);
2397};
2398
2399template <class _Rp, class _Class, class ..._Param>
2400struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
2401{2320{
2402 typedef _Class _ClassType;2321 typedef _Class _ClassType;
2403 typedef _Rp _ReturnType;2322 typedef _Rp _ReturnType;
...@@ -2452,8 +2371,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil...@@ -2452,8 +2371,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
2452 typedef _Rp (_FnType) (_Param..., ...);2371 typedef _Rp (_FnType) (_Param..., ...);
2453};2372};
24542373
2455#if __has_feature(cxx_reference_qualified_functions) || \2374#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
2456 (defined(_GNUC_VER) && _GNUC_VER >= 409)
24572375
2458template <class _Rp, class _Class, class ..._Param>2376template <class _Rp, class _Class, class ..._Param>
2459struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>2377struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
...@@ -2583,267 +2501,8 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil...@@ -2583,267 +2501,8 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
2583 typedef _Rp (_FnType) (_Param..., ...);2501 typedef _Rp (_FnType) (_Param..., ...);
2584};2502};
25852503
2586#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 4092504#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
2587
2588#else // _LIBCPP_HAS_NO_VARIADICS
2589
2590template <class _Rp, class _Class>
2591struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
2592{
2593 typedef _Class _ClassType;
2594 typedef _Rp _ReturnType;
2595 typedef _Rp (_FnType) ();
2596};
2597
2598template <class _Rp, class _Class>
2599struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
2600{
2601 typedef _Class _ClassType;
2602 typedef _Rp _ReturnType;
2603 typedef _Rp (_FnType) (...);
2604};
2605
2606template <class _Rp, class _Class, class _P0>
2607struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
2608{
2609 typedef _Class _ClassType;
2610 typedef _Rp _ReturnType;
2611 typedef _Rp (_FnType) (_P0);
2612};
2613
2614template <class _Rp, class _Class, class _P0>
2615struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
2616{
2617 typedef _Class _ClassType;
2618 typedef _Rp _ReturnType;
2619 typedef _Rp (_FnType) (_P0, ...);
2620};
2621
2622template <class _Rp, class _Class, class _P0, class _P1>
2623struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
2624{
2625 typedef _Class _ClassType;
2626 typedef _Rp _ReturnType;
2627 typedef _Rp (_FnType) (_P0, _P1);
2628};
2629
2630template <class _Rp, class _Class, class _P0, class _P1>
2631struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
2632{
2633 typedef _Class _ClassType;
2634 typedef _Rp _ReturnType;
2635 typedef _Rp (_FnType) (_P0, _P1, ...);
2636};
2637
2638template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2639struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
2640{
2641 typedef _Class _ClassType;
2642 typedef _Rp _ReturnType;
2643 typedef _Rp (_FnType) (_P0, _P1, _P2);
2644};
2645
2646template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2647struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
2648{
2649 typedef _Class _ClassType;
2650 typedef _Rp _ReturnType;
2651 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2652};
2653
2654template <class _Rp, class _Class>
2655struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
2656{
2657 typedef _Class const _ClassType;
2658 typedef _Rp _ReturnType;
2659 typedef _Rp (_FnType) ();
2660};
2661
2662template <class _Rp, class _Class>
2663struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
2664{
2665 typedef _Class const _ClassType;
2666 typedef _Rp _ReturnType;
2667 typedef _Rp (_FnType) (...);
2668};
2669
2670template <class _Rp, class _Class, class _P0>
2671struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
2672{
2673 typedef _Class const _ClassType;
2674 typedef _Rp _ReturnType;
2675 typedef _Rp (_FnType) (_P0);
2676};
2677
2678template <class _Rp, class _Class, class _P0>
2679struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
2680{
2681 typedef _Class const _ClassType;
2682 typedef _Rp _ReturnType;
2683 typedef _Rp (_FnType) (_P0, ...);
2684};
2685
2686template <class _Rp, class _Class, class _P0, class _P1>
2687struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
2688{
2689 typedef _Class const _ClassType;
2690 typedef _Rp _ReturnType;
2691 typedef _Rp (_FnType) (_P0, _P1);
2692};
2693
2694template <class _Rp, class _Class, class _P0, class _P1>
2695struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
2696{
2697 typedef _Class const _ClassType;
2698 typedef _Rp _ReturnType;
2699 typedef _Rp (_FnType) (_P0, _P1, ...);
2700};
2701
2702template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2703struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
2704{
2705 typedef _Class const _ClassType;
2706 typedef _Rp _ReturnType;
2707 typedef _Rp (_FnType) (_P0, _P1, _P2);
2708};
2709
2710template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2711struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
2712{
2713 typedef _Class const _ClassType;
2714 typedef _Rp _ReturnType;
2715 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2716};
2717
2718template <class _Rp, class _Class>
2719struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
2720{
2721 typedef _Class volatile _ClassType;
2722 typedef _Rp _ReturnType;
2723 typedef _Rp (_FnType) ();
2724};
2725
2726template <class _Rp, class _Class>
2727struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
2728{
2729 typedef _Class volatile _ClassType;
2730 typedef _Rp _ReturnType;
2731 typedef _Rp (_FnType) (...);
2732};
2733
2734template <class _Rp, class _Class, class _P0>
2735struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
2736{
2737 typedef _Class volatile _ClassType;
2738 typedef _Rp _ReturnType;
2739 typedef _Rp (_FnType) (_P0);
2740};
2741
2742template <class _Rp, class _Class, class _P0>
2743struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
2744{
2745 typedef _Class volatile _ClassType;
2746 typedef _Rp _ReturnType;
2747 typedef _Rp (_FnType) (_P0, ...);
2748};
2749
2750template <class _Rp, class _Class, class _P0, class _P1>
2751struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
2752{
2753 typedef _Class volatile _ClassType;
2754 typedef _Rp _ReturnType;
2755 typedef _Rp (_FnType) (_P0, _P1);
2756};
2757
2758template <class _Rp, class _Class, class _P0, class _P1>
2759struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
2760{
2761 typedef _Class volatile _ClassType;
2762 typedef _Rp _ReturnType;
2763 typedef _Rp (_FnType) (_P0, _P1, ...);
2764};
2765
2766template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2767struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
2768{
2769 typedef _Class volatile _ClassType;
2770 typedef _Rp _ReturnType;
2771 typedef _Rp (_FnType) (_P0, _P1, _P2);
2772};
2773
2774template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2775struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
2776{
2777 typedef _Class volatile _ClassType;
2778 typedef _Rp _ReturnType;
2779 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2780};
2781
2782template <class _Rp, class _Class>
2783struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
2784{
2785 typedef _Class const volatile _ClassType;
2786 typedef _Rp _ReturnType;
2787 typedef _Rp (_FnType) ();
2788};
2789
2790template <class _Rp, class _Class>
2791struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
2792{
2793 typedef _Class const volatile _ClassType;
2794 typedef _Rp _ReturnType;
2795 typedef _Rp (_FnType) (...);
2796};
2797
2798template <class _Rp, class _Class, class _P0>
2799struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
2800{
2801 typedef _Class const volatile _ClassType;
2802 typedef _Rp _ReturnType;
2803 typedef _Rp (_FnType) (_P0);
2804};
2805
2806template <class _Rp, class _Class, class _P0>
2807struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
2808{
2809 typedef _Class const volatile _ClassType;
2810 typedef _Rp _ReturnType;
2811 typedef _Rp (_FnType) (_P0, ...);
2812};
2813
2814template <class _Rp, class _Class, class _P0, class _P1>
2815struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
2816{
2817 typedef _Class const volatile _ClassType;
2818 typedef _Rp _ReturnType;
2819 typedef _Rp (_FnType) (_P0, _P1);
2820};
2821
2822template <class _Rp, class _Class, class _P0, class _P1>
2823struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
2824{
2825 typedef _Class const volatile _ClassType;
2826 typedef _Rp _ReturnType;
2827 typedef _Rp (_FnType) (_P0, _P1, ...);
2828};
2829
2830template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2831struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
2832{
2833 typedef _Class const volatile _ClassType;
2834 typedef _Rp _ReturnType;
2835 typedef _Rp (_FnType) (_P0, _P1, _P2);
2836};
2837
2838template <class _Rp, class _Class, class _P0, class _P1, class _P2>
2839struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
2840{
2841 typedef _Class const volatile _ClassType;
2842 typedef _Rp _ReturnType;
2843 typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
2844};
28452505
2846#endif // _LIBCPP_HAS_NO_VARIADICS
28472506
2848template <class _Rp, class _Class>2507template <class _Rp, class _Class>
2849struct __member_pointer_traits_imp<_Rp _Class::*, false, true>2508struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
...@@ -3042,10 +2701,10 @@ struct __is_invalid_base_to_derived_cast {...@@ -3042,10 +2701,10 @@ struct __is_invalid_base_to_derived_cast {
3042 static_assert(is_reference<_To>::value, "Wrong specialization");2701 static_assert(is_reference<_To>::value, "Wrong specialization");
3043 using _RawFrom = __uncvref_t<_From>;2702 using _RawFrom = __uncvref_t<_From>;
3044 using _RawTo = __uncvref_t<_To>;2703 using _RawTo = __uncvref_t<_To>;
3045 static const bool value = __lazy_and<2704 static const bool value = _And<
3046 __lazy_not<is_same<_RawFrom, _RawTo>>,2705 _IsNotSame<_RawFrom, _RawTo>,
3047 is_base_of<_RawFrom, _RawTo>,2706 is_base_of<_RawFrom, _RawTo>,
3048 __lazy_not<__libcpp_is_constructible<_RawTo, _From>>2707 _Not<__libcpp_is_constructible<_RawTo, _From>>
3049 >::value;2708 >::value;
3050};2709};
30512710
...@@ -3058,10 +2717,10 @@ template <class _ToRef, class _FromRef>...@@ -3058,10 +2717,10 @@ template <class _ToRef, class _FromRef>
3058struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> {2717struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> {
3059 using _RawFrom = __uncvref_t<_FromRef>;2718 using _RawFrom = __uncvref_t<_FromRef>;
3060 using _RawTo = __uncvref_t<_ToRef>;2719 using _RawTo = __uncvref_t<_ToRef>;
3061 static const bool value = __lazy_and<2720 static const bool value = _And<
3062 __lazy_not<is_function<_RawTo>>,2721 _Not<is_function<_RawTo>>,
3063 __lazy_or<2722 _Or<
3064 is_same<_RawFrom, _RawTo>,2723 _IsSame<_RawFrom, _RawTo>,
3065 is_base_of<_RawTo, _RawFrom>>2724 is_base_of<_RawTo, _RawFrom>>
3066 >::value;2725 >::value;
3067};2726};
...@@ -3117,276 +2776,48 @@ template <class _Tp, size_t _Nx>...@@ -3117,276 +2776,48 @@ template <class _Tp, size_t _Nx>
3117struct __is_default_constructible<_Tp[_Nx], false>2776struct __is_default_constructible<_Tp[_Nx], false>
3118 : __is_default_constructible<typename remove_all_extents<_Tp>::type> {};2777 : __is_default_constructible<typename remove_all_extents<_Tp>::type> {};
31192778
3120template <class _Tp, class... _Args>2779template <class _Tp, class... _Args>
3121struct __libcpp_is_constructible2780struct __libcpp_is_constructible
3122{2781{
3123 static_assert(sizeof...(_Args) > 1, "Wrong specialization");2782 static_assert(sizeof...(_Args) > 1, "Wrong specialization");
3124 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0))2783 typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0))
3125 type;2784 type;
3126};2785};
3127
3128template <class _Tp>
3129struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {};
3130
3131template <class _Tp, class _A0>
3132struct __libcpp_is_constructible<_Tp, _A0>
3133 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0))
3134{};
3135
3136template <class _Tp, class _A0>
3137struct __libcpp_is_constructible<_Tp&, _A0>
3138 : public decltype(__is_constructible_helper::
3139 __test_cast<_Tp&, _A0>(0))
3140{};
3141
3142template <class _Tp, class _A0>
3143struct __libcpp_is_constructible<_Tp&&, _A0>
3144 : public decltype(__is_constructible_helper::
3145 __test_cast<_Tp&&, _A0>(0))
3146{};
3147
3148#endif
3149
3150#if __has_feature(is_constructible)
3151template <class _Tp, class ..._Args>
3152struct _LIBCPP_TEMPLATE_VIS is_constructible
3153 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
3154 {};
3155#elif !defined(_LIBCPP_CXX03_LANG)
3156template <class _Tp, class... _Args>
3157struct _LIBCPP_TEMPLATE_VIS is_constructible
3158 : public __libcpp_is_constructible<_Tp, _Args...>::type {};
3159#else
3160// template <class T> struct is_constructible0;
3161
3162// main is_constructible0 test
3163
3164template <class _Tp>
3165decltype((_Tp(), true_type()))
3166__is_constructible0_test(_Tp&);
3167
3168false_type
3169__is_constructible0_test(__any);
3170
3171template <class _Tp, class _A0>
3172decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
3173__is_constructible1_test(_Tp&, _A0&);
3174
3175template <class _A0>
3176false_type
3177__is_constructible1_test(__any, _A0&);
3178
3179template <class _Tp, class _A0, class _A1>
3180decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
3181__is_constructible2_test(_Tp&, _A0&, _A1&);
3182
3183template <class _A0, class _A1>
3184false_type
3185__is_constructible2_test(__any, _A0&, _A1&);
3186
3187template <class _Tp, class _A0, class _A1, class _A2>
3188decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>(), _VSTD::declval<_A2>()), true_type()))
3189__is_constructible3_test(_Tp&, _A0&, _A1&, _A2&);
3190
3191template <class _A0, class _A1, class _A2>
3192false_type
3193__is_constructible3_test(__any, _A0&, _A1&, _A2&);
3194
3195template <bool, class _Tp>
3196struct __is_constructible0_imp // false, _Tp is not a scalar
3197 : public common_type
3198 <
3199 decltype(__is_constructible0_test(declval<_Tp&>()))
3200 >::type
3201 {};
3202
3203template <bool, class _Tp, class _A0>
3204struct __is_constructible1_imp // false, _Tp is not a scalar
3205 : public common_type
3206 <
3207 decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
3208 >::type
3209 {};
3210
3211template <bool, class _Tp, class _A0, class _A1>
3212struct __is_constructible2_imp // false, _Tp is not a scalar
3213 : public common_type
3214 <
3215 decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
3216 >::type
3217 {};
3218
3219template <bool, class _Tp, class _A0, class _A1, class _A2>
3220struct __is_constructible3_imp // false, _Tp is not a scalar
3221 : public common_type
3222 <
3223 decltype(__is_constructible3_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>(), declval<_A2>()))
3224 >::type
3225 {};
3226
3227// handle scalars and reference types
3228
3229// Scalars are default constructible, references are not
3230
3231template <class _Tp>
3232struct __is_constructible0_imp<true, _Tp>
3233 : public is_scalar<_Tp>
3234 {};
3235
3236template <class _Tp, class _A0>
3237struct __is_constructible1_imp<true, _Tp, _A0>
3238 : public is_convertible<_A0, _Tp>
3239 {};
3240
3241template <class _Tp, class _A0, class _A1>
3242struct __is_constructible2_imp<true, _Tp, _A0, _A1>
3243 : public false_type
3244 {};
3245
3246template <class _Tp, class _A0, class _A1, class _A2>
3247struct __is_constructible3_imp<true, _Tp, _A0, _A1, _A2>
3248 : public false_type
3249 {};
3250
3251// Treat scalars and reference types separately
3252
3253template <bool, class _Tp>
3254struct __is_constructible0_void_check
3255 : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3256 _Tp>
3257 {};
3258
3259template <bool, class _Tp, class _A0>
3260struct __is_constructible1_void_check
3261 : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3262 _Tp, _A0>
3263 {};
3264
3265template <bool, class _Tp, class _A0, class _A1>
3266struct __is_constructible2_void_check
3267 : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3268 _Tp, _A0, _A1>
3269 {};
3270
3271template <bool, class _Tp, class _A0, class _A1, class _A2>
3272struct __is_constructible3_void_check
3273 : public __is_constructible3_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
3274 _Tp, _A0, _A1, _A2>
3275 {};
3276
3277// If any of T or Args is void, is_constructible should be false
3278
3279template <class _Tp>
3280struct __is_constructible0_void_check<true, _Tp>
3281 : public false_type
3282 {};
3283
3284template <class _Tp, class _A0>
3285struct __is_constructible1_void_check<true, _Tp, _A0>
3286 : public false_type
3287 {};
3288
3289template <class _Tp, class _A0, class _A1>
3290struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
3291 : public false_type
3292 {};
3293
3294template <class _Tp, class _A0, class _A1, class _A2>
3295struct __is_constructible3_void_check<true, _Tp, _A0, _A1, _A2>
3296 : public false_type
3297 {};
3298
3299// is_constructible entry point
3300
3301template <class _Tp, class _A0 = __is_construct::__nat,
3302 class _A1 = __is_construct::__nat,
3303 class _A2 = __is_construct::__nat>
3304struct _LIBCPP_TEMPLATE_VIS is_constructible
3305 : public __is_constructible3_void_check<is_void<_Tp>::value
3306 || is_abstract<_Tp>::value
3307 || is_function<_Tp>::value
3308 || is_void<_A0>::value
3309 || is_void<_A1>::value
3310 || is_void<_A2>::value,
3311 _Tp, _A0, _A1, _A2>
3312 {};
3313
3314template <class _Tp>
3315struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
3316 : public __is_constructible0_void_check<is_void<_Tp>::value
3317 || is_abstract<_Tp>::value
3318 || is_function<_Tp>::value,
3319 _Tp>
3320 {};
3321
3322template <class _Tp, class _A0>
3323struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, __is_construct::__nat>
3324 : public __is_constructible1_void_check<is_void<_Tp>::value
3325 || is_abstract<_Tp>::value
3326 || is_function<_Tp>::value
3327 || is_void<_A0>::value,
3328 _Tp, _A0>
3329 {};
3330
3331template <class _Tp, class _A0, class _A1>
3332struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, _A1, __is_construct::__nat>
3333 : public __is_constructible2_void_check<is_void<_Tp>::value
3334 || is_abstract<_Tp>::value
3335 || is_function<_Tp>::value
3336 || is_void<_A0>::value
3337 || is_void<_A1>::value,
3338 _Tp, _A0, _A1>
3339 {};
3340
3341// Array types are default constructible if their element type
3342// is default constructible
3343
3344template <class _Ap, size_t _Np>
3345struct __is_constructible0_imp<false, _Ap[_Np]>
3346 : public is_constructible<typename remove_all_extents<_Ap>::type>
3347 {};
3348
3349template <class _Ap, size_t _Np, class _A0>
3350struct __is_constructible1_imp<false, _Ap[_Np], _A0>
3351 : public false_type
3352 {};
3353
3354template <class _Ap, size_t _Np, class _A0, class _A1>
3355struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
3356 : public false_type
3357 {};
33582786
3359template <class _Ap, size_t _Np, class _A0, class _A1, class _A2>2787template <class _Tp>
3360struct __is_constructible3_imp<false, _Ap[_Np], _A0, _A1, _A2>2788struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {};
3361 : public false_type
3362 {};
33632789
3364// Incomplete array types are not constructible2790template <class _Tp, class _A0>
2791struct __libcpp_is_constructible<_Tp, _A0>
2792 : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0))
2793{};
33652794
3366template <class _Ap>2795template <class _Tp, class _A0>
3367struct __is_constructible0_imp<false, _Ap[]>2796struct __libcpp_is_constructible<_Tp&, _A0>
3368 : public false_type2797 : public decltype(__is_constructible_helper::
3369 {};2798 __test_cast<_Tp&, _A0>(0))
2799{};
33702800
3371template <class _Ap, class _A0>2801template <class _Tp, class _A0>
3372struct __is_constructible1_imp<false, _Ap[], _A0>2802struct __libcpp_is_constructible<_Tp&&, _A0>
3373 : public false_type2803 : public decltype(__is_constructible_helper::
3374 {};2804 __test_cast<_Tp&&, _A0>(0))
2805{};
33752806
3376template <class _Ap, class _A0, class _A1>2807#endif
3377struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
3378 : public false_type
3379 {};
33802808
3381template <class _Ap, class _A0, class _A1, class _A2>2809#if __has_feature(is_constructible)
3382struct __is_constructible3_imp<false, _Ap[], _A0, _A1, _A2>2810template <class _Tp, class ..._Args>
3383 : public false_type2811struct _LIBCPP_TEMPLATE_VIS is_constructible
2812 : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
3384 {};2813 {};
2814#else
2815template <class _Tp, class... _Args>
2816struct _LIBCPP_TEMPLATE_VIS is_constructible
2817 : public __libcpp_is_constructible<_Tp, _Args...>::type {};
2818#endif
33852819
3386#endif // __has_feature(is_constructible)2820#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3387
3388
3389#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
3390template <class _Tp, class ..._Args>2821template <class _Tp, class ..._Args>
3391_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_constructible_v2822_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_constructible_v
3392 = is_constructible<_Tp, _Args...>::value;2823 = is_constructible<_Tp, _Args...>::value;
...@@ -3422,11 +2853,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_constructible_v...@@ -3422,11 +2853,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_constructible_v
34222853
3423template <class _Tp>2854template <class _Tp>
3424struct _LIBCPP_TEMPLATE_VIS is_move_constructible2855struct _LIBCPP_TEMPLATE_VIS is_move_constructible
3425#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3426 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>2856 : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3427#else
3428 : public is_copy_constructible<_Tp>
3429#endif
3430 {};2857 {};
34312858
3432#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)2859#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -3437,8 +2864,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_constructible_v...@@ -3437,8 +2864,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_constructible_v
34372864
3438// is_trivially_constructible2865// is_trivially_constructible
34392866
3440#ifndef _LIBCPP_HAS_NO_VARIADICS
3441
3442#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 5012867#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
34432868
3444template <class _Tp, class... _Args>2869template <class _Tp, class... _Args>
...@@ -3457,7 +2882,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible...@@ -3457,7 +2882,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
34572882
3458template <class _Tp>2883template <class _Tp>
3459struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>2884struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>
3460#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403)2885#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_COMPILER_GCC)
3461 : integral_constant<bool, __has_trivial_constructor(_Tp)>2886 : integral_constant<bool, __has_trivial_constructor(_Tp)>
3462#else2887#else
3463 : integral_constant<bool, is_scalar<_Tp>::value>2888 : integral_constant<bool, is_scalar<_Tp>::value>
...@@ -3466,11 +2891,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>...@@ -3466,11 +2891,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp>
3466};2891};
34672892
3468template <class _Tp>2893template <class _Tp>
3469#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3470struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&>2894struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&>
3471#else
3472struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp>
3473#endif
3474 : integral_constant<bool, is_scalar<_Tp>::value>2895 : integral_constant<bool, is_scalar<_Tp>::value>
3475{2896{
3476};2897};
...@@ -3489,80 +2910,8 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&>...@@ -3489,80 +2910,8 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&>
34892910
3490#endif // !__has_feature(is_trivially_constructible)2911#endif // !__has_feature(is_trivially_constructible)
34912912
3492#else // _LIBCPP_HAS_NO_VARIADICS
3493
3494template <class _Tp, class _A0 = __is_construct::__nat,
3495 class _A1 = __is_construct::__nat>
3496struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
3497 : false_type
3498{
3499};
3500
3501#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
3502
3503template <class _Tp>
3504struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
3505 __is_construct::__nat>
3506 : integral_constant<bool, __is_trivially_constructible(_Tp)>
3507{
3508};
3509
3510template <class _Tp>
3511struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp,
3512 __is_construct::__nat>
3513 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
3514{
3515};
3516
3517template <class _Tp>
3518struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&,
3519 __is_construct::__nat>
3520 : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
3521{
3522};
3523
3524template <class _Tp>
3525struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&,
3526 __is_construct::__nat>
3527 : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
3528{
3529};
3530
3531#else // !__has_feature(is_trivially_constructible)
3532
3533template <class _Tp>
3534struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, __is_construct::__nat,
3535 __is_construct::__nat>
3536 : integral_constant<bool, is_scalar<_Tp>::value>
3537{
3538};
3539
3540template <class _Tp>
3541struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp,
3542 __is_construct::__nat>
3543 : integral_constant<bool, is_scalar<_Tp>::value>
3544{
3545};
3546
3547template <class _Tp>
3548struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&,
3549 __is_construct::__nat>
3550 : integral_constant<bool, is_scalar<_Tp>::value>
3551{
3552};
3553
3554template <class _Tp>
3555struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&,
3556 __is_construct::__nat>
3557 : integral_constant<bool, is_scalar<_Tp>::value>
3558{
3559};
3560
3561#endif // !__has_feature(is_trivially_constructible)
3562
3563#endif // _LIBCPP_HAS_NO_VARIADICS
35642913
3565#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)2914#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3566template <class _Tp, class... _Args>2915template <class _Tp, class... _Args>
3567_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_constructible_v2916_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
3568 = is_trivially_constructible<_Tp, _Args...>::value;2917 = is_trivially_constructible<_Tp, _Args...>::value;
...@@ -3595,11 +2944,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v...@@ -3595,11 +2944,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
3595// is_trivially_move_constructible2944// is_trivially_move_constructible
35962945
3597template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible2946template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
3598#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3599 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>2947 : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3600#else
3601 : public is_trivially_copy_constructible<_Tp>
3602#endif
3603 {};2948 {};
36042949
3605#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)2950#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -3636,14 +2981,10 @@ template <class _Tp>...@@ -3636,14 +2981,10 @@ template <class _Tp>
3636struct is_trivially_assignable<_Tp&, const _Tp&>2981struct is_trivially_assignable<_Tp&, const _Tp&>
3637 : integral_constant<bool, is_scalar<_Tp>::value> {};2982 : integral_constant<bool, is_scalar<_Tp>::value> {};
36382983
3639#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3640
3641template <class _Tp>2984template <class _Tp>
3642struct is_trivially_assignable<_Tp&, _Tp&&>2985struct is_trivially_assignable<_Tp&, _Tp&&>
3643 : integral_constant<bool, is_scalar<_Tp>::value> {};2986 : integral_constant<bool, is_scalar<_Tp>::value> {};
36442987
3645#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3646
3647#endif // !__has_feature(is_trivially_assignable)2988#endif // !__has_feature(is_trivially_assignable)
36482989
3649#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)2990#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -3668,11 +3009,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v...@@ -3668,11 +3009,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
36683009
3669template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable3010template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable
3670 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,3011 : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
3671#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3672 typename add_rvalue_reference<_Tp>::type>3012 typename add_rvalue_reference<_Tp>::type>
3673#else
3674 typename add_lvalue_reference<_Tp>::type>
3675#endif
3676 {};3013 {};
36773014
3678#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)3015#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -3683,7 +3020,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v...@@ -3683,7 +3020,12 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
36833020
3684// is_trivially_destructible3021// is_trivially_destructible
36853022
3686#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)3023#if __has_keyword(__is_trivially_destructible)
3024
3025template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
3026 : public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
3027
3028#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC)
36873029
3688template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible3030template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
3689 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};3031 : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
...@@ -3710,19 +3052,14 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_destructible_v...@@ -3710,19 +3052,14 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
37103052
3711// is_nothrow_constructible3053// is_nothrow_constructible
37123054
3713#if 03055#if __has_keyword(__is_nothrow_constructible)
3056
3714template <class _Tp, class... _Args>3057template <class _Tp, class... _Args>
3715struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible3058struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3716 : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))>3059 : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
3717{
3718};
37193060
3720#else3061#else
37213062
3722#ifndef _LIBCPP_HAS_NO_VARIADICS
3723
3724#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
3725
3726template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;3063template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
37273064
3728template <class _Tp, class... _Args>3065template <class _Tp, class... _Args>
...@@ -3758,117 +3095,10 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>...@@ -3758,117 +3095,10 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>
3758{3095{
3759};3096};
37603097
3761#else // __has_feature(cxx_noexcept)3098#endif // _LIBCPP_HAS_NO_NOEXCEPT
3762
3763template <class _Tp, class... _Args>
3764struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3765 : false_type
3766{
3767};
3768
3769template <class _Tp>
3770struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp>
3771#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3772 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3773#else
3774 : integral_constant<bool, is_scalar<_Tp>::value>
3775#endif
3776{
3777};
3778
3779template <class _Tp>
3780#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3781struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&&>
3782#else
3783struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp>
3784#endif
3785#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3786 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3787#else
3788 : integral_constant<bool, is_scalar<_Tp>::value>
3789#endif
3790{
3791};
3792
3793template <class _Tp>
3794struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&>
3795#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3796 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3797#else
3798 : integral_constant<bool, is_scalar<_Tp>::value>
3799#endif
3800{
3801};
3802
3803template <class _Tp>
3804struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&>
3805#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3806 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3807#else
3808 : integral_constant<bool, is_scalar<_Tp>::value>
3809#endif
3810{
3811};
3812
3813#endif // __has_feature(cxx_noexcept)
3814
3815#else // _LIBCPP_HAS_NO_VARIADICS
3816
3817template <class _Tp, class _A0 = __is_construct::__nat,
3818 class _A1 = __is_construct::__nat>
3819struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
3820 : false_type
3821{
3822};
3823
3824template <class _Tp>
3825struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat,
3826 __is_construct::__nat>
3827#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403)
3828 : integral_constant<bool, __has_nothrow_constructor(_Tp)>
3829#else
3830 : integral_constant<bool, is_scalar<_Tp>::value>
3831#endif
3832{
3833};
3834
3835template <class _Tp>
3836struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp,
3837 __is_construct::__nat>
3838#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3839 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3840#else
3841 : integral_constant<bool, is_scalar<_Tp>::value>
3842#endif
3843{
3844};
3845
3846template <class _Tp>
3847struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&,
3848 __is_construct::__nat>
3849#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3850 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3851#else
3852 : integral_constant<bool, is_scalar<_Tp>::value>
3853#endif
3854{
3855};
3856
3857template <class _Tp>
3858struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&,
3859 __is_construct::__nat>
3860#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403)
3861 : integral_constant<bool, __has_nothrow_copy(_Tp)>
3862#else
3863 : integral_constant<bool, is_scalar<_Tp>::value>
3864#endif
3865{
3866};
38673099
3868#endif // _LIBCPP_HAS_NO_VARIADICS
3869#endif // __has_feature(is_nothrow_constructible)
38703100
3871#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)3101#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3872template <class _Tp, class ..._Args>3102template <class _Tp, class ..._Args>
3873_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v3103_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
3874 = is_nothrow_constructible<_Tp, _Args...>::value;3104 = is_nothrow_constructible<_Tp, _Args...>::value;
...@@ -3901,11 +3131,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v...@@ -3901,11 +3131,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
3901// is_nothrow_move_constructible3131// is_nothrow_move_constructible
39023132
3903template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible3133template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
3904#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3905 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>3134 : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
3906#else
3907 : public is_nothrow_copy_constructible<_Tp>
3908#endif
3909 {};3135 {};
39103136
3911#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)3137#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -3916,7 +3142,13 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v...@@ -3916,7 +3142,13 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
39163142
3917// is_nothrow_assignable3143// is_nothrow_assignable
39183144
3919#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)3145#if __has_keyword(__is_nothrow_assignable)
3146
3147template <class _Tp, class _Arg>
3148struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
3149 : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
3150
3151#else
39203152
3921template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;3153template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
39223154
...@@ -3938,49 +3170,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable...@@ -3938,49 +3170,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
3938{3170{
3939};3171};
39403172
3941#else // __has_feature(cxx_noexcept)3173#endif // _LIBCPP_HAS_NO_NOEXCEPT
3942
3943template <class _Tp, class _Arg>
3944struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
3945 : public false_type {};
3946
3947template <class _Tp>
3948struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp>
3949#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3950 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3951#else
3952 : integral_constant<bool, is_scalar<_Tp>::value> {};
3953#endif
3954
3955template <class _Tp>
3956struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&>
3957#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3958 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3959#else
3960 : integral_constant<bool, is_scalar<_Tp>::value> {};
3961#endif
3962
3963template <class _Tp>
3964struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
3965#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3966 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3967#else
3968 : integral_constant<bool, is_scalar<_Tp>::value> {};
3969#endif
3970
3971#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3972
3973template <class _Tp>
3974struct is_nothrow_assignable<_Tp&, _Tp&&>
3975#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403)
3976 : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
3977#else
3978 : integral_constant<bool, is_scalar<_Tp>::value> {};
3979#endif
3980
3981#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3982
3983#endif // __has_feature(cxx_noexcept)
39843174
3985#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)3175#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
3986template <class _Tp, class _Arg>3176template <class _Tp, class _Arg>
...@@ -4004,11 +3194,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v...@@ -4004,11 +3194,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
40043194
4005template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable3195template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
4006 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,3196 : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
4007#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4008 typename add_rvalue_reference<_Tp>::type>3197 typename add_rvalue_reference<_Tp>::type>
4009#else
4010 typename add_lvalue_reference<_Tp>::type>
4011#endif
4012 {};3198 {};
40133199
4014#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)3200#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -4019,7 +3205,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v...@@ -4019,7 +3205,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
40193205
4020// is_nothrow_destructible3206// is_nothrow_destructible
40213207
4022#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)3208#if !defined(_LIBCPP_CXX03_LANG)
40233209
4024template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;3210template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
40253211
...@@ -4053,16 +3239,12 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&>...@@ -4053,16 +3239,12 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&>
4053{3239{
4054};3240};
40553241
4056#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
4057
4058template <class _Tp>3242template <class _Tp>
4059struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&>3243struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&>
4060 : public true_type3244 : public true_type
4061{3245{
4062};3246};
40633247
4064#endif
4065
4066#else3248#else
40673249
4068template <class _Tp> struct __libcpp_nothrow_destructor3250template <class _Tp> struct __libcpp_nothrow_destructor
...@@ -4086,7 +3268,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v...@@ -4086,7 +3268,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
40863268
4087// is_pod3269// is_pod
40883270
4089#if __has_feature(is_pod) || (_GNUC_VER >= 403)3271#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC)
40903272
4091template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod3273template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
4092 : public integral_constant<bool, __is_pod(_Tp)> {};3274 : public integral_constant<bool, __is_pod(_Tp)> {};
...@@ -4110,12 +3292,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pod_v...@@ -4110,12 +3292,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pod_v
4110// is_literal_type;3292// is_literal_type;
41113293
4112template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_literal_type3294template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_literal_type
4113#ifdef _LIBCPP_IS_LITERAL3295 : public integral_constant<bool, __is_literal_type(_Tp)>
4114 : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)>
4115#else
4116 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value ||
4117 is_reference<typename remove_all_extents<_Tp>::type>::value>
4118#endif
4119 {};3296 {};
41203297
4121#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)3298#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
...@@ -4127,7 +3304,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_literal_type_v...@@ -4127,7 +3304,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_literal_type_v
4127// is_standard_layout;3304// is_standard_layout;
41283305
4129template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout3306template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
4130#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407)3307#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC)
4131 : public integral_constant<bool, __is_standard_layout(_Tp)>3308 : public integral_constant<bool, __is_standard_layout(_Tp)>
4132#else3309#else
4133 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>3310 : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
...@@ -4161,7 +3338,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copyable_v...@@ -4161,7 +3338,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
4161// is_trivial;3338// is_trivial;
41623339
4163template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial3340template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
4164#if __has_feature(is_trivial) || _GNUC_VER >= 4073341#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC)
4165 : public integral_constant<bool, __is_trivial(_Tp)>3342 : public integral_constant<bool, __is_trivial(_Tp)>
4166#else3343#else
4167 : integral_constant<bool, is_trivially_copyable<_Tp>::value &&3344 : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
...@@ -4361,28 +3538,31 @@ _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)...@@ -4361,28 +3538,31 @@ _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)
4361#undef _LIBCPP_INVOKE_RETURN3538#undef _LIBCPP_INVOKE_RETURN
43623539
4363// __invokable3540// __invokable
4364
4365template <class _Ret, class _Fp, class ..._Args>3541template <class _Ret, class _Fp, class ..._Args>
4366struct __invokable_r3542struct __invokable_r
4367{3543{
4368 // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,3544 template <class _XFp, class ..._XArgs>
4369 // or incomplete array types as required by the standard.3545 static auto __try_call(int) -> decltype(
4370 using _Result = decltype(3546 _VSTD::__invoke(_VSTD::declval<_XFp>(), _VSTD::declval<_XArgs>()...));
4371 _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));3547 template <class _XFp, class ..._XArgs>
3548 static __nat __try_call(...);
43723549
4373 using type =3550 // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
4374 typename conditional<3551 // or incomplete array types as required by the standard.
4375 !is_same<_Result, __nat>::value,3552 using _Result = decltype(__try_call<_Fp, _Args...>(0));
4376 typename conditional<
4377 is_void<_Ret>::value,
4378 true_type,
4379 is_convertible<_Result, _Ret>
4380 >::type,
4381 false_type
4382 >::type;
4383 static const bool value = type::value;
4384};
43853553
3554 using type =
3555 typename conditional<
3556 _IsNotSame<_Result, __nat>::value,
3557 typename conditional<
3558 is_void<_Ret>::value,
3559 true_type,
3560 is_convertible<_Result, _Ret>
3561 >::type,
3562 false_type
3563 >::type;
3564 static const bool value = type::value;
3565};
4386template <class _Fp, class ..._Args>3566template <class _Fp, class ..._Args>
4387using __invokable = __invokable_r<void, _Fp, _Args...>;3567using __invokable = __invokable_r<void, _Fp, _Args...>;
43883568
...@@ -4512,6 +3692,7 @@ typename enable_if...@@ -4512,6 +3692,7 @@ typename enable_if
4512#else3692#else
4513void3693void
4514#endif3694#endif
3695_LIBCPP_CONSTEXPR_AFTER_CXX17
4515swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&3696swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
4516 is_nothrow_move_assignable<_Tp>::value)3697 is_nothrow_move_assignable<_Tp>::value)
4517{3698{
...@@ -4521,14 +3702,14 @@ swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&...@@ -4521,14 +3702,14 @@ swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
4521}3702}
45223703
4523template<class _Tp, size_t _Np>3704template<class _Tp, size_t _Np>
4524inline _LIBCPP_INLINE_VISIBILITY3705inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4525typename enable_if<3706typename enable_if<
4526 __is_swappable<_Tp>::value3707 __is_swappable<_Tp>::value
4527>::type3708>::type
4528swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);3709swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
45293710
4530template <class _ForwardIterator1, class _ForwardIterator2>3711template <class _ForwardIterator1, class _ForwardIterator2>
4531inline _LIBCPP_INLINE_VISIBILITY3712inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
4532void3713void
4533iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)3714iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
4534 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))3715 // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
...@@ -4558,8 +3739,8 @@ struct __swappable_with...@@ -4558,8 +3739,8 @@ struct __swappable_with
4558 typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;3739 typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
4559 typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;3740 typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
45603741
4561 static const bool value = !is_same<__swap1, __nat>::value3742 static const bool value = _IsNotSame<__swap1, __nat>::value
4562 && !is_same<__swap2, __nat>::value;3743 && _IsNotSame<__swap2, __nat>::value;
4563};3744};
45643745
4565template <class _Tp, class _Up>3746template <class _Tp, class _Up>
...@@ -4649,30 +3830,24 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_swappable_v...@@ -4649,30 +3830,24 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_swappable_v
46493830
4650#endif // _LIBCPP_STD_VER > 143831#endif // _LIBCPP_STD_VER > 14
46513832
4652#ifdef _LIBCPP_UNDERLYING_TYPE3833template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl;
3834
3835template <class _Tp>
3836struct __underlying_type_impl<_Tp, false> {};
46533837
4654template <class _Tp>3838template <class _Tp>
4655struct underlying_type3839struct __underlying_type_impl<_Tp, true>
4656{3840{
4657 typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type;3841 typedef __underlying_type(_Tp) type;
4658};3842};
46593843
3844template <class _Tp>
3845struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
3846
4660#if _LIBCPP_STD_VER > 113847#if _LIBCPP_STD_VER > 11
4661template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;3848template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
4662#endif3849#endif
46633850
4664#else // _LIBCPP_UNDERLYING_TYPE
4665
4666template <class _Tp, bool _Support = false>
4667struct underlying_type
4668{
4669 static_assert(_Support, "The underyling_type trait requires compiler "
4670 "support. Either no such support exists or "
4671 "libc++ does not know how to use it.");
4672};
4673
4674#endif // _LIBCPP_UNDERLYING_TYPE
4675
46763851
4677template <class _Tp, bool = is_enum<_Tp>::value>3852template <class _Tp, bool = is_enum<_Tp>::value>
4678struct __sfinae_underlying_type3853struct __sfinae_underlying_type
...@@ -4758,25 +3933,23 @@ struct __has_operator_addressof...@@ -4758,25 +3933,23 @@ struct __has_operator_addressof
47583933
4759template <class...> using void_t = void;3934template <class...> using void_t = void;
47603935
4761# ifndef _LIBCPP_HAS_NO_VARIADICS
4762template <class... _Args>3936template <class... _Args>
4763struct conjunction : __and_<_Args...> {};3937struct conjunction : _And<_Args...> {};
4764template<class... _Args>3938template<class... _Args>
4765_LIBCPP_INLINE_VAR constexpr bool conjunction_v3939_LIBCPP_INLINE_VAR constexpr bool conjunction_v
4766 = conjunction<_Args...>::value;3940 = conjunction<_Args...>::value;
47673941
4768template <class... _Args>3942template <class... _Args>
4769struct disjunction : __or_<_Args...> {};3943struct disjunction : _Or<_Args...> {};
4770template<class... _Args>3944template<class... _Args>
4771_LIBCPP_INLINE_VAR constexpr bool disjunction_v3945_LIBCPP_INLINE_VAR constexpr bool disjunction_v
4772 = disjunction<_Args...>::value;3946 = disjunction<_Args...>::value;
47733947
4774template <class _Tp>3948template <class _Tp>
4775struct negation : __not_<_Tp> {};3949struct negation : _Not<_Tp> {};
4776template<class _Tp>3950template<class _Tp>
4777_LIBCPP_INLINE_VAR constexpr bool negation_v3951_LIBCPP_INLINE_VAR constexpr bool negation_v
4778 = negation<_Tp>::value;3952 = negation<_Tp>::value;
4779# endif // _LIBCPP_HAS_NO_VARIADICS
4780#endif // _LIBCPP_STD_VER > 143953#endif // _LIBCPP_STD_VER > 14
47813954
4782// These traits are used in __tree and __hash_table3955// These traits are used in __tree and __hash_table
...@@ -4788,12 +3961,12 @@ struct __extract_key_first_tag {};...@@ -4788,12 +3961,12 @@ struct __extract_key_first_tag {};
4788template <class _ValTy, class _Key,3961template <class _ValTy, class _Key,
4789 class _RawValTy = typename __unconstref<_ValTy>::type>3962 class _RawValTy = typename __unconstref<_ValTy>::type>
4790struct __can_extract_key3963struct __can_extract_key
4791 : conditional<is_same<_RawValTy, _Key>::value, __extract_key_self_tag,3964 : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag,
4792 __extract_key_fail_tag>::type {};3965 __extract_key_fail_tag>::type {};
47933966
4794template <class _Pair, class _Key, class _First, class _Second>3967template <class _Pair, class _Key, class _First, class _Second>
4795struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>3968struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
4796 : conditional<is_same<typename remove_const<_First>::type, _Key>::value,3969 : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value,
4797 __extract_key_first_tag, __extract_key_fail_tag>::type {};3970 __extract_key_first_tag, __extract_key_fail_tag>::type {};
47983971
4799// __can_extract_map_key uses true_type/false_type instead of the tags.3972// __can_extract_map_key uses true_type/false_type instead of the tags.
...@@ -4802,7 +3975,7 @@ struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>...@@ -4802,7 +3975,7 @@ struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
4802template <class _ValTy, class _Key, class _ContainerValueTy,3975template <class _ValTy, class _Key, class _ContainerValueTy,
4803 class _RawValTy = typename __unconstref<_ValTy>::type>3976 class _RawValTy = typename __unconstref<_ValTy>::type>
4804struct __can_extract_map_key3977struct __can_extract_map_key
4805 : integral_constant<bool, is_same<_RawValTy, _Key>::value> {};3978 : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
48063979
4807// This specialization returns __extract_key_fail_tag for non-map containers3980// This specialization returns __extract_key_fail_tag for non-map containers
4808// because _Key == _ContainerValueTy3981// because _Key == _ContainerValueTy
...@@ -4827,6 +4000,24 @@ enum class endian...@@ -4827,6 +4000,24 @@ enum class endian
4827};4000};
4828#endif4001#endif
48294002
4003#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
4004#if _LIBCPP_STD_VER > 17
4005_LIBCPP_INLINE_VISIBILITY
4006inline constexpr bool is_constant_evaluated() noexcept {
4007 return __builtin_is_constant_evaluated();
4008}
4009#endif
4010
4011inline _LIBCPP_CONSTEXPR
4012bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
4013#else
4014inline _LIBCPP_CONSTEXPR
4015bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; }
4016#endif
4017
4018template <class _CharT>
4019using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
4020
4830_LIBCPP_END_NAMESPACE_STD4021_LIBCPP_END_NAMESPACE_STD
48314022
4832#if _LIBCPP_STD_VER > 144023#if _LIBCPP_STD_VER > 14
lib/libcxx/include/typeindex+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- typeindex ---------------------------------===//2//===-------------------------- typeindex ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/typeinfo+190-76
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- typeinfo ----------------------------------===//2//===-------------------------- typeinfo ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -69,59 +68,32 @@ public:...@@ -69,59 +68,32 @@ public:
69#pragma GCC system_header68#pragma GCC system_header
70#endif69#endif
7170
72#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)71#if defined(_LIBCPP_ABI_VCRUNTIME)
73#include <vcruntime_typeinfo.h>72#include <vcruntime_typeinfo.h>
74#else73#else
7574
76#if defined(_LIBCPP_NONUNIQUE_RTTI_BIT) && !defined(_LIBCPP_ABI_MICROSOFT)
77# define _LIBCPP_HAS_NONUNIQUE_TYPEINFO
78#endif
79
80namespace std // purposefully not using versioning namespace75namespace std // purposefully not using versioning namespace
81{76{
8277
78
79#if defined(_LIBCPP_ABI_MICROSOFT)
80
83class _LIBCPP_EXCEPTION_ABI type_info81class _LIBCPP_EXCEPTION_ABI type_info
84{82{
85 type_info& operator=(const type_info&);83 type_info& operator=(const type_info&);
86 type_info(const type_info&);84 type_info(const type_info&);
8785
88#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
89 _LIBCPP_INLINE_VISIBILITY
90 int __compare_nonunique_names(const type_info &__arg) const _NOEXCEPT
91 { return __builtin_strcmp(name(), __arg.name()); }
92#endif
93
94#if defined(_LIBCPP_ABI_MICROSOFT)
95 mutable struct {86 mutable struct {
96 const char *__undecorated_name;87 const char *__undecorated_name;
97 const char __decorated_name[1];88 const char __decorated_name[1];
98 } __data;89 } __data;
9990
100 int __compare(const type_info &__rhs) const _NOEXCEPT;91 int __compare(const type_info &__rhs) const _NOEXCEPT;
101#endif // _LIBCPP_ABI_MICROSOFT
102
103protected:
104#if !defined(_LIBCPP_ABI_MICROSOFT)
105#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
106 // A const char* with the non-unique RTTI bit possibly set.
107 uintptr_t __type_name;
108
109 _LIBCPP_INLINE_VISIBILITY
110 explicit type_info(const char* __n)
111 : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
112#else
113 const char *__type_name;
114
115 _LIBCPP_INLINE_VISIBILITY
116 explicit type_info(const char* __n) : __type_name(__n) {}
117#endif
118#endif // ! _LIBCPP_ABI_MICROSOFT
11992
120public:93public:
121 _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE94 _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
122 virtual ~type_info();95 virtual ~type_info();
12396
124#if defined(_LIBCPP_ABI_MICROSOFT)
125 const char *name() const _NOEXCEPT;97 const char *name() const _NOEXCEPT;
12698
127 _LIBCPP_INLINE_VISIBILITY99 _LIBCPP_INLINE_VISIBILITY
...@@ -135,91 +107,233 @@ public:...@@ -135,91 +107,233 @@ public:
135 bool operator==(const type_info& __arg) const _NOEXCEPT {107 bool operator==(const type_info& __arg) const _NOEXCEPT {
136 return __compare(__arg) == 0;108 return __compare(__arg) == 0;
137 }109 }
138#else
139#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
140 _LIBCPP_INLINE_VISIBILITY
141 const char* name() const _NOEXCEPT
142 {
143 return reinterpret_cast<const char*>(__type_name &
144 ~_LIBCPP_NONUNIQUE_RTTI_BIT);
145 }
146110
147 _LIBCPP_INLINE_VISIBILITY111 _LIBCPP_INLINE_VISIBILITY
148 bool before(const type_info& __arg) const _NOEXCEPT112 bool operator!=(const type_info& __arg) const _NOEXCEPT
149 {113 { return !operator==(__arg); }
150 if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))114};
151 return __type_name < __arg.__type_name;115
152 return __compare_nonunique_names(__arg) < 0;116#else // !defined(_LIBCPP_ABI_MICROSOFT)
117
118// ========================================================================== //
119// Implementations
120// ========================================================================== //
121// ------------------------------------------------------------------------- //
122// Unique
123// ------------------------------------------------------------------------- //
124// This implementation of type_info assumes a unique copy of the RTTI for a
125// given type inside a program. This is a valid assumption when abiding to
126// Itanium ABI (http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-components).
127// Under this assumption, we can always compare the addresses of the type names
128// to implement equality-comparison of type_infos instead of having to perform
129// a deep string comparison.
130// -------------------------------------------------------------------------- //
131// NonUnique
132// -------------------------------------------------------------------------- //
133// This implementation of type_info does not assume there is always a unique
134// copy of the RTTI for a given type inside a program. For various reasons
135// the linker may have failed to merge every copy of a types RTTI
136// (For example: -Bsymbolic or llvm.org/PR37398). Under this assumption, two
137// type_infos are equal if their addresses are equal or if a deep string
138// comparison is equal.
139// -------------------------------------------------------------------------- //
140// NonUniqueARMRTTIBit
141// -------------------------------------------------------------------------- //
142// This implementation of type_info does not assume always a unique copy of
143// the RTTI for a given type inside a program. It packs the pointer to the
144// type name into a uintptr_t and reserves the high bit of that pointer (which
145// is assumed to be free for use under the ABI in use) to represent whether
146// that specific copy of the RTTI can be assumed unique inside the program.
147// To implement equality-comparison of type_infos, we check whether BOTH
148// type_infos are guaranteed unique, and if so, we simply compare the addresses
149// of their type names instead of doing a deep string comparison, which is
150// faster. If at least one of the type_infos can't guarantee uniqueness, we
151// have no choice but to fall back to a deep string comparison.
152//
153// This implementation is specific to ARM64 on Apple platforms.
154//
155// Note that the compiler is the one setting (or unsetting) the high bit of
156// the pointer when it constructs the type_info, depending on whether it can
157// guarantee uniqueness for that specific type_info.
158
159struct __type_info_implementations {
160 struct __string_impl_base {
161 typedef const char* __type_name_t;
162 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
163 _LIBCPP_CONSTEXPR static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
164 return __v;
153 }165 }
166 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
167 _LIBCPP_CONSTEXPR static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
168 return __v;
169 }
170 };
154171
155 _LIBCPP_INLINE_VISIBILITY172 struct __unique_impl : __string_impl_base {
156 size_t hash_code() const _NOEXCEPT173 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
157 {174 static size_t __hash(__type_name_t __v) _NOEXCEPT {
158 if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT))175 return reinterpret_cast<size_t>(__v);
159 return __type_name;176 }
177 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
178 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
179 return __lhs == __rhs;
180 }
181 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
182 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
183 return __lhs < __rhs;
184 }
185 };
160186
161 const char* __ptr = name();187 struct __non_unique_impl : __string_impl_base {
188 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
189 static size_t __hash(__type_name_t __ptr) _NOEXCEPT {
162 size_t __hash = 5381;190 size_t __hash = 5381;
163 while (unsigned char __c = static_cast<unsigned char>(*__ptr++))191 while (unsigned char __c = static_cast<unsigned char>(*__ptr++))
164 __hash = (__hash * 33) ^ __c;192 __hash = (__hash * 33) ^ __c;
165 return __hash;193 return __hash;
166 }194 }
195 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
196 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
197 return __lhs == __rhs || __builtin_strcmp(__lhs, __rhs) == 0;
198 }
199 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
200 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
201 return __builtin_strcmp(__lhs, __rhs) < 0;
202 }
203 };
167204
168 _LIBCPP_INLINE_VISIBILITY205 struct __non_unique_arm_rtti_bit_impl {
169 bool operator==(const type_info& __arg) const _NOEXCEPT206 typedef uintptr_t __type_name_t;
170 {207
171 if (__type_name == __arg.__type_name)208 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
172 return true;209 static const char* __type_name_to_string(__type_name_t __v) _NOEXCEPT {
210 return reinterpret_cast<const char*>(__v &
211 ~__non_unique_rtti_bit::value);
212 }
213 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
214 static __type_name_t __string_to_type_name(const char* __v) _NOEXCEPT {
215 return reinterpret_cast<__type_name_t>(__v);
216 }
173217
174 if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))218 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
219 static size_t __hash(__type_name_t __v) _NOEXCEPT {
220 if (__is_type_name_unique(__v))
221 return reinterpret_cast<size_t>(__v);
222 return __non_unique_impl::__hash(__type_name_to_string(__v));
223 }
224 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
225 static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
226 if (__lhs == __rhs)
227 return true;
228 if (__is_type_name_unique(__lhs, __rhs))
175 return false;229 return false;
176 return __compare_nonunique_names(__arg) == 0;230 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
231 }
232 _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
233 static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
234 if (__is_type_name_unique(__lhs, __rhs))
235 return __lhs < __rhs;
236 return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
177 }237 }
238
239 private:
240 // The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
241 // this implementation is actually used.
242 typedef std::integral_constant<__type_name_t,
243 (1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
244
245 _LIBCPP_INLINE_VISIBILITY
246 static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
247 return !(__lhs & __non_unique_rtti_bit::value);
248 }
249 _LIBCPP_INLINE_VISIBILITY
250 static bool __is_type_name_unique(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
251 return !((__lhs & __rhs) & __non_unique_rtti_bit::value);
252 }
253 };
254
255 typedef
256#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
257 __non_unique_arm_rtti_bit_impl
258#elif _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT == 0
259 __non_unique_impl
260#elif _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT == 1
261 __unique_impl
178#else262#else
263# error invalid configuration for _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
264#endif
265 __impl;
266};
267
268class _LIBCPP_EXCEPTION_ABI type_info
269{
270 type_info& operator=(const type_info&);
271 type_info(const type_info&);
272
273 protected:
274 typedef __type_info_implementations::__impl __impl;
275
276 __impl::__type_name_t __type_name;
277
278 _LIBCPP_INLINE_VISIBILITY
279 explicit type_info(const char* __n)
280 : __type_name(__impl::__string_to_type_name(__n)) {}
281
282public:
283 _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
284 virtual ~type_info();
285
179 _LIBCPP_INLINE_VISIBILITY286 _LIBCPP_INLINE_VISIBILITY
180 const char* name() const _NOEXCEPT287 const char* name() const _NOEXCEPT
181 { return __type_name; }288 {
289 return __impl::__type_name_to_string(__type_name);
290 }
182291
183 _LIBCPP_INLINE_VISIBILITY292 _LIBCPP_INLINE_VISIBILITY
184 bool before(const type_info& __arg) const _NOEXCEPT293 bool before(const type_info& __arg) const _NOEXCEPT
185 { return __type_name < __arg.__type_name; }294 {
295 return __impl::__lt(__type_name, __arg.__type_name);
296 }
186297
187 _LIBCPP_INLINE_VISIBILITY298 _LIBCPP_INLINE_VISIBILITY
188 size_t hash_code() const _NOEXCEPT299 size_t hash_code() const _NOEXCEPT
189 { return reinterpret_cast<size_t>(__type_name); }300 {
301 return __impl::__hash(__type_name);
302 }
190303
191 _LIBCPP_INLINE_VISIBILITY304 _LIBCPP_INLINE_VISIBILITY
192 bool operator==(const type_info& __arg) const _NOEXCEPT305 bool operator==(const type_info& __arg) const _NOEXCEPT
193 { return __type_name == __arg.__type_name; }306 {
194#endif307 return __impl::__eq(__type_name, __arg.__type_name);
195#endif // _LIBCPP_ABI_MICROSOFT308 }
196309
197 _LIBCPP_INLINE_VISIBILITY310 _LIBCPP_INLINE_VISIBILITY
198 bool operator!=(const type_info& __arg) const _NOEXCEPT311 bool operator!=(const type_info& __arg) const _NOEXCEPT
199 { return !operator==(__arg); }312 { return !operator==(__arg); }
200};313};
314#endif // defined(_LIBCPP_ABI_MICROSOFT)
201315
202class _LIBCPP_EXCEPTION_ABI bad_cast316class _LIBCPP_EXCEPTION_ABI bad_cast
203 : public exception317 : public exception
204{318{
205public:319 public:
206 bad_cast() _NOEXCEPT;320 bad_cast() _NOEXCEPT;
207 virtual ~bad_cast() _NOEXCEPT;321 virtual ~bad_cast() _NOEXCEPT;
208 virtual const char* what() const _NOEXCEPT;322 virtual const char* what() const _NOEXCEPT;
209};323};
210324
211class _LIBCPP_EXCEPTION_ABI bad_typeid325class _LIBCPP_EXCEPTION_ABI bad_typeid
212 : public exception326 : public exception
213{327{
214public:328 public:
215 bad_typeid() _NOEXCEPT;329 bad_typeid() _NOEXCEPT;
216 virtual ~bad_typeid() _NOEXCEPT;330 virtual ~bad_typeid() _NOEXCEPT;
217 virtual const char* what() const _NOEXCEPT;331 virtual const char* what() const _NOEXCEPT;
218};332};
219333
220} // std334} // std
221335
222#endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)336#endif // defined(_LIBCPP_ABI_VCRUNTIME)
223337
224_LIBCPP_BEGIN_NAMESPACE_STD338_LIBCPP_BEGIN_NAMESPACE_STD
225_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY339_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
lib/libcxx/include/unordered_map+173-28
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- unordered_map -----------------------------===//2//===-------------------------- unordered_map -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -80,12 +79,12 @@ public:...@@ -80,12 +79,12 @@ public:
80 unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)79 unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
81 : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++1480 : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14
82 template <class InputIterator>81 template <class InputIterator>
83 unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf, 82 unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
84 const allocator_type& a)83 const allocator_type& a)
85 : unordered_map(f, l, n, hf, key_equal(), a) {} // C++1484 : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14
86 unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)85 unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
87 : unordered_map(il, n, hasher(), key_equal(), a) {} // C++1486 : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14
88 unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf, 87 unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
89 const allocator_type& a)88 const allocator_type& a)
90 : unordered_map(il, n, hf, key_equal(), a) {} // C++1489 : unordered_map(il, n, hf, key_equal(), a) {} // C++14
91 ~unordered_map();90 ~unordered_map();
...@@ -175,6 +174,7 @@ public:...@@ -175,6 +174,7 @@ public:
175 iterator find(const key_type& k);174 iterator find(const key_type& k);
176 const_iterator find(const key_type& k) const;175 const_iterator find(const key_type& k) const;
177 size_type count(const key_type& k) const;176 size_type count(const key_type& k) const;
177 bool contains(const key_type& k) const; // C++20
178 pair<iterator, iterator> equal_range(const key_type& k);178 pair<iterator, iterator> equal_range(const key_type& k);
179 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;179 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
180180
...@@ -278,12 +278,12 @@ public:...@@ -278,12 +278,12 @@ public:
278 unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)278 unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
279 : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14279 : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14
280 template <class InputIterator>280 template <class InputIterator>
281 unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf, 281 unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
282 const allocator_type& a)282 const allocator_type& a)
283 : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14283 : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14
284 unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)284 unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
285 : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14285 : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14
286 unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf, 286 unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
287 const allocator_type& a)287 const allocator_type& a)
288 : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14288 : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14
289 ~unordered_multimap();289 ~unordered_multimap();
...@@ -356,6 +356,7 @@ public:...@@ -356,6 +356,7 @@ public:
356 iterator find(const key_type& k);356 iterator find(const key_type& k);
357 const_iterator find(const key_type& k) const;357 const_iterator find(const key_type& k) const;
358 size_type count(const key_type& k) const;358 size_type count(const key_type& k) const;
359 bool contains(const key_type& k) const; // C++20
359 pair<iterator, iterator> equal_range(const key_type& k);360 pair<iterator, iterator> equal_range(const key_type& k);
360 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;361 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
361362
...@@ -845,15 +846,14 @@ public:...@@ -845,15 +846,14 @@ public:
845 // types846 // types
846 typedef _Key key_type;847 typedef _Key key_type;
847 typedef _Tp mapped_type;848 typedef _Tp mapped_type;
848 typedef _Hash hasher;849 typedef typename __identity<_Hash>::type hasher;
849 typedef _Pred key_equal;850 typedef typename __identity<_Pred>::type key_equal;
850 typedef _Alloc allocator_type;851 typedef typename __identity<_Alloc>::type allocator_type;
851 typedef pair<const key_type, mapped_type> value_type;852 typedef pair<const key_type, mapped_type> value_type;
852 typedef value_type& reference;853 typedef value_type& reference;
853 typedef const value_type& const_reference;854 typedef const value_type& const_reference;
854 static_assert((is_same<value_type, typename allocator_type::value_type>::value),855 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
855 "Invalid allocator::value_type");856 "Invalid allocator::value_type");
856 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
857857
858private:858private:
859 typedef __hash_value_type<key_type, mapped_type> __value_type;859 typedef __hash_value_type<key_type, mapped_type> __value_type;
...@@ -953,18 +953,22 @@ public:...@@ -953,18 +953,22 @@ public:
953 : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}953 : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {}
954 template <class _InputIterator>954 template <class _InputIterator>
955 _LIBCPP_INLINE_VISIBILITY955 _LIBCPP_INLINE_VISIBILITY
956 unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 956 unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
957 const allocator_type& __a)957 const allocator_type& __a)
958 : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}958 : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
959 _LIBCPP_INLINE_VISIBILITY959 _LIBCPP_INLINE_VISIBILITY
960 unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)960 unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
961 : unordered_map(__il, __n, hasher(), key_equal(), __a) {}961 : unordered_map(__il, __n, hasher(), key_equal(), __a) {}
962 _LIBCPP_INLINE_VISIBILITY962 _LIBCPP_INLINE_VISIBILITY
963 unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 963 unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
964 const allocator_type& __a)964 const allocator_type& __a)
965 : unordered_map(__il, __n, __hf, key_equal(), __a) {}965 : unordered_map(__il, __n, __hf, key_equal(), __a) {}
966#endif966#endif
967 // ~unordered_map() = default;967 _LIBCPP_INLINE_VISIBILITY
968 ~unordered_map() {
969 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
970 }
971
968 _LIBCPP_INLINE_VISIBILITY972 _LIBCPP_INLINE_VISIBILITY
969 unordered_map& operator=(const unordered_map& __u)973 unordered_map& operator=(const unordered_map& __u)
970 {974 {
...@@ -1276,6 +1280,10 @@ public:...@@ -1276,6 +1280,10 @@ public:
1276 const_iterator find(const key_type& __k) const {return __table_.find(__k);}1280 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
1277 _LIBCPP_INLINE_VISIBILITY1281 _LIBCPP_INLINE_VISIBILITY
1278 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}1282 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
1283 #if _LIBCPP_STD_VER > 17
1284 _LIBCPP_INLINE_VISIBILITY
1285 bool contains(const key_type& __k) const {return find(__k) != end();}
1286 #endif // _LIBCPP_STD_VER > 17
1279 _LIBCPP_INLINE_VISIBILITY1287 _LIBCPP_INLINE_VISIBILITY
1280 pair<iterator, iterator> equal_range(const key_type& __k)1288 pair<iterator, iterator> equal_range(const key_type& __k)
1281 {return __table_.__equal_range_unique(__k);}1289 {return __table_.__equal_range_unique(__k);}
...@@ -1346,6 +1354,73 @@ private:...@@ -1346,6 +1354,73 @@ private:
1346#endif1354#endif
1347};1355};
13481356
1357#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1358template<class _InputIterator,
1359 class _Hash = hash<__iter_key_type<_InputIterator>>,
1360 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
1361 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
1362 class = _EnableIf<!__is_allocator<_Hash>::value>,
1363 class = _EnableIf<!is_integral<_Hash>::value>,
1364 class = _EnableIf<!__is_allocator<_Pred>::value>,
1365 class = _EnableIf<__is_allocator<_Allocator>::value>>
1366unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
1367 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1368 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
1369
1370template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
1371 class _Pred = equal_to<remove_const_t<_Key>>,
1372 class _Allocator = allocator<pair<const _Key, _Tp>>,
1373 class = _EnableIf<!__is_allocator<_Hash>::value>,
1374 class = _EnableIf<!is_integral<_Hash>::value>,
1375 class = _EnableIf<!__is_allocator<_Pred>::value>,
1376 class = _EnableIf<__is_allocator<_Allocator>::value>>
1377unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
1378 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1379 -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
1380
1381template<class _InputIterator, class _Allocator,
1382 class = _EnableIf<__is_allocator<_Allocator>::value>>
1383unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
1384 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1385 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1386
1387template<class _InputIterator, class _Allocator,
1388 class = _EnableIf<__is_allocator<_Allocator>::value>>
1389unordered_map(_InputIterator, _InputIterator, _Allocator)
1390 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1391 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1392
1393template<class _InputIterator, class _Hash, class _Allocator,
1394 class = _EnableIf<!__is_allocator<_Hash>::value>,
1395 class = _EnableIf<!is_integral<_Hash>::value>,
1396 class = _EnableIf<__is_allocator<_Allocator>::value>>
1397unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1398 -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
1399 _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
1400
1401template<class _Key, class _Tp, class _Allocator,
1402 class = _EnableIf<__is_allocator<_Allocator>::value>>
1403unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
1404 -> unordered_map<remove_const_t<_Key>, _Tp,
1405 hash<remove_const_t<_Key>>,
1406 equal_to<remove_const_t<_Key>>, _Allocator>;
1407
1408template<class _Key, class _Tp, class _Allocator,
1409 class = _EnableIf<__is_allocator<_Allocator>::value>>
1410unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1411 -> unordered_map<remove_const_t<_Key>, _Tp,
1412 hash<remove_const_t<_Key>>,
1413 equal_to<remove_const_t<_Key>>, _Allocator>;
1414
1415template<class _Key, class _Tp, class _Hash, class _Allocator,
1416 class = _EnableIf<!__is_allocator<_Hash>::value>,
1417 class = _EnableIf<!is_integral<_Hash>::value>,
1418 class = _EnableIf<__is_allocator<_Allocator>::value>>
1419unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1420 -> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
1421 equal_to<remove_const_t<_Key>>, _Allocator>;
1422#endif
1423
1349template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>1424template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
1350unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(1425unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
1351 size_type __n, const hasher& __hf, const key_equal& __eql)1426 size_type __n, const hasher& __hf, const key_equal& __eql)
...@@ -1603,10 +1678,8 @@ _Tp&...@@ -1603,10 +1678,8 @@ _Tp&
1603unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)1678unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k)
1604{1679{
1605 iterator __i = find(__k);1680 iterator __i = find(__k);
1606#ifndef _LIBCPP_NO_EXCEPTIONS
1607 if (__i == end())1681 if (__i == end())
1608 throw out_of_range("unordered_map::at: key not found");1682 __throw_out_of_range("unordered_map::at: key not found");
1609#endif // _LIBCPP_NO_EXCEPTIONS
1610 return __i->second;1683 return __i->second;
1611}1684}
16121685
...@@ -1615,10 +1688,8 @@ const _Tp&...@@ -1615,10 +1688,8 @@ const _Tp&
1615unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const1688unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
1616{1689{
1617 const_iterator __i = find(__k);1690 const_iterator __i = find(__k);
1618#ifndef _LIBCPP_NO_EXCEPTIONS
1619 if (__i == end())1691 if (__i == end())
1620 throw out_of_range("unordered_map::at: key not found");1692 __throw_out_of_range("unordered_map::at: key not found");
1621#endif // _LIBCPP_NO_EXCEPTIONS
1622 return __i->second;1693 return __i->second;
1623}1694}
16241695
...@@ -1675,15 +1746,14 @@ public:...@@ -1675,15 +1746,14 @@ public:
1675 // types1746 // types
1676 typedef _Key key_type;1747 typedef _Key key_type;
1677 typedef _Tp mapped_type;1748 typedef _Tp mapped_type;
1678 typedef _Hash hasher;1749 typedef typename __identity<_Hash>::type hasher;
1679 typedef _Pred key_equal;1750 typedef typename __identity<_Pred>::type key_equal;
1680 typedef _Alloc allocator_type;1751 typedef typename __identity<_Alloc>::type allocator_type;
1681 typedef pair<const key_type, mapped_type> value_type;1752 typedef pair<const key_type, mapped_type> value_type;
1682 typedef value_type& reference;1753 typedef value_type& reference;
1683 typedef const value_type& const_reference;1754 typedef const value_type& const_reference;
1684 static_assert((is_same<value_type, typename allocator_type::value_type>::value),1755 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
1685 "Invalid allocator::value_type");1756 "Invalid allocator::value_type");
1686 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
16871757
1688private:1758private:
1689 typedef __hash_value_type<key_type, mapped_type> __value_type;1759 typedef __hash_value_type<key_type, mapped_type> __value_type;
...@@ -1781,18 +1851,22 @@ public:...@@ -1781,18 +1851,22 @@ public:
1781 : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}1851 : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {}
1782 template <class _InputIterator>1852 template <class _InputIterator>
1783 _LIBCPP_INLINE_VISIBILITY1853 _LIBCPP_INLINE_VISIBILITY
1784 unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, 1854 unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf,
1785 const allocator_type& __a)1855 const allocator_type& __a)
1786 : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}1856 : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
1787 _LIBCPP_INLINE_VISIBILITY1857 _LIBCPP_INLINE_VISIBILITY
1788 unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)1858 unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
1789 : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}1859 : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
1790 _LIBCPP_INLINE_VISIBILITY1860 _LIBCPP_INLINE_VISIBILITY
1791 unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, 1861 unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf,
1792 const allocator_type& __a)1862 const allocator_type& __a)
1793 : unordered_multimap(__il, __n, __hf, key_equal(), __a) {}1863 : unordered_multimap(__il, __n, __hf, key_equal(), __a) {}
1794#endif1864#endif
1795 // ~unordered_multimap() = default;1865 _LIBCPP_INLINE_VISIBILITY
1866 ~unordered_multimap() {
1867 static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
1868 }
1869
1796 _LIBCPP_INLINE_VISIBILITY1870 _LIBCPP_INLINE_VISIBILITY
1797 unordered_multimap& operator=(const unordered_multimap& __u)1871 unordered_multimap& operator=(const unordered_multimap& __u)
1798 {1872 {
...@@ -1981,6 +2055,10 @@ public:...@@ -1981,6 +2055,10 @@ public:
1981 const_iterator find(const key_type& __k) const {return __table_.find(__k);}2055 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
1982 _LIBCPP_INLINE_VISIBILITY2056 _LIBCPP_INLINE_VISIBILITY
1983 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}2057 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
2058 #if _LIBCPP_STD_VER > 17
2059 _LIBCPP_INLINE_VISIBILITY
2060 bool contains(const key_type& __k) const {return find(__k) != end();}
2061 #endif // _LIBCPP_STD_VER > 17
1984 _LIBCPP_INLINE_VISIBILITY2062 _LIBCPP_INLINE_VISIBILITY
1985 pair<iterator, iterator> equal_range(const key_type& __k)2063 pair<iterator, iterator> equal_range(const key_type& __k)
1986 {return __table_.__equal_range_multi(__k);}2064 {return __table_.__equal_range_multi(__k);}
...@@ -2040,6 +2118,73 @@ public:...@@ -2040,6 +2118,73 @@ public:
20402118
2041};2119};
20422120
2121#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
2122template<class _InputIterator,
2123 class _Hash = hash<__iter_key_type<_InputIterator>>,
2124 class _Pred = equal_to<__iter_key_type<_InputIterator>>,
2125 class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
2126 class = _EnableIf<!__is_allocator<_Hash>::value>,
2127 class = _EnableIf<!is_integral<_Hash>::value>,
2128 class = _EnableIf<!__is_allocator<_Pred>::value>,
2129 class = _EnableIf<__is_allocator<_Allocator>::value>>
2130unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
2131 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
2132 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
2133
2134template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
2135 class _Pred = equal_to<remove_const_t<_Key>>,
2136 class _Allocator = allocator<pair<const _Key, _Tp>>,
2137 class = _EnableIf<!__is_allocator<_Hash>::value>,
2138 class = _EnableIf<!is_integral<_Hash>::value>,
2139 class = _EnableIf<!__is_allocator<_Pred>::value>,
2140 class = _EnableIf<__is_allocator<_Allocator>::value>>
2141unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
2142 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
2143 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
2144
2145template<class _InputIterator, class _Allocator,
2146 class = _EnableIf<__is_allocator<_Allocator>::value>>
2147unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
2148 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2149 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2150
2151template<class _InputIterator, class _Allocator,
2152 class = _EnableIf<__is_allocator<_Allocator>::value>>
2153unordered_multimap(_InputIterator, _InputIterator, _Allocator)
2154 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2155 hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2156
2157template<class _InputIterator, class _Hash, class _Allocator,
2158 class = _EnableIf<!__is_allocator<_Hash>::value>,
2159 class = _EnableIf<!is_integral<_Hash>::value>,
2160 class = _EnableIf<__is_allocator<_Allocator>::value>>
2161unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
2162 -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
2163 _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
2164
2165template<class _Key, class _Tp, class _Allocator,
2166 class = _EnableIf<__is_allocator<_Allocator>::value>>
2167unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
2168 -> unordered_multimap<remove_const_t<_Key>, _Tp,
2169 hash<remove_const_t<_Key>>,
2170 equal_to<remove_const_t<_Key>>, _Allocator>;
2171
2172template<class _Key, class _Tp, class _Allocator,
2173 class = _EnableIf<__is_allocator<_Allocator>::value>>
2174unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2175 -> unordered_multimap<remove_const_t<_Key>, _Tp,
2176 hash<remove_const_t<_Key>>,
2177 equal_to<remove_const_t<_Key>>, _Allocator>;
2178
2179template<class _Key, class _Tp, class _Hash, class _Allocator,
2180 class = _EnableIf<!__is_allocator<_Hash>::value>,
2181 class = _EnableIf<!is_integral<_Hash>::value>,
2182 class = _EnableIf<__is_allocator<_Allocator>::value>>
2183unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
2184 -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
2185 equal_to<remove_const_t<_Key>>, _Allocator>;
2186#endif
2187
2043template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>2188template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
2044unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(2189unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
2045 size_type __n, const hasher& __hf, const key_equal& __eql)2190 size_type __n, const hasher& __hf, const key_equal& __eql)
lib/libcxx/include/unordered_set+145-20
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- unordered_set -----------------------------===//2//===-------------------------- unordered_set -----------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -76,7 +75,7 @@ public:...@@ -76,7 +75,7 @@ public:
76 template <class InputIterator>75 template <class InputIterator>
77 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++1476 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
78 template <class InputIterator>77 template <class InputIterator>
79 unordered_set(InputIterator f, InputIterator l, size_type n, 78 unordered_set(InputIterator f, InputIterator l, size_type n,
80 const hasher& hf, const allocator_type& a); // C++1479 const hasher& hf, const allocator_type& a); // C++14
81 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++1480 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
82 unordered_set(initializer_list<value_type> il, size_type n,81 unordered_set(initializer_list<value_type> il, size_type n,
...@@ -147,6 +146,7 @@ public:...@@ -147,6 +146,7 @@ public:
147 iterator find(const key_type& k);146 iterator find(const key_type& k);
148 const_iterator find(const key_type& k) const;147 const_iterator find(const key_type& k) const;
149 size_type count(const key_type& k) const;148 size_type count(const key_type& k) const;
149 bool contains(const key_type& k) const; // C++20
150 pair<iterator, iterator> equal_range(const key_type& k);150 pair<iterator, iterator> equal_range(const key_type& k);
151 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;151 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
152152
...@@ -243,7 +243,7 @@ public:...@@ -243,7 +243,7 @@ public:
243 unordered_multiset(InputIterator f, InputIterator l, size_type n,243 unordered_multiset(InputIterator f, InputIterator l, size_type n,
244 const hasher& hf, const allocator_type& a); // C++14244 const hasher& hf, const allocator_type& a); // C++14
245 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14245 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
246 unordered_multiset(initializer_list<value_type> il, size_type n, 246 unordered_multiset(initializer_list<value_type> il, size_type n,
247 const hasher& hf, const allocator_type& a); // C++14247 const hasher& hf, const allocator_type& a); // C++14
248 ~unordered_multiset();248 ~unordered_multiset();
249 unordered_multiset& operator=(const unordered_multiset&);249 unordered_multiset& operator=(const unordered_multiset&);
...@@ -311,6 +311,7 @@ public:...@@ -311,6 +311,7 @@ public:
311 iterator find(const key_type& k);311 iterator find(const key_type& k);
312 const_iterator find(const key_type& k) const;312 const_iterator find(const key_type& k) const;
313 size_type count(const key_type& k) const;313 size_type count(const key_type& k) const;
314 bool contains(const key_type& k) const; // C++20
314 pair<iterator, iterator> equal_range(const key_type& k);315 pair<iterator, iterator> equal_range(const key_type& k);
315 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;316 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
316317
...@@ -384,14 +385,13 @@ public:...@@ -384,14 +385,13 @@ public:
384 // types385 // types
385 typedef _Value key_type;386 typedef _Value key_type;
386 typedef key_type value_type;387 typedef key_type value_type;
387 typedef _Hash hasher;388 typedef typename __identity<_Hash>::type hasher;
388 typedef _Pred key_equal;389 typedef typename __identity<_Pred>::type key_equal;
389 typedef _Alloc allocator_type;390 typedef typename __identity<_Alloc>::type allocator_type;
390 typedef value_type& reference;391 typedef value_type& reference;
391 typedef const value_type& const_reference;392 typedef const value_type& const_reference;
392 static_assert((is_same<value_type, typename allocator_type::value_type>::value),393 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
393 "Invalid allocator::value_type");394 "Invalid allocator::value_type");
394 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
395395
396private:396private:
397 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;397 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
...@@ -452,11 +452,11 @@ public:...@@ -452,11 +452,11 @@ public:
452#if _LIBCPP_STD_VER > 11452#if _LIBCPP_STD_VER > 11
453 template <class _InputIterator>453 template <class _InputIterator>
454 inline _LIBCPP_INLINE_VISIBILITY454 inline _LIBCPP_INLINE_VISIBILITY
455 unordered_set(_InputIterator __first, _InputIterator __last, 455 unordered_set(_InputIterator __first, _InputIterator __last,
456 size_type __n, const allocator_type& __a)456 size_type __n, const allocator_type& __a)
457 : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}457 : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
458 template <class _InputIterator>458 template <class _InputIterator>
459 unordered_set(_InputIterator __first, _InputIterator __last, 459 unordered_set(_InputIterator __first, _InputIterator __last,
460 size_type __n, const hasher& __hf, const allocator_type& __a)460 size_type __n, const hasher& __hf, const allocator_type& __a)
461 : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}461 : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
462#endif462#endif
...@@ -482,12 +482,16 @@ public:...@@ -482,12 +482,16 @@ public:
482 const allocator_type& __a)482 const allocator_type& __a)
483 : unordered_set(__il, __n, hasher(), key_equal(), __a) {}483 : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
484 inline _LIBCPP_INLINE_VISIBILITY484 inline _LIBCPP_INLINE_VISIBILITY
485 unordered_set(initializer_list<value_type> __il, size_type __n, 485 unordered_set(initializer_list<value_type> __il, size_type __n,
486 const hasher& __hf, const allocator_type& __a)486 const hasher& __hf, const allocator_type& __a)
487 : unordered_set(__il, __n, __hf, key_equal(), __a) {}487 : unordered_set(__il, __n, __hf, key_equal(), __a) {}
488#endif488#endif
489#endif // _LIBCPP_CXX03_LANG489#endif // _LIBCPP_CXX03_LANG
490 // ~unordered_set() = default;490 _LIBCPP_INLINE_VISIBILITY
491 ~unordered_set() {
492 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
493 }
494
491 _LIBCPP_INLINE_VISIBILITY495 _LIBCPP_INLINE_VISIBILITY
492 unordered_set& operator=(const unordered_set& __u)496 unordered_set& operator=(const unordered_set& __u)
493 {497 {
...@@ -675,6 +679,10 @@ public:...@@ -675,6 +679,10 @@ public:
675 const_iterator find(const key_type& __k) const {return __table_.find(__k);}679 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
676 _LIBCPP_INLINE_VISIBILITY680 _LIBCPP_INLINE_VISIBILITY
677 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}681 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
682 #if _LIBCPP_STD_VER > 17
683 _LIBCPP_INLINE_VISIBILITY
684 bool contains(const key_type& __k) const {return find(__k) != end();}
685 #endif // _LIBCPP_STD_VER > 17
678 _LIBCPP_INLINE_VISIBILITY686 _LIBCPP_INLINE_VISIBILITY
679 pair<iterator, iterator> equal_range(const key_type& __k)687 pair<iterator, iterator> equal_range(const key_type& __k)
680 {return __table_.__equal_range_unique(__k);}688 {return __table_.__equal_range_unique(__k);}
...@@ -731,6 +739,62 @@ public:...@@ -731,6 +739,62 @@ public:
731739
732};740};
733741
742#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
743template<class _InputIterator,
744 class _Hash = hash<__iter_value_type<_InputIterator>>,
745 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
746 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
747 class = _EnableIf<!__is_allocator<_Hash>::value>,
748 class = _EnableIf<!is_integral<_Hash>::value>,
749 class = _EnableIf<!__is_allocator<_Pred>::value>,
750 class = _EnableIf<__is_allocator<_Allocator>::value>>
751unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
752 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
753 -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
754
755template<class _Tp, class _Hash = hash<_Tp>,
756 class _Pred = equal_to<_Tp>,
757 class _Allocator = allocator<_Tp>,
758 class = _EnableIf<!__is_allocator<_Hash>::value>,
759 class = _EnableIf<!is_integral<_Hash>::value>,
760 class = _EnableIf<!__is_allocator<_Pred>::value>,
761 class = _EnableIf<__is_allocator<_Allocator>::value>>
762unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
763 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
764 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
765
766template<class _InputIterator, class _Allocator,
767 class = _EnableIf<__is_allocator<_Allocator>::value>>
768unordered_set(_InputIterator, _InputIterator,
769 typename allocator_traits<_Allocator>::size_type, _Allocator)
770 -> unordered_set<__iter_value_type<_InputIterator>,
771 hash<__iter_value_type<_InputIterator>>,
772 equal_to<__iter_value_type<_InputIterator>>,
773 _Allocator>;
774
775template<class _InputIterator, class _Hash, class _Allocator,
776 class = _EnableIf<!__is_allocator<_Hash>::value>,
777 class = _EnableIf<!is_integral<_Hash>::value>,
778 class = _EnableIf<__is_allocator<_Allocator>::value>>
779unordered_set(_InputIterator, _InputIterator,
780 typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
781 -> unordered_set<__iter_value_type<_InputIterator>, _Hash,
782 equal_to<__iter_value_type<_InputIterator>>,
783 _Allocator>;
784
785template<class _Tp, class _Allocator,
786 class = _EnableIf<__is_allocator<_Allocator>::value>>
787unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
788 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
789
790template<class _Tp, class _Hash, class _Allocator,
791 class = _EnableIf<!__is_allocator<_Hash>::value>,
792 class = _EnableIf<!is_integral<_Hash>::value>,
793 class = _EnableIf<__is_allocator<_Allocator>::value>>
794unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
795 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
796#endif
797
734template <class _Value, class _Hash, class _Pred, class _Alloc>798template <class _Value, class _Hash, class _Pred, class _Alloc>
735unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,799unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
736 const hasher& __hf, const key_equal& __eql)800 const hasher& __hf, const key_equal& __eql)
...@@ -984,14 +1048,13 @@ public:...@@ -984,14 +1048,13 @@ public:
984 // types1048 // types
985 typedef _Value key_type;1049 typedef _Value key_type;
986 typedef key_type value_type;1050 typedef key_type value_type;
987 typedef _Hash hasher;1051 typedef typename __identity<_Hash>::type hasher;
988 typedef _Pred key_equal;1052 typedef typename __identity<_Pred>::type key_equal;
989 typedef _Alloc allocator_type;1053 typedef typename __identity<_Alloc>::type allocator_type;
990 typedef value_type& reference;1054 typedef value_type& reference;
991 typedef const value_type& const_reference;1055 typedef const value_type& const_reference;
992 static_assert((is_same<value_type, typename allocator_type::value_type>::value),1056 static_assert((is_same<value_type, typename allocator_type::value_type>::value),
993 "Invalid allocator::value_type");1057 "Invalid allocator::value_type");
994 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
9951058
996private:1059private:
997 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;1060 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
...@@ -1051,7 +1114,7 @@ public:...@@ -1051,7 +1114,7 @@ public:
1051#if _LIBCPP_STD_VER > 111114#if _LIBCPP_STD_VER > 11
1052 template <class _InputIterator>1115 template <class _InputIterator>
1053 inline _LIBCPP_INLINE_VISIBILITY1116 inline _LIBCPP_INLINE_VISIBILITY
1054 unordered_multiset(_InputIterator __first, _InputIterator __last, 1117 unordered_multiset(_InputIterator __first, _InputIterator __last,
1055 size_type __n, const allocator_type& __a)1118 size_type __n, const allocator_type& __a)
1056 : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}1119 : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
1057 template <class _InputIterator>1120 template <class _InputIterator>
...@@ -1085,7 +1148,11 @@ public:...@@ -1085,7 +1148,11 @@ public:
1085 : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}1148 : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
1086#endif1149#endif
1087#endif // _LIBCPP_CXX03_LANG1150#endif // _LIBCPP_CXX03_LANG
1088 // ~unordered_multiset() = default;1151 _LIBCPP_INLINE_VISIBILITY
1152 ~unordered_multiset() {
1153 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
1154 }
1155
1089 _LIBCPP_INLINE_VISIBILITY1156 _LIBCPP_INLINE_VISIBILITY
1090 unordered_multiset& operator=(const unordered_multiset& __u)1157 unordered_multiset& operator=(const unordered_multiset& __u)
1091 {1158 {
...@@ -1243,6 +1310,10 @@ public:...@@ -1243,6 +1310,10 @@ public:
1243 const_iterator find(const key_type& __k) const {return __table_.find(__k);}1310 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
1244 _LIBCPP_INLINE_VISIBILITY1311 _LIBCPP_INLINE_VISIBILITY
1245 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}1312 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
1313 #if _LIBCPP_STD_VER > 17
1314 _LIBCPP_INLINE_VISIBILITY
1315 bool contains(const key_type& __k) const {return find(__k) != end();}
1316 #endif // _LIBCPP_STD_VER > 17
1246 _LIBCPP_INLINE_VISIBILITY1317 _LIBCPP_INLINE_VISIBILITY
1247 pair<iterator, iterator> equal_range(const key_type& __k)1318 pair<iterator, iterator> equal_range(const key_type& __k)
1248 {return __table_.__equal_range_multi(__k);}1319 {return __table_.__equal_range_multi(__k);}
...@@ -1299,6 +1370,60 @@ public:...@@ -1299,6 +1370,60 @@ public:
12991370
1300};1371};
13011372
1373#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1374template<class _InputIterator,
1375 class _Hash = hash<__iter_value_type<_InputIterator>>,
1376 class _Pred = equal_to<__iter_value_type<_InputIterator>>,
1377 class _Allocator = allocator<__iter_value_type<_InputIterator>>,
1378 class = _EnableIf<!__is_allocator<_Hash>::value>,
1379 class = _EnableIf<!is_integral<_Hash>::value>,
1380 class = _EnableIf<!__is_allocator<_Pred>::value>,
1381 class = _EnableIf<__is_allocator<_Allocator>::value>>
1382unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
1383 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1384 -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
1385
1386template<class _Tp, class _Hash = hash<_Tp>,
1387 class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
1388 class = _EnableIf<!__is_allocator<_Hash>::value>,
1389 class = _EnableIf<!is_integral<_Hash>::value>,
1390 class = _EnableIf<!__is_allocator<_Pred>::value>,
1391 class = _EnableIf<__is_allocator<_Allocator>::value>>
1392unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
1393 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1394 -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
1395
1396template<class _InputIterator, class _Allocator,
1397 class = _EnableIf<__is_allocator<_Allocator>::value>>
1398unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
1399 -> unordered_multiset<__iter_value_type<_InputIterator>,
1400 hash<__iter_value_type<_InputIterator>>,
1401 equal_to<__iter_value_type<_InputIterator>>,
1402 _Allocator>;
1403
1404template<class _InputIterator, class _Hash, class _Allocator,
1405 class = _EnableIf<!__is_allocator<_Hash>::value>,
1406 class = _EnableIf<!is_integral<_Hash>::value>,
1407 class = _EnableIf<__is_allocator<_Allocator>::value>>
1408unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
1409 _Hash, _Allocator)
1410 -> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
1411 equal_to<__iter_value_type<_InputIterator>>,
1412 _Allocator>;
1413
1414template<class _Tp, class _Allocator,
1415 class = _EnableIf<__is_allocator<_Allocator>::value>>
1416unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
1417 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1418
1419template<class _Tp, class _Hash, class _Allocator,
1420 class = _EnableIf<!__is_allocator<_Hash>::value>,
1421 class = _EnableIf<!is_integral<_Hash>::value>,
1422 class = _EnableIf<__is_allocator<_Allocator>::value>>
1423unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
1424 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
1425#endif
1426
1302template <class _Value, class _Hash, class _Pred, class _Alloc>1427template <class _Value, class _Hash, class _Pred, class _Alloc>
1303unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(1428unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
1304 size_type __n, const hasher& __hf, const key_equal& __eql)1429 size_type __n, const hasher& __hf, const key_equal& __eql)
lib/libcxx/include/utility+27-30
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- utility -----------------------------------===//2//===-------------------------- utility -----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -104,7 +103,7 @@ struct piecewise_construct_t { };...@@ -104,7 +103,7 @@ struct piecewise_construct_t { };
104inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();103inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
105104
106template <class T> struct tuple_size;105template <class T> struct tuple_size;
107template <size_t I, class T> class tuple_element;106template <size_t I, class T> struct tuple_element;
108107
109template <class T1, class T2> struct tuple_size<pair<T1, T2> >;108template <class T1, class T2> struct tuple_size<pair<T1, T2> >;
110template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;109template <class T1, class T2> struct tuple_element<0, pair<T1, T2> >;
...@@ -253,7 +252,7 @@ operator>=(const _Tp& __x, const _Tp& __y)...@@ -253,7 +252,7 @@ operator>=(const _Tp& __x, const _Tp& __y)
253252
254253
255template <class _ForwardIterator1, class _ForwardIterator2>254template <class _ForwardIterator1, class _ForwardIterator2>
256inline _LIBCPP_INLINE_VISIBILITY255inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
257_ForwardIterator2256_ForwardIterator2
258swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)257swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
259{258{
...@@ -264,7 +263,7 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera...@@ -264,7 +263,7 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera
264263
265// forward declared in <type_traits>264// forward declared in <type_traits>
266template<class _Tp, size_t _Np>265template<class _Tp, size_t _Np>
267inline _LIBCPP_INLINE_VISIBILITY266inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
268typename enable_if<267typename enable_if<
269 __is_swappable<_Tp>::value268 __is_swappable<_Tp>::value
270>::type269>::type
...@@ -350,7 +349,7 @@ struct _LIBCPP_TEMPLATE_VIS pair...@@ -350,7 +349,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
350 }349 }
351#else350#else
352 template <bool _Val>351 template <bool _Val>
353 using _EnableB = typename enable_if<_Val, bool>::type;352 using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
354353
355 struct _CheckArgs {354 struct _CheckArgs {
356 template <class _U1, class _U2>355 template <class _U1, class _U2>
...@@ -377,7 +376,7 @@ struct _LIBCPP_TEMPLATE_VIS pair...@@ -377,7 +376,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
377 };376 };
378377
379 template <bool _MaybeEnable>378 template <bool _MaybeEnable>
380 using _CheckArgsDep = typename conditional<379 using _CheckArgsDep _LIBCPP_NODEBUG_TYPE = typename conditional<
381 _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;380 _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
382381
383 struct _CheckTupleLikeConstructor {382 struct _CheckTupleLikeConstructor {
...@@ -399,7 +398,7 @@ struct _LIBCPP_TEMPLATE_VIS pair...@@ -399,7 +398,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
399 };398 };
400399
401 template <class _Tuple>400 template <class _Tuple>
402 using _CheckTLC = typename conditional<401 using _CheckTLC _LIBCPP_NODEBUG_TYPE = typename conditional<
403 __tuple_like_with_size<_Tuple, 2>::value402 __tuple_like_with_size<_Tuple, 2>::value
404 && !is_same<typename decay<_Tuple>::type, pair>::value,403 && !is_same<typename decay<_Tuple>::type, pair>::value,
405 _CheckTupleLikeConstructor,404 _CheckTupleLikeConstructor,
...@@ -638,10 +637,10 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)...@@ -638,10 +637,10 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
638}637}
639638
640template <class _Tp>639template <class _Tp>
641struct __unwrap_reference { typedef _Tp type; };640struct __unwrap_reference { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
642641
643template <class _Tp>642template <class _Tp>
644struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _Tp& type; };643struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
645644
646#if _LIBCPP_STD_VER > 17645#if _LIBCPP_STD_VER > 17
647template <class _Tp>646template <class _Tp>
...@@ -688,23 +687,21 @@ template <class _T1, class _T2>...@@ -688,23 +687,21 @@ template <class _T1, class _T2>
688 : public integral_constant<size_t, 2> {};687 : public integral_constant<size_t, 2> {};
689688
690template <size_t _Ip, class _T1, class _T2>689template <size_t _Ip, class _T1, class _T2>
691class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >690struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
692{691{
693 static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");692 static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
694};693};
695694
696template <class _T1, class _T2>695template <class _T1, class _T2>
697class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >696struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
698{697{
699public:698 typedef _LIBCPP_NODEBUG_TYPE _T1 type;
700 typedef _T1 type;
701};699};
702700
703template <class _T1, class _T2>701template <class _T1, class _T2>
704class _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >702struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
705{703{
706public:704 typedef _LIBCPP_NODEBUG_TYPE _T2 type;
707 typedef _T2 type;
708};705};
709706
710template <size_t _Ip> struct __get_pair;707template <size_t _Ip> struct __get_pair;
...@@ -883,11 +880,11 @@ template<size_t... _Ip>...@@ -883,11 +880,11 @@ template<size_t... _Ip>
883#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)880#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
884881
885template <class _Tp, _Tp _Ep>882template <class _Tp, _Tp _Ep>
886using __make_integer_sequence = __make_integer_seq<integer_sequence, _Tp, _Ep>;883using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = __make_integer_seq<integer_sequence, _Tp, _Ep>;
887884
888#else885#else
889886
890template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked =887template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG_TYPE =
891 typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;888 typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
892889
893template <class _Tp, _Tp _Ep>890template <class _Tp, _Tp _Ep>
...@@ -898,11 +895,11 @@ struct __make_integer_sequence_checked...@@ -898,11 +895,11 @@ struct __make_integer_sequence_checked
898 static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");895 static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
899 // Workaround GCC bug by preventing bad installations when 0 <= _Ep896 // Workaround GCC bug by preventing bad installations when 0 <= _Ep
900 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929897 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
901 typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;898 typedef _LIBCPP_NODEBUG_TYPE __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
902};899};
903900
904template <class _Tp, _Tp _Ep>901template <class _Tp, _Tp _Ep>
905using __make_integer_sequence = typename __make_integer_sequence_checked<_Tp, _Ep>::type;902using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
906903
907#endif904#endif
908905
...@@ -1482,7 +1479,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float>...@@ -1482,7 +1479,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float>
1482 size_t operator()(float __v) const _NOEXCEPT1479 size_t operator()(float __v) const _NOEXCEPT
1483 {1480 {
1484 // -0.0 and 0.0 should return same hash1481 // -0.0 and 0.0 should return same hash
1485 if (__v == 0.0)1482 if (__v == 0.0f)
1486 return 0;1483 return 0;
1487 return __scalar_hash<float>::operator()(__v);1484 return __scalar_hash<float>::operator()(__v);
1488 }1485 }
...@@ -1510,7 +1507,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>...@@ -1510,7 +1507,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
1510 size_t operator()(long double __v) const _NOEXCEPT1507 size_t operator()(long double __v) const _NOEXCEPT
1511 {1508 {
1512 // -0.0 and 0.0 should return same hash1509 // -0.0 and 0.0 should return same hash
1513 if (__v == 0.0)1510 if (__v == 0.0L)
1514 return 0;1511 return 0;
1515#if defined(__i386__)1512#if defined(__i386__)
1516 // Zero out padding bits1513 // Zero out padding bits
...@@ -1593,29 +1590,29 @@ struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>...@@ -1593,29 +1590,29 @@ struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
15931590
1594#ifndef _LIBCPP_CXX03_LANG1591#ifndef _LIBCPP_CXX03_LANG
1595template <class _Key, class _Hash>1592template <class _Key, class _Hash>
1596using __check_hash_requirements = integral_constant<bool,1593using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
1597 is_copy_constructible<_Hash>::value &&1594 is_copy_constructible<_Hash>::value &&
1598 is_move_constructible<_Hash>::value &&1595 is_move_constructible<_Hash>::value &&
1599 __invokable_r<size_t, _Hash, _Key const&>::value1596 __invokable_r<size_t, _Hash, _Key const&>::value
1600>;1597>;
16011598
1602template <class _Key, class _Hash = std::hash<_Key> >1599template <class _Key, class _Hash = std::hash<_Key> >
1603using __has_enabled_hash = integral_constant<bool,1600using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
1604 __check_hash_requirements<_Key, _Hash>::value &&1601 __check_hash_requirements<_Key, _Hash>::value &&
1605 is_default_constructible<_Hash>::value1602 is_default_constructible<_Hash>::value
1606>;1603>;
16071604
1608#if _LIBCPP_STD_VER > 141605#if _LIBCPP_STD_VER > 14
1609template <class _Type, class>1606template <class _Type, class>
1610using __enable_hash_helper_imp = _Type;1607using __enable_hash_helper_imp _LIBCPP_NODEBUG_TYPE = _Type;
16111608
1612template <class _Type, class ..._Keys>1609template <class _Type, class ..._Keys>
1613using __enable_hash_helper = __enable_hash_helper_imp<_Type,1610using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = __enable_hash_helper_imp<_Type,
1614 typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type1611 typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
1615>;1612>;
1616#else1613#else
1617template <class _Type, class ...>1614template <class _Type, class ...>
1618using __enable_hash_helper = _Type;1615using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = _Type;
1619#endif1616#endif
16201617
1621#endif // !_LIBCPP_CXX03_LANG1618#endif // !_LIBCPP_CXX03_LANG
lib/libcxx/include/valarray+22-10
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===-------------------------- valarray ----------------------------------===//2//===-------------------------- valarray ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -674,6 +673,7 @@ public:...@@ -674,6 +673,7 @@ public:
674 _LIBCPP_INLINE_VISIBILITY673 _LIBCPP_INLINE_VISIBILITY
675 size_t size() const {return __size_;}674 size_t size() const {return __size_;}
676675
676 template <class> friend class __val_expr;
677 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;677 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
678};678};
679679
...@@ -1059,8 +1059,6 @@ private:...@@ -1059,8 +1059,6 @@ private:
1059 valarray& __assign_range(const value_type* __f, const value_type* __l);1059 valarray& __assign_range(const value_type* __f, const value_type* __l);
1060};1060};
10611061
1062_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
1063_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
1064_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))1062_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
10651063
1066template <class _Op, class _Tp>1064template <class _Op, class _Tp>
...@@ -2222,6 +2220,7 @@ public:...@@ -2222,6 +2220,7 @@ public:
2222 _LIBCPP_INLINE_VISIBILITY2220 _LIBCPP_INLINE_VISIBILITY
2223 size_t size() const {return __1d_.size();}2221 size_t size() const {return __1d_.size();}
22242222
2223 template <class> friend class __val_expr;
2225 template <class> friend class valarray;2224 template <class> friend class valarray;
2226};2225};
22272226
...@@ -2592,6 +2591,7 @@ public:...@@ -2592,6 +2591,7 @@ public:
2592 _LIBCPP_INLINE_VISIBILITY2591 _LIBCPP_INLINE_VISIBILITY
2593 size_t size() const {return __1d_.size();}2592 size_t size() const {return __1d_.size();}
25942593
2594 template <class> friend class __val_expr;
2595 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;2595 template <class> friend class _LIBCPP_TEMPLATE_VIS valarray;
2596};2596};
25972597
...@@ -2614,19 +2614,31 @@ public:...@@ -2614,19 +2614,31 @@ public:
26142614
2615 _LIBCPP_INLINE_VISIBILITY2615 _LIBCPP_INLINE_VISIBILITY
2616 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const2616 __val_expr<__slice_expr<_ValExpr> > operator[](slice __s) const
2617 {return __val_expr<__slice_expr<_ValExpr> >(__expr_, __s);}2617 {
2618 typedef __slice_expr<_ValExpr> _NewExpr;
2619 return __val_expr< _NewExpr >(_NewExpr(__s, __expr_));
2620 }
26182621
2619 _LIBCPP_INLINE_VISIBILITY2622 _LIBCPP_INLINE_VISIBILITY
2620 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const2623 __val_expr<__indirect_expr<_ValExpr> > operator[](const gslice& __gs) const
2621 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __gs.__1d_);}2624 {
2625 typedef __indirect_expr<_ValExpr> _NewExpr;
2626 return __val_expr<_NewExpr >(_NewExpr(__gs.__1d_, __expr_));
2627 }
26222628
2623 _LIBCPP_INLINE_VISIBILITY2629 _LIBCPP_INLINE_VISIBILITY
2624 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const2630 __val_expr<__mask_expr<_ValExpr> > operator[](const valarray<bool>& __vb) const
2625 {return __val_expr<__mask_expr<_ValExpr> >(__expr_, __vb);}2631 {
2632 typedef __mask_expr<_ValExpr> _NewExpr;
2633 return __val_expr< _NewExpr >( _NewExpr(__vb, __expr_));
2634 }
26262635
2627 _LIBCPP_INLINE_VISIBILITY2636 _LIBCPP_INLINE_VISIBILITY
2628 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const2637 __val_expr<__indirect_expr<_ValExpr> > operator[](const valarray<size_t>& __vs) const
2629 {return __val_expr<__indirect_expr<_ValExpr> >(__expr_, __vs);}2638 {
2639 typedef __indirect_expr<_ValExpr> _NewExpr;
2640 return __val_expr< _NewExpr >(_NewExpr(__vs, __expr_));
2641 }
26302642
2631 _LIBCPP_INLINE_VISIBILITY2643 _LIBCPP_INLINE_VISIBILITY
2632 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >2644 __val_expr<_UnaryOp<__unary_plus<value_type>, _ValExpr> >
lib/libcxx/include/variant+65-13
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ variant -------------------------------===//2//===------------------------------ variant -------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -1090,20 +1089,73 @@ private:...@@ -1090,20 +1089,73 @@ private:
1090 }1089 }
1091};1090};
10921091
1093template <class... _Types>1092struct __no_narrowing_check {
1094struct __overload;1093 template <class _Dest, class _Source>
1094 using _Apply = __identity<_Dest>;
1095};
10951096
1096template <>1097struct __narrowing_check {
1097struct __overload<> { void operator()() const; };1098 template <class _Dest>
1099 static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>;
1100 template <class _Dest, class _Source>
1101 using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({std::declval<_Source>()}));
1102};
10981103
1099template <class _Tp, class... _Types>1104template <class _Dest, class _Source>
1100struct __overload<_Tp, _Types...> : __overload<_Types...> {1105using __check_for_narrowing _LIBCPP_NODEBUG_TYPE =
1101 using __overload<_Types...>::operator();1106 typename _If<
1102 __identity<_Tp> operator()(_Tp) const;1107#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
1108 false &&
1109#endif
1110 is_arithmetic<_Dest>::value,
1111 __narrowing_check,
1112 __no_narrowing_check
1113 >::template _Apply<_Dest, _Source>;
1114
1115template <class _Tp, size_t _Idx>
1116struct __overload {
1117 template <class _Up>
1118 auto operator()(_Tp, _Up&&) const -> __check_for_narrowing<_Tp, _Up>;
1103};1119};
11041120
1121template <class _Tp, size_t>
1122struct __overload_bool {
1123 template <class _Up, class _Ap = __uncvref_t<_Up>>
1124 auto operator()(bool, _Up&&) const
1125 -> enable_if_t<is_same_v<_Ap, bool>, __identity<_Tp>>;
1126};
1127
1128template <size_t _Idx>
1129struct __overload<bool, _Idx> : __overload_bool<bool, _Idx> {};
1130template <size_t _Idx>
1131struct __overload<bool const, _Idx> : __overload_bool<bool const, _Idx> {};
1132template <size_t _Idx>
1133struct __overload<bool volatile, _Idx> : __overload_bool<bool volatile, _Idx> {};
1134template <size_t _Idx>
1135struct __overload<bool const volatile, _Idx> : __overload_bool<bool const volatile, _Idx> {};
1136
1137template <class ..._Bases>
1138struct __all_overloads : _Bases... {
1139 void operator()() const;
1140 using _Bases::operator()...;
1141};
1142
1143template <class IdxSeq>
1144struct __make_overloads_imp;
1145
1146template <size_t ..._Idx>
1147struct __make_overloads_imp<__tuple_indices<_Idx...> > {
1148 template <class ..._Types>
1149 using _Apply _LIBCPP_NODEBUG_TYPE = __all_overloads<__overload<_Types, _Idx>...>;
1150};
1151
1152template <class ..._Types>
1153using _MakeOverloads _LIBCPP_NODEBUG_TYPE = typename __make_overloads_imp<
1154 __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
1155
1105template <class _Tp, class... _Types>1156template <class _Tp, class... _Types>
1106using __best_match_t = typename result_of_t<__overload<_Types...>(_Tp&&)>::type;1157using __best_match_t =
1158 typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
11071159
1108} // __variant_detail1160} // __variant_detail
11091161
lib/libcxx/include/vector+23-19
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===------------------------------ vector --------------------------------===//2//===------------------------------ vector --------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -665,27 +664,27 @@ public:...@@ -665,27 +664,27 @@ public:
665 void reserve(size_type __n);664 void reserve(size_type __n);
666 void shrink_to_fit() _NOEXCEPT;665 void shrink_to_fit() _NOEXCEPT;
667666
668 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n);667 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) _NOEXCEPT;
669 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const;668 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const _NOEXCEPT;
670 reference at(size_type __n);669 reference at(size_type __n);
671 const_reference at(size_type __n) const;670 const_reference at(size_type __n) const;
672671
673 _LIBCPP_INLINE_VISIBILITY reference front()672 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT
674 {673 {
675 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");674 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
676 return *this->__begin_;675 return *this->__begin_;
677 }676 }
678 _LIBCPP_INLINE_VISIBILITY const_reference front() const677 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT
679 {678 {
680 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");679 _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
681 return *this->__begin_;680 return *this->__begin_;
682 }681 }
683 _LIBCPP_INLINE_VISIBILITY reference back()682 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT
684 {683 {
685 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");684 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
686 return *(this->__end_ - 1);685 return *(this->__end_ - 1);
687 }686 }
688 _LIBCPP_INLINE_VISIBILITY const_reference back() const687 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT
689 {688 {
690 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");689 _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
691 return *(this->__end_ - 1);690 return *(this->__end_ - 1);
...@@ -780,9 +779,9 @@ public:...@@ -780,9 +779,9 @@ public:
780779
781 void swap(vector&)780 void swap(vector&)
782#if _LIBCPP_STD_VER >= 14781#if _LIBCPP_STD_VER >= 14
783 _NOEXCEPT_DEBUG;782 _NOEXCEPT;
784#else783#else
785 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||784 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
786 __is_nothrow_swappable<allocator_type>::value);785 __is_nothrow_swappable<allocator_type>::value);
787#endif786#endif
788787
...@@ -836,12 +835,17 @@ private:...@@ -836,12 +835,17 @@ private:
836 }835 }
837836
838#ifndef _LIBCPP_CXX03_LANG837#ifndef _LIBCPP_CXX03_LANG
839 template <class _Up> void __push_back_slow_path(_Up&& __x);838 template <class _Up>
839 _LIBCPP_INLINE_VISIBILITY
840 inline void __push_back_slow_path(_Up&& __x);
840841
841 template <class... _Args>842 template <class... _Args>
842 void __emplace_back_slow_path(_Args&&... __args);843 _LIBCPP_INLINE_VISIBILITY
844 inline void __emplace_back_slow_path(_Args&&... __args);
843#else845#else
844 template <class _Up> void __push_back_slow_path(_Up& __x);846 template <class _Up>
847 _LIBCPP_INLINE_VISIBILITY
848 inline void __push_back_slow_path(_Up& __x);
845#endif849#endif
846850
847 // The following functions are no-ops outside of AddressSanitizer mode.851 // The following functions are no-ops outside of AddressSanitizer mode.
...@@ -1538,7 +1542,7 @@ vector<_Tp, _Allocator>::end() const _NOEXCEPT...@@ -1538,7 +1542,7 @@ vector<_Tp, _Allocator>::end() const _NOEXCEPT
1538template <class _Tp, class _Allocator>1542template <class _Tp, class _Allocator>
1539inline _LIBCPP_INLINE_VISIBILITY1543inline _LIBCPP_INLINE_VISIBILITY
1540typename vector<_Tp, _Allocator>::reference1544typename vector<_Tp, _Allocator>::reference
1541vector<_Tp, _Allocator>::operator[](size_type __n)1545vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT
1542{1546{
1543 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");1547 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
1544 return this->__begin_[__n];1548 return this->__begin_[__n];
...@@ -1547,7 +1551,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n)...@@ -1547,7 +1551,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n)
1547template <class _Tp, class _Allocator>1551template <class _Tp, class _Allocator>
1548inline _LIBCPP_INLINE_VISIBILITY1552inline _LIBCPP_INLINE_VISIBILITY
1549typename vector<_Tp, _Allocator>::const_reference1553typename vector<_Tp, _Allocator>::const_reference
1550vector<_Tp, _Allocator>::operator[](size_type __n) const1554vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT
1551{1555{
1552 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");1556 _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds");
1553 return this->__begin_[__n];1557 return this->__begin_[__n];
...@@ -2065,9 +2069,9 @@ template <class _Tp, class _Allocator>...@@ -2065,9 +2069,9 @@ template <class _Tp, class _Allocator>
2065void2069void
2066vector<_Tp, _Allocator>::swap(vector& __x)2070vector<_Tp, _Allocator>::swap(vector& __x)
2067#if _LIBCPP_STD_VER >= 142071#if _LIBCPP_STD_VER >= 14
2068 _NOEXCEPT_DEBUG2072 _NOEXCEPT
2069#else2073#else
2070 _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||2074 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
2071 __is_nothrow_swappable<allocator_type>::value)2075 __is_nothrow_swappable<allocator_type>::value)
2072#endif2076#endif
2073{2077{
lib/libcxx/include/version+11-6
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- version ----------------------------------===//2//===--------------------------- version ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
...@@ -59,6 +58,7 @@ __cpp_lib_hypot 201603L <cmath>...@@ -59,6 +58,7 @@ __cpp_lib_hypot 201603L <cmath>
59__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>58__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
60__cpp_lib_integer_sequence 201304L <utility>59__cpp_lib_integer_sequence 201304L <utility>
61__cpp_lib_integral_constant_callable 201304L <type_traits>60__cpp_lib_integral_constant_callable 201304L <type_traits>
61__cpp_lib_interpolate 201902L <numeric>
62__cpp_lib_invoke 201411L <functional>62__cpp_lib_invoke 201411L <functional>
63__cpp_lib_is_aggregate 201703L <type_traits>63__cpp_lib_is_aggregate 201703L <type_traits>
64__cpp_lib_is_constant_evaluated 201811L <type_traits>64__cpp_lib_is_constant_evaluated 201811L <type_traits>
...@@ -220,10 +220,15 @@ __cpp_lib_void_t 201411L <type_traits>...@@ -220,10 +220,15 @@ __cpp_lib_void_t 201411L <type_traits>
220// # define __cpp_lib_concepts 201806L220// # define __cpp_lib_concepts 201806L
221// # define __cpp_lib_constexpr_misc 201811L221// # define __cpp_lib_constexpr_misc 201811L
222// # define __cpp_lib_constexpr_swap_algorithms 201806L222// # define __cpp_lib_constexpr_swap_algorithms 201806L
223// # define __cpp_lib_destroying_delete 201806L223# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
224# define __cpp_lib_destroying_delete 201806L
225# endif
224# define __cpp_lib_erase_if 201811L226# define __cpp_lib_erase_if 201811L
225// # define __cpp_lib_generic_unordered_lookup 201811L227// # define __cpp_lib_generic_unordered_lookup 201811L
226// # define __cpp_lib_is_constant_evaluated 201811L228# define __cpp_lib_interpolate 201902L
229# if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
230# define __cpp_lib_is_constant_evaluated 201811L
231# endif
227// # define __cpp_lib_list_remove_return_type 201806L232// # define __cpp_lib_list_remove_return_type 201806L
228// # define __cpp_lib_ranges 201811L233// # define __cpp_lib_ranges 201811L
229// # define __cpp_lib_three_way_comparison 201711L234// # define __cpp_lib_three_way_comparison 201711L
lib/libcxx/include/wchar.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- wchar.h ----------------------------------===//2//===--------------------------- wchar.h ----------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109
lib/libcxx/include/wctype.h+3-4
...@@ -1,10 +1,9 @@...@@ -1,10 +1,9 @@
1// -*- C++ -*-1// -*- C++ -*-
2//===--------------------------- wctype.h ---------------------------------===//2//===--------------------------- wctype.h ---------------------------------===//
3//3//
4// The LLVM Compiler Infrastructure4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5//5// See https://llvm.org/LICENSE.txt for license information.
6// This file is dual licensed under the MIT and the University of Illinois Open6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7// Source Licenses. See LICENSE.TXT for details.
8//7//
9//===----------------------------------------------------------------------===//8//===----------------------------------------------------------------------===//
109