diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-17 19:47:30 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-17 19:47:30 +0300 |
commit | 6cd2f2e57d12f964d04a6d930e03fb2103e150fb (patch) | |
tree | a8db9c73a8e424560b3c4630b25eb7b696865ae2 /contrib/libs | |
parent | 5d55b92061339c2513c9c587480e1ca10c704fc1 (diff) | |
download | ydb-6cd2f2e57d12f964d04a6d930e03fb2103e150fb.tar.gz |
intermediate changes
ref:b701e8676af251d91697287754da22505ad43d4e
Diffstat (limited to 'contrib/libs')
85 files changed, 1602 insertions, 1150 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/CREDITS.TXT b/contrib/libs/cxxsupp/libcxx/CREDITS.TXT index 597c5fcb7c..fc442f4db1 100644 --- a/contrib/libs/cxxsupp/libcxx/CREDITS.TXT +++ b/contrib/libs/cxxsupp/libcxx/CREDITS.TXT @@ -149,6 +149,10 @@ N: Klaas de Vries E: klaas at klaasgaaf dot nl D: Minor bug fix. +N: Mark de Wever +E: koraq at xs4all dot nl +D: Format library support. + N: Zhang Xiongpang E: zhangxiongpang@gmail.com D: Minor patches and bug fixes. diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import index 913c2009a1..c2f213f437 100755 --- a/contrib/libs/cxxsupp/libcxx/import +++ b/contrib/libs/cxxsupp/libcxx/import @@ -1,6 +1,6 @@ #!/bin/sh -e -rev=13fa4fcf +rev=529a7930 output_dir="libcxx-r$rev" if [ -z $1 ] ; then git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp" diff --git a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h index 2d5c2eca46..a5788d9777 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bsd_locale_fallbacks.h @@ -108,7 +108,7 @@ size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, } #endif -inline +inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -118,7 +118,7 @@ int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__forma return __res; } -inline +inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -128,7 +128,7 @@ int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) { return __res; } -inline +inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h b/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h index e49b2d45de..42f060387d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h +++ b/contrib/libs/cxxsupp/libcxx/include/__compare/strong_order.h @@ -86,11 +86,11 @@ namespace __strong_order { bool __u_is_nan = _VSTD::isnan(__u); bool __t_is_negative = _VSTD::signbit(__t); bool __u_is_negative = _VSTD::signbit(__u); - using _IntType = std::conditional_t< - sizeof(__t) == sizeof(int32_t), int32_t, std::conditional_t< + using _IntType = conditional_t< + sizeof(__t) == sizeof(int32_t), int32_t, conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >; - if constexpr (std::is_same_v<_IntType, void>) { + if constexpr (is_same_v<_IntType, void>) { static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type"); } else if (__t_is_nan && __u_is_nan) { // Order by sign bit, then by "payload bits" (we'll just use bit_cast). diff --git a/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h b/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h index f67416ed3e..ce914b2321 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h +++ b/contrib/libs/cxxsupp/libcxx/include/__compare/weak_order.h @@ -42,13 +42,13 @@ namespace __weak_order { _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept { - std::partial_ordering __po = (__t <=> __u); - if (__po == std::partial_ordering::less) { - return std::weak_ordering::less; - } else if (__po == std::partial_ordering::equivalent) { - return std::weak_ordering::equivalent; - } else if (__po == std::partial_ordering::greater) { - return std::weak_ordering::greater; + partial_ordering __po = (__t <=> __u); + if (__po == partial_ordering::less) { + return weak_ordering::less; + } else if (__po == partial_ordering::equivalent) { + return weak_ordering::equivalent; + } else if (__po == partial_ordering::greater) { + return weak_ordering::greater; } else { // Otherwise, at least one of them is a NaN. bool __t_is_nan = _VSTD::isnan(__t); diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config index d2e69a122e..07ebb3b5bc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__config +++ b/contrib/libs/cxxsupp/libcxx/include/__config @@ -100,10 +100,6 @@ # define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB # define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB # define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE -// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr -// provided under the alternate keyword __nullptr, which changes the mangling -// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. @@ -153,6 +149,23 @@ # endif #endif +// By default, don't use a nullptr_t emulation type in C++03. +// +// This is technically an ABI break from previous releases, however it is +// very unlikely to impact anyone. If a user is impacted by this break, +// they can return to using the C++03 nullptr emulation by defining +// _LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION. +// +// This switch will be removed entirely in favour of never providing a +// C++03 emulation after one release. +// +// IMPORTANT: IF YOU ARE READING THIS AND YOU TURN THIS MACRO ON, PLEASE LEAVE +// A COMMENT ON https://reviews.llvm.org/D109459 OR YOU WILL BE BROKEN +// IN THE FUTURE WHEN WE REMOVE THE ABILITY TO USE THE C++03 EMULATION. +#ifndef _LIBCPP_ABI_USE_CXX03_NULLPTR_EMULATION +# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +#endif + #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Enable additional explicit instantiations of iostreams components. This // reduces the number of weak definitions generated in programs that use @@ -873,12 +886,6 @@ typedef unsigned int char32_t; #define _LIBCPP_HAS_NO_RANGES #endif -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_DEFAULT {} -#else -# define _LIBCPP_DEFAULT = default; -#endif - #ifdef __GNUC__ # define _LIBCPP_NOALIAS __attribute__((__malloc__)) #else @@ -1104,12 +1111,6 @@ typedef unsigned int char32_t; # define _LIBCPP_NODISCARD_AFTER_CXX17 #endif -#if !defined(_LIBCPP_DEBUG) && _LIBCPP_STD_VER > 11 -# define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr -#else -# define _LIBCPP_CONSTEXPR_IF_NODEBUG -#endif - #if __has_attribute(no_destroy) # define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) #else @@ -1441,10 +1442,12 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( #endif #if defined(__GNUC__) || defined(__clang__) -#define _LIBCPP_FORMAT_PRINTF(a, b) \ - __attribute__((__format__(__printf__, a, b))) + // The attribute uses 1-based indices for ordinary and static member functions. + // The attribute uses 2-based indices for non-static member functions. +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ + __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) #else -#define _LIBCPP_FORMAT_PRINTF(a, b) +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ #endif #endif // __cplusplus diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h index 80dbd6ca89..141d6bac8f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/bind.h @@ -70,7 +70,7 @@ _LIBCPP_FUNC_VIS extern const __ph<10> _10; /* inline */ constexpr __ph<10> _10{}; #endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) -} // placeholders +} // namespace placeholders template<int _Np> struct __is_placeholder<placeholders::__ph<_Np> > diff --git a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h index 3aa1326357..e379f1e2d0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__functional/function.h +++ b/contrib/libs/cxxsupp/libcxx/include/__functional/function.h @@ -946,7 +946,7 @@ public: #endif // _LIBCPP_HAS_EXTENSION_BLOCKS && !_LIBCPP_HAS_OBJC_ARC -} // __function +} // namespace __function template<class _Rp, class ..._ArgTypes> class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> @@ -1724,13 +1724,11 @@ public: // 20.7.16.2.3, function capacity: _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} -private: - // deleted overloads close possible hole in the type system template<class _R2> - bool operator==(const function<_R2()>&) const;// = delete; + bool operator==(const function<_R2()>&) const = delete; template<class _R2> - bool operator!=(const function<_R2()>&) const;// = delete; -public: + bool operator!=(const function<_R2()>&) const = delete; + // 20.7.16.2.4, function invocation: _Rp operator()() const; @@ -2004,13 +2002,11 @@ public: // 20.7.16.2.3, function capacity: _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} -private: - // deleted overloads close possible hole in the type system template<class _R2, class _B0> - bool operator==(const function<_R2(_B0)>&) const;// = delete; + bool operator==(const function<_R2(_B0)>&) const = delete; template<class _R2, class _B0> - bool operator!=(const function<_R2(_B0)>&) const;// = delete; -public: + bool operator!=(const function<_R2(_B0)>&) const = delete; + // 20.7.16.2.4, function invocation: _Rp operator()(_A0) const; @@ -2284,13 +2280,11 @@ public: // 20.7.16.2.3, function capacity: _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} -private: - // deleted overloads close possible hole in the type system template<class _R2, class _B0, class _B1> - bool operator==(const function<_R2(_B0, _B1)>&) const;// = delete; + bool operator==(const function<_R2(_B0, _B1)>&) const = delete; template<class _R2, class _B0, class _B1> - bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete; -public: + bool operator!=(const function<_R2(_B0, _B1)>&) const = delete; + // 20.7.16.2.4, function invocation: _Rp operator()(_A0, _A1) const; @@ -2563,13 +2557,11 @@ public: // 20.7.16.2.3, function capacity: _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __f_;} -private: - // deleted overloads close possible hole in the type system template<class _R2, class _B0, class _B1, class _B2> - bool operator==(const function<_R2(_B0, _B1, _B2)>&) const;// = delete; + bool operator==(const function<_R2(_B0, _B1, _B2)>&) const = delete; template<class _R2, class _B0, class _B1, class _B2> - bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete; -public: + bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const = delete; + // 20.7.16.2.4, function invocation: _Rp operator()(_A0, _A1, _A2) const; diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h index d764bd6f71..3054378f7e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/next.h @@ -79,4 +79,4 @@ inline constexpr auto next = __next_fn(__function_like::__tag()); _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___ITERATOR_PRIMITIVES_H +#endif // _LIBCPP___ITERATOR_NEXT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h index f7a948950d..d06859ee5f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/reverse_iterator.h @@ -11,6 +11,8 @@ #define _LIBCPP___ITERATOR_REVERSE_ITERATOR_H #include <__config> +#include <__compare/compare_three_way_result.h> +#include <__compare/three_way_comparable.h> #include <__iterator/iterator.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> @@ -193,6 +195,16 @@ operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& return __x.base() >= __y.base(); } +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS) +template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2> +_LIBCPP_HIDE_FROM_ABI constexpr +compare_three_way_result_t<_Iter1, _Iter2> +operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) +{ + return __y.base() <=> __x.base(); +} +#endif + #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h index 28872f9fa4..cfcc9857b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/wrap_iter.h @@ -40,120 +40,129 @@ public: private: iterator_type __i; public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT -#if _LIBCPP_STD_VER > 11 - : __i{} -#endif + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter() _NOEXCEPT + : __i() { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_i(this); #endif } - template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG + template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(const __wrap_iter<_Up>& __u, typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT : __i(__u.base()) { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) __get_db()->__iterator_copy(this, _VSTD::addressof(__u)); #endif } #if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(const __wrap_iter& __x) : __i(__x.base()) { + if (!__libcpp_is_constant_evaluated()) __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator=(const __wrap_iter& __x) { - if (this != _VSTD::addressof(__x)) + if (this != _VSTD::addressof(__x) && !__libcpp_is_constant_evaluated()) { __get_db()->__iterator_copy(this, _VSTD::addressof(__x)); __i = __x.__i; } return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__wrap_iter() { + if (!__libcpp_is_constant_evaluated()) __get_db()->__erase_i(this); } #endif - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator*() const _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable iterator"); #endif return *__i; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pointer operator->() const _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable iterator"); #endif return _VSTD::__to_address(__i); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator++() _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to increment a non-incrementable iterator"); #endif ++__i; return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator++(int) _NOEXCEPT {__wrap_iter __tmp(*this); ++(*this); return __tmp;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator--() _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), "Attempted to decrement a non-decrementable iterator"); #endif --__i; return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator--(int) _NOEXCEPT {__wrap_iter __tmp(*this); --(*this); return __tmp;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator+ (difference_type __n) const _NOEXCEPT {__wrap_iter __w(*this); __w += __n; return __w;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n), "Attempted to add/subtract an iterator outside its valid range"); #endif __i += __n; return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter operator- (difference_type __n) const _NOEXCEPT {return *this + (-__n);} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT {*this += -__n; return *this;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 reference operator[](difference_type __n) const _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n), "Attempted to subscript an iterator outside its valid range"); #endif return __i[__n]; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;} private: #if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(const void* __p, iterator_type __x) : __i(__x) { + if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_ic(this, __p); } #else - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} #endif template <class _Up> friend class __wrap_iter; @@ -163,24 +172,25 @@ private: }; template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { return __x.base() == __y.base(); } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return __x.base() == __y.base(); } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(_VSTD::addressof(__x), _VSTD::addressof(__y)), "Attempted to compare incomparable iterators"); #endif @@ -188,10 +198,11 @@ bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _ } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), "Attempted to compare incomparable iterators"); #endif @@ -199,63 +210,63 @@ bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _ } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { return !(__x == __y); } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__x == __y); } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { return __y < __x; } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return __y < __x; } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { return !(__x < __y); } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__x < __y); } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { return !(__y < __x); } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__y < __x); } template <class _Iter1, class _Iter2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 #ifndef _LIBCPP_CXX03_LANG auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT -> decltype(__x.base() - __y.base()) @@ -265,6 +276,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC #endif // C++03 { #if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(_VSTD::addressof(__x), _VSTD::addressof(__y)), "Attempted to subtract incompatible iterators"); #endif @@ -272,7 +284,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC } template <class _Iter1> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter<_Iter1> operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT { __x += __n; diff --git a/contrib/libs/cxxsupp/libcxx/include/__locale b/contrib/libs/cxxsupp/libcxx/include/__locale index 38cb7a6f39..6375933801 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__locale +++ b/contrib/libs/cxxsupp/libcxx/include/__locale @@ -208,9 +208,9 @@ class _LIBCPP_TYPE_VIS locale::id static int32_t __next_id; public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} -private: - void operator=(const id&); // = delete; - id(const id&); // = delete; + void operator=(const id&) = delete; + id(const id&) = delete; + public: // only needed for tests long __get(); diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h index c174994ddf..8bbcfe2063 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator.h @@ -89,7 +89,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT _LIBCPP_DEFAULT + allocator() _NOEXCEPT = default; template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 @@ -171,7 +171,7 @@ public: typedef true_type is_always_equal; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - allocator() _NOEXCEPT _LIBCPP_DEFAULT + allocator() _NOEXCEPT = default; template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h index cc32352ae1..f4c8fa02d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/allocator_traits.h @@ -349,14 +349,6 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits } }; -// A version of `allocator_traits` for internal usage that SFINAEs away if the -// given allocator doesn't have a nested `value_type`. This helps avoid hard -// errors when forming implicit deduction guides for a container that has an -// invalid Allocator type. See https://wg21.link/LWGXXXXX. -// TODO(varconst): use the actual link once available. -template <class _Alloc, class _ValueType = typename _Alloc::value_type> -struct _LIBCPP_TEMPLATE_VIS __allocator_traits : allocator_traits<_Alloc> {}; - template <class _Traits, class _Tp> struct __rebind_alloc_helper { #ifndef _LIBCPP_CXX03_LANG diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__memory/concepts.h new file mode 100644 index 0000000000..4029b590fe --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/concepts.h @@ -0,0 +1,66 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___MEMORY_CONCEPTS_H +#define _LIBCPP___MEMORY_CONCEPTS_H + +#include <__config> +#include <__iterator/concepts.h> +#include <__iterator/iterator_traits.h> +#include <__iterator/readable_traits.h> +#include <__ranges/access.h> +#include <__ranges/concepts.h> +#include <concepts> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if !defined(_LIBCPP_HAS_NO_RANGES) +namespace ranges { + +// [special.mem.concepts] + +// This concept ensures that uninitialized algorithms can construct an object +// at the address pointed-to by the iterator, which requires an lvalue. +template <class _Ip> +concept __nothrow_input_iterator = + input_iterator<_Ip> && + is_lvalue_reference_v<iter_reference_t<_Ip>> && + same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>; + +template <class _Sp, class _Ip> +concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>; + +template <class _Rp> +concept __nothrow_input_range = + range<_Rp> && + __nothrow_input_iterator<iterator_t<_Rp>> && + __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>; + +template <class _Ip> +concept __nothrow_forward_iterator = + __nothrow_input_iterator<_Ip> && + forward_iterator<_Ip> && + __nothrow_sentinel_for<_Ip, _Ip>; + +template <class _Rp> +concept __nothrow_forward_range = + __nothrow_input_range<_Rp> && + __nothrow_forward_iterator<iterator_t<_Rp>>; + +} // namespace ranges +#endif // !defined(_LIBCPP_HAS_NO_RANGES) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___MEMORY_CONCEPTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h index 7a0e4645fa..3aeff41733 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory/unique_ptr.h @@ -175,17 +175,17 @@ public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} + _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} + _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > _LIBCPP_INLINE_VISIBILITY - explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __default_init_tag()) {} + explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > @@ -227,7 +227,7 @@ public: typename enable_if<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, __nat>::type = __nat()) _NOEXCEPT - : __ptr_(__p.release(), __default_init_tag()) {} + : __ptr_(__p.release(), __value_init_tag()) {} #endif _LIBCPP_INLINE_VISIBILITY @@ -398,19 +398,19 @@ public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} + _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(pointer(), __default_init_tag()) {} + _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>, class = _EnableIfPointerConvertible<_Pp> > _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT - : __ptr_(__p, __default_init_tag()) {} + : __ptr_(__p, __value_init_tag()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, diff --git a/contrib/libs/cxxsupp/libcxx/include/__mutex_base b/contrib/libs/cxxsupp/libcxx/include/__mutex_base index da2967164a..21e2075603 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__mutex_base +++ b/contrib/libs/cxxsupp/libcxx/include/__mutex_base @@ -140,11 +140,9 @@ public: __m_->unlock(); } -private: - unique_lock(unique_lock const&); // = delete; - unique_lock& operator=(unique_lock const&); // = delete; + unique_lock(unique_lock const&) = delete; + unique_lock& operator=(unique_lock const&) = delete; -public: _LIBCPP_INLINE_VISIBILITY unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) diff --git a/contrib/libs/cxxsupp/libcxx/include/__nullptr b/contrib/libs/cxxsupp/libcxx/include/__nullptr index d02be215ef..c6645cd015 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__nullptr +++ b/contrib/libs/cxxsupp/libcxx/include/__nullptr @@ -54,7 +54,7 @@ _LIBCPP_END_NAMESPACE_STD namespace std { typedef decltype(nullptr) nullptr_t; -} +} // namespace std #endif // _LIBCPP_HAS_NO_NULLPTR diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/accumulate.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/accumulate.h new file mode 100644 index 0000000000..fcdad58df1 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/accumulate.h @@ -0,0 +1,52 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_ACCUMULATE_H +#define _LIBCPP___NUMERIC_ACCUMULATE_H + +#include <__config> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _InputIterator, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_Tp +accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) +{ + for (; __first != __last; ++__first) +#if _LIBCPP_STD_VER > 17 + __init = _VSTD::move(__init) + *__first; +#else + __init = __init + *__first; +#endif + return __init; +} + +template <class _InputIterator, class _Tp, class _BinaryOperation> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_Tp +accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) +{ + for (; __first != __last; ++__first) +#if _LIBCPP_STD_VER > 17 + __init = __binary_op(_VSTD::move(__init), *__first); +#else + __init = __binary_op(__init, *__first); +#endif + return __init; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_ACCUMULATE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/adjacent_difference.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/adjacent_difference.h new file mode 100644 index 0000000000..5c712ecdf7 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/adjacent_difference.h @@ -0,0 +1,72 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H +#define _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H + +#include <__config> +#include <__iterator/iterator_traits.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _InputIterator, class _OutputIterator> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + if (__first != __last) + { + typename iterator_traits<_InputIterator>::value_type __acc(*__first); + *__result = __acc; + for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) + { + typename iterator_traits<_InputIterator>::value_type __val(*__first); +#if _LIBCPP_STD_VER > 17 + *__result = __val - _VSTD::move(__acc); +#else + *__result = __val - __acc; +#endif + __acc = _VSTD::move(__val); + } + } + return __result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOperation> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, + _BinaryOperation __binary_op) +{ + if (__first != __last) + { + typename iterator_traits<_InputIterator>::value_type __acc(*__first); + *__result = __acc; + for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) + { + typename iterator_traits<_InputIterator>::value_type __val(*__first); +#if _LIBCPP_STD_VER > 17 + *__result = __binary_op(__val, _VSTD::move(__acc)); +#else + *__result = __binary_op(__val, __acc); +#endif + __acc = _VSTD::move(__val); + } + } + return __result; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_ADJACENT_DIFFERENCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/exclusive_scan.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/exclusive_scan.h new file mode 100644 index 0000000000..c0c89b3880 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/exclusive_scan.h @@ -0,0 +1,53 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H +#define _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H + +#include <__config> +#include <__functional/operations.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator +exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) { + if (__first != __last) { + _Tp __tmp(__b(__init, *__first)); + while (true) { + *__result = _VSTD::move(__init); + ++__result; + ++__first; + if (__first == __last) + break; + __init = _VSTD::move(__tmp); + __tmp = __b(__init, *__first); + } + } + return __result; +} + +template <class _InputIterator, class _OutputIterator, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator +exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) { + return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); +} + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_EXCLUSIVE_SCAN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h new file mode 100644 index 0000000000..34c0e533c9 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/gcd_lcm.h @@ -0,0 +1,96 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_GCD_LCM_H +#define _LIBCPP___NUMERIC_GCD_LCM_H + +#include <__config> +#include <__debug> +#include <limits> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs; + +template <typename _Result, typename _Source> +struct __ct_abs<_Result, _Source, true> { + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + _Result operator()(_Source __t) const noexcept + { + if (__t >= 0) return __t; + if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); + return -__t; + } +}; + +template <typename _Result, typename _Source> +struct __ct_abs<_Result, _Source, false> { + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + _Result operator()(_Source __t) const noexcept { return __t; } +}; + + +template<class _Tp> +_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN +_Tp __gcd(_Tp __m, _Tp __n) +{ + static_assert((!is_signed<_Tp>::value), ""); + return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n); +} + +template<class _Tp, class _Up> +_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY +common_type_t<_Tp,_Up> +gcd(_Tp __m, _Up __n) +{ + static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); + static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" ); + static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" ); + using _Rp = common_type_t<_Tp,_Up>; + using _Wp = make_unsigned_t<_Rp>; + return static_cast<_Rp>(_VSTD::__gcd( + static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), + static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n)))); +} + +template<class _Tp, class _Up> +_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY +common_type_t<_Tp,_Up> +lcm(_Tp __m, _Up __n) +{ + static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types"); + static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" ); + static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" ); + if (__m == 0 || __n == 0) + return 0; + + using _Rp = common_type_t<_Tp,_Up>; + _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); + _Rp __val2 = __ct_abs<_Rp, _Up>()(__n); + _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); + return __val1 * __val2; +} + +#endif // _LIBCPP_STD_VER + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___NUMERIC_GCD_LCM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/inclusive_scan.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/inclusive_scan.h new file mode 100644 index 0000000000..a6b0050758 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/inclusive_scan.h @@ -0,0 +1,60 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H +#define _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H + +#include <__config> +#include <__functional/operations.h> +#include <__iterator/iterator_traits.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator +inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) { + for (; __first != __last; ++__first, (void)++__result) { + __init = __b(__init, *__first); + *__result = __init; + } + return __result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator +inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) { + if (__first != __last) { + typename iterator_traits<_InputIterator>::value_type __init = *__first; + *__result++ = __init; + if (++__first != __last) + return _VSTD::inclusive_scan(__first, __last, __result, __b, __init); + } + + return __result; +} + +template <class _InputIterator, class _OutputIterator> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _OutputIterator inclusive_scan(_InputIterator __first, + _InputIterator __last, + _OutputIterator __result) { + return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>()); +} + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_INCLUSIVE_SCAN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/inner_product.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/inner_product.h new file mode 100644 index 0000000000..004acdde6a --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/inner_product.h @@ -0,0 +1,53 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_INNER_PRODUCT_H +#define _LIBCPP___NUMERIC_INNER_PRODUCT_H + +#include <__config> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _InputIterator1, class _InputIterator2, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_Tp +inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) +#if _LIBCPP_STD_VER > 17 + __init = _VSTD::move(__init) + *__first1 * *__first2; +#else + __init = __init + *__first1 * *__first2; +#endif + return __init; +} + +template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_Tp +inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, + _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) +#if _LIBCPP_STD_VER > 17 + __init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); +#else + __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); +#endif + return __init; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_INNER_PRODUCT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/iota.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/iota.h new file mode 100644 index 0000000000..b30e0e0a54 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/iota.h @@ -0,0 +1,32 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_IOTA_H +#define _LIBCPP___NUMERIC_IOTA_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _ForwardIterator, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +void +iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) +{ + for (; __first != __last; ++__first, (void) ++__value_) + *__first = __value_; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_IOTA_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h new file mode 100644 index 0000000000..668030c46b --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/midpoint.h @@ -0,0 +1,85 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_MIDPOINT_H +#define _LIBCPP___NUMERIC_MIDPOINT_H + +#include <__config> +#include <limits> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 17 +template <class _Tp> +_LIBCPP_INLINE_VISIBILITY constexpr +enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp> +midpoint(_Tp __a, _Tp __b) noexcept +_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +{ + using _Up = make_unsigned_t<_Tp>; + constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1; + + _Up __diff = _Up(__b) - _Up(__a); + _Up __sign_bit = __b < __a; + + _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff); + + return __a + __half_diff; +} + + +template <class _TPtr> +_LIBCPP_INLINE_VISIBILITY constexpr +enable_if_t<is_pointer_v<_TPtr> + && is_object_v<remove_pointer_t<_TPtr>> + && ! is_void_v<remove_pointer_t<_TPtr>> + && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr> +midpoint(_TPtr __a, _TPtr __b) noexcept +{ + return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a); +} + + +template <typename _Tp> +constexpr int __sign(_Tp __val) { + return (_Tp(0) < __val) - (__val < _Tp(0)); +} + +template <typename _Fp> +constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; } + +template <class _Fp> +_LIBCPP_INLINE_VISIBILITY constexpr +enable_if_t<is_floating_point_v<_Fp>, _Fp> +midpoint(_Fp __a, _Fp __b) noexcept +{ + constexpr _Fp __lo = numeric_limits<_Fp>::min()*2; + constexpr _Fp __hi = numeric_limits<_Fp>::max()/2; + return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible + (__a + __b)/2 : // always correctly rounded + __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a + __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b + __a/2 + __b/2; // otherwise correctly rounded +} + +#endif // _LIBCPP_STD_VER > 17 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___NUMERIC_MIDPOINT_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/partial_sum.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/partial_sum.h new file mode 100644 index 0000000000..9acee3afc2 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/partial_sum.h @@ -0,0 +1,70 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_PARTIAL_SUM_H +#define _LIBCPP___NUMERIC_PARTIAL_SUM_H + +#include <__config> +#include <__iterator/iterator_traits.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _InputIterator, class _OutputIterator> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +{ + if (__first != __last) + { + typename iterator_traits<_InputIterator>::value_type __t(*__first); + *__result = __t; + for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) + { +#if _LIBCPP_STD_VER > 17 + __t = _VSTD::move(__t) + *__first; +#else + __t = __t + *__first; +#endif + *__result = __t; + } + } + return __result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOperation> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, + _BinaryOperation __binary_op) +{ + if (__first != __last) + { + typename iterator_traits<_InputIterator>::value_type __t(*__first); + *__result = __t; + for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) + { +#if _LIBCPP_STD_VER > 17 + __t = __binary_op(_VSTD::move(__t), *__first); +#else + __t = __binary_op(__t, *__first); +#endif + *__result = __t; + } + } + return __result; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_PARTIAL_SUM_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h new file mode 100644 index 0000000000..90e4d238d8 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/reduce.h @@ -0,0 +1,47 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_REDUCE_H +#define _LIBCPP___NUMERIC_REDUCE_H + +#include <__config> +#include <__functional/operations.h> +#include <__iterator/iterator_traits.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 +template <class _InputIterator, class _Tp, class _BinaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp reduce(_InputIterator __first, _InputIterator __last, + _Tp __init, _BinaryOp __b) { + for (; __first != __last; ++__first) + __init = __b(__init, *__first); + return __init; +} + +template <class _InputIterator, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp reduce(_InputIterator __first, _InputIterator __last, + _Tp __init) { + return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>()); +} + +template <class _InputIterator> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename iterator_traits<_InputIterator>::value_type +reduce(_InputIterator __first, _InputIterator __last) { + return _VSTD::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{}); +} +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_exclusive_scan.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_exclusive_scan.h new file mode 100644 index 0000000000..45b3077f66 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_exclusive_scan.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H +#define _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _InputIterator, class _OutputIterator, class _Tp, + class _BinaryOp, class _UnaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +transform_exclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp __init, + _BinaryOp __b, _UnaryOp __u) +{ + if (__first != __last) + { + _Tp __saved = __init; + do + { + __init = __b(__init, __u(*__first)); + *__result = __saved; + __saved = __init; + ++__result; + } while (++__first != __last); + } + return __result; +} + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_inclusive_scan.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_inclusive_scan.h new file mode 100644 index 0000000000..b0d4ab5a88 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_inclusive_scan.h @@ -0,0 +1,58 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H +#define _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H + +#include <__config> +#include <__iterator/iterator_traits.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +transform_inclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) +{ + for (; __first != __last; ++__first, (void) ++__result) { + __init = __b(__init, __u(*__first)); + *__result = __init; + } + + return __result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +_OutputIterator +transform_inclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) +{ + if (__first != __last) { + typename iterator_traits<_InputIterator>::value_type __init = __u(*__first); + *__result++ = __init; + if (++__first != __last) + return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init); + } + + return __result; +} + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h new file mode 100644 index 0000000000..da5a77988c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__numeric/transform_reduce.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H +#define _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H + +#include <__config> +#include <__functional/operations.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 +template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator __first, + _InputIterator __last, _Tp __init, + _BinaryOp __b, _UnaryOp __u) { + for (; __first != __last; ++__first) + __init = __b(__init, __u(*__first)); + return __init; +} + +template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init, + _BinaryOp1 __b1, _BinaryOp2 __b2) { + for (; __first1 != __last1; ++__first1, (void)++__first2) + __init = __b1(__init, __b2(*__first1, *__first2)); + return __init; +} + +template <class _InputIterator1, class _InputIterator2, class _Tp> +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp transform_reduce(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init) { + return _VSTD::transform_reduce(__first1, __last1, __first2, _VSTD::move(__init), _VSTD::plus<>(), + _VSTD::multiplies<>()); +} +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/clamp_to_integral.h b/contrib/libs/cxxsupp/libcxx/include/__random/clamp_to_integral.h new file mode 100644 index 0000000000..dd5d2b0186 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__random/clamp_to_integral.h @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___RANDOM_CLAMP_TO_INTEGRAL_H +#define _LIBCPP___RANDOM_CLAMP_TO_INTEGRAL_H + +#include <__config> +#include <cmath> +#include <limits> +#include <type_traits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _IntT, class _FloatT, + bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits), + int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> +_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { + static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); + static_assert(is_integral<_IntT>::value, "must be an integral type"); + static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); + static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value + || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); + return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); +} + +// Convert a floating point number to the specified integral type after +// clamping to the integral type's representable range. +// +// The behavior is undefined if `__r` is NaN. +template <class _IntT, class _RealT> +_LIBCPP_INLINE_VISIBILITY +_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { + using _Lim = numeric_limits<_IntT>; + const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + return _Lim::max(); + } else if (__r <= _Lim::lowest()) { + return _Lim::min(); + } + return static_cast<_IntT>(__r); +} + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___RANDOM_CLAMP_TO_INTEGRAL_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/log2.h b/contrib/libs/cxxsupp/libcxx/include/__random/log2.h index f29b57949c..bfef9ec142 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/log2.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/log2.h @@ -12,6 +12,7 @@ #include <__config> #include <cstddef> #include <limits> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -19,30 +20,54 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class _UIntType, _UIntType _Xp, size_t _Rp> +struct __log2_imp; + template <unsigned long long _Xp, size_t _Rp> -struct __log2_imp +struct __log2_imp<unsigned long long, _Xp, _Rp> { static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp - : __log2_imp<_Xp, _Rp - 1>::value; + : __log2_imp<unsigned long long, _Xp, _Rp - 1>::value; }; template <unsigned long long _Xp> -struct __log2_imp<_Xp, 0> +struct __log2_imp<unsigned long long, _Xp, 0> { static const size_t value = 0; }; template <size_t _Rp> -struct __log2_imp<0, _Rp> +struct __log2_imp<unsigned long long, 0, _Rp> { static const size_t value = _Rp + 1; }; +#ifndef _LIBCPP_HAS_NO_INT128 + +template <__uint128_t _Xp, size_t _Rp> +struct __log2_imp<__uint128_t, _Xp, _Rp> +{ + static const size_t value = (_Xp >> 64) + ? (64 + __log2_imp<unsigned long long, (_Xp >> 64), 63>::value) + : __log2_imp<unsigned long long, _Xp, 63>::value; +}; + +#endif // _LIBCPP_HAS_NO_INT128 + template <class _UIntType, _UIntType _Xp> struct __log2 { - static const size_t value = __log2_imp<_Xp, - sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; + static const size_t value = __log2_imp< +#ifndef _LIBCPP_HAS_NO_INT128 + typename conditional< + sizeof(_UIntType) <= sizeof(unsigned long long), + unsigned long long, + __uint128_t + >::type, +#else + unsigned long long, +#endif // _LIBCPP_HAS_NO_INT128 + _Xp, sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; }; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/poisson_distribution.h b/contrib/libs/cxxsupp/libcxx/include/__random/poisson_distribution.h index fb213b0103..d157e8f230 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/poisson_distribution.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/poisson_distribution.h @@ -10,6 +10,7 @@ #define _LIBCPP___RANDOM_POISSON_DISTRIBUTION_H #include <__config> +#include <__random/clamp_to_integral.h> #include <__random/exponential_distribution.h> #include <__random/normal_distribution.h> #include <__random/uniform_real_distribution.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h index f62f7a3d26..6a6b0cc306 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/random_device.h @@ -56,10 +56,8 @@ public: // property functions double entropy() const _NOEXCEPT; -private: - // no copy functions - random_device(const random_device&); // = delete; - random_device& operator=(const random_device&); // = delete; + random_device(const random_device&) = delete; + void operator=(const random_device&) = delete; }; #endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h index 97bc88d0d4..bf27af6627 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/seed_seq.h @@ -63,10 +63,8 @@ public: void param(_OutputIterator __dest) const {_VSTD::copy(__v_.begin(), __v_.end(), __dest);} -private: - // no copy functions - seed_seq(const seed_seq&); // = delete; - void operator=(const seed_seq&); // = delete; + seed_seq(const seed_seq&) = delete; + void operator=(const seed_seq&) = delete; _LIBCPP_INLINE_VISIBILITY static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);} diff --git a/contrib/libs/cxxsupp/libcxx/include/__random/uniform_int_distribution.h b/contrib/libs/cxxsupp/libcxx/include/__random/uniform_int_distribution.h index 3f47d5f470..55b4761637 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__random/uniform_int_distribution.h +++ b/contrib/libs/cxxsupp/libcxx/include/__random/uniform_int_distribution.h @@ -12,6 +12,7 @@ #include <__bits> #include <__config> #include <__random/log2.h> +#include <bit> #include <cstddef> #include <cstdint> #include <iosfwd> @@ -154,7 +155,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) return _Sp; } -template<class _IntType = int> +template<class _IntType = int> // __int128_t is also supported as an extension here class uniform_int_distribution { public: @@ -229,8 +230,8 @@ typename uniform_int_distribution<_IntType>::result_type uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { - typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), - uint32_t, uint64_t>::type _UIntType; + typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), uint32_t, + typename make_unsigned<result_type>::type>::type _UIntType; const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); if (_Rp == 1) return __p.a(); @@ -238,7 +239,7 @@ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK typedef __independent_bits_engine<_URNG, _UIntType> _Eng; if (_Rp == 0) return static_cast<result_type>(_Eng(__g, _Dt)()); - size_t __w = _Dt - __libcpp_clz(_Rp) - 1; + size_t __w = _Dt - __countl_zero(_Rp) - 1; if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) ++__w; _Eng __e(__g, __w); diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h index d292bcbb18..cb97840924 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/counted.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___RANGES_COUNTED_H #define _LIBCPP___RANGES_COUNTED_H +#include <__concepts/convertible_to.h> #include <__config> #include <__iterator/concepts.h> #include <__iterator/counted_iterator.h> @@ -16,10 +17,7 @@ #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> -#include <__ranges/concepts.h> #include <__ranges/subrange.h> -#include <__utility/decay_copy.h> -#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> #include <span> @@ -36,50 +34,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges::views { namespace __counted { - template<class _From, class _To> - concept __explicitly_convertible = requires { - _To(_From{}); - }; struct __fn { - template<class _Iter, class _Diff> - requires contiguous_iterator<decay_t<_Iter>> && - __explicitly_convertible<_Diff, iter_difference_t<_Iter>> + template<contiguous_iterator _It> _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Iter&& __it, _Diff __c) const - noexcept(noexcept( - span(_VSTD::to_address(__it), static_cast<iter_difference_t<_Iter>>(__c)) - )) - { - return span(_VSTD::to_address(__it), static_cast<iter_difference_t<_Iter>>(__c)); - } - - template<class _Iter, class _Diff> - requires random_access_iterator<decay_t<_Iter>> && - __explicitly_convertible<_Diff, iter_difference_t<_Iter>> + static constexpr auto __go(_It __it, iter_difference_t<_It> __count) + noexcept(noexcept(span(_VSTD::to_address(__it), static_cast<size_t>(__count)))) + // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly + { return span(_VSTD::to_address(__it), static_cast<size_t>(__count)); } + + template<random_access_iterator _It> _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Iter&& __it, _Diff __c) const - noexcept( - noexcept(__it + static_cast<iter_difference_t<_Iter>>(__c)) && - noexcept(ranges::subrange(_VSTD::forward<_Iter>(__it), _VSTD::__decay_copy(__it))) - ) - { - auto __last = __it + static_cast<iter_difference_t<_Iter>>(__c); - return ranges::subrange(_VSTD::forward<_Iter>(__it), _VSTD::move(__last)); - } - - template<class _Iter, class _Diff> - requires __explicitly_convertible<_Diff, iter_difference_t<_Iter>> + static constexpr auto __go(_It __it, iter_difference_t<_It> __count) + noexcept(noexcept(subrange(__it, __it + __count))) + -> decltype( subrange(__it, __it + __count)) + { return subrange(__it, __it + __count); } + + template<class _It> _LIBCPP_HIDE_FROM_ABI - constexpr auto operator()(_Iter&& __it, _Diff __c) const - noexcept(noexcept( - ranges::subrange(counted_iterator(_VSTD::forward<_Iter>(__it), __c), default_sentinel) - )) - { - return ranges::subrange(counted_iterator(_VSTD::forward<_Iter>(__it), __c), default_sentinel); - } + static constexpr auto __go(_It __it, iter_difference_t<_It> __count) + noexcept(noexcept(subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel))) + -> decltype( subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel)) + { return subrange(counted_iterator(_VSTD::move(__it), __count), default_sentinel); } + + template<class _It, convertible_to<iter_difference_t<_It>> _Diff> + requires input_or_output_iterator<decay_t<_It>> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI + constexpr auto operator()(_It&& __it, _Diff&& __count) const + noexcept(noexcept(__go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count)))) + -> decltype( __go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count))) + { return __go(_VSTD::forward<_It>(__it), _VSTD::forward<_Diff>(__count)); } }; -} + +} // namespace __counted inline namespace __cpo { inline constexpr auto counted = __counted::__fn{}; diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h index af4e276006..8e984f2bf0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/subrange.h @@ -91,14 +91,14 @@ namespace ranges { _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent) requires _MustProvideSizeAtConstruction - : __begin_(_VSTD::move(__iter)), __end_(std::move(__sent)) + : __begin_(_VSTD::move(__iter)), __end_(_VSTD::move(__sent)) { } _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t<iter_difference_t<_Iter>> __n) requires (_Kind == subrange_kind::sized) - : __begin_(_VSTD::move(__iter)), __end_(std::move(__sent)), __size_(__n) + : __begin_(_VSTD::move(__iter)), __end_(_VSTD::move(__sent)), __size_(__n) { if constexpr (sized_sentinel_for<_Sent, _Iter>) _LIBCPP_ASSERT((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n), diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h index 208a9a2269..0f53fbaa7e 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/transform_view.h @@ -46,11 +46,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { +template<class _Fn, class _View> +concept __regular_invocable_with_range_ref = + regular_invocable<_Fn, range_reference_t<_View>>; + template<class _View, class _Fn> concept __transform_view_constraints = - view<_View> && is_object_v<_Fn> && - regular_invocable<_Fn&, range_reference_t<_View>> && - __referenceable<invoke_result_t<_Fn&, range_reference_t<_View>>>; + view<_View> && is_object_v<_Fn> && + regular_invocable<_Fn&, range_reference_t<_View>> && + __referenceable<invoke_result_t<_Fn&, range_reference_t<_View>>>; template<input_range _View, copy_constructible _Fn> requires __transform_view_constraints<_View, _Fn> @@ -82,7 +86,7 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const requires range<const _View> && - regular_invocable<const _Fn&, range_reference_t<const _View>> + __regular_invocable_with_range_ref<const _Fn&, const _View> { return __iterator<true>(*this, ranges::begin(__base_)); } @@ -100,14 +104,14 @@ public: _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const requires range<const _View> && - regular_invocable<const _Fn&, range_reference_t<const _View>> + __regular_invocable_with_range_ref<const _Fn&, const _View> { return __sentinel<true>(ranges::end(__base_)); } _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const requires common_range<const _View> && - regular_invocable<const _Fn&, range_reference_t<const _View>> + __regular_invocable_with_range_ref<const _Fn&, const _View> { return __iterator<true>(*this, ranges::end(__base_)); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__string b/contrib/libs/cxxsupp/libcxx/include/__string index 50f6f5e475..6b7d50b1ed 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__string +++ b/contrib/libs/cxxsupp/libcxx/include/__string @@ -42,9 +42,6 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -// The the extern template ABI lists are kept outside of <string> to improve the -// readability of that header. - // The extern template ABI lists are kept outside of <string> to improve the // readability of that header. We maintain 2 ABI lists: // - _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST diff --git a/contrib/libs/cxxsupp/libcxx/include/__threading_support b/contrib/libs/cxxsupp/libcxx/include/__threading_support index 9f70ad18b4..54d99e36b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__threading_support +++ b/contrib/libs/cxxsupp/libcxx/include/__threading_support @@ -298,7 +298,7 @@ inline __libcpp_timespec_t __convert_to_timespec(const chrono::nanoseconds& __ns return __ts; } -} +} // namespace __thread_detail #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) @@ -645,7 +645,7 @@ namespace this_thread _LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; -} // this_thread +} // namespace this_thread template<> struct hash<__thread_id>; @@ -715,7 +715,7 @@ get_id() _NOEXCEPT return __libcpp_thread_get_current_id(); } -} // this_thread +} // namespace this_thread #endif // !_LIBCPP_HAS_NO_THREADS diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h index c94b8fddaf..d59e96d72d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h @@ -55,7 +55,7 @@ operator>=(const _Tp& __x, const _Tp& __y) return !(__x < __y); } -} // rel_ops +} // namespace rel_ops _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/atomic b/contrib/libs/cxxsupp/libcxx/include/atomic index 188b36c69f..da3bfb03aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/atomic +++ b/contrib/libs/cxxsupp/libcxx/include/atomic @@ -1464,7 +1464,7 @@ struct __cxx_atomic_impl : public _Base { static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type"); - _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT _LIBCPP_DEFAULT + _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT = default; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp value) _NOEXCEPT : _Base(value) {} }; @@ -1665,7 +1665,7 @@ struct __atomic_base // false __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} #else _LIBCPP_INLINE_VISIBILITY - __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT + __atomic_base() _NOEXCEPT = default; #endif _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR @@ -1701,7 +1701,7 @@ struct __atomic_base<_Tp, true> typedef __atomic_base<_Tp, false> __base; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - __atomic_base() _NOEXCEPT _LIBCPP_DEFAULT + __atomic_base() _NOEXCEPT = default; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} @@ -1790,7 +1790,7 @@ struct atomic atomic() = default; #else _LIBCPP_INLINE_VISIBILITY - atomic() _NOEXCEPT _LIBCPP_DEFAULT + atomic() _NOEXCEPT = default; #endif _LIBCPP_INLINE_VISIBILITY @@ -1818,7 +1818,7 @@ struct atomic<_Tp*> typedef ptrdiff_t difference_type; _LIBCPP_INLINE_VISIBILITY - atomic() _NOEXCEPT _LIBCPP_DEFAULT + atomic() _NOEXCEPT = default; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} @@ -2460,7 +2460,7 @@ typedef struct atomic_flag atomic_flag() _NOEXCEPT : __a_(false) {} #else _LIBCPP_INLINE_VISIBILITY - atomic_flag() _NOEXCEPT _LIBCPP_DEFAULT + atomic_flag() _NOEXCEPT = default; #endif _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR diff --git a/contrib/libs/cxxsupp/libcxx/include/charconv b/contrib/libs/cxxsupp/libcxx/include/charconv index 3c969dc79a..ff7b75c8d7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/charconv +++ b/contrib/libs/cxxsupp/libcxx/include/charconv @@ -105,7 +105,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace __itoa { _LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer) _NOEXCEPT; _LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer) _NOEXCEPT; -} +} // namespace __itoa #ifndef _LIBCPP_CXX03_LANG diff --git a/contrib/libs/cxxsupp/libcxx/include/chrono b/contrib/libs/cxxsupp/libcxx/include/chrono index b133a6b460..a10a80ab91 100644 --- a/contrib/libs/cxxsupp/libcxx/include/chrono +++ b/contrib/libs/cxxsupp/libcxx/include/chrono @@ -743,7 +743,7 @@ struct __is_duration<volatile duration<_Rep, _Period> > : true_type {}; template <class _Rep, class _Period> struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {}; -} // chrono +} // namespace chrono template <class _Rep1, class _Period1, class _Rep2, class _Period2> struct _LIBCPP_TEMPLATE_VIS common_type<chrono::duration<_Rep1, _Period1>, @@ -1270,7 +1270,7 @@ public: _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() _NOEXCEPT {return time_point(duration::max());} }; -} // chrono +} // namespace chrono template <class _Clock, class _Duration1, class _Duration2> struct _LIBCPP_TEMPLATE_VIS common_type<chrono::time_point<_Clock, _Duration1>, @@ -2706,7 +2706,7 @@ constexpr hours make24(const hours& __h, bool __is_pm) noexcept } #endif // _LIBCPP_STD_VER > 17 -} // chrono +} // namespace chrono #if _LIBCPP_STD_VER > 11 // Suffixes for duration literals [time.duration.literals] @@ -2791,11 +2791,12 @@ inline namespace literals return chrono::year(static_cast<int>(__y)); } #endif -}} +} // namespace chrono_literals +} // namespace literals namespace chrono { // hoist the literals into namespace std::chrono using namespace literals::chrono_literals; -} +} // namespace chrono #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/cmath b/contrib/libs/cxxsupp/libcxx/include/cmath index 5ad779ec00..2bae24877d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/cmath +++ b/contrib/libs/cxxsupp/libcxx/include/cmath @@ -638,36 +638,6 @@ lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __ler #endif // _LIBCPP_STD_VER > 17 -template <class _IntT, class _FloatT, - bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits), - int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> -_LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { - static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); - static_assert(is_integral<_IntT>::value, "must be an integral type"); - static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); - static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value - || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); - return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); -} - -// Convert a floating point number to the specified integral type after -// clamping to the integral types representable range. -// -// The behavior is undefined if `__r` is NaN. -template <class _IntT, class _RealT> -_LIBCPP_INLINE_VISIBILITY -_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { - using _Lim = numeric_limits<_IntT>; - const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>(); - if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { - return _Lim::max(); - } else if (__r <= _Lim::lowest()) { - return _Lim::min(); - } - return static_cast<_IntT>(__r); -} - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/compare b/contrib/libs/cxxsupp/libcxx/include/compare index 5c4578da0b..5d07ebaf2f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/compare +++ b/contrib/libs/cxxsupp/libcxx/include/compare @@ -146,4 +146,8 @@ namespace std { #include <__compare/weak_order.h> #include <__config> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #endif // _LIBCPP_COMPARE diff --git a/contrib/libs/cxxsupp/libcxx/include/complex b/contrib/libs/cxxsupp/libcxx/include/complex index 7c9a5b94fa..3c59754da5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/complex +++ b/contrib/libs/cxxsupp/libcxx/include/complex @@ -1487,8 +1487,8 @@ inline namespace literals return { 0.0f, static_cast<float>(__im) }; } #endif - } -} + } // namespace complex_literals +} // namespace literals #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque index c6619d3b77..1f8d301260 100644 --- a/contrib/libs/cxxsupp/libcxx/include/deque +++ b/contrib/libs/cxxsupp/libcxx/include/deque @@ -917,16 +917,16 @@ class __deque_base __deque_base(const __deque_base& __c); __deque_base& operator=(const __deque_base& __c); public: - typedef _Allocator allocator_type; - typedef allocator_traits<allocator_type> __alloc_traits; - typedef typename __alloc_traits::size_type size_type; + typedef _Allocator allocator_type; + typedef allocator_traits<allocator_type> __alloc_traits; + typedef typename __alloc_traits::size_type size_type; - typedef _Tp value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename __alloc_traits::difference_type difference_type; - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; + typedef _Tp value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename __alloc_traits::difference_type difference_type; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; static const difference_type __block_size; @@ -1261,20 +1261,20 @@ public: static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); - typedef __deque_base<value_type, allocator_type> __base; + typedef __deque_base<value_type, allocator_type> __base; - typedef typename __base::__alloc_traits __alloc_traits; - typedef typename __base::reference reference; - typedef typename __base::const_reference const_reference; - typedef typename __base::iterator iterator; - typedef typename __base::const_iterator const_iterator; - typedef typename __allocator_traits<allocator_type>::size_type size_type; - typedef typename __base::difference_type difference_type; + typedef typename __base::__alloc_traits __alloc_traits; + typedef typename __base::reference reference; + typedef typename __base::const_reference const_reference; + typedef typename __base::iterator iterator; + typedef typename __base::const_iterator const_iterator; + typedef typename __base::size_type size_type; + typedef typename __base::difference_type difference_type; - typedef typename __base::pointer pointer; - typedef typename __base::const_pointer const_pointer; - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + typedef typename __base::pointer pointer; + typedef typename __base::const_pointer const_pointer; + typedef _VSTD::reverse_iterator<iterator> reverse_iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; using typename __base::__deque_range; using typename __base::__deque_block_range; @@ -1291,7 +1291,14 @@ public: explicit deque(size_type __n, const _Allocator& __a); #endif deque(size_type __n, const value_type& __v); - deque(size_type __n, const value_type& __v, const allocator_type& __a); + + template <class = __enable_if_t<__is_allocator<_Allocator>::value> > + deque(size_type __n, const value_type& __v, const allocator_type& __a) : __base(__a) + { + if (__n > 0) + __append(__n, __v); + } + template <class _InputIter> deque(_InputIter __f, _InputIter __l, typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); @@ -1611,14 +1618,6 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) } template <class _Tp, class _Allocator> -deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const allocator_type& __a) - : __base(__a) -{ - if (__n > 0) - __append(__n, __v); -} - -template <class _Tp, class _Allocator> template <class _InputIter> deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type*) diff --git a/contrib/libs/cxxsupp/libcxx/include/exception b/contrib/libs/cxxsupp/libcxx/include/exception index f29147d935..5bcd5817e4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/exception +++ b/contrib/libs/cxxsupp/libcxx/include/exception @@ -303,6 +303,6 @@ rethrow_if_nested(const _Ep&, { } -} // std +} // namespace std #endif // _LIBCPP_EXCEPTION diff --git a/contrib/libs/cxxsupp/libcxx/include/execution b/contrib/libs/cxxsupp/libcxx/include/execution index f87bb77f93..58b8b4bf72 100644 --- a/contrib/libs/cxxsupp/libcxx/include/execution +++ b/contrib/libs/cxxsupp/libcxx/include/execution @@ -16,4 +16,8 @@ //# include <__pstl_execution> #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #endif // _LIBCPP_EXECUTION diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/__memory b/contrib/libs/cxxsupp/libcxx/include/experimental/__memory index b38b664b33..bd9bf95e59 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/__memory +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/__memory @@ -17,6 +17,10 @@ #include <__functional_base> #include <type_traits> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_LFTS template < diff --git a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator index 10c903832d..9da08a0cff 100644 --- a/contrib/libs/cxxsupp/libcxx/include/experimental/iterator +++ b/contrib/libs/cxxsupp/libcxx/include/experimental/iterator @@ -52,15 +52,18 @@ namespace std { */ -#include <experimental/__config> - -#if _LIBCPP_STD_VER > 11 - #include <__memory/addressof.h> #include <__utility/move.h> #include <__utility/forward.h> +#include <experimental/__config> #include <iterator> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER > 11 + _LIBCPP_BEGIN_NAMESPACE_LFTS template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>> @@ -111,6 +114,6 @@ make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) _LIBCPP_END_NAMESPACE_LFTS -#endif /* _LIBCPP_STD_VER > 11 */ +#endif // _LIBCPP_STD_VER > 11 #endif // _LIBCPP_EXPERIMENTAL_ITERATOR diff --git a/contrib/libs/cxxsupp/libcxx/include/ext/__hash b/contrib/libs/cxxsupp/libcxx/include/ext/__hash index 268577f3c9..2f998ee40a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ext/__hash +++ b/contrib/libs/cxxsupp/libcxx/include/ext/__hash @@ -129,6 +129,6 @@ template <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> return __c; } }; -} +} // namespace __gnu_cxx #endif // _LIBCPP_EXT_HASH diff --git a/contrib/libs/cxxsupp/libcxx/include/ext/hash_map b/contrib/libs/cxxsupp/libcxx/include/ext/hash_map index 6c757e2fba..d6ea26c2cf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ext/hash_map +++ b/contrib/libs/cxxsupp/libcxx/include/ext/hash_map @@ -979,6 +979,6 @@ operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, return !(__x == __y); } -} // __gnu_cxx +} // namespace __gnu_cxx #endif // _LIBCPP_HASH_MAP diff --git a/contrib/libs/cxxsupp/libcxx/include/ext/hash_set b/contrib/libs/cxxsupp/libcxx/include/ext/hash_set index b61f5f1da4..7d19ccd006 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ext/hash_set +++ b/contrib/libs/cxxsupp/libcxx/include/ext/hash_set @@ -205,6 +205,10 @@ template <class Value, class Hash, class Pred, class Alloc> #endif #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + namespace __gnu_cxx { @@ -654,6 +658,6 @@ operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x, return !(__x == __y); } -} // __gnu_cxx +} // namespace __gnu_cxx #endif // _LIBCPP_HASH_SET diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index 5333c2e63b..0fec8674a5 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -1039,7 +1039,7 @@ public: auto __p_root_name = __p.__root_name(); auto __p_root_name_size = __p_root_name.size(); if (__p.is_absolute() || - (!__p_root_name.empty() && __p_root_name != root_name())) { + (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) { __pn_ = __p.__pn_; return *this; } @@ -1498,22 +1498,22 @@ public: #endif // !_LIBCPP_HAS_NO_LOCALIZATION friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) == 0; + return __lhs.__compare(__rhs.__pn_) == 0; } friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) != 0; + return __lhs.__compare(__rhs.__pn_) != 0; } friend _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) < 0; + return __lhs.__compare(__rhs.__pn_) < 0; } friend _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) <= 0; + return __lhs.__compare(__rhs.__pn_) <= 0; } friend _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) > 0; + return __lhs.__compare(__rhs.__pn_) > 0; } friend _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs, const path& __rhs) noexcept { - return __lhs.compare(__rhs) >= 0; + return __lhs.__compare(__rhs.__pn_) >= 0; } friend _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs, @@ -3030,13 +3030,17 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM #if !defined(_LIBCPP_HAS_NO_RANGES) template <> +_LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_borrowed_range<_VSTD_FS::directory_iterator> = true; template <> +_LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_borrowed_range<_VSTD_FS::recursive_directory_iterator> = true; template <> +_LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::directory_iterator> = true; template <> +_LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::recursive_directory_iterator> = true; #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format index e1d47c9f84..788b9c299a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/format +++ b/contrib/libs/cxxsupp/libcxx/include/format @@ -51,9 +51,6 @@ namespace std { using wformat_args = basic_format_args<wformat_context>; - template<class Out, class charT> - using format_args_t = basic_format_args<basic_format_context<Out, charT>>; - // [format.functions], formatting functions template<class... Args> string format(string_view fmt, const Args&... args); @@ -79,17 +76,15 @@ namespace std { Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args); template<class Out> - Out vformat_to(Out out, string_view fmt, - format_args_t<type_identity_t<Out>, char> args); + Out vformat_to(Out out, string_view fmt, format_args args); template<class Out> - Out vformat_to(Out out, wstring_view fmt, - format_args_t<type_identity_t<Out>, wchar_t> args); + Out vformat_to(Out out, wstring_view fmt, wformat_args args); template<class Out> Out vformat_to(Out out, const locale& loc, string_view fmt, - format_args_t<type_identity_t<Out>, char> args); + format_args char> args); template<class Out> Out vformat_to(Out out, const locale& loc, wstring_view fmt, - format_args_t<type_identity_t<Out>, wchar_t> args); + wformat_args args); template<class Out> struct format_to_n_result { Out out; @@ -325,9 +320,6 @@ using format_args = basic_format_args<format_context>; using wformat_args = basic_format_args<wformat_context>; #endif -template <class _OutIt, class _CharT> -using format_args_t = basic_format_args<basic_format_context<_OutIt, _CharT>>; - template <class _Context, class... _Args> struct _LIBCPP_TEMPLATE_VIS __format_arg_store { // TODO FMT Use a built-in array. @@ -436,51 +428,55 @@ __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) { } // namespace __format -template <class _OutIt, class _CharT> +template <class _OutIt, class _CharT, class _FormatOutIt> requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt - __vformat_to(_OutIt __out_it, basic_string_view<_CharT> __fmt, - format_args_t<type_identity_t<_OutIt>, _CharT> __args) { - return __format::__vformat_to( - basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); + __vformat_to( + _OutIt __out_it, basic_string_view<_CharT> __fmt, + basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { + if constexpr (same_as<_OutIt, _FormatOutIt>) + return _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::move(__out_it), __args)); + else { + basic_string<_CharT> __str; + _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args)); + return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + } } template <output_iterator<const char&> _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, string_view __fmt, - format_args_t<type_identity_t<_OutIt>, char> __args) { +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, wstring_view __fmt, - format_args_t<type_identity_t<_OutIt>, wchar_t> __args) { +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #endif template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(_OutIt __out_it, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), __fmt, - _VSTD::make_format_args<basic_format_context<_OutIt, char>>(__args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, + _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to(_OutIt __out_it, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), __fmt, - _VSTD::make_format_args<basic_format_context<_OutIt, wchar_t>>( - __args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt, + _VSTD::make_wformat_args(__args...)); } #endif -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string vformat(string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); @@ -488,7 +484,7 @@ vformat(string_view __fmt, format_args __args) { } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring vformat(wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); @@ -497,14 +493,14 @@ vformat(wstring_view __fmt, wformat_args __args) { #endif template <class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(string_view __fmt, const _Args&... __args) { return _VSTD::vformat(__fmt, _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring format(wstring_view __fmt, const _Args&... __args) { return _VSTD::vformat(__fmt, _VSTD::make_wformat_args(__args...)); } @@ -556,54 +552,59 @@ formatted_size(wstring_view __fmt, const _Args&... __args) { #ifndef _LIBCPP_HAS_NO_LOCALIZATION -template <class _OutIt, class _CharT> +template <class _OutIt, class _CharT, class _FormatOutIt> requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt - __vformat_to(_OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, - format_args_t<type_identity_t<_OutIt>, _CharT> __args) { - return __format::__vformat_to( - basic_format_parse_context{__fmt, __args.__size()}, - _VSTD::__format_context_create(_VSTD::move(__out_it), __args, - _VSTD::move(__loc))); + __vformat_to( + _OutIt __out_it, locale __loc, basic_string_view<_CharT> __fmt, + basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) { + if constexpr (same_as<_OutIt, _FormatOutIt>) + return _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::move(__out_it), __args, + _VSTD::move(__loc))); + else { + basic_string<_CharT> __str; + _VSTD::__format::__vformat_to( + basic_format_parse_context{__fmt, __args.__size()}, + _VSTD::__format_context_create(_VSTD::back_inserter(__str), __args, + _VSTD::move(__loc))); + return _VSTD::copy_n(__str.begin(), __str.size(), _VSTD::move(__out_it)); + } } template <output_iterator<const char&> _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, - format_args_t<type_identity_t<_OutIt>, char> __args) { +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( + _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt -vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, - format_args_t<type_identity_t<_OutIt>, wchar_t> __args) { +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( + _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); } #endif template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( _OutIt __out_it, locale __loc, string_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), _VSTD::move(__loc), __fmt, - _VSTD::make_format_args<basic_format_context<_OutIt, char>>(__args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, + _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt format_to( _OutIt __out_it, locale __loc, wstring_view __fmt, const _Args&... __args) { - return _VSTD::vformat_to( - _VSTD::move(__out_it), _VSTD::move(__loc), __fmt, - _VSTD::make_format_args<basic_format_context<_OutIt, wchar_t>>( - __args...)); + return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, + _VSTD::make_wformat_args(__args...)); } #endif -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string vformat(locale __loc, string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, @@ -612,7 +613,7 @@ vformat(locale __loc, string_view __fmt, format_args __args) { } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring vformat(locale __loc, wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, @@ -622,7 +623,7 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) { #endif template <class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(locale __loc, string_view __fmt, const _Args&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt, _VSTD::make_format_args(__args...)); @@ -630,7 +631,7 @@ format(locale __loc, string_view __fmt, const _Args&... __args) { #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring format(locale __loc, wstring_view __fmt, const _Args&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt, _VSTD::make_wformat_args(__args...)); diff --git a/contrib/libs/cxxsupp/libcxx/include/forward_list b/contrib/libs/cxxsupp/libcxx/include/forward_list index 9d19e741f0..34168e8874 100644 --- a/contrib/libs/cxxsupp/libcxx/include/forward_list +++ b/contrib/libs/cxxsupp/libcxx/include/forward_list @@ -186,6 +186,7 @@ template <class T, class Allocator, class Predicate> #include <iterator> #include <limits> #include <memory> +#include <type_traits> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -643,12 +644,12 @@ public: static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits<allocator_type>::pointer pointer; - typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; - typedef typename __allocator_traits<allocator_type>::size_type size_type; - typedef typename allocator_traits<allocator_type>::difference_type difference_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename allocator_traits<allocator_type>::pointer pointer; + typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; + typedef typename allocator_traits<allocator_type>::size_type size_type; + typedef typename allocator_traits<allocator_type>::difference_type difference_type; typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; @@ -669,7 +670,13 @@ public: explicit forward_list(size_type __n, const allocator_type& __a); #endif forward_list(size_type __n, const value_type& __v); - forward_list(size_type __n, const value_type& __v, const allocator_type& __a); + + template <class = __enable_if_t<__is_allocator<_Alloc>::value> > + forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) + { + insert_after(cbefore_begin(), __n, __v); + } + template <class _InputIterator> forward_list(_InputIterator __f, _InputIterator __l, typename enable_if< @@ -944,14 +951,6 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) } template <class _Tp, class _Alloc> -forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v, - const allocator_type& __a) - : base(__a) -{ - insert_after(cbefore_begin(), __n, __v); -} - -template <class _Tp, class _Alloc> template <class _InputIterator> forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, typename enable_if< diff --git a/contrib/libs/cxxsupp/libcxx/include/initializer_list b/contrib/libs/cxxsupp/libcxx/include/initializer_list index ae8b2c5bd5..bf8b4330da 100644 --- a/contrib/libs/cxxsupp/libcxx/include/initializer_list +++ b/contrib/libs/cxxsupp/libcxx/include/initializer_list @@ -124,7 +124,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT #endif // !defined(_LIBCPP_CXX03_LANG) -} // std +} // namespace std #endif // _LIBCPP_COMPILER_MSVC diff --git a/contrib/libs/cxxsupp/libcxx/include/ios b/contrib/libs/cxxsupp/libcxx/include/ios index b7d32946bf..237d146dfb 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ios +++ b/contrib/libs/cxxsupp/libcxx/include/ios @@ -308,11 +308,9 @@ public: typedef void (*event_callback)(event, ios_base&, int __index); void register_callback(event_callback __fn, int __index); -private: - ios_base(const ios_base&); // = delete; - ios_base& operator=(const ios_base&); // = delete; + ios_base(const ios_base&) = delete; + ios_base& operator=(const ios_base&) = delete; -public: static bool sync_with_stdio(bool __sync = true); _LIBCPP_INLINE_VISIBILITY iostate rdstate() const; diff --git a/contrib/libs/cxxsupp/libcxx/include/istream b/contrib/libs/cxxsupp/libcxx/include/istream index 2f39e35f46..de49d49e45 100644 --- a/contrib/libs/cxxsupp/libcxx/include/istream +++ b/contrib/libs/cxxsupp/libcxx/include/istream @@ -291,15 +291,15 @@ class _LIBCPP_TEMPLATE_VIS basic_istream<_CharT, _Traits>::sentry { bool __ok_; - sentry(const sentry&); // = delete; - sentry& operator=(const sentry&); // = delete; - public: explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); // ~sentry() = default; _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __ok_;} + + sentry(const sentry&) = delete; + sentry& operator=(const sentry&) = delete; }; template <class _CharT, class _Traits> diff --git a/contrib/libs/cxxsupp/libcxx/include/list b/contrib/libs/cxxsupp/libcxx/include/list index 0b615a09ae..cb7ababdf4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/list +++ b/contrib/libs/cxxsupp/libcxx/include/list @@ -845,24 +845,24 @@ class _LIBCPP_TEMPLATE_VIS list typedef typename base::__link_pointer __link_pointer; public: - typedef _Tp value_type; - typedef _Alloc allocator_type; + typedef _Tp value_type; + typedef _Alloc allocator_type; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename base::pointer pointer; - typedef typename base::const_pointer const_pointer; - typedef typename __allocator_traits<allocator_type>::size_type size_type; - typedef typename base::difference_type difference_type; - typedef typename base::iterator iterator; - typedef typename base::const_iterator const_iterator; - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename base::pointer pointer; + typedef typename base::const_pointer const_pointer; + typedef typename base::size_type size_type; + typedef typename base::difference_type difference_type; + typedef typename base::iterator iterator; + typedef typename base::const_iterator const_iterator; + typedef _VSTD::reverse_iterator<iterator> reverse_iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; #if _LIBCPP_STD_VER > 17 - typedef size_type __remove_return_type; + typedef size_type __remove_return_type; #else - typedef void __remove_return_type; + typedef void __remove_return_type; #endif _LIBCPP_INLINE_VISIBILITY @@ -885,7 +885,16 @@ public: explicit list(size_type __n, const allocator_type& __a); #endif list(size_type __n, const value_type& __x); - list(size_type __n, const value_type& __x, const allocator_type& __a); + template <class = __enable_if_t<__is_allocator<_Alloc>::value> > + list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) + { +#if _LIBCPP_DEBUG_LEVEL == 2 + __get_db()->__insert_c(this); +#endif + for (; __n > 0; --__n) + push_back(__x); + } + template <class _InpIter> list(_InpIter __f, _InpIter __l, typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); @@ -1242,17 +1251,6 @@ list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) } template <class _Tp, class _Alloc> -list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a) - : base(__a) -{ -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - for (; __n > 0; --__n) - push_back(__x); -} - -template <class _Tp, class _Alloc> template <class _InpIter> list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*) diff --git a/contrib/libs/cxxsupp/libcxx/include/memory b/contrib/libs/cxxsupp/libcxx/include/memory index e089462135..9b3e294467 100644 --- a/contrib/libs/cxxsupp/libcxx/include/memory +++ b/contrib/libs/cxxsupp/libcxx/include/memory @@ -669,6 +669,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include <__memory/allocator_arg_t.h> #include <__memory/allocator_traits.h> #include <__memory/compressed_pair.h> +#include <__memory/concepts.h> #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> #include <__memory/raw_storage_iterator.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 71acf7a6ef..ae1d2aeba9 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -353,9 +353,9 @@ module std [system] { export * module __charconv { - module chars_format { private header "__charconv/chars_format.h" } + module chars_format { private header "__charconv/chars_format.h" } module from_chars_result { private header "__charconv/from_chars_result.h" } - module to_chars_result { private header "__charconv/to_chars_result.h" } + module to_chars_result { private header "__charconv/to_chars_result.h" } } } @@ -373,15 +373,15 @@ module std [system] { module __compare { module common_comparison_category { private header "__compare/common_comparison_category.h" } - module compare_three_way { private header "__compare/compare_three_way.h" } - module compare_three_way_result { private header "__compare/compare_three_way_result.h" } - module is_eq { private header "__compare/is_eq.h" } - module ordering { private header "__compare/ordering.h" } - module partial_order { private header "__compare/partial_order.h" } - module strong_order { private header "__compare/strong_order.h" } - module synth_three_way { private header "__compare/synth_three_way.h" } - module three_way_comparable { private header "__compare/three_way_comparable.h" } - module weak_order { private header "__compare/weak_order.h" } + module compare_three_way { private header "__compare/compare_three_way.h" } + module compare_three_way_result { private header "__compare/compare_three_way_result.h" } + module is_eq { private header "__compare/is_eq.h" } + module ordering { private header "__compare/ordering.h" } + module partial_order { private header "__compare/partial_order.h" } + module strong_order { private header "__compare/strong_order.h" } + module synth_three_way { private header "__compare/synth_three_way.h" } + module three_way_comparable { private header "__compare/three_way_comparable.h" } + module weak_order { private header "__compare/weak_order.h" } } } module complex { @@ -393,28 +393,28 @@ module std [system] { export * module __concepts { - module arithmetic { private header "__concepts/arithmetic.h" } - module assignable { private header "__concepts/assignable.h" } - module boolean_testable { private header "__concepts/boolean_testable.h" } - module class_or_enum { private header "__concepts/class_or_enum.h" } - module common_reference_with { private header "__concepts/common_reference_with.h" } - module common_with { private header "__concepts/common_with.h" } - module constructible { private header "__concepts/constructible.h" } - module convertible_to { private header "__concepts/convertible_to.h" } - module copyable { private header "__concepts/copyable.h" } - module derived_from { private header "__concepts/derived_from.h" } - module destructible { private header "__concepts/destructible.h" } - module different_from { private header "__concepts/different_from.h" } - module equality_comparable { private header "__concepts/equality_comparable.h" } - module invocable { private header "__concepts/invocable.h" } - module movable { private header "__concepts/movable.h" } - module predicate { private header "__concepts/predicate.h" } - module regular { private header "__concepts/regular.h" } - module relation { private header "__concepts/relation.h" } - module same_as { private header "__concepts/same_as.h" } - module semiregular { private header "__concepts/semiregular.h" } - module swappable { private header "__concepts/swappable.h" } - module totally_ordered { private header "__concepts/totally_ordered.h" } + module arithmetic { private header "__concepts/arithmetic.h" } + module assignable { private header "__concepts/assignable.h" } + module boolean_testable { private header "__concepts/boolean_testable.h" } + module class_or_enum { private header "__concepts/class_or_enum.h" } + module common_reference_with { private header "__concepts/common_reference_with.h" } + module common_with { private header "__concepts/common_with.h" } + module constructible { private header "__concepts/constructible.h" } + module convertible_to { private header "__concepts/convertible_to.h" } + module copyable { private header "__concepts/copyable.h" } + module derived_from { private header "__concepts/derived_from.h" } + module destructible { private header "__concepts/destructible.h" } + module different_from { private header "__concepts/different_from.h" } + module equality_comparable { private header "__concepts/equality_comparable.h" } + module invocable { private header "__concepts/invocable.h" } + module movable { private header "__concepts/movable.h" } + module predicate { private header "__concepts/predicate.h" } + module regular { private header "__concepts/regular.h" } + module relation { private header "__concepts/relation.h" } + module same_as { private header "__concepts/same_as.h" } + module semiregular { private header "__concepts/semiregular.h" } + module swappable { private header "__concepts/swappable.h" } + module totally_ordered { private header "__concepts/totally_ordered.h" } } } module condition_variable { @@ -428,10 +428,10 @@ module std [system] { export * module __coroutine { - module coroutine_handle { private header "__coroutine/coroutine_handle.h" } - module coroutine_traits { private header "__coroutine/coroutine_traits.h" } - module trivial_awaitables { private header "__coroutine/trivial_awaitables.h" } - module noop_coroutine_handle { private header "__coroutine/noop_coroutine_handle.h" } + module coroutine_handle { private header "__coroutine/coroutine_handle.h" } + module coroutine_traits { private header "__coroutine/coroutine_traits.h" } + module trivial_awaitables { private header "__coroutine/trivial_awaitables.h" } + module noop_coroutine_handle { private header "__coroutine/noop_coroutine_handle.h" } } } module deque { @@ -456,24 +456,24 @@ module std [system] { export * module __format { - module format_arg { private header "__format/format_arg.h" } - module format_args { private header "__format/format_args.h" } + module format_arg { private header "__format/format_arg.h" } + module format_args { private header "__format/format_args.h" } module format_context { private header "__format/format_context.h" export optional export locale } - module format_error { private header "__format/format_error.h" } - module format_fwd { private header "__format/format_fwd.h" } - module format_parse_context { private header "__format/format_parse_context.h" } - module format_string { private header "__format/format_string.h" } - module format_to_n_result { private header "__format/format_to_n_result.h" } - module formatter { private header "__format/formatter.h" } - module formatter_bool { private header "__format/formatter_bool.h" } - module formatter_char { private header "__format/formatter_char.h" } - module formatter_integer { private header "__format/formatter_integer.h" } - module formatter_integral { private header "__format/formatter_integral.h" } - module formatter_string { private header "__format/formatter_string.h" } + module format_error { private header "__format/format_error.h" } + module format_fwd { private header "__format/format_fwd.h" } + module format_parse_context { private header "__format/format_parse_context.h" } + module format_string { private header "__format/format_string.h" } + module format_to_n_result { private header "__format/format_to_n_result.h" } + module formatter { private header "__format/formatter.h" } + module formatter_bool { private header "__format/formatter_bool.h" } + module formatter_char { private header "__format/formatter_char.h" } + module formatter_integer { private header "__format/formatter_integer.h" } + module formatter_integral { private header "__format/formatter_integral.h" } + module formatter_string { private header "__format/formatter_string.h" } module parser_std_format_spec { private header "__format/parser_std_format_spec.h" } } } @@ -505,8 +505,8 @@ module std [system] { module identity { private header "__functional/identity.h" } module invoke { private header "__functional/invoke.h" } module is_transparent { private header "__functional/is_transparent.h" } - module mem_fn { private header "__functional/mem_fn.h" } - module mem_fun_ref { private header "__functional/mem_fun_ref.h" } + module mem_fn { private header "__functional/mem_fn.h" } + module mem_fun_ref { private header "__functional/mem_fun_ref.h" } module not_fn { private header "__functional/not_fn.h" } module operations { private header "__functional/operations.h" } module perfect_forward { private header "__functional/perfect_forward.h" } @@ -630,21 +630,22 @@ module std [system] { export * module __memory { - module addressof { private header "__memory/addressof.h" } - module allocation_guard { private header "__memory/allocation_guard.h" } - module allocator { private header "__memory/allocator.h" } - module allocator_arg_t { private header "__memory/allocator_arg_t.h" } - module allocator_traits { private header "__memory/allocator_traits.h" } - module auto_ptr { private header "__memory/auto_ptr.h" } - module compressed_pair { private header "__memory/compressed_pair.h" } - module construct_at { private header "__memory/construct_at.h" } - module pointer_traits { private header "__memory/pointer_traits.h" } - module raw_storage_iterator { private header "__memory/raw_storage_iterator.h" } - module shared_ptr { private header "__memory/shared_ptr.h" } - module temporary_buffer { private header "__memory/temporary_buffer.h" } + module addressof { private header "__memory/addressof.h" } + module allocation_guard { private header "__memory/allocation_guard.h" } + module allocator { private header "__memory/allocator.h" } + module allocator_arg_t { private header "__memory/allocator_arg_t.h" } + module allocator_traits { private header "__memory/allocator_traits.h" } + module auto_ptr { private header "__memory/auto_ptr.h" } + module compressed_pair { private header "__memory/compressed_pair.h" } + module concepts { private header "__memory/concepts.h" } + module construct_at { private header "__memory/construct_at.h" } + module pointer_traits { private header "__memory/pointer_traits.h" } + module raw_storage_iterator { private header "__memory/raw_storage_iterator.h" } + module shared_ptr { private header "__memory/shared_ptr.h" } + module temporary_buffer { private header "__memory/temporary_buffer.h" } module uninitialized_algorithms { private header "__memory/uninitialized_algorithms.h" } - module unique_ptr { private header "__memory/unique_ptr.h" } - module uses_allocator { private header "__memory/uses_allocator.h" } + module unique_ptr { private header "__memory/unique_ptr.h" } + module uses_allocator { private header "__memory/uses_allocator.h" } } } module mutex { @@ -662,6 +663,22 @@ module std [system] { module numeric { header "numeric" export * + + module __numeric { + module accumulate { private header "__numeric/accumulate.h" } + module adjacent_difference { private header "__numeric/adjacent_difference.h" } + module exclusive_scan { private header "__numeric/exclusive_scan.h" } + module gcd_lcm { private header "__numeric/gcd_lcm.h" } + module inclusive_scan { private header "__numeric/inclusive_scan.h" } + module inner_product { private header "__numeric/inner_product.h" } + module iota { private header "__numeric/iota.h" } + module midpoint { private header "__numeric/midpoint.h" } + module partial_sum { private header "__numeric/partial_sum.h" } + module reduce { private header "__numeric/reduce.h" } + module transform_exclusive_scan { private header "__numeric/transform_exclusive_scan.h" } + module transform_inclusive_scan { private header "__numeric/transform_inclusive_scan.h" } + module transform_reduce { private header "__numeric/transform_reduce.h" } + } } module optional { header "optional" @@ -683,41 +700,42 @@ module std [system] { export * module __random { - module bernoulli_distribution { private header "__random/bernoulli_distribution.h" } - module binomial_distribution { private header "__random/binomial_distribution.h" } - module cauchy_distribution { private header "__random/cauchy_distribution.h" } - module chi_squared_distribution { private header "__random/chi_squared_distribution.h" } - module default_random_engine { private header "__random/default_random_engine.h" } - module discard_block_engine { private header "__random/discard_block_engine.h" } - module discrete_distribution { private header "__random/discrete_distribution.h" } - module exponential_distribution { private header "__random/exponential_distribution.h" } - module extreme_value_distribution { private header "__random/extreme_value_distribution.h" } - module fisher_f_distribution { private header "__random/fisher_f_distribution.h" } - module gamma_distribution { private header "__random/gamma_distribution.h" } - module generate_canonical { private header "__random/generate_canonical.h" } - module geometric_distribution { private header "__random/geometric_distribution.h" } - module independent_bits_engine { private header "__random/independent_bits_engine.h" } - module is_seed_sequence { private header "__random/is_seed_sequence.h" } - module knuth_b { private header "__random/knuth_b.h" } - module linear_congruential_engine { private header "__random/linear_congruential_engine.h" } - module log2 { private header "__random/log2.h" } - module lognormal_distribution { private header "__random/lognormal_distribution.h" } - module mersenne_twister_engine { private header "__random/mersenne_twister_engine.h" } - module negative_binomial_distribution { private header "__random/negative_binomial_distribution.h" } - module normal_distribution { private header "__random/normal_distribution.h" } + module bernoulli_distribution { private header "__random/bernoulli_distribution.h" } + module binomial_distribution { private header "__random/binomial_distribution.h" } + module cauchy_distribution { private header "__random/cauchy_distribution.h" } + module chi_squared_distribution { private header "__random/chi_squared_distribution.h" } + module clamp_to_integral { private header "__random/clamp_to_integral.h" } + module default_random_engine { private header "__random/default_random_engine.h" } + module discard_block_engine { private header "__random/discard_block_engine.h" } + module discrete_distribution { private header "__random/discrete_distribution.h" } + module exponential_distribution { private header "__random/exponential_distribution.h" } + module extreme_value_distribution { private header "__random/extreme_value_distribution.h" } + module fisher_f_distribution { private header "__random/fisher_f_distribution.h" } + module gamma_distribution { private header "__random/gamma_distribution.h" } + module generate_canonical { private header "__random/generate_canonical.h" } + module geometric_distribution { private header "__random/geometric_distribution.h" } + module independent_bits_engine { private header "__random/independent_bits_engine.h" } + module is_seed_sequence { private header "__random/is_seed_sequence.h" } + module knuth_b { private header "__random/knuth_b.h" } + module linear_congruential_engine { private header "__random/linear_congruential_engine.h" } + module log2 { private header "__random/log2.h" } + module lognormal_distribution { private header "__random/lognormal_distribution.h" } + module mersenne_twister_engine { private header "__random/mersenne_twister_engine.h" } + module negative_binomial_distribution { private header "__random/negative_binomial_distribution.h" } + module normal_distribution { private header "__random/normal_distribution.h" } module piecewise_constant_distribution { private header "__random/piecewise_constant_distribution.h" } - module piecewise_linear_distribution { private header "__random/piecewise_linear_distribution.h" } - module poisson_distribution { private header "__random/poisson_distribution.h" } - module random_device { private header "__random/random_device.h" } - module ranlux { private header "__random/ranlux.h" } - module seed_seq { private header "__random/seed_seq.h" } - module shuffle_order_engine { private header "__random/shuffle_order_engine.h" } - module student_t_distribution { private header "__random/student_t_distribution.h" } - module subtract_with_carry_engine { private header "__random/subtract_with_carry_engine.h" } - module uniform_int_distribution { private header "__random/uniform_int_distribution.h" } - module uniform_random_bit_generator { private header "__random/uniform_random_bit_generator.h" } - module uniform_real_distribution { private header "__random/uniform_real_distribution.h" } - module weibull_distribution { private header "__random/weibull_distribution.h" } + module piecewise_linear_distribution { private header "__random/piecewise_linear_distribution.h" } + module poisson_distribution { private header "__random/poisson_distribution.h" } + module random_device { private header "__random/random_device.h" } + module ranlux { private header "__random/ranlux.h" } + module seed_seq { private header "__random/seed_seq.h" } + module shuffle_order_engine { private header "__random/shuffle_order_engine.h" } + module student_t_distribution { private header "__random/student_t_distribution.h" } + module subtract_with_carry_engine { private header "__random/subtract_with_carry_engine.h" } + module uniform_int_distribution { private header "__random/uniform_int_distribution.h" } + module uniform_random_bit_generator { private header "__random/uniform_random_bit_generator.h" } + module uniform_real_distribution { private header "__random/uniform_real_distribution.h" } + module weibull_distribution { private header "__random/weibull_distribution.h" } } } module ranges { @@ -728,39 +746,39 @@ module std [system] { export * module __ranges { - module access { private header "__ranges/access.h" } + module access { private header "__ranges/access.h" } module all { private header "__ranges/all.h" export functional.__functional.compose export functional.__functional.perfect_forward } - module common_view { private header "__ranges/common_view.h" } - module concepts { private header "__ranges/concepts.h" } - module copyable_box { private header "__ranges/copyable_box.h" } - module counted { private header "__ranges/counted.h" } - module dangling { private header "__ranges/dangling.h" } - module data { private header "__ranges/data.h" } - module drop_view { private header "__ranges/drop_view.h" } - module empty { private header "__ranges/empty.h" } - module empty_view { private header "__ranges/empty_view.h" } + module common_view { private header "__ranges/common_view.h" } + module concepts { private header "__ranges/concepts.h" } + module copyable_box { private header "__ranges/copyable_box.h" } + module counted { private header "__ranges/counted.h" } + module dangling { private header "__ranges/dangling.h" } + module data { private header "__ranges/data.h" } + module drop_view { private header "__ranges/drop_view.h" } + module empty { private header "__ranges/empty.h" } + module empty_view { private header "__ranges/empty_view.h" } module enable_borrowed_range { private header "__ranges/enable_borrowed_range.h" } - module enable_view { private header "__ranges/enable_view.h" } - module iota_view { private header "__ranges/iota_view.h" } - module join_view { private header "__ranges/join_view.h" } + module enable_view { private header "__ranges/enable_view.h" } + module iota_view { private header "__ranges/iota_view.h" } + module join_view { private header "__ranges/join_view.h" } module non_propagating_cache { private header "__ranges/non_propagating_cache.h" } - module range_adaptor { private header "__ranges/range_adaptor.h" } - module ref_view { private header "__ranges/ref_view.h" } - module reverse_view { private header "__ranges/reverse_view.h" } - module size { private header "__ranges/size.h" } - module single_view { private header "__ranges/single_view.h" } - module subrange { private header "__ranges/subrange.h" } - module take_view { private header "__ranges/take_view.h" } + module range_adaptor { private header "__ranges/range_adaptor.h" } + module ref_view { private header "__ranges/ref_view.h" } + module reverse_view { private header "__ranges/reverse_view.h" } + module size { private header "__ranges/size.h" } + module single_view { private header "__ranges/single_view.h" } + module subrange { private header "__ranges/subrange.h" } + module take_view { private header "__ranges/take_view.h" } module transform_view { private header "__ranges/transform_view.h" export functional.__functional.bind_back export functional.__functional.perfect_forward } - module view_interface { private header "__ranges/view_interface.h" } + module view_interface { private header "__ranges/view_interface.h" } } } module ratio { @@ -875,21 +893,21 @@ module std [system] { export * module __utility { - module as_const { private header "__utility/as_const.h" } - module cmp { private header "__utility/cmp.h" } - module decay_copy { private header "__utility/decay_copy.h" } - module declval { private header "__utility/declval.h" } - module exchange { private header "__utility/exchange.h" } - module forward { private header "__utility/forward.h" } - module in_place { private header "__utility/in_place.h" } - module integer_sequence { private header "__utility/integer_sequence.h" } - module move { private header "__utility/move.h" } - module pair { private header "__utility/pair.h" } + module as_const { private header "__utility/as_const.h" } + module cmp { private header "__utility/cmp.h" } + module decay_copy { private header "__utility/decay_copy.h" } + module declval { private header "__utility/declval.h" } + module exchange { private header "__utility/exchange.h" } + module forward { private header "__utility/forward.h" } + module in_place { private header "__utility/in_place.h" } + module integer_sequence { private header "__utility/integer_sequence.h" } + module move { private header "__utility/move.h" } + module pair { private header "__utility/pair.h" } module piecewise_construct { private header "__utility/piecewise_construct.h" } - module priority_tag { private header "__utility/priority_tag.h" } - module rel_ops { private header "__utility/rel_ops.h" } - module swap { private header "__utility/swap.h" } - module to_underlying { private header "__utility/to_underlying.h" } + module priority_tag { private header "__utility/priority_tag.h" } + module rel_ops { private header "__utility/rel_ops.h" } + module swap { private header "__utility/swap.h" } + module to_underlying { private header "__utility/to_underlying.h" } } } module valarray { @@ -920,22 +938,22 @@ module std [system] { module __availability { private header "__availability" export * } module __bit_reference { private header "__bit_reference" export * } module __bits { private header "__bits" export * } - module __debug { header "__debug" export * } + module __debug { header "__debug" export * } module __errc { private header "__errc" export * } module __function_like { private header "__function_like.h" export * } - module __hash_table { header "__hash_table" export * } + module __hash_table { header "__hash_table" export * } module __locale { private header "__locale" export * } module __mbstate { private header "__mbstate_t.h" export * } module __mutex_base { private header "__mutex_base" export * } module __node_handle { private header "__node_handle" export * } - module __nullptr { header "__nullptr" export * } + module __nullptr { header "__nullptr" export * } module __split_buffer { private header "__split_buffer" export * } module __std_stream { private header "__std_stream" export * } module __string { private header "__string" export * } - module __threading_support { header "__threading_support" export * } - module __tree { header "__tree" export * } + module __threading_support { header "__threading_support" export * } + module __tree { header "__tree" export * } module __tuple { private header "__tuple" export * } - module __undef_macros { header "__undef_macros" export * } + module __undef_macros { header "__undef_macros" export * } module experimental { requires cplusplus11 diff --git a/contrib/libs/cxxsupp/libcxx/include/mutex b/contrib/libs/cxxsupp/libcxx/include/mutex index 7e5dc94482..049904e40b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/mutex +++ b/contrib/libs/cxxsupp/libcxx/include/mutex @@ -219,14 +219,12 @@ class _LIBCPP_TYPE_VIS recursive_mutex __libcpp_recursive_mutex_t __m_; public: - recursive_mutex(); - ~recursive_mutex(); + recursive_mutex(); + ~recursive_mutex(); -private: - recursive_mutex(const recursive_mutex&); // = delete; - recursive_mutex& operator=(const recursive_mutex&); // = delete; + recursive_mutex(const recursive_mutex&) = delete; + recursive_mutex& operator=(const recursive_mutex&) = delete; -public: void lock(); bool try_lock() _NOEXCEPT; void unlock() _NOEXCEPT; @@ -246,9 +244,8 @@ public: timed_mutex(); ~timed_mutex(); -private: - timed_mutex(const timed_mutex&); // = delete; - timed_mutex& operator=(const timed_mutex&); // = delete; + timed_mutex(const timed_mutex&) = delete; + timed_mutex& operator=(const timed_mutex&) = delete; public: void lock(); @@ -287,14 +284,12 @@ class _LIBCPP_TYPE_VIS recursive_timed_mutex size_t __count_; __thread_id __id_; public: - recursive_timed_mutex(); - ~recursive_timed_mutex(); + recursive_timed_mutex(); + ~recursive_timed_mutex(); -private: - recursive_timed_mutex(const recursive_timed_mutex&); // = delete; - recursive_timed_mutex& operator=(const recursive_timed_mutex&); // = delete; + recursive_timed_mutex(const recursive_timed_mutex&) = delete; + recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; -public: void lock(); bool try_lock() _NOEXCEPT; template <class _Rep, class _Period> @@ -580,6 +575,8 @@ struct _LIBCPP_TEMPLATE_VIS once_flag _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR once_flag() _NOEXCEPT : __state_(0) {} + once_flag(const once_flag&) = delete; + once_flag& operator=(const once_flag&) = delete; #if defined(_LIBCPP_ABI_MICROSOFT) typedef uintptr_t _State_type; @@ -587,11 +584,7 @@ struct _LIBCPP_TEMPLATE_VIS once_flag typedef unsigned long _State_type; #endif - private: - once_flag(const once_flag&); // = delete; - once_flag& operator=(const once_flag&); // = delete; - #if defined(_LIBCPP_ABI_MICROSOFT) atomic<_State_type> __state_; #else diff --git a/contrib/libs/cxxsupp/libcxx/include/new b/contrib/libs/cxxsupp/libcxx/include/new index 593af9d5c6..be0d972f42 100644 --- a/contrib/libs/cxxsupp/libcxx/include/new +++ b/contrib/libs/cxxsupp/libcxx/include/new @@ -177,7 +177,7 @@ struct destroying_delete_t { inline constexpr destroying_delete_t destroying_delete{}; #endif // _LIBCPP_STD_VER > 17 -} // std +} // namespace std #if defined(_LIBCPP_CXX03_LANG) #define _THROW_BAD_ALLOC throw(std::bad_alloc) diff --git a/contrib/libs/cxxsupp/libcxx/include/numeric b/contrib/libs/cxxsupp/libcxx/include/numeric index 12fefa9e5c..273bbac9be 100644 --- a/contrib/libs/cxxsupp/libcxx/include/numeric +++ b/contrib/libs/cxxsupp/libcxx/include/numeric @@ -145,492 +145,31 @@ template<class T> */ #include <__config> -#include <__debug> #include <cmath> // for isnormal #include <functional> #include <iterator> -#include <limits> // for numeric_limits #include <version> +#include <__numeric/accumulate.h> +#include <__numeric/adjacent_difference.h> +#include <__numeric/exclusive_scan.h> +#include <__numeric/gcd_lcm.h> +#include <__numeric/inclusive_scan.h> +#include <__numeric/inner_product.h> +#include <__numeric/iota.h> +#include <__numeric/midpoint.h> +#include <__numeric/partial_sum.h> +#include <__numeric/reduce.h> +#include <__numeric/transform_exclusive_scan.h> +#include <__numeric/transform_inclusive_scan.h> +#include <__numeric/transform_reduce.h> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _InputIterator, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) -{ - for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER > 17 - __init = _VSTD::move(__init) + *__first; -#else - __init = __init + *__first; -#endif - return __init; -} - -template <class _InputIterator, class _Tp, class _BinaryOperation> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) -{ - for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER > 17 - __init = __binary_op(_VSTD::move(__init), *__first); -#else - __init = __binary_op(__init, *__first); -#endif - return __init; -} - -#if _LIBCPP_STD_VER > 14 -template <class _InputIterator, class _Tp, class _BinaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) -{ - for (; __first != __last; ++__first) - __init = __b(__init, *__first); - return __init; -} - -template <class _InputIterator, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -reduce(_InputIterator __first, _InputIterator __last, _Tp __init) -{ - return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>()); -} - -template <class _InputIterator> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename iterator_traits<_InputIterator>::value_type -reduce(_InputIterator __first, _InputIterator __last) -{ - return _VSTD::reduce(__first, __last, - typename iterator_traits<_InputIterator>::value_type{}); -} -#endif - -template <class _InputIterator1, class _InputIterator2, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) -{ - for (; __first1 != __last1; ++__first1, (void) ++__first2) -#if _LIBCPP_STD_VER > 17 - __init = _VSTD::move(__init) + *__first1 * *__first2; -#else - __init = __init + *__first1 * *__first2; -#endif - return __init; -} - -template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, - _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) -{ - for (; __first1 != __last1; ++__first1, (void) ++__first2) -#if _LIBCPP_STD_VER > 17 - __init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); -#else - __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); -#endif - return __init; -} - -#if _LIBCPP_STD_VER > 14 -template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -transform_reduce(_InputIterator __first, _InputIterator __last, - _Tp __init, _BinaryOp __b, _UnaryOp __u) -{ - for (; __first != __last; ++__first) - __init = __b(__init, __u(*__first)); - return __init; -} - -template <class _InputIterator1, class _InputIterator2, - class _Tp, class _BinaryOp1, class _BinaryOp2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2) -{ - for (; __first1 != __last1; ++__first1, (void) ++__first2) - __init = __b1(__init, __b2(*__first1, *__first2)); - return __init; -} - -template <class _InputIterator1, class _InputIterator2, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_Tp -transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp __init) -{ - return _VSTD::transform_reduce(__first1, __last1, __first2, _VSTD::move(__init), - _VSTD::plus<>(), _VSTD::multiplies<>()); -} -#endif - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) -{ - if (__first != __last) - { - typename iterator_traits<_InputIterator>::value_type __t(*__first); - *__result = __t; - for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) - { -#if _LIBCPP_STD_VER > 17 - __t = _VSTD::move(__t) + *__first; -#else - __t = __t + *__first; -#endif - *__result = __t; - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOperation> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, - _BinaryOperation __binary_op) -{ - if (__first != __last) - { - typename iterator_traits<_InputIterator>::value_type __t(*__first); - *__result = __t; - for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) - { -#if _LIBCPP_STD_VER > 17 - __t = __binary_op(_VSTD::move(__t), *__first); -#else - __t = __binary_op(__t, *__first); -#endif - *__result = __t; - } - } - return __result; -} - -#if _LIBCPP_STD_VER > 14 -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp __init, _BinaryOp __b) -{ - if (__first != __last) - { - _Tp __tmp(__b(__init, *__first)); - while (true) - { - *__result = _VSTD::move(__init); - ++__result; - ++__first; - if (__first == __last) - break; - __init = _VSTD::move(__tmp); - __tmp = __b(__init, *__first); - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -exclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp __init) -{ - return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); -} - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOp __b, _Tp __init) -{ - for (; __first != __last; ++__first, (void) ++__result) { - __init = __b(__init, *__first); - *__result = __init; - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOp __b) -{ - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __init = *__first; - *__result++ = __init; - if (++__first != __last) - return _VSTD::inclusive_scan(__first, __last, __result, __b, __init); - } - - return __result; -} - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result) -{ - return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>()); -} - -template <class _InputIterator, class _OutputIterator, class _Tp, - class _BinaryOp, class _UnaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -transform_exclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp __init, - _BinaryOp __b, _UnaryOp __u) -{ - if (__first != __last) - { - _Tp __saved = __init; - do - { - __init = __b(__init, __u(*__first)); - *__result = __saved; - __saved = __init; - ++__result; - } while (++__first != __last); - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -transform_inclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) -{ - for (; __first != __last; ++__first, (void) ++__result) { - __init = __b(__init, __u(*__first)); - *__result = __init; - } - - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -transform_inclusive_scan(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) -{ - if (__first != __last) { - typename iterator_traits<_InputIterator>::value_type __init = __u(*__first); - *__result++ = __init; - if (++__first != __last) - return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init); - } - - return __result; -} -#endif - -template <class _InputIterator, class _OutputIterator> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) -{ - if (__first != __last) - { - typename iterator_traits<_InputIterator>::value_type __acc(*__first); - *__result = __acc; - for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) - { - typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER > 17 - *__result = __val - _VSTD::move(__acc); -#else - *__result = __val - __acc; -#endif - __acc = _VSTD::move(__val); - } - } - return __result; -} - -template <class _InputIterator, class _OutputIterator, class _BinaryOperation> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -_OutputIterator -adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, - _BinaryOperation __binary_op) -{ - if (__first != __last) - { - typename iterator_traits<_InputIterator>::value_type __acc(*__first); - *__result = __acc; - for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) - { - typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER > 17 - *__result = __binary_op(__val, _VSTD::move(__acc)); -#else - *__result = __binary_op(__val, __acc); -#endif - __acc = _VSTD::move(__val); - } - } - return __result; -} - -template <class _ForwardIterator, class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -void -iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) -{ - for (; __first != __last; ++__first, (void) ++__value_) - *__first = __value_; -} - - -#if _LIBCPP_STD_VER > 14 -template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs; - -template <typename _Result, typename _Source> -struct __ct_abs<_Result, _Source, true> { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - _Result operator()(_Source __t) const noexcept - { - if (__t >= 0) return __t; - if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); - return -__t; - } -}; - -template <typename _Result, typename _Source> -struct __ct_abs<_Result, _Source, false> { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - _Result operator()(_Source __t) const noexcept { return __t; } -}; - - -template<class _Tp> -_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN -_Tp __gcd(_Tp __m, _Tp __n) -{ - static_assert((!is_signed<_Tp>::value), ""); - return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n); -} - - -template<class _Tp, class _Up> -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY -common_type_t<_Tp,_Up> -gcd(_Tp __m, _Up __n) -{ - static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); - static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" ); - static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" ); - using _Rp = common_type_t<_Tp,_Up>; - using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(_VSTD::__gcd( - static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n)))); -} - -template<class _Tp, class _Up> -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY -common_type_t<_Tp,_Up> -lcm(_Tp __m, _Up __n) -{ - static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types"); - static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" ); - static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" ); - if (__m == 0 || __n == 0) - return 0; - - using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); - _Rp __val2 = __ct_abs<_Rp, _Up>()(__n); - _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); - return __val1 * __val2; -} - -#endif /* _LIBCPP_STD_VER > 14 */ - -#if _LIBCPP_STD_VER > 17 -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp> -midpoint(_Tp __a, _Tp __b) noexcept -_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -{ - using _Up = make_unsigned_t<_Tp>; - constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1; - - _Up __diff = _Up(__b) - _Up(__a); - _Up __sign_bit = __b < __a; - - _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff); - - return __a + __half_diff; -} - - -template <class _TPtr> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<is_pointer_v<_TPtr> - && is_object_v<remove_pointer_t<_TPtr>> - && ! is_void_v<remove_pointer_t<_TPtr>> - && (sizeof(remove_pointer_t<_TPtr>) > 0), _TPtr> -midpoint(_TPtr __a, _TPtr __b) noexcept -{ - return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a); -} - - -template <typename _Tp> -constexpr int __sign(_Tp __val) { - return (_Tp(0) < __val) - (__val < _Tp(0)); -} - -template <typename _Fp> -constexpr _Fp __fp_abs(_Fp __f) { return __f >= 0 ? __f : -__f; } - -template <class _Fp> -_LIBCPP_INLINE_VISIBILITY constexpr -enable_if_t<is_floating_point_v<_Fp>, _Fp> -midpoint(_Fp __a, _Fp __b) noexcept -{ - constexpr _Fp __lo = numeric_limits<_Fp>::min()*2; - constexpr _Fp __hi = numeric_limits<_Fp>::max()/2; - return __fp_abs(__a) <= __hi && __fp_abs(__b) <= __hi ? // typical case: overflow is impossible - (__a + __b)/2 : // always correctly rounded - __fp_abs(__a) < __lo ? __a + __b/2 : // not safe to halve a - __fp_abs(__b) < __lo ? __a/2 + __b : // not safe to halve b - __a/2 + __b/2; // otherwise correctly rounded -} - -#endif // _LIBCPP_STD_VER > 17 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 -//# include <__pstl_numeric> +// # include <__pstl_numeric> #endif #endif // _LIBCPP_NUMERIC diff --git a/contrib/libs/cxxsupp/libcxx/include/optional b/contrib/libs/cxxsupp/libcxx/include/optional index 998ae31921..1d16767dcf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/optional +++ b/contrib/libs/cxxsupp/libcxx/include/optional @@ -175,7 +175,7 @@ public: virtual const char* what() const _NOEXCEPT; }; -} // std +} // namespace std #if _LIBCPP_STD_VER > 14 diff --git a/contrib/libs/cxxsupp/libcxx/include/ostream b/contrib/libs/cxxsupp/libcxx/include/ostream index 98f36ea7ac..d948d591c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/ostream +++ b/contrib/libs/cxxsupp/libcxx/include/ostream @@ -249,12 +249,11 @@ class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry bool __ok_; basic_ostream<_CharT, _Traits>& __os_; - sentry(const sentry&); // = delete; - sentry& operator=(const sentry&); // = delete; - public: explicit sentry(basic_ostream<_CharT, _Traits>& __os); ~sentry(); + sentry(const sentry&) = delete; + sentry& operator=(const sentry&) = delete; _LIBCPP_INLINE_VISIBILITY explicit operator bool() const {return __ok_;} diff --git a/contrib/libs/cxxsupp/libcxx/include/random b/contrib/libs/cxxsupp/libcxx/include/random index 9eb70bac00..c88bfce03b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/random +++ b/contrib/libs/cxxsupp/libcxx/include/random @@ -1682,6 +1682,7 @@ class piecewise_linear_distribution #include <__random/binomial_distribution.h> #include <__random/cauchy_distribution.h> #include <__random/chi_squared_distribution.h> +#include <__random/clamp_to_integral.h> #include <__random/default_random_engine.h> #include <__random/discard_block_engine.h> #include <__random/discrete_distribution.h> diff --git a/contrib/libs/cxxsupp/libcxx/include/regex b/contrib/libs/cxxsupp/libcxx/include/regex index 815ff7d386..8203c81659 100644 --- a/contrib/libs/cxxsupp/libcxx/include/regex +++ b/contrib/libs/cxxsupp/libcxx/include/regex @@ -978,7 +978,7 @@ enum error_type __re_err_parse }; -} // regex_constants +} // namespace regex_constants class _LIBCPP_EXCEPTION_ABI regex_error : public runtime_error diff --git a/contrib/libs/cxxsupp/libcxx/include/stdexcept b/contrib/libs/cxxsupp/libcxx/include/stdexcept index ddbc6303b6..c1dc05669b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/stdexcept +++ b/contrib/libs/cxxsupp/libcxx/include/stdexcept @@ -209,7 +209,7 @@ public: #endif }; -} // std +} // namespace std _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/string b/contrib/libs/cxxsupp/libcxx/include/string index e5d7541449..4660cde9c8 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string +++ b/contrib/libs/cxxsupp/libcxx/include/string @@ -4603,8 +4603,8 @@ inline namespace literals { return basic_string<char32_t> (__str, __len); } - } -} + } // namespace string_literals +} // namespace literals #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/string_view b/contrib/libs/cxxsupp/libcxx/include/string_view index 71fea01816..c1282606d6 100644 --- a/contrib/libs/cxxsupp/libcxx/include/string_view +++ b/contrib/libs/cxxsupp/libcxx/include/string_view @@ -87,6 +87,8 @@ namespace std { constexpr basic_string_view(const charT* str, size_type len); template <class It, class End> constexpr basic_string_view(It begin, End end); // C++20 + template <class Range> + constexpr basic_string_view(Range&& r); // C++23 // 7.4, basic_string_view iterator support constexpr const_iterator begin() const noexcept; @@ -171,6 +173,8 @@ namespace std { // basic_string_view deduction guides template<class It, class End> basic_string_view(It, End) -> basic_string_view<iter_value_t<It>>; // C++20 + template<class Range> + basic_string_view(Range&&) -> basic_string_view<ranges::range_value_t<Range>>; // C++23 // 7.11, Hash support template <class T> struct hash; @@ -191,12 +195,13 @@ namespace std { */ -#include <__concepts/convertible_to.h> -#include <__concepts/same_as.h> #include <__config> #include <__debug> +#include <__ranges/concepts.h> +#include <__ranges/data.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> +#include <__ranges/size.h> #include <__string> #include <algorithm> #include <compare> @@ -204,6 +209,7 @@ namespace std { #include <iterator> #include <limits> #include <stdexcept> +#include <type_traits> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -290,7 +296,7 @@ public: #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_RANGES) template <contiguous_iterator _It, sized_sentinel_for<_It> _End> - requires (same_as<iter_value_t<_It>, _CharT> && !convertible_to<_End, size_type>) + requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>) constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end) : __data(_VSTD::to_address(__begin)), __size(__end - __begin) { @@ -298,6 +304,25 @@ public: } #endif +#if _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_RANGES) + template <class _Range> + requires ( + !is_same_v<remove_cvref_t<_Range>, basic_string_view> && + ranges::contiguous_range<_Range> && + ranges::sized_range<_Range> && + is_same_v<ranges::range_value_t<_Range>, _CharT> && + !is_convertible_v<_Range, const _CharT*> && + (!requires(remove_cvref_t<_Range>& d) { + d.operator _VSTD::basic_string_view<_CharT, _Traits>(); + }) && + (!requires { + typename remove_reference_t<_Range>::traits_type; + } || is_same_v<typename remove_reference_t<_Range>::traits_type, _Traits>) + ) + constexpr _LIBCPP_HIDE_FROM_ABI + basic_string_view(_Range&& __r) : __data(ranges::data(__r)), __size(ranges::size(__r)) {} +#endif + _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view(nullptr_t) = delete; @@ -342,7 +367,7 @@ public: size_type length() const _NOEXCEPT { return __size; } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - size_type max_size() const _NOEXCEPT { return numeric_limits<size_type>::max(); } + size_type max_size() const _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); } _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size == 0; } @@ -709,6 +734,12 @@ template <contiguous_iterator _It, sized_sentinel_for<_It> _End> basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>; #endif + +#if _LIBCPP_STD_VER > 20 && !defined(_LIBCPP_HAS_NO_RANGES) +template <ranges::contiguous_range _Range> + basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>; +#endif + // [string.view.comparison] // operator == template<class _CharT, class _Traits> @@ -720,14 +751,9 @@ bool operator==(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) == 0; } -// Workaround for the bug in MSVC and clang on windows. Looks like MSVC generates the same -// mangled name for this function as for the previous function. So we introduce -// artificial difference to avoid that. -#if defined(_LIBCPP_COMPILER_MSVC) || (defined(_WIN32) && defined(_LIBCPP_COMPILER_CLANG)) +// The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409236 for details. +// This applies to the other sufficient overloads below for the other comparison operators. template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator==(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -736,11 +762,7 @@ bool operator==(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) == 0; } -#if defined(_LIBCPP_COMPILER_MSVC) || (defined(_WIN32) && defined(_LIBCPP_COMPILER_CLANG)) template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -761,11 +783,7 @@ bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Cha } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator!=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -775,11 +793,7 @@ bool operator!=(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) != 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -798,11 +812,7 @@ bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Char return __lhs.compare(__rhs) < 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator<(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -810,11 +820,7 @@ bool operator<(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) < 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -831,11 +837,7 @@ bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Cha return __lhs.compare(__rhs) > 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -843,11 +845,7 @@ bool operator>(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) > 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -864,11 +862,7 @@ bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Cha return __lhs.compare(__rhs) <= 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator<=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -876,11 +870,7 @@ bool operator<=(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) <= 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -898,11 +888,7 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_Cha } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 1> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT @@ -910,11 +896,7 @@ bool operator>=(basic_string_view<_CharT, _Traits> __lhs, return __lhs.compare(__rhs) >= 0; } -#ifdef _LIBCPP_COMPILER_MSVC template<class _CharT, class _Traits, int = 2> -#else -template<class _CharT, class _Traits> -#endif _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT @@ -978,8 +960,8 @@ inline namespace literals { return basic_string_view<char32_t> (__str, __len); } - } -} + } // namespace string_view_literals +} // namespace literals #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/system_error b/contrib/libs/cxxsupp/libcxx/include/system_error index ed487d144b..b599fb3934 100644 --- a/contrib/libs/cxxsupp/libcxx/include/system_error +++ b/contrib/libs/cxxsupp/libcxx/include/system_error @@ -208,13 +208,11 @@ public: error_category() _NOEXCEPT; #else _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT + _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT = default; #endif -private: - error_category(const error_category&);// = delete; - error_category& operator=(const error_category&);// = delete; + error_category(const error_category&) = delete; + error_category& operator=(const error_category&) = delete; -public: virtual const char* name() const _NOEXCEPT = 0; virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index a51a11c0d3..bf751c87aa 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -403,7 +403,7 @@ sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t) inline _LIBCPP_INLINE_VISIBILITY void yield() _NOEXCEPT {__libcpp_thread_yield();} -} // this_thread +} // namespace this_thread _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/tuple b/contrib/libs/cxxsupp/libcxx/include/tuple index 88188d7442..9480848dcf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/tuple +++ b/contrib/libs/cxxsupp/libcxx/include/tuple @@ -1217,7 +1217,7 @@ struct __find_exactly_one_checked<_T1> { static_assert(!is_same<_T1, _T1>::value, "type not in empty type list"); }; -} // namespace __find_detail; +} // namespace __find_detail template <typename _T1, typename... _Args> struct __find_exactly_one_t @@ -1274,7 +1274,7 @@ struct __ignore_t namespace { constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); -} +} // namespace template <class... _Tp> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 diff --git a/contrib/libs/cxxsupp/libcxx/include/type_traits b/contrib/libs/cxxsupp/libcxx/include/type_traits index 9c8571c5f7..760ddc5d12 100644 --- a/contrib/libs/cxxsupp/libcxx/include/type_traits +++ b/contrib/libs/cxxsupp/libcxx/include/type_traits @@ -1443,10 +1443,7 @@ template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; // is_signed -// Before Clang 10, __is_signed didn't work for floating-point types or enums. -#if __has_keyword(__is_signed) && \ - !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1000) && \ - !defined(__CUDACC__) +#if __has_keyword(__is_signed) && !defined(__CUDACC__) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; @@ -4009,7 +4006,7 @@ struct __nothrow_swappable_with { template <class _Tp, class _Up> struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; -} // __detail +} // namespace __detail template <class _Tp> struct __is_swappable diff --git a/contrib/libs/cxxsupp/libcxx/include/typeinfo b/contrib/libs/cxxsupp/libcxx/include/typeinfo index f62e03e0f6..697d3d6bb4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/typeinfo +++ b/contrib/libs/cxxsupp/libcxx/include/typeinfo @@ -379,7 +379,7 @@ public: #endif }; -} // std +} // namespace std #ifdef _LIBCPP_ABI_MICROSOFT class type_info : public std::type_info {}; diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 4fa90289a4..ac8470e269 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -235,4 +235,8 @@ template <class T> #include <initializer_list> #include <version> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #endif // _LIBCPP_UTILITY diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector index 5efd72c476..185d77671d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/vector +++ b/contrib/libs/cxxsupp/libcxx/include/vector @@ -348,28 +348,28 @@ class _LIBCPP_TEMPLATE_VIS vector : private __vector_base<_Tp, _Allocator> { private: - typedef __vector_base<_Tp, _Allocator> __base; - typedef allocator<_Tp> __default_allocator_type; + typedef __vector_base<_Tp, _Allocator> __base; + typedef allocator<_Tp> __default_allocator_type; public: - typedef vector __self; - typedef _Tp value_type; - typedef _Allocator allocator_type; - typedef allocator_traits<allocator_type> __alloc_traits; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename __allocator_traits<allocator_type>::size_type size_type; - typedef typename __alloc_traits::difference_type difference_type; - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; + typedef vector __self; + typedef _Tp value_type; + typedef _Allocator allocator_type; + typedef allocator_traits<allocator_type> __alloc_traits; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename __alloc_traits::size_type size_type; + typedef typename __alloc_traits::difference_type difference_type; + typedef typename __alloc_traits::pointer pointer; + typedef typename __alloc_traits::const_pointer const_pointer; #if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 1 - typedef pointer iterator; - typedef const_pointer const_iterator; + typedef pointer iterator; + typedef const_pointer const_iterator; #else - typedef __wrap_iter<pointer> iterator; - typedef __wrap_iter<const_pointer> const_iterator; + typedef __wrap_iter<pointer> iterator; + typedef __wrap_iter<const_pointer> const_iterator; #endif - typedef _VSTD::reverse_iterator<iterator> reverse_iterator; - typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; + typedef _VSTD::reverse_iterator<iterator> reverse_iterator; + typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); @@ -398,7 +398,21 @@ public: explicit vector(size_type __n, const allocator_type& __a); #endif vector(size_type __n, const value_type& __x); - vector(size_type __n, const value_type& __x, const allocator_type& __a); + + template <class = __enable_if_t<__is_allocator<_Allocator>::value> > + vector(size_type __n, const value_type& __x, const allocator_type& __a) + : __base(__a) + { +#if _LIBCPP_DEBUG_LEVEL == 2 + __get_db()->__insert_c(this); +#endif + if (__n > 0) + { + __vallocate(__n); + __construct_at_end(__n, __x); + } + } + template <class _InputIterator> vector(_InputIterator __first, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && @@ -1160,20 +1174,6 @@ vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) } template <class _Tp, class _Allocator> -vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) - : __base(__a) -{ -#if _LIBCPP_DEBUG_LEVEL == 2 - __get_db()->__insert_c(this); -#endif - if (__n > 0) - { - __vallocate(__n); - __construct_at_end(__n, __x); - } -} - -template <class _Tp, class _Allocator> template <class _InputIterator> vector<_Tp, _Allocator>::vector(_InputIterator __first, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && diff --git a/contrib/libs/cxxsupp/libcxx/include/version b/contrib/libs/cxxsupp/libcxx/include/version index 741ab41951..f69d85889a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/version +++ b/contrib/libs/cxxsupp/libcxx/include/version @@ -73,7 +73,7 @@ __cpp_lib_exchange_function 201304L <utility> __cpp_lib_execution 201902L <execution> 201603L // C++17 __cpp_lib_filesystem 201703L <filesystem> -__cpp_lib_format 201907L <format> +__cpp_lib_format 202106L <format> __cpp_lib_gcd_lcm 201606L <numeric> __cpp_lib_generic_associative_lookup 201304L <map> <set> __cpp_lib_generic_unordered_lookup 201811L <unordered_map> <unordered_set> @@ -309,7 +309,7 @@ __cpp_lib_void_t 201411L <type_traits> # undef __cpp_lib_execution // # define __cpp_lib_execution 201902L # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) -// # define __cpp_lib_format 201907L +// # define __cpp_lib_format 202106L # endif # define __cpp_lib_generic_unordered_lookup 201811L # define __cpp_lib_int_pow2 202002L diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h index 9c6fdf34f6..39e53b7843 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h @@ -60,7 +60,7 @@ errc __win_err_to_errc(int err); namespace { -static _LIBCPP_FORMAT_PRINTF(1, 0) string +static _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 0) string format_string_impl(const char* msg, va_list ap) { array<char, 256> buf; @@ -84,7 +84,7 @@ format_string_impl(const char* msg, va_list ap) { return result; } -static _LIBCPP_FORMAT_PRINTF(1, 2) string +static _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) string format_string(const char* msg, ...) { string ret; va_list ap; @@ -182,7 +182,7 @@ struct ErrorHandler { _LIBCPP_UNREACHABLE(); } - _LIBCPP_FORMAT_PRINTF(3, 0) + _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 0) void report_impl(const error_code& ec, const char* msg, va_list ap) const { if (ec_) { *ec_ = ec; @@ -201,7 +201,7 @@ struct ErrorHandler { _LIBCPP_UNREACHABLE(); } - _LIBCPP_FORMAT_PRINTF(3, 4) + _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) T report(const error_code& ec, const char* msg, ...) const { va_list ap; va_start(ap, msg); @@ -223,7 +223,7 @@ struct ErrorHandler { return report(make_error_code(err)); } - _LIBCPP_FORMAT_PRINTF(3, 4) + _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) T report(errc const& err, const char* msg, ...) const { va_list ap; va_start(ap, msg); |